Changes In Branch origin/unlabeled-1.7.2 Excluding Merge-Ins

This is equivalent to a diff from dca4801b4d to a1a6e6441c

2002-07-10
14:55:18
Updated from main branch. Leaf check-in: a1a6e6441c user: geraint@users.sourceforge.net tags: origin/unlabeled-1.7.2, trunk
2002-04-23
11:44:34
Fix for bug [ 547495 ] - renamed "sim" representation as "cxxsim".
This representation creates a C++ simulation without using Reduce.
Additional files are required.
check-in: fd12d1c586 user: geraint@users.sourceforge.net tags: origin/master, trunk
09:51:55
Created branch unlabeled-1.7.2 check-in: afb9dc617d user: gawthrop@users.sourceforge.net tags: origin/unlabeled-1.7.2, trunk
09:51:54
Changed incorrect statement about searching for components. check-in: dca4801b4d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2002-04-22
10:25:47
Handles unnamed components & ingnores artwork check-in: 900a60e271 user: gawthrop@users.sourceforge.net tags: origin/master, trunk

Deleted CVSROOT/checkoutlist version [db1d2d9b69].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
#	[<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'
syncmail

Deleted CVSROOT/commitinfo version [85654ac9a8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list 
# of files to check.  A non-zero exit of the filter program will 
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT.  For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

Deleted CVSROOT/config version [28e7a42550].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no

# Set `PreservePermissions' to `yes' to save file status information
# in the repository.
#PreservePermissions=no

# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no

Deleted CVSROOT/cvswrappers version [9d41597c29].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
#  wildcard	[option value][option value]...
#
#  where option is one of
#  -f		from cvs filter		value: path to filter
#  -t		to cvs filter		value: path to filter
#  -m		update methodology	value: MERGE or COPY
#  -k		expansion mode		value: b, o, kkv, &c
#
#  and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'

Deleted CVSROOT/editinfo version [dfa5fb459c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "editinfo" file is used to allow verification of logging
# information.  It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure.  Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
#   Making sure that the entered bug-id number is correct.
#   Validating that the code that was reviewed is indeed the code being
#       checked in (using the bug-id number or a seperate review
#       number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported.  There can be only one entry that matches a given
# repository.

Deleted CVSROOT/loginfo version [7508d75767].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "loginfo" file controls where "cvs commit" log information
# is sent.  The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT.  If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter.  The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators.  The format
# characters are:
#
#   s = file name
#   V = old version number (pre-checkin)
#   v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog

# Lines to mail changes
CVSROOT $CVSROOT/CVSROOT/syncmail %{sVv} gawthrop@users.sourceforge.net
DEFAULT $CVSROOT/CVSROOT/syncmail %{sVv} mtt-checkins@lists.sourceforge.net

Deleted CVSROOT/modules version [84b74e5335].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Three different line formats are valid:
#	key	-a    aliases...
#	key [options] directory
#	key [options] directory files...
#
# Where "options" are composed of:
#	-i prog		Run "prog" on "cvs commit" from top-level of module.
#	-o prog		Run "prog" on "cvs checkout" of module.
#	-e prog		Run "prog" on "cvs export" of module.
#	-t prog		Run "prog" on "cvs rtag" of module.
#	-u prog		Run "prog" on "cvs update" of module.
#	-d dir		Place module in directory "dir" instead of module name.
#	-l		Top-level directory only -- do not recurse.
#
# NOTE:  If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias.  An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module.  This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.

Deleted CVSROOT/notify version [2a5259e3c5].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent.  The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT.  If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"

Deleted CVSROOT/rcsinfo version [c276b88ba1].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT.  For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

Deleted CVSROOT/syncmail version [c9554ab114].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /usr/bin/python

# NOTE: Until SourceForge installs a modern version of Python on the cvs
# servers, this script MUST be compatible with Python 1.5.2.

"""Complicated notification for CVS checkins.

This script is used to provide email notifications of changes to the CVS
repository.  These email changes will include context diffs of the changes.
Really big diffs will be trimmed.

This script is run from a CVS loginfo file (see $CVSROOT/CVSROOT/loginfo).  To
set this up, create a loginfo entry that looks something like this:

    mymodule /path/to/this/script %%s some-email-addr@your.domain

In this example, whenever a checkin that matches `mymodule' is made, this
script is invoked, which will generate the diff containing email, and send it
to some-email-addr@your.domain.

    Note: This module used to also do repository synchronizations via
    rsync-over-ssh, but since the repository has been moved to SourceForge,
    this is no longer necessary.  The syncing functionality has been ripped
    out in the 3.0, which simplifies it considerably.  Access the 2.x versions
    to refer to this functionality.  Because of this, the script is misnamed.

It no longer makes sense to run this script from the command line.  Doing so
will only print out this usage information.

Usage:

    %(PROGRAM)s [options] <%%S> email-addr [email-addr ...]

Where options is:

    --cvsroot=<path>
    	Use <path> as the environment variable CVSROOT.  Otherwise this
    	variable must exist in the environment.

    --help / -h
        Print this text.

    --context=#
    -C #
        Include # lines of context around lines that differ (default: 2).

    -c
        Produce a context diff (default).

    -u
        Produce a unified diff (smaller).

    --quiet/-q
        Don't print as much status to stdout.

    <%%S>
        CVS %%s loginfo expansion.  When invoked by CVS, this will be a single
        string containing the directory the checkin is being made in, relative
        to $CVSROOT, followed by the list of files that are changing.  If the
        %%s in the loginfo file is %%{sVv}, context diffs for each of the
        modified files are included in any email messages that are generated.

    email-addrs
        At least one email address.
"""
import os
import sys
import time
import string
import getopt
import smtplib
import pwd
import socket

from cStringIO import StringIO

# Which SMTP server to do we connect to?  Empty string means localhost.
MAILHOST = ''
MAILPORT = 25

# Diff trimming stuff
DIFF_HEAD_LINES = 20
DIFF_TAIL_LINES = 20
DIFF_TRUNCATE_IF_LARGER = 1000

EMPTYSTRING = ''
SPACE = ' '
DOT = '.'
COMMASPACE = ', '

PROGRAM = sys.argv[0]

BINARY_EXPLANATION_LINES = [
    "(This appears to be a binary file; contents omitted.)\n"
    ]


def usage(code, msg=''):
    print __doc__ % globals()
    if msg:
        print msg
    sys.exit(code)



def calculate_diff(filespec, contextlines):
    try:
        file, oldrev, newrev = string.split(filespec, ',')
    except ValueError:
        # No diff to report
        return '***** Bogus filespec: %s' % filespec
    if oldrev == 'NONE':
        try:
            if os.path.exists(file):
                fp = open(file)
            else:
                update_cmd = 'cvs -fn update -r %s -p %s' % (newrev, file)
                fp = os.popen(update_cmd)
            lines = fp.readlines()
            fp.close()
            # Is this a binary file?  Let's look at the first few
            # lines to figure it out:
            for line in lines[:5]:
                for c in string.rstrip(line):
                    if c in string.whitespace:
                        continue
                    if c < ' ' or c > chr(127):
                        lines = BINARY_EXPLANATION_LINES[:]
                        break
            lines.insert(0, '--- NEW FILE: %s ---\n' % file)
        except IOError, e:
            lines = ['***** Error reading new file: ',
                     str(e), '\n***** file: ', file, ' cwd: ', os.getcwd()]
    elif newrev == 'NONE':
        lines = ['--- %s DELETED ---\n' % file]
    else:
        # This /has/ to happen in the background, otherwise we'll run into CVS
        # lock contention.  What a crock.
        if contextlines > 0:
            difftype = "-C " + str(contextlines)
        else:
            difftype = "-u"
        diffcmd = "/usr/bin/cvs -f diff -kk %s --minimal -r %s -r %s '%s'" % (
            difftype, oldrev, newrev, file)
        fp = os.popen(diffcmd)
        lines = fp.readlines()
        sts = fp.close()
        # ignore the error code, it always seems to be 1 :(
##        if sts:
##            return 'Error code %d occurred during diff\n' % (sts >> 8)
    if len(lines) > DIFF_TRUNCATE_IF_LARGER:
        removedlines = len(lines) - DIFF_HEAD_LINES - DIFF_TAIL_LINES
        del lines[DIFF_HEAD_LINES:-DIFF_TAIL_LINES]
        lines.insert(DIFF_HEAD_LINES,
                     '[...%d lines suppressed...]\n' % removedlines)
    return string.join(lines, '')



def getdomain():
    try:
        fqdn = socket.getfqdn()
    except AttributeError:
        # Python 1.5.2 :(
        hostname = socket.gethostname()
        byaddr = socket.gethostbyaddr(socket.gethostbyname(hostname))
        aliases = byaddr[1]
        aliases.insert(0, byaddr[0])
        aliases.insert(0, hostname)
        for fqdn in aliases:
            if '.' in fqdn:
                break
        else:
            fqdn = 'localhost.localdomain'
    parts = string.split(fqdn, DOT)
    return string.join(parts[1:], DOT)



def blast_mail(subject, people, filestodiff, contextlines):
    # cannot wait for child process or that will cause parent to retain cvs
    # lock for too long.  Urg!
    if not os.fork():
        # in the child
        # give up the lock you cvs thang!
        time.sleep(2)
        # Create the smtp connection to the localhost
        conn = smtplib.SMTP()
        conn.connect(MAILHOST, MAILPORT)
        user = pwd.getpwuid(os.getuid())[0]
        domain = getdomain()
        author = '%s@%s' % (user, domain)
        s = StringIO()
        sys.stdout = s
        try:
            print '''\
From: %(author)s
To: %(people)s
Subject: %(subject)s
''' % {'author' : author,
       'people' : string.join(people, COMMASPACE),
       'subject': subject,
       }
            s.write(sys.stdin.read())
            # append the diffs if available
            print
            for file in filestodiff:
                print calculate_diff(file, contextlines)
        finally:
            sys.stdout = sys.__stdout__
        resp = conn.sendmail(author, people, s.getvalue())
        conn.close()
        os._exit(0)



# scan args for options
def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hC:cuq',
                                   ['context=', 'cvsroot=', 'help', 'quiet'])
    except getopt.error, msg:
        usage(1, msg)

    # parse the options
    contextlines = 2
    verbose = 1
    for opt, arg in opts:
        if opt in ('-h', '--help'):
            usage(0)
        elif opt == '--cvsroot':
            os.environ['CVSROOT'] = arg
        elif opt in ('-C', '--context'):
            contextlines = int(arg)
        elif opt == '-c':
            if contextlines <= 0:
                contextlines = 2
        elif opt == '-u':
            contextlines = 0
        elif opt in ('-q', '--quiet'):
            verbose = 0

    # What follows is the specification containing the files that were
    # modified.  The argument actually must be split, with the first component
    # containing the directory the checkin is being made in, relative to
    # $CVSROOT, followed by the list of files that are changing.
    if not args:
        usage(1, 'No CVS module specified')
    subject = args[0]
    specs = string.split(args[0])
    del args[0]

    # The remaining args should be the email addresses
    if not args:
        usage(1, 'No recipients specified')

    # Now do the mail command
    people = args

    if verbose:
        print 'Mailing %s...' % string.join(people, COMMASPACE)

    if specs == ['-', 'Imported', 'sources']:
        return
    if specs[-3:] == ['-', 'New', 'directory']:
        del specs[-3:]
    elif len(specs) > 2:
        L = specs[:2]
        for s in specs[2:]:
            prev = L[-1]
            if string.count(prev, ',') < 2:
                L[-1] = "%s %s" % (prev, s)
            else:
                L.append(s)
        specs = L

    if verbose:
        print 'Generating notification message...'
    blast_mail(subject, people, specs[1:], contextlines)
    if verbose:
        print 'Generating notification message... done.'



if __name__ == '__main__':
    main()
    sys.exit(0)

Deleted CVSROOT/taginfo version [364dad5373].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4->  file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT.  For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

Deleted CVSROOT/verifymsg version [cbc796537d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "verifymsg" file is used to allow verification of logging
# information.  It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure.  Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
#   Making sure that the entered bug-id number is correct.
#   Validating that the code that was reviewed is indeed the code being
#       checked in (using the bug-id number or a seperate review
#       number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported.  There can be only one entry that matches a given
# repository.

Deleted mttroot/CVSROOT/checkoutlist version [db1d2d9b69].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
#	[<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'
syncmail

Deleted mttroot/CVSROOT/commitinfo version [85654ac9a8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list 
# of files to check.  A non-zero exit of the filter program will 
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT.  For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

Deleted mttroot/CVSROOT/config version [28e7a42550].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no

# Set `PreservePermissions' to `yes' to save file status information
# in the repository.
#PreservePermissions=no

# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no

Deleted mttroot/CVSROOT/cvswrappers version [9d41597c29].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
#  wildcard	[option value][option value]...
#
#  where option is one of
#  -f		from cvs filter		value: path to filter
#  -t		to cvs filter		value: path to filter
#  -m		update methodology	value: MERGE or COPY
#  -k		expansion mode		value: b, o, kkv, &c
#
#  and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'

Deleted mttroot/CVSROOT/editinfo version [dfa5fb459c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "editinfo" file is used to allow verification of logging
# information.  It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure.  Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
#   Making sure that the entered bug-id number is correct.
#   Validating that the code that was reviewed is indeed the code being
#       checked in (using the bug-id number or a seperate review
#       number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported.  There can be only one entry that matches a given
# repository.

Deleted mttroot/CVSROOT/loginfo version [f5255d5add].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "loginfo" file controls where "cvs commit" log information
# is sent.  The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT.  If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter.  The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators.  The format
# characters are:
#
#   s = file name
#   V = old version number (pre-checkin)
#   v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog

# Lines to mail changes
CVSROOT $CVSROOT/CVSROOT/syncmail %{sVv} mtt@gawthrop.net
DEFAULT $CVSROOT/CVSROOT/syncmail %{sVv} mtt-cvs@lists.sourceforge.net

Deleted mttroot/CVSROOT/modules version [84b74e5335].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Three different line formats are valid:
#	key	-a    aliases...
#	key [options] directory
#	key [options] directory files...
#
# Where "options" are composed of:
#	-i prog		Run "prog" on "cvs commit" from top-level of module.
#	-o prog		Run "prog" on "cvs checkout" of module.
#	-e prog		Run "prog" on "cvs export" of module.
#	-t prog		Run "prog" on "cvs rtag" of module.
#	-u prog		Run "prog" on "cvs update" of module.
#	-d dir		Place module in directory "dir" instead of module name.
#	-l		Top-level directory only -- do not recurse.
#
# NOTE:  If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias.  An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module.  This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.

Deleted mttroot/CVSROOT/notify version [2a5259e3c5].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent.  The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT.  If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"

Deleted mttroot/CVSROOT/rcsinfo version [c276b88ba1].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT.  For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

Deleted mttroot/CVSROOT/syncmail version [c9554ab114].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /usr/bin/python

# NOTE: Until SourceForge installs a modern version of Python on the cvs
# servers, this script MUST be compatible with Python 1.5.2.

"""Complicated notification for CVS checkins.

This script is used to provide email notifications of changes to the CVS
repository.  These email changes will include context diffs of the changes.
Really big diffs will be trimmed.

This script is run from a CVS loginfo file (see $CVSROOT/CVSROOT/loginfo).  To
set this up, create a loginfo entry that looks something like this:

    mymodule /path/to/this/script %%s some-email-addr@your.domain

In this example, whenever a checkin that matches `mymodule' is made, this
script is invoked, which will generate the diff containing email, and send it
to some-email-addr@your.domain.

    Note: This module used to also do repository synchronizations via
    rsync-over-ssh, but since the repository has been moved to SourceForge,
    this is no longer necessary.  The syncing functionality has been ripped
    out in the 3.0, which simplifies it considerably.  Access the 2.x versions
    to refer to this functionality.  Because of this, the script is misnamed.

It no longer makes sense to run this script from the command line.  Doing so
will only print out this usage information.

Usage:

    %(PROGRAM)s [options] <%%S> email-addr [email-addr ...]

Where options is:

    --cvsroot=<path>
    	Use <path> as the environment variable CVSROOT.  Otherwise this
    	variable must exist in the environment.

    --help / -h
        Print this text.

    --context=#
    -C #
        Include # lines of context around lines that differ (default: 2).

    -c
        Produce a context diff (default).

    -u
        Produce a unified diff (smaller).

    --quiet/-q
        Don't print as much status to stdout.

    <%%S>
        CVS %%s loginfo expansion.  When invoked by CVS, this will be a single
        string containing the directory the checkin is being made in, relative
        to $CVSROOT, followed by the list of files that are changing.  If the
        %%s in the loginfo file is %%{sVv}, context diffs for each of the
        modified files are included in any email messages that are generated.

    email-addrs
        At least one email address.
"""
import os
import sys
import time
import string
import getopt
import smtplib
import pwd
import socket

from cStringIO import StringIO

# Which SMTP server to do we connect to?  Empty string means localhost.
MAILHOST = ''
MAILPORT = 25

# Diff trimming stuff
DIFF_HEAD_LINES = 20
DIFF_TAIL_LINES = 20
DIFF_TRUNCATE_IF_LARGER = 1000

EMPTYSTRING = ''
SPACE = ' '
DOT = '.'
COMMASPACE = ', '

PROGRAM = sys.argv[0]

BINARY_EXPLANATION_LINES = [
    "(This appears to be a binary file; contents omitted.)\n"
    ]


def usage(code, msg=''):
    print __doc__ % globals()
    if msg:
        print msg
    sys.exit(code)



def calculate_diff(filespec, contextlines):
    try:
        file, oldrev, newrev = string.split(filespec, ',')
    except ValueError:
        # No diff to report
        return '***** Bogus filespec: %s' % filespec
    if oldrev == 'NONE':
        try:
            if os.path.exists(file):
                fp = open(file)
            else:
                update_cmd = 'cvs -fn update -r %s -p %s' % (newrev, file)
                fp = os.popen(update_cmd)
            lines = fp.readlines()
            fp.close()
            # Is this a binary file?  Let's look at the first few
            # lines to figure it out:
            for line in lines[:5]:
                for c in string.rstrip(line):
                    if c in string.whitespace:
                        continue
                    if c < ' ' or c > chr(127):
                        lines = BINARY_EXPLANATION_LINES[:]
                        break
            lines.insert(0, '--- NEW FILE: %s ---\n' % file)
        except IOError, e:
            lines = ['***** Error reading new file: ',
                     str(e), '\n***** file: ', file, ' cwd: ', os.getcwd()]
    elif newrev == 'NONE':
        lines = ['--- %s DELETED ---\n' % file]
    else:
        # This /has/ to happen in the background, otherwise we'll run into CVS
        # lock contention.  What a crock.
        if contextlines > 0:
            difftype = "-C " + str(contextlines)
        else:
            difftype = "-u"
        diffcmd = "/usr/bin/cvs -f diff -kk %s --minimal -r %s -r %s '%s'" % (
            difftype, oldrev, newrev, file)
        fp = os.popen(diffcmd)
        lines = fp.readlines()
        sts = fp.close()
        # ignore the error code, it always seems to be 1 :(
##        if sts:
##            return 'Error code %d occurred during diff\n' % (sts >> 8)
    if len(lines) > DIFF_TRUNCATE_IF_LARGER:
        removedlines = len(lines) - DIFF_HEAD_LINES - DIFF_TAIL_LINES
        del lines[DIFF_HEAD_LINES:-DIFF_TAIL_LINES]
        lines.insert(DIFF_HEAD_LINES,
                     '[...%d lines suppressed...]\n' % removedlines)
    return string.join(lines, '')



def getdomain():
    try:
        fqdn = socket.getfqdn()
    except AttributeError:
        # Python 1.5.2 :(
        hostname = socket.gethostname()
        byaddr = socket.gethostbyaddr(socket.gethostbyname(hostname))
        aliases = byaddr[1]
        aliases.insert(0, byaddr[0])
        aliases.insert(0, hostname)
        for fqdn in aliases:
            if '.' in fqdn:
                break
        else:
            fqdn = 'localhost.localdomain'
    parts = string.split(fqdn, DOT)
    return string.join(parts[1:], DOT)



def blast_mail(subject, people, filestodiff, contextlines):
    # cannot wait for child process or that will cause parent to retain cvs
    # lock for too long.  Urg!
    if not os.fork():
        # in the child
        # give up the lock you cvs thang!
        time.sleep(2)
        # Create the smtp connection to the localhost
        conn = smtplib.SMTP()
        conn.connect(MAILHOST, MAILPORT)
        user = pwd.getpwuid(os.getuid())[0]
        domain = getdomain()
        author = '%s@%s' % (user, domain)
        s = StringIO()
        sys.stdout = s
        try:
            print '''\
From: %(author)s
To: %(people)s
Subject: %(subject)s
''' % {'author' : author,
       'people' : string.join(people, COMMASPACE),
       'subject': subject,
       }
            s.write(sys.stdin.read())
            # append the diffs if available
            print
            for file in filestodiff:
                print calculate_diff(file, contextlines)
        finally:
            sys.stdout = sys.__stdout__
        resp = conn.sendmail(author, people, s.getvalue())
        conn.close()
        os._exit(0)



# scan args for options
def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hC:cuq',
                                   ['context=', 'cvsroot=', 'help', 'quiet'])
    except getopt.error, msg:
        usage(1, msg)

    # parse the options
    contextlines = 2
    verbose = 1
    for opt, arg in opts:
        if opt in ('-h', '--help'):
            usage(0)
        elif opt == '--cvsroot':
            os.environ['CVSROOT'] = arg
        elif opt in ('-C', '--context'):
            contextlines = int(arg)
        elif opt == '-c':
            if contextlines <= 0:
                contextlines = 2
        elif opt == '-u':
            contextlines = 0
        elif opt in ('-q', '--quiet'):
            verbose = 0

    # What follows is the specification containing the files that were
    # modified.  The argument actually must be split, with the first component
    # containing the directory the checkin is being made in, relative to
    # $CVSROOT, followed by the list of files that are changing.
    if not args:
        usage(1, 'No CVS module specified')
    subject = args[0]
    specs = string.split(args[0])
    del args[0]

    # The remaining args should be the email addresses
    if not args:
        usage(1, 'No recipients specified')

    # Now do the mail command
    people = args

    if verbose:
        print 'Mailing %s...' % string.join(people, COMMASPACE)

    if specs == ['-', 'Imported', 'sources']:
        return
    if specs[-3:] == ['-', 'New', 'directory']:
        del specs[-3:]
    elif len(specs) > 2:
        L = specs[:2]
        for s in specs[2:]:
            prev = L[-1]
            if string.count(prev, ',') < 2:
                L[-1] = "%s %s" % (prev, s)
            else:
                L.append(s)
        specs = L

    if verbose:
        print 'Generating notification message...'
    blast_mail(subject, people, specs[1:], contextlines)
    if verbose:
        print 'Generating notification message... done.'



if __name__ == '__main__':
    main()
    sys.exit(0)

Deleted mttroot/CVSROOT/taginfo version [364dad5373].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4->  file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT.  For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

Deleted mttroot/CVSROOT/verifymsg version [cbc796537d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The "verifymsg" file is used to allow verification of logging
# information.  It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure.  Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
#   Making sure that the entered bug-id number is correct.
#   Validating that the code that was reviewed is indeed the code being
#       checked in (using the bug-id number or a seperate review
#       number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported.  There can be only one entry that matches a given
# repository.

Deleted mttroot/mtt/bin/check_integration version [a5d2ce5a34].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## Check if obsolete method of specifiying integration method in use.
if [ -f "$1_simpar.txt" ]; then
  method_line=`grep -i METHOD  $1_simpar.txt`
  if [ -n "`echo $method_line | grep -i euler`" ]; then
     echo "$1_simpar.txt contains Euler method - please use mtt -i euler in future"
     mtt_switches="$mtt_switches -i euler";
  elif [ -n "`echo $method_line | grep -i implicit`" ]; then
     echo "$1_simpar.txt contains Implicit method - please use mtt -i implicit in future"
     mtt_switches="$mtt_switches -i implicit";
  fi
fi

echo Invoking mtt $mtt_switches $1 $2 $3 $4

mtt $mtt_switches $1 $2 $3 $4

Deleted mttroot/mtt/bin/mtt version [688ae9a121].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt
# This is the main shell script for MTT

# P.J.Gawthrop Oct 1989, Dec 1989, 1990, 1991, Oct 1993, Dec 1993, Jan 1994, Dec 95, Nov 1996.
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996, 1997,1998,1999
# Copyright (C) 2000 by Peter J. Gawthrop
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.330  2002/04/17 10:03:12  geraint
## Marked .sg as a major representation.
##
## Revision 1.329  2002/04/16 14:58:00  gawthrop
## mtt copy does NOT now copy the CVS directory
## $directory --> ${directory}  (just to be tidy)
##
## Revision 1.328  2002/02/19 16:27:05  geraint
## Changes to make MTT work out of the box with Debian.
##
## Revision 1.327  2001/11/15 02:56:17  geraint
## Added DASSL as an option for solution of algebraic equations (-ae dassl).
## Requires octave-2.1.35.
##
## Revision 1.326  2001/10/26 01:01:47  geraint
## fixcc when rdae_is_dae (-cr).
##
## Revision 1.325  2001/10/11 03:15:55  geraint
## Fixed make dependencies for c++ simulation code
## - re-simulation no longer required for different output format.
##
## Revision 1.324  2001/10/05 23:39:43  geraint
## Made odes.dat2 .PRECIOUS to prevent deletion when simulation receives ^C.
##
## Revision 1.323  2001/08/08 02:14:59  geraint
## Rationalisation of solver code, beginning with algebraic solvers.
##
## Revision 1.322  2001/08/01 04:06:07  geraint
## Added -i dassl for -cc and -oct.
##
## Revision 1.321  2001/07/27 23:43:34  geraint
## Added -cc to usage options (required for use with xmtt).
##
## Revision 1.320  2001/07/27 23:38:38  geraint
## Changed comment below (# SUMMARY) - fixes xmtt.
##
## Revision 1.319  2001/07/27 23:29:10  geraint
## *** empty log message ***
##
## Revision 1.318  2001/07/24 04:17:30  gawthrop
## Removed all " from # SUMMARY lines - messes up xmtt
##
## Revision 1.317  2001/07/24 00:55:17  gawthrop
## Resolved clashes -- marked with ## >>>
##
## Revision 1.316  2001/07/22 19:24:03  geraint
## Multiple '-v' increases verbosity.
##
## Revision 1.315  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.314  2001/07/13 04:19:03  gawthrop
## Now loads _subs.r with _cr.r file when using -cr option
##
## Revision 1.313  2001/06/13 14:53:59  gawthrop
## MTT now gas the double-colon option in the abg.fig file
## eg R:r:a^2+3*b
##
## Revision 1.312  2001/06/11 19:43:49  gawthrop
## MTT is now much more sophisticated in generating lbl files
## Labels can contain maths
## Repetative components are now broken
##
## Revision 1.311  2001/05/26 18:36:43  gawthrop
## Further modifications. Now works on rcPPP
##  -- next jobs:
##     add identification to ppp_nlin_sim
##     create real-time ppp_nlin_run
##
## Revision 1.310  2001/05/08 08:30:12  gawthrop
## Added line to reverse the x^y --> pow(x,y) in default  _simp file to
## prettyfy LaTeX
##
## Revision 1.309.2.3  2001/07/13 04:02:31  geraint
## Implemented numerical algebraic solution for _ode2odes.oct.
##
## Revision 1.309.2.2  2001/06/05 03:20:39  geraint
## added -ae option to select algebraic equation solution method.
##
## Revision 1.309.2.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
##
## Revision 1.309  2001/04/28 03:15:03  geraint
## Fixed comment (interfered with "mtt help representations").
##
## Revision 1.308  2001/04/25 22:17:45  geraint
## Fixed icd.txt2 dependency.
##
## Revision 1.307  2001/04/15 21:15:41  geraint
## Added interface definition rep: _ICD.(txt|c|cc|m).
##
## Revision 1.305  2001/04/11 09:44:26  gawthrop
## Fixed cc and c problems to do with pow(x,y) and integers
## mtt/lib/reduce/fix_c.r is included in rdae2dae and cse2smx_lang for
## -c, -cc and -oct options
##
## Revision 1.304  2001/04/11 07:35:22  gawthrop
## Now uses system_cr.h in place of system.h in .c rep -
##   compatible with older code
##
## Revision 1.303  2001/04/10 12:54:50  gawthrop
## Minor fixes for sensitivity versions
##
## Revision 1.302  2001/04/06 05:24:30  geraint
## -stdin for .cc reps.
##
## Revision 1.301  2001/04/05 03:46:12  geraint
## Added mtt_prepend.sh, -p preserves time attribute of base file
## - eliminates error in dependencies due to update of ese.r by modpar.r.
##
## Revision 1.300  2001/04/04 10:06:49  gawthrop
## New ssim (sensitiveity simulation) rep
##
## Revision 1.299  2001/04/03 14:49:42  gawthrop
## Revised to incorporate new ssim (sensitivity simulation)
## representation (m only just now).
##
## Revision 1.298  2001/04/02 17:36:20  gawthrop
## Resolved $sys name clash when using -s
##
## Revision 1.297  2001/03/29 19:20:45  gawthrop
## Can now use c representations of crs when using -c option
##
## Revision 1.296  2001/03/27 01:07:34  geraint
## Improved determination of Octave version for ode2odes.exe creation.
## Removed FORCE check_update of .txts.
##
## Revision 1.295  2001/03/23 11:21:29  gawthrop
## Show -pdf oprion in help list
##
## Revision 1.294  2001/03/19 02:28:52  geraint
## Branch merge: merging-ode2odes-exe back to MAIN.
##
## Revision 1.293.2.8  2001/03/19 01:35:31  geraint
## Reverted forced update check to main branch form, ready for merge.
##
## Revision 1.293.2.7  2001/03/17 09:51:06  geraint
## Implemented Runge-Kutta IV fixed-step method (-i rk4).
##
## Revision 1.293.2.6  2001/03/03 06:50:38  geraint
## Added summary lines for ode2odes.
##
## Revision 1.293.2.5  2001/03/03 00:27:14  geraint
## Fixed ar options to work with GNU ar. Allow mtt to create dependencies for mtt_%.cc when making mtt_%.oct.
##
## Revision 1.293.2.4  2001/03/02 00:45:21  geraint
## Separated Euler and Implicit methods in .cc code and dependencies.
##
## Revision 1.293.2.3  2001/03/01 05:05:53  geraint
## Minor revisions.
##
## Revision 1.293.2.2  2001/02/23 03:53:53  geraint
## Minor revisions. (ode2odes.exe works on GNU/Linux and ~GNU/Irix)
##
## Revision 1.293.2.1  2001/02/22 06:41:40  geraint
## Initial merge of ode2odes.exe into main mtt.
## standalone_rep.make deleted: rules moved to mtt, variables to mttrc.
##
## Revision 1.293  2001/02/06 04:39:08  geraint
## Added _standalone.exe representation.
##
## Revision 1.292  2001/02/05 17:27:40  gawthrop
## Make sure _def.r exists before creating _state.txt
##
## Revision 1.291  2000/12/27 14:50:40  peterg
## This is the first CVS version (4.9).
## Commented out code now deleted
##
## Revision 1.290  2000/12/05 09:59:37  peterg
## Generates $1_cr.h - allows inclusion of c functions for crs
##
## Revision 1.289  2000/12/05 09:01:52  peterg
## Changed == to =
##
## Revision 1.288  2000/12/01 17:59:01  peterg
## Added .PRECIOUS: %.cc to hang on to cc files - thanks Geraint
##
## Revision 1.287  2000/12/01 16:04:24  peterg
## More partitioning achieved -- now needs the connections to be properly
## sorted in cbg2ese_r
##
## Revision 1.286  2000/12/01 14:18:44  peterg
## -partition now partially works up to cse.m
##   but need to think about indexing, struc files etc for subsystems.
##
## Revision 1.285  2000/11/27 11:51:21  peterg
## Fixed a few pdf /fig bugs
##
## Revision 1.284  2000/11/27 10:33:35  peterg
## -pdf option now coerces ps-->pdf
##
## Revision 1.283  2000/11/24 15:11:50  peterg
## -pdf switch for simple displays
##
## Revision 1.282  2000/11/24 14:53:53  peterg
## Added lagrange rep : lde.r and lde.tex
##
## Revision 1.281  2000/11/16 13:51:15  peterg
## Added units stuff
##
## Revision 1.280  2000/11/10 14:45:16  peterg
## Finished up changes to incorporate Geraint's cc stuff
##
## Revision 1.279  2000/11/08 09:51:52  peterg
## Started incorporating Geraints CC/oct conversions
##
## Revision 1.278  2000/11/07 16:39:21  peterg
## *** empty log message ***
##
## Revision 1.277  2000/10/17 09:54:07  peterg
## logic rep sorted out
##
## Revision 1.276  2000/10/15 09:30:31  peterg
## *** empty log message ***
##
## Revision 1.275  2000/10/12 18:38:47  peterg
## New method of sympar generation implemented - uses mtt_make_sympar
## Check/update of numpar.txt is forced.
##
## Revision 1.274  2000/10/12 15:11:54  peterg
## Added the update function for numpar only
##
## Revision 1.273  2000/10/10 21:00:27  peterg
## More changes for new code gneration
##
## Revision 1.272  2000/10/06 16:20:00  peterg
## added ode_write rule
##
## Revision 1.271  2000/10/03 12:14:25  peterg
## Version 4.8
##
## Revision 1.270  2000/10/03 12:13:51  peterg
## Corrected MTT_LIB paths
##
## Revision 1.269  2000/09/30 14:12:03  peterg
## Fixed bug with no-parameter systems - changed mtt_txt2m and mtt_m2p
##
## Revision 1.268  2000/09/27 16:15:55  peterg
## Now sh (as opposed to bash) compatible -  fixed dat22dat again
##
## Revision 1.267  2000/09/21 10:08:30  peterg
## Version 4.7.1 - bug in odes.dat representation fixed in dat22dat
##
## Revision 1.266  2000/09/19 07:47:38  peterg
## fig2dev back to eps - ps produces a4 style output.
##
## Revision 1.265  2000/09/19 07:45:28  peterg
## Version 4.7
##
## Revision 1.264  2000/09/15 08:37:27  peterg
## Fixed bug using -sub in cbg view
##
## Revision 1.263  2000/09/15 07:33:35  peterg
## Replace fig2dev language eps by ps to avoid version problem.
##
## Revision 1.262  2000/09/14 17:16:33  peterg
## Fixes some outstanding bugs:
##   perpendicular strokes in cbg.fig
##   proper display of hierachical cbg file (-sub and -viewlevel)
##
## Revision 1.261  2000/09/14 12:43:46  peterg
## view of ps s files now uses -sub and -viewlevel options
##
## Revision 1.260  2000/09/14 09:59:08  peterg
## Added -viewlevel switch
##
## Revision 1.259  2000/09/11 08:21:27  peterg
## Introduced MML - but for _tf rep only.
##
## Revision 1.258  2000/09/11 08:17:28  peterg
## Extended _simp.r to incude default switches
##
## Revision 1.257  2000/09/02 15:53:53  peterg
## Now does partitioning up to dae.view
##
## Revision 1.256  2000/09/02 14:24:06  peterg
## -sub switch introduced - works up to dae.r
##
## Revision 1.255  2000/08/30 11:43:04  peterg
## Put in the -opt switch for code optimisation
##
## Revision 1.254  2000/08/29 09:59:47  peterg
## Version 4.5 -- includes code optimisation using the "Scope" package in reduce
##
## Revision 1.253  2000/08/24 08:53:35  peterg
## New makesubs to create a .subs.r file with output switches to simplify output.
##
## Revision 1.252  2000/08/09 10:31:17  peterg
## Use -d option to find if its a book-style report
##
## Revision 1.251  2000/08/04 10:54:33  peterg
## Rationalised call to gcc using -lp2c to access p2c lib.
##
## Revision 1.250  2000/08/01 19:29:27  peterg
## Explcit zero of input in the simulations
##
## Revision 1.249  2000/08/01 12:28:02  peterg
## VERSION 4.4
##    euler now works
##    stepfactor applies to both int. algorithms
##
## Revision 1.248  2000/07/20 07:46:07  peterg
## Version 4.3
##
## Revision 1.247  2000/07/13 07:21:12  peterg
## Interface to Octave Control Systems Toolbox (OCST) - mtt2sys.m
##
## Revision 1.246  2000/05/21 18:00:11  peterg
## Make manual if not already done.
## Released 4.2 version
## (Train Durham -- Glasgow).
##
## Revision 1.245  2000/05/19 17:50:10  peterg
## Changes to state rep - now has parameter
##
## Revision 1.244  2000/05/19 14:19:46  peterg
## Added library path for representations
##
## Revision 1.243  2000/05/19 11:36:36  peterg
## Added logic rep.
##
## Revision 1.242  2000/05/18 20:12:02  peterg
## Version 4.2
##
## Revision 1.241  2000/05/16 11:42:14  peterg
## Addded /usr/lib/libp2c.a  to gcc
##
## Revision 1.240  2000/05/10 09:38:58  peterg
## Added Make to list of copied files.
##
## Revision 1.239  2000/04/11 18:08:33  peterg
## Fixed cse.tex bug
##
## Revision 1.238  2000/04/10 10:06:41  peterg
## Sorted out implicit rules for p2oct conversion
##
## Revision 1.237  2000/04/07 19:10:24  peterg
## New smxa and smxax reps
##
## Revision 1.236  2000/04/06 10:55:36  peterg
## Removed debug lines
##
## Revision 1.235  2000/04/06 10:52:53  peterg
## Replace $PWD with `pwd` for sh compatibility
##
## Revision 1.234  2000/04/04 16:14:08  peterg
## Sorted mtt help
##
## Revision 1.233  2000/03/16 10:16:11  peterg
## Clean no longer zaps the abg.m files
##
## Revision 1.232  2000/03/16 09:43:35  peterg
## Put in $mtt_switches in mtt comand line when creating _state.txt and
## _input.txt
##
## Revision 1.231  2000/03/15 21:24:23  peterg
## Version 4.1:
##   Fixed problems with -abg mode
##   Old-style SS lbl no longer supported
##
## Revision 1.230  2000/03/15 20:31:06  peterg
## Replaced lbl2cr by abg2cr_m2txt
##
## Revision 1.229  2000/03/15 19:39:40  peterg
## Replaced sub creation cmp2sub_m2sh by abg2sub_m2sh
##
## Revision 1.228  2000/03/07 10:54:14  peterg
## Added  $1_lbl.txt to sympar.txt
##
## Revision 1.227  2000/02/16 15:05:46  peterg
## Replaced spurious 8spaces by tab
##
## Revision 1.226  2000/02/10 18:51:31  peterg
## Included OFF exp; in subs.r default
##
## Revision 1.225  2000/02/10 15:03:10  peterg
## Put subs.r file into the m-code generation -- allows the off exp;
## switch for simpler expresions.
##
## Revision 1.224  2000/02/08 10:27:04  peterg
## Removed obselete .h stuff
##
## Revision 1.223  2000/02/08 09:55:00  peterg
## Added .oct language for ode
## -- octave loadable builtin
##
## Revision 1.222  1999/12/23 10:03:42  peterg
## Added $1_sympars.txt to numpar.m target
##
## Revision 1.221  1999/12/22 05:15:51  peterg
## Set to version 4.0.
##
## Revision 1.220  1999/12/17 03:17:57  peterg
## reps_made is now $1_reps_made - stops clash between two reps per directory
##
## Revision 1.219  1999/12/14 00:36:50  peterg
## Changed $source to $stdin and added to mtt_m2p arg list
##
## Revision 1.218  1999/12/03 00:04:50  peterg
## Version to eric.
## -stdin switch added
##
## Revision 1.217  1999/11/16 22:15:55  peterg
## Changed compcopy to test for abg, not lbl file
##
## Revision 1.216  1999/11/16 05:53:21  peterg
## Added sensitivity (-s) switch
##
## Revision 1.215  1999/11/15 22:45:31  peterg
## Reorganised integration method using -i switch
## Introduced -r (reset) switch
##
## Revision 1.214  1999/11/14 21:27:11  peterg
## *** empty log message ***
##
## Revision 1.213  1999/09/02 23:24:40  peterg
## Now explicitly generates executable _ode2odes.out file
## Which takes command line arguments
##
## Revision 1.212  1999/08/18 06:20:32  peterg
## Put -u back again .....
##
## Revision 1.211  1999/08/17 04:10:38  peterg
## Removed the -u switch from cp - it doesnt work on non GNU cps
##
## Revision 1.210  1999/08/02 12:52:12  peterg
## Removed redundant .p copying.
##
## Revision 1.209  1999/07/27 03:50:13  peterg
## Fixed odeo.p bug.
## Fixed compound object bug in fig.
##
## Revision 1.208  1999/07/20 23:43:05  peterg
## V 3.8 ( to Eric)
##
## Revision 1.207  1999/04/02 07:17:37  peterg
## Upped version to 3.6 -- the new implicit solver with switches
##
## Revision 1.206  1999/04/02 06:28:54  peterg
## New implicit method - solves numerical prob with ISW
##
## Revision 1.205  1999/03/15 23:27:43  peterg
## Modified generation of odes.dat2 data
##
## Revision 1.204  1999/03/15 05:53:33  peterg
## Put in user-defined representations
##
## Revision 1.203  1999/03/08 03:51:12  peterg
## Version 3.5 for Linux Red Hat 5.2 (Newcastle)
##
## Revision 1.202  1999/02/17 01:59:20  peterg
## Now handles html copy correctely (ie mv directory to ..)
## Fixed path probs with html
##
## Revision 1.201  1999/02/16 03:50:09  peterg
## Removed explicit _smx targets
##
## Revision 1.200  1998/12/03 17:11:03  peterg
## Added -dc (derivative causality) switch.
##
## Revision 1.199  1998/12/03 16:53:50  peterg
## Now completes causality using component, not bond, status.
##
## Revision 1.198  1998/11/20 16:12:30  peterg
## Now copies aliased systems BEFORE generating rgb etc.
##
## Revision 1.197  1998/11/20 09:00:45  peterg
## Number of changes to underlying tools
##
## Revision 1.196  1998/11/10 11:55:40  peterg
## Added $info_switch to abg2cbg invocation
##
## Revision 1.195  1998/10/28 13:58:57  peterg
## Added $1_sympars.txt prerequisite to _tf.m target
##
## Revision 1.194  1998/10/20 09:00:43  peterg
## Added a few summary lines - to help with xmtt
##
## Revision 1.193  1998/10/01 16:11:42  peterg
## Implicit integration now handles switches
##
## Revision 1.192  1998/09/29 20:09:46  peterg
## Fixed nyfr and nifr plotting bug
##
## Revision 1.191  1998/09/02 12:05:39  peterg
## Added INPUT to simpar
## Revision 1.190  1998/09/02 11:48:51  peterg
## VERSION 3.2 (Swansea)
## abg data structure now uses explicti port and subsystem lists so that
## processing is in predetermined order.
##
## Revision 1.189  1998/08/31 10:49:15  peterg
## Minor changes to -abg operation
##
## Revision 1.188  1998/08/27 08:33:21  peterg
## New reduce integration methods - euler/Implicit only
##
## Revision 1.187  1998/08/25 20:06:56  peterg
## New data structure for abg.m and cbg.m
##
## Revision 1.186  1998/08/18 10:49:05  peterg
## VERSION 3.1 release
##
## Revision 1.185  1998/08/18 09:21:14  peterg
## Removed "" from default simpar file.
##
## Revision 1.184  1998/08/18 09:08:26  peterg
## Now grabs components (specified in lbl file as alias) at the rbg stage
## - this makes sure that they are there when needed.
##
## Revision 1.183  1998/08/18 08:48:43  peterg
## Sorted out problem with ifeq ($REPTYPE,data) block - added else.
##
## Revision 1.182  1998/08/17 15:48:39  peterg
## Replaced SVD solver with LUD solver
##
## Revision 1.181  1998/08/15 13:45:28  peterg
## Added new integration methods in Pascal/c version
## Revised the various translations appropriately
##
## Revision 1.180  1998/08/12 14:15:13  peterg
## Implicit integration - c implemetation now included.
##
## Revision 1.179  1998/08/12 12:29:18  peterg
## Put back some of the args stuff -- needed for plots.
##
## Revision 1.178  1998/08/11 13:38:35  peterg
## Zapped the obsolete args stuff
##
## Revision 1.177  1998/07/30 17:32:44  peterg
## VERSION 3.0
##
## Revision 1.176  1998/07/27 20:25:15  peterg
## Sorted out new mtt_r2m
##
## Revision 1.175  1998/07/27 18:49:09  peterg
## Fixed the frequency stuff
##
## Revision 1.174  1998/07/27 07:10:10  peterg
## Removed dummy global stuff.
##
## Revision 1.173  1998/07/26 14:38:20  peterg
## *** empty log message ***
##
## Revision 1.172  1998/07/26 11:13:38  peterg
## Fixed name classes with globs - ide is that all @strong{MTT} variables
## start with @strong{MTT}
##
## Revision 1.171  1998/07/25 20:37:22  peterg
## Removes -s (switches) option -- they are now assumed to be present
## I still need to shift the old switch
##
## Revision 1.170  1998/07/25 19:16:22  peterg
## Sorted out sympar + switch variables - new sympars rep combines both
##
## Revision 1.169  1998/07/25 16:35:12  peterg
## Incorporated mtt_p2c (uses p2c)
##
## Revision 1.168  1998/07/25 09:44:25  peterg
## Uses Pascal as step on the way to c code -- MUCH nicer!
## State and input now use the simple default - no steady states
##
## Revision 1.167  1998/07/24 17:10:34  peterg
## *** empty log message ***
##
## Revision 1.166  1998/07/22 08:37:30  peterg
## Implicit integration now the default - for octave anyway.
##
## Revision 1.165  1998/07/19 16:00:22  peterg
## Added smx representation
##
## Revision 1.164  1998/07/17 19:45:58  peterg
## Component aliases implemented.
##
## Revision 1.163  1998/07/17 08:27:33  peterg
## Added find target
##
## Revision 1.162  1998/07/16 16:14:27  peterg
## Now stops if a transformation forces error.
##
## Revision 1.161  1998/07/08 11:21:32  peterg
## Added -I switch
##
## Revision 1.160  1998/07/04 11:38:51  peterg
## Version 3.0-- (Seascale)
##
## Revision 1.159  1998/07/04 11:37:43  peterg
## Aliases implemented for parameters + lots of associated goodies
## New-style lbl files - no more SS nonsense.
##
## Revision 1.158  1998/07/03 09:06:39  peterg
## Alias implemented for ports
##
## Revision 1.157  1998/07/01 10:22:11  peterg
## Moved tidy stuff to end of preamble -- needed to make muti-plot copy
## correctely
## Now copies ps file with arguments to WD
##
## Revision 1.156  1998/06/26 14:19:43  peterg
## Copy hidden files (eg .octaverc) in tidy mode
##
## Revision 1.155  1998/06/24 07:43:42  peterg
## Version 2.91 -- includes implicit integration (octave)
##
## Revision 1.154  1998/06/17 14:14:09  peterg
## Removed struc.txt prerequisite for simpar.txt - switch version
##
## Revision 1.153  1998/05/28 09:36:38  peterg
## --version and --versions switch
##
## Revision 1.152  1998/05/24 15:43:10  peterg
## Added symbolic solution of alg. equations (-A)
##
## Revision 1.151  1998/05/23 16:18:37  peterg
## ordinary differential equation.m files generated with the new ode2lang
## method.
##
## Revision 1.150  1998/05/19 19:47:37  peterg
## Updated the odesso representation to use simpar file.
##
## Revision 1.149  1998/05/14 15:16:13  peterg
## Sorted out Differential-Algebraic Equation simulation
## Added LSODE methode to ordinary differential equation simulation
##
## Revision 1.148  1998/05/12 14:42:07  peterg
## Added ese_tidy and new method for organising ese files -
## Each subsystem has an array of variables - effort, flow and state for
## each bond
##
## Revision 1.147  1998/04/15 18:41:47  peterg
## Fixed various probs with multiple systems in one directory
##
## Revision 1.146  1998/04/04 11:00:20  peterg
## Modified various parts to allow coercing directions at ports
##
## Revision 1.145  1998/04/03 11:17:44  peterg
## VERSION 2.9
##
## Revision 1.144  1998/03/27 13:32:25  peterg
## Removed sympar prerequisites from ss reps.
##
## Revision 1.143  1998/03/22 21:14:03  peterg
## Added obspar.r representation
## Help now case insensitive
##
## Revision 1.142  1998/03/20 15:09:26  peterg
## Changed order of prerequisites for _dae.r to put _rdae.r first.
##
## Revision 1.141  1998/03/11 10:45:19  peterg
## Added rclean - recursive clean
##
## Revision 1.140  1998/03/09 10:23:30  peterg
## PS view now runs as a background process.
##
## Revision 1.139  1998/03/07 16:04:23  peterg
## Added some more txt view reps: input, lbl, numpar, state
##
## Revision 1.138  1998/03/07 15:23:40  peterg
## Uses sort_sympar to uniquely produce the sympar list.
##
## Revision 1.137  1998/03/07 14:04:17  peterg
## dae creation split into 2 parts:
## 1. create a raw (ie without constitutive relationship) dae (rdae)
## 2. add the raw dae to the crs to get the dae.
## reduce has less work to do with this approach
##
## Revision 1.136  1998/03/04 16:34:19  peterg
## New local (_cr.r) and generic (.cr) CR structure.
## CR and lbl now have view mode.
## CRS in abg_tex.
##
## Revision 1.135  1998/02/25 22:09:48  peterg
## Added simpar representation.
##
## Revision 1.134  1998/02/25 15:28:34  peterg
## Added state.m rep.
##
## Revision 1.133  1998/02/24 22:35:33  peterg
## Added -p (preserve) switch to cp in tidy mode.
##
## Revision 1.132  1998/02/24 22:33:23  peterg
## new state reresentation included
##
## Revision 1.131  1998/02/23 16:21:21  peterg
## Just do model name in summary line of lbl file
##
## Revision 1.130  1998/02/19 13:40:24  peterg
## Removed prerequisit from sspar.r target.
##
## Revision 1.129  1998/02/12 08:18:42  peterg
## VERSION 2.8 (St. Annes)
##
## Revision 1.128  1998/02/12 07:48:04  peterg
## Tidy mode copies all files (containing .) to work dir -- this makes
## sure that files such a .c .constitutive relationship go across.
##
## Revision 1.127  1998/02/11 19:36:29  peterg
## Only displays one level of cbg file now.
##
## Revision 1.126  1998/02/11 19:26:03  peterg
## Added verbose (-v) mode.
##
## Revision 1.125  1998/02/11 11:36:28  peterg
## Updated version control mode - make it untidy.
## cp --> cp -u after tidy-mode .
##
## Revision 1.124  1998/02/10 13:03:36  peterg
## Now includes controller transfer function (ctf).
##
## Revision 1.123  1998/02/09 13:51:04  peterg
## Fixed directory string bug.
##
## Revision 1.122  1998/02/06 15:02:26  peterg
## New default sspar -- sets all states to zero.
##
## Revision 1.121  1998/02/06 14:36:51  peterg
## Report on copying back from MTT_work
##
## Revision 1.120  1998/02/05 16:06:53  peterg
## Removed debugging lines.
## Auto parts in books.
##
## Revision 1.119  1998/02/05 15:04:25  peterg
## Fixed problem with book in tidy mode.
##
## Revision 1.118  1998/02/05 12:00:11  peterg
## Tidy mode now default.
## It seems to work ok but not for book type documents.
##
## Revision 1.117  1998/02/04 16:50:50  peterg
## Introduced the tidy (-t and -T) options
##
## Revision 1.116  1998/02/04 11:00:04  peterg
## Added view of subsystems.
##
## Revision 1.115  1998/01/29 19:37:31  peterg
## Fixed spurious call to X server bug
##
## Revision 1.114  1998/01/23 13:38:07  peterg
## VERSION 2.7
##
## Revision 1.113  1998/01/23 13:27:13  peterg
## Added state-feedback control representations:
## smc,smo,ssk,ssl
##
## Revision 1.112  1998/01/21 09:24:46  peterg
## Removed 'touch $1_rep.txt' -- perhaps best to do this by hand if
## necessary. As it is, it cuased probs wene reediting the _rep.txt file.
##
## Revision 1.111  1998/01/16 14:56:59  peterg
## Argument now correctely recognised as a string beginning with -
## (rather than containing -)
##
# Revision 1.110  1998/01/06  13:59:30  peterg
# Added rename function.
#
# Revision 1.109  1998/01/06  09:20:02  peterg
# Made LATEX2HTML an environment variable.
#
# Revision 1.108  1997/12/19  08:48:55  peterg
# Lille modifications - bicausal algebraic loops supported
#
## Revision 1.107  1997/12/11 10:59:50  peterg
## This is version 2.6
##
# Revision 1.106  1997/12/11  10:59:07  peterg
# Added debug -D switch + echos directory when -d switch used.
#
# Revision 1.105  1997/12/11  09:04:47  peterg
# Reduced default rep.txt file to just abg.txt -- this is to document
# components which may not be causally complete
#
# Revision 1.104  1997/12/07  21:05:10  peterg
# Removed a debbugging echo
#
## Revision 1.103  1997/12/07 20:10:36  peterg
## Fixed bugs with reprots and distinguish between book, article and
## section reports.
##
## Revision 1.102  1997/12/07 12:14:43  peterg
## Hnadles book, article and section reports seperately
##
## Revision 1.101  1997/12/06 18:54:53  peterg
## Now tidies up after itself.
## Major modifications to do a rep on a directory -- creates a book with
## each example as a chapter.
##
## Revision 1.100  1997/12/06 12:14:39  peterg
## Put a conditional around the PS data rep to check for set arguments.
##
## Revision 1.99  1997/12/04 22:06:53  peterg
## Added view arguments for graph plotting
##
## Revision 1.98  1997/12/04 10:58:15  peterg
## Tidied up switches
##
## Revision 1.97  1997/12/04 10:44:33  peterg
## Changed $cc to $CC
##
## Revision 1.96  1997/12/04 10:40:26  peterg
## Added -p switch - print enviromment variables
##
## Revision 1.95  1997/12/04 10:05:02  peterg
## Compiler now symbolocic $cc
##
# Revision 1.94  1997/11/20  11:23:16  peterg
# Changed gcc to cc
#
## Revision 1.93  1997/09/18 16:57:28  peterg
## _sympar.txt now has a second column - the system type from whence the
## parameter (in the first column) came.
## Done on the train Glasgow-Warrington !
##
## Revision 1.92  1997/09/11 17:08:46  peterg
## Added spreadsheet version of odeso
##
## Revision 1.91  1997/09/11 08:21:08  peterg
## copy utility split into two:
## copy: copies examples (copies the entire directory)
## compcopy: (just used internally) copies components.
##
## Revision 1.90  1997/08/30 19:35:39  peterg
## Added date to mtt line
##
## Revision 1.89  1997/08/26 15:20:25  peterg
## Added explicit evaluation of report representations
## Version now 2.5++
##
## Revision 1.88  1997/08/25 07:51:47  peterg
## Version 2.5.
##
## Revision 1.87  1997/07/27 13:11:11  peterg
## Added path checking code -- mtt_check_vars
##
# Revision 1.86  1997/06/29  19:05:51  peterg
# Seascale changes -- mainly to new rep format.
#
## Revision 1.85  1997/06/27 12:14:49  peterg
## Upped version to 2.4++
##
# Revision 1.84  1997/06/13  14:08:23  peterg
# Changed default rep.txt
#
# Revision 1.83  1997/06/13  09:18:28  peterg
# Removed all params.m
#
# Revision 1.82  1997/06/13  08:59:03  peterg
# Set to version 2.4
#
## Revision 1.81  1997/05/22 10:11:04  peterg
## Fixed dat2gdat bug (with parameters)
##
## Revision 1.80  1997/05/22 07:38:27  peterg
## Added command line info to .doc files (makedoc)
##
## Revision 1.79  1997/05/19 16:44:12  peterg
## Many changes to get rep.html mode working properly.
##
# Revision 1.78  1997/05/19  13:17:50  peterg
# Explicit inclusion of mtt.sty in .doc files -- latex2html prefers this
#
# Revision 1.77  1997/05/19  11:29:37  peterg
# Added desc.tex and abg.tex descriptions.
#
# Revision 1.76  1997/05/15  09:43:46  peterg
# New version of _input.txt for -s option
#
# Revision 1.75  1997/05/15  09:15:54  peterg
# Included switch.c in dependancy list for _input.c (when -s switch set)
#
# Revision 1.74  1997/05/13  16:58:02  peterg
# Added -s switch to get mtt to search for (Bond Graph) switches
#
## Revision 1.73  1997/05/09 09:18:45  peterg
## Put ./ in front of a.out (again)
##
# Revision 1.72  1997/05/06  13:54:21  peterg
# Changed gcc arguments for the ode simulation -- all files now included
# in the _odes.c file
#
# Revision 1.71  1997/05/03  15:50:18  peterg
# c functions not included in gcc arg list -- they are now included in
# the main prog.
#
# Revision 1.70  1997/05/03  14:17:13  peterg
# Now copies c utilities (eg dsvdcmp.c) from $MTTPATH/trans/c.
#
# Revision 1.69  1997/05/03  13:58:35  peterg
# Implicit integration for sm representation added.
#
# Revision 1.68  1997/05/01  08:39:20  peterg
# params.c and params.m not used any more.
# _numpar.txt is the common base from which _numpar.c and numpar.m is
# generated.
#
# Revision 1.67  1997/04/23  07:26:49  peterg
# Added -o switch -- ode and dae are the same
# Added switches to default menu
#
# Revision 1.66  1997/04/16  09:46:01  peterg
# More informative copy message
#
# Revision 1.65  1997/04/15  15:16:12  peterg
# Added structure (_struc) files.
# Fixed prob with dvi2ps conversion -- removed .doc extension.
#
# Revision 1.64  1997/04/09  09:26:44  peterg
# Added crcopy feature to pull crs from library -- similar to copy
# feature.
#
# Revision 1.63  1997/03/22  17:09:11  peterg
# Fixed bug in recursive cr.txt generation.
# Fixed bug in recursive sympar.txt generation.
#
# Revision 1.62  1997/03/20  17:48:50  peterg
# Better _input.c file default.
#
# Revision 1.61  1997/03/20  16:53:01  peterg
# Generates c files using include statements.
#
# Revision 1.60  1997/03/20  10:25:41  peterg
# Generates a compehensive default params file.
#
# Revision 1.59  1997/03/19  10:14:04  peterg
# Now produces a stripped acausal bond graph.
#
# Revision 1.58  1997/03/18  17:58:12  peterg
# Generates label files containing all variables in fig file.
# Generates sympar file for all levels in system.
# Generates txt version of sympar file.
#
# Revision 1.57  1997/03/10  09:24:58  peterg
# a.out now deleted in the clean operation
#
# Revision 1.56  1997/03/05  08:24:09  peterg
# Delete a.out after it has run.
#
# Revision 1.55  1997/02/24  19:31:10  peterg
# Removed numpar.m requirement from .m files
#
## Revision 1.54  1997/02/09 20:33:13  peterg
## Replaced a.out with ./a.out
##
## Revision 1.53  1997/02/09 20:30:04  peterg
## Copied from tweedledum.
##
# Revision 1.54  1997/02/07  13:33:03  peterg
# Added ; to _input.c file - bug fix.
#
# Revision 1.53  1997/02/07  13:25:04  peterg
# Version 2.3
#
# Revision 1.52  1997/01/21  22:55:59  peterg
# Minor bug fixes
#
## Revision 1.51  1997/01/21 13:16:40  peterg
## Included transformations to language c for:
## ode
## params
## numpar
##
## Revision 1.50  1996/12/21 19:46:52  peterg
## Set to 2.2++
## Changed \* --> \\* in rbg_fig2m.awk
##
## Revision 1.49  1996/12/19 19:55:22  peterg
## Version 2.2 -- Linux.
##
## Revision 1.48  1996/12/07 21:33:52  peterg
## Changed _input file to give unit step on ALL inputs
##
## Revision 1.47  1996/12/07 20:50:16  peterg
## *** empty log message ***
##
## Revision 1.46  1996/12/05 10:48:51  peterg
## Put sympar in clean list.
## sympar now sucks in params.r file
##
## Revision 1.45  1996/12/05 10:41:39  peterg
## Saved many changes over past 2 weeks.
##
# Revision 1.44  1996/11/12  16:04:25  peterg
# Really VERSION 2.1
#
# Revision 1.43  1996/11/12  08:52:57  peterg
# Fixed bug in test arg to if - missing "".
#
# Revision 1.42  1996/11/11  17:23:03  peterg
# Added numpar.m requirement to all .m targets
#
## Revision 1.41  1996/11/11 17:18:32  peterg
## VERSION 2.1
##
## Revision 1.40  1996/11/09 21:17:38  peterg
## Fixed bug with copying at level 0.
##
## Revision 1.39  1996/11/09 20:22:54  peterg
## VERSION 2.0
##
## Revision 1.38  1996/11/09 20:17:34  peterg
## Fixed bug with null ARGS argument
## Put in new lib paths.
##
## Revision 1.37  1996/11/09 18:47:46  peterg
## Added new copy command (using find).
## More documaentation stuff.
##
# Revision 1.36  1996/11/03  21:19:02  peterg
# Recursice generation of Constitutive Relationship files.
#
## Revision 1.35  1996/11/02 10:19:19  peterg
## Constitutive Relationship generation from lbl file
##
## Revision 1.34  1996/11/01 13:34:35  peterg
## -q (quiet) switch added
##
## Revision 1.33  1996/11/01 12:34:45  peterg
## Added browser - mtt_help
##
## Revision 1.32  1996/10/31 20:48:41  peterg
## Revised html generation.
## Stopped deletion of rep.txt file.
##
# Revision 1.31  1996/10/20  19:23:54  peterg
# Automatic generation of sub-system abg.m files.
#
## Revision 1.30  1996/10/01 14:08:05  peterg
## Replaced $() by ``
## Replaced make with gmake
##
# Revision 1.29  1996/10/01  11:04:05  peter
# Changed name of html document.
#
## Revision 1.28  1996/09/13 18:44:11  peter
## Added params dependencies.
##
## Revision 1.27  1996/09/12 19:24:56  peter
## New numpar/params setup.
##
## Revision 1.26  1996/09/10 17:04:47  peter
## Added impulse response (ir) representation.
##
## Revision 1.25  1996/08/30 20:03:45  peter
## Removed dependencies from vc
##
## Revision 1.24  1996/08/30 18:37:17  peter
## inor changes.
##
## Revision 1.23  1996/08/30 11:10:37  peter
## More files in clean up.
##
## Revision 1.22  1996/08/30 10:07:51  peter
## Removed impicit creation of abg.fig file.
##
## Revision 1.21  1996/08/22 12:19:51  peter
## Added various document viewers.
##
## Revision 1.20  1996/08/20 08:24:53  peter
## Now with version control.
##
## Revision 1.19  1996/08/19 15:33:22  peter
## Included new state matric (sm) rep.
## Generate step response (sr) from sm.
##
## Revision 1.18  1996/08/19 13:30:54  peter
## New CLEAN target.
##
## Revision 1.17  1996/08/19 06:48:14  peter
## Explicit figure editing.
##
## Revision 1.16  1996/08/18 19:58:36  peter
## Report generation included.
##
## Revision 1.15  1996/08/18 12:01:01  peter
## Unified format of time responses.
##
## Revision 1.14  1996/08/16 14:52:24  peter
## Added two alternative view options - dview and pview.
##
## Revision 1.13  1996/08/16 08:24:31  peter
## Correctly chooses how to make a ps file using $REPTYPE.
##
## Revision 1.12  1996/08/15 16:47:47  peter
## DAE solution (experimental) included.
##
## Revision 1.11  1996/08/15 11:55:30  peter
## Checks for changed argument.
## Handles frequency response.
##
## Revision 1.10  1996/08/15 07:44:24  peter
## Now handles generic transformations using %.
##
## Revision 1.9  1996/08/14 09:16:08  peter
## Step response now goes through  m, dat and gdat conversions
##
## Revision 1.8  1996/08/12 20:19:52  peter
## Arguments now passed via $1_args.m file
##
## Revision 1.7  1996/08/11 19:49:27  peter
## Parameter passing (via $4) added.
##
## Revision 1.6  1996/08/11 10:40:56  peter
## Added new numpar stuff.
## Added step response.
##
## Revision 1.5  1996/08/10 14:13:47  peter
## Added impulse and frequency response stuff.
##
## Revision 1.4  1996/08/10 09:19:48  peter
## Put in help, info and warranty stuff.
##
## Revision 1.3  1996/08/09 15:13:13  peter
## Generic viewing of any representation via ps files implemented.
##
## Revision 1.2  1996/08/05 19:50:55  peter
## Put in fig.fig target.
##
## Revision 1.1  1996/08/04 17:29:42  peter
## Initial revision
##
###############################################################


#Check $MTTPATH has been set
mtt_check_var "$MTTPATH" "MTTPATH"

#Version
version='4.9'

# MTT recursion level is zero unless explicitly set
level=0

#Computation mode is octave by default
computation=octave

#By default, the dae and ode representations are different
dae_is_ode=0

#By default, the ode and cse reps are different
ode_is_cse=0

# By default, don't look for BG switches
switches=0

#By default, don't print the environment variables
print='';

# By default, make it tidy
tidy=tidy;

# Default not verbose
verbose=' -s'
verbosity=0

# Default integration method
integration_method=implicit;

# Default algebraic equation solver
algebraic_solver=Reduce_Solver;

# Default no info
info_switch=''

# Default use m, not oct files
m='m';

# Default use ps files
ps=ps
eps=eps
psview=$PSVIEW

#Initialise list
mtt_switches='';


#Look for a command line argument
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-q )
                mtt_switches="$mtt_switches $1";
		quiet=quiet;;  
	-r )
                mtt_switches="$mtt_switches $1";
		reset=reset;;  

	-p )
                mtt_switches="$mtt_switches $1";
		print='-p';;
	-c )
                fixcc='-fixcc'
                mtt_switches="$mtt_switches $1";
                matrix_smxa="-matrix";
		computation=c ;;
	-cc )
                fixcc='-fixcc'
                mtt_switches="$mtt_switches $1";
                matrix_smxa="-matrix";
		computation=cc ;;
	-cr )
                mtt_switches="$mtt_switches $1";
		rdae_is_dae=1 ;
                cr_first='-cr';;
	-o )
                mtt_switches="$mtt_switches $1";
		dae_is_ode=1 ;;
	-nocr )
                mtt_switches="$mtt_switches $1";
		rdae_is_dae=1 ;;
	-i )
                mtt_switches="$mtt_switches $1";
                shift;
                case $1 in
		    dassl)
			integration_method=dassl;
			mtt_switches="$mtt_switches dassl";
			;;
		    euler)
			integration_method=euler;
                        mtt_switches="$mtt_switches euler";
			;;
		    implicit)
			integration_method=implicit;
                        mtt_switches="$mtt_switches implicit";
			;;
		    rk4)
			integration_method=rk4;
			mtt_switches="$mtt_switches rk4";
			;;
		    *)
			echo $1 is an unknown integration method - use dassl, euler, rk4 or implicit;
                        exit;;
		esac;;
	-ae )
                mtt_switches="$mtt_switches $1";
		case $2 in
		    dassl)
			mtt_switches="$mtt_switches $2";
			algebraic_solver=Dassl_Solver;
			shift;
			;;
		    fsolve | hybrd)
			mtt_switches="$mtt_switches $2";
			algebraic_solver=Hybrd_Solver;
			shift;
			;;
		    hooke)
			mtt_switches="$mtt_switches $2";
			algebraic_solver=HJ_Solver;
			shift;
			;;
		    reduce)
			mtt_switches="$mtt_switches $2";
			algebraic_solver=Reduce_Solver;			
			Solve='-A';
			shift;
			;;
		    *)
			echo $1 is an unknown solver - use hybrd, hooke or reduce;
			exit;;
	        esac;;
	-s )
                sensitivity_switch='-s';
                mtt_switches="$mtt_switches $1";
		sensitivity=sensitivity ;;
	-ss )
                mtt_switches="$mtt_switches $1";
		steadystate_computation=yes ;;
	-d )
		directory=$2; cd $directory; shift ;;
	-dc )
		mtt_switches="$mtt_switches $1";
		causality_switch='-derivative' ;;
	-S )
		directory=$2;  shift;;
	-D )
                mtt_switches="$mtt_switches $1";
		debug=debug ;;
	-v )
                mtt_switches="$mtt_switches $1";
		info_switch='-I';
                Verbose='verbose';
		verbosity=`expr $verbosity + 1`;
		if [ $verbosity -ge 1 ]; then verbose=' -w '; fi;
		if [ $verbosity -ge 2 ]; then set -x; fi;
		if [ $verbosity -ge 3 ]; then verbose_make=' -d '; fi;
		;;
	-I )
                mtt_switches="$mtt_switches $1";
		info_switch='-I' ;;
	-t )
		tidy=tidy ;;
	-trace )
                mtt_switches="$mtt_switches $1";
		trace='-n' ;;
	-T )
		tidy=tidy;
                verytidy=verytidy ;;
	-u )
		tidy=untidy ;
                mtt_switches="$mtt_switches $1";
                ;;
	-l )
                mtt_switches="$mtt_switches $1 $2";
		level=$2; shift ;;
	-A )
                mtt_switches="$mtt_switches $1";
                Solve='-A';;
	-abg )
                mtt_switches="$mtt_switches $1";
                start_at_abg='yes';;
	-stdin )
                mtt_switches="$mtt_switches $1";
                stdin=stdin;;
	-sub )  mtt_switches="$mtt_switches $1 $2";
                sub='-sub'; 
                subsystem="_"$2;
                shift;;
	-oct )
                fixcc='-fixcc'
                mtt_switches="$mtt_switches $1";
                using_oct=yes;
                m=oct
                ;;
	-opt )  mtt_switches="$mtt_switches $1";
                optimise='-optimise';;
	-partition ) mtt_switches="$mtt_switches $1";
                     partition='-partition';
                ;;
	-pdf )   mtt_switches="$mtt_switches $1";
                 ps=pdf; 
                 eps=pdf;
                 pdf='-pdf';
                 psview=$PDFVIEW;
                ;;
	-viewlevel )  mtt_switches="$mtt_switches $1 $2";
                      viewlevel=$2;
                      shift;;
        --version)                
                  echo 'MTT version' $version; exit;;
        --versions)                
                mtt_versions; exit;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
  echo
  echo 'MTT (Model Transformation Tools) version' $version
  echo '($Date$)'
  echo 'This is free software with ABSOLUTELY NO WARRANTY.'
  echo 'Type `mtt warranty'\' 'for details.'
  echo
  # Print current directory if in -d mode
  if [ -n "$directory" ]; then
    echo Using directory $directory
    echo
  fi
fi

#Print what's going on if in verbose mode
if [ -n "$Verbose" ]; then
    echo  Starting  mtt  $mtt_switches  $1 $2 $3 $4 at level $level 
    echo  "        " current wd `pwd`
fi

#Check the principle paths
mtt_check_vars $print

# Exit if just printing paths
if [ "$print" != "" ]; then
  exit
fi

if [ -z "$1" ]; then
  if [ -z "$print" ]; then
    echo 'Usage: mtt help             -- mtt on-line help'
    echo '       mtt find component   -- find location of a compound component'
    echo '       mtt info             -- info-based manual'
    echo '       mtt info topic'
    echo '       mtt hinfo            -- hypertext manual'
    echo '       mtt manual           -- pdf manual'
    echo '       mtt warranty'
    echo '       mtt clean           -- cleans up intermediate files'
    echo '       mtt rclean          -- recursively cleans up intermediate files'
    echo '       mtt Clean           -- cleans up all generated files'
    echo '       mtt <system_name> clean'
    echo '       mtt copy <system_name> <path_name>'
    echo '       mtt rename <old_name> <new_name>'
    echo '       mtt <system_name> <representation> vc' 
    echo '       mtt <system_name> <representation> <language>'
    echo '       mtt <system_name> <representation> <language> <parameters>'
    echo 'Options: -q  quiet mode -- suppress MTT banner'
    echo '         -A  solve algebraic equations symbolically'
    echo '         -D  debug -- leave log files etc'
    echo '         -I  prints more information'
    echo '         -abg start at abg.m representation'
    echo '         -c  c-code generation'
    echo '         -cc C++ code generation'
    echo '         -cr Use cr before resolving equations'
    echo '         -d  <dir>  use directory <dir>'
    echo '         -dc Maximise derivative (not integral) causality'
    echo '         -dc Maximise derivative (not integral) causality'
    echo '         -i <implicit|euler|rk4|dassl>   Use implicit, euler, rk4 or dassl integration'
    echo '         -ae <reduce|hybrd|dassl|hooke>   Solve algebraic equations with specified solver'
    echo '         -o ode is same as dae'
    echo '         -oct use oct files in place of m files where appropriate'
    echo '         -opt optimise code generation'
    echo '         -p  print environment variables'
    echo '         -partition partition hierachical system'
    echo '         -pdf generate pdf in place of ps'
    echo '         -r  reset time stamp on representation'
    echo '         -s  generate sensitivity BG (use mtt -s sSys rep lang)'
    echo '         -ss use steady-state info to initialise simulations'
    echo '         -stdin read input data from standard input for  simulations'
    echo '         -sub <subsystem> operate on this subsystem'
    echo '         -t  tidy mode (default)'
    echo '         -trace  Just indicate what mtt will do - but do not do it'
    echo '         -u  untidy mode (leaves files in current dir)'
    echo '         -v  verbose mode (multiple uses of -v increase the verbosity level)'
    echo '         -viewlevel <N> View N levels of hierachy'
    echo '         --version print version and exit'
    echo '         --versions print version of mtt and components and exit'
    exit
  fi
fi


if [ "$1" = "info" ]  && [ "$3" = "" ]; then
  (cd $MTTPATH/doc/; make --silent mtt.info)
  echo "Invoking info in xterm"
  xterm -e info -f $MTTPATH/doc/mtt.info $2
  exit
fi

if [ "$1" = "help" ]; then
  mtt_help $2 $3
  exit
fi

if [ "$1" = "hinfo" ] && [$2 = ""]; then
   mtt_check_var "$HTMLVIEW" HTMLVIEW
  (cd $MTT_DOC/; make --silent mtt.html) 
   echo Invoking $HTMLVIEW
   (cd $MTT_DOC; $HTMLVIEW ./mtt.html)&
   exit
fi

if [ "$1" = "manual" ] && [$2 = ""]; then
  mtt_check_var "$PDFVIEW" PDFVIEW
  (cd $MTT_DOC/; make --silent mtt.pdf) 
  echo Invoking $PDFVIEW 
  $PDFVIEW  $MTT_DOC/mtt.pdf &
  exit
fi

if [ $1 = "find" ]&& [$3 = ""]; then
    mtt_find $MTT_COMPONENTS $2
    find_status=$?
  if [ $find_status = "1" ]; then
    echo Component $2 not found - is MTT_COMPONENTS set correctly?
  fi
    exit $find_status
fi

if [ "$1" = "warranty" ] && [$2 = ""]; then
  cat << EOF
Copyright (C) 1989, 1990, 1991, 1992, 1993, 
              1994, 1995, 1996, 1997, 1998, 1999 Peter J. Gawthrop
This is free software with ABSOLUTELY NO WARRANTY.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

EOF
  exit
fi

# Start at abg representation
if [ -n "$start_at_abg" ]; then
  if [ -f "$1_abg.m" ]; then
    if [ "$quiet" != "quiet" ]; then
        echo Starting from $1_abg.m
    fi
  else
    echo $1_abg.m does not exist
    exit
  fi
fi

# Clean up 
if [ "$1" = "clean" ]; then
  echo Removing intermediate files in `pwd`
  rm -fr MTT_work
  exit
fi

# Recursively clean up
if [ "$1" = "rclean" ]; then
  echo 'Removing intermediate files recursively'
  dir2paths '.' | awk '{print "mtt -q -d " $1 " clean " $2}' | sh
  exit
fi

# The big clean up
if [ "$1" = "Clean" ] && [ "$2" = "" ]; then
  echo 'Removing all generated files for all systems'
  rm -f *.log  mtt_info.txt warning.txt
  rm -f *_abg.ps *_args.*  *_cr.txt *_abg.tex
  rm -f *_sabg.fig *_sabg.ps *_head.fig *_bnd.fig 
  rm -f *_sympar.r *_sympar.c *_sympar.h *_sympar.txt? *_sympar.tex
  rm -f *_rbg.* *_cmp.* *_fig.fig *_*cbg.* *_ese.* *_def.* *_alias.*
  rm -f *_sub.* *_type.sh
  rm -f *_dae*.* *_cse.* *_ode.*
  rm -f *_obs.* *_rfe.* *_ss.*
  rm -f *_dm.* *_csm.*  *_tf.* *_sr*.* *_ir*.* *_*fr.*
  rm -f *_numpar.m *_numpar.c *_input.m *_input.c *_switch.c *_switch.txt
  rm -f *_sm.* *_can.*
  rm -f *_struc.* *_sympar.txt *_sympar.c *_sympar.h *_sympar.m
  rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps *_odes.sg
  rm -f *_odeso.dat *_odeso.gdat *_odeso.sdat *_odeso.m *_odeso.ps
  rm -f *_*.doc *_*.idx *_*.ind *_*.ilg *_*.dvi *_*.aux *_*.lof *_*.toc
  rm -f *_rep.tex
  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt *_ode2odes.out 
  rm -f *_*_write.r *_simpar.m *_simpar.p
  rm -f *_cseo.oct *_input.oct *_simpar.oct *_smxax.oct
  rm -f *_csex.oct *_numpar.oct *_smxa.oct *_state.oct 
  rm -f *_ode.oct *_odeo.oct
  rm -f *_cseo.cc *_input.cc *_simpar.cc *_smxax.cc
  rm -f *_csex.cc *_numpar.cc *_smxa.cc *_state.cc 
  rm -f *_ode.cc *_odeo.cc
  rm -f *_logic.m *_logic.cc *_logic.oct
  rm -f *_state.m *_state.cc *_state.oct
  rm -f *_ode2odes.* *.dat2 MTT.core
  rm -f *_modpar.txt *_modpar.r
  rm -f *_ICD.txt *_ICD.c *_ICD.cc *_ICD.m
  rm -f *_ae.r *_ae.m *_ae.cc *_ae.oct
  rm -fR *_rep MTT_work
  exit
fi

# Clean up named system
if [ "$2" = "Clean" ] && [ "$3" = "" ]; then
  echo 'Removing all generated files for system ' $1
  rm -f *.log  mtt_info.txt warning.txt
  rm -f $1_abg.ps $1_args.*  $1_cr.txt $1_abg.tex
  rm -f $1_sabg.fig $1_sabg.ps $1_head.fig $1_bnd.fig 
  rm -f $1_sympar.r $1_sympar.c $1_sympar.h $1_sympar.txt? $1_sympar.tex
  rm -f $1_rbg.* $1_cmp.* $1_fig.fig $1*_*cbg.* $1*_ese.* $1_def.* $1_alias.*
  rm -f $1_sub.* $1_type.sh
  rm -f $1_dae*.* $1_cse.* $1_ode.*  $1_obs.* $1_rfe.* $1_ss.*
  rm -f $1_dm.* $1_csm.* $1_tf.* $1_sr*.* $1_ir*.* $1_*fr.*
  rm -f  $1_numpar.m $1_numpar.c $1_input.m $1_input.c $1_switch.c $1_switch.txt
  rm -f $1_sm*.* $1_can.*
  rm -f $1_struc.* $1_sympar.txt $1_sympar.c $1_sympar.h $1_sympar.m
  rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps $1_odes.sg
  rm -f $1_odeso.dat $1_odeso.gdat $1_odeso.m $1_odeso.ps
  rm -f $1_*.doc $1_*.idx $1_*.ind $1_*.ilg $1_*.dvi $1_*.aux $1_*.lof $1_*.toc
  rm -f $1_rep.tex
  rm -f $1_unique_raw_list $1_raw_list
  rm -f mtt_error.txt mtt_info.txt $1_ode2odes.out 
  rm -f $1_*_write.r $1_simpar.m $1_simpar.p
  rm -f $1_cseo.oct $1_input.oct $1_simpar.oct $1_smxax.oct
  rm -f $1_csex.oct $1_numpar.oct $1_smxa.oct $1_state.oct 
  rm -f $1_ode.oct $1_odeo.oct
  rm -f $1_cseo.cc $1_input.cc $1_simpar.cc $1_smxax.cc
  rm -f $1_csex.cc $1_numpar.cc $1_smxa.cc $1_state.cc 
  rm -f $1_ode.cc $1_odeo.cc
  rm -f $1_logic.m $1_logic.cc $1_logic.oct 
  rm -f $1_state.m $1_state.cc $1_state.oct
  rm -f $1_ode2odes.* $1.dat2
  rm -f $1_modpar.txt $1_modpar.r
  rm -f $1_ICD.txt $1_ICD.c $1_ICD.cc $1_ICD.m
  rm -f $1_ae.r $1_ae.m $1_ae.cc $1_ae.oct
  rm -fR $1_rep MTT_work
  exit
fi

if [ "$2" = "rep" ]; then
     documenttype=article
      # See if we are making a book -- ie representation rep on a directory
     isMTT_work=`pwd | grep 'MTT_work'`
      if [ -n "$isMTT_work" ]; then
	dotdot='../'
      fi  
  
     #isdirectory=`file $dotdot$1 | awk '{print $2}' | grep directory`
     if [ -d "$dotdot$1" ]; then
	documenttype=book
     fi
else
     documenttype=section
fi

case $2 in
    nyfr)
	NyquistStyle='True'
	;;
    nifr)
	NyquistStyle='True'
	;;
    *)
	
esac

#SUMMARY abg*	acausal bond graph (fig)
#SUMMARY abg*	acausal bond graph (ps)
#SUMMARY abg*	acausal bond graph (view)
# Invoke explicit requests for modification
if [ "$2" = "abg" ] && [ "$3" = "fig" ]; then
  mtt_check_var "$FIG" FIG
  echo Editing $1_$2.$3
  ($FIG $1_$2.$3; cp $1_abg.fig $1_$1_abg.fig) &
  exit
fi

# Rename a system
if [ "$1" = "rename" ]; then
  mtt_rename_all $2 $3
  exit
fi

# Copy systems from the example library
if [ "$1" = "copy" ]; then
   #set up source and destination dirs
    source=$3
    if [ -z "$source" ]; then
      source=$MTT_Examples
    fi
    destination=$4
    if [ -z "${destination}" ]; then
      destination=$2
    fi      
# check that its not here already
  file_exists=`ls ${destination}/$2_abg.fig 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo System $2 exists already - no action taken
    fi
  else
    source=$3
    if [ -z "$source" ]; then
      source=$MTT_EXAMPLES
    fi
    destination=$4
    if [ -z "${destination}" ]; then
      destination=$2
    fi    
echo Copying system $2 from $source into directory ${destination}
    find $source -name "$2" -exec cp -fr {} . \;
    rm -rf ${destination}/CVS
  fi
  exit
fi

# Copy components from the library
if [ "$1" = "compcopy" ]; then

   #Pull out the base name (we may have a library as well)
   name=`basename $2`

   #set up source and destination dirs
    source=$3
    if [ -z "$source" ]; then
      source=$MTT_COMPONENTS
    fi
    destination=$4
    if [ -z "${destination}" ]; then
      destination='.'
    fi   

  # check that its not here already
  file_exists=`ls ${destination}/"$name"_abg.fig 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo Component $name exists already - no action taken
    fi
  else
    if [ $source = "." ]; then
      cp -u *_*.* ${destination}
    else
      comp_path=`mtt_find $source $2 path_only`
      n_found=`echo $comp_path | wc | awk '{print $2}'`

      if [ "$n_found" = "1" ]; then
         echo Copying $2 from $comp_path to ${destination}
         cp $comp_path/*_*.* ${destination}
         exit 0
      elif [ "$n_found" = "0" ]; then
	if [ "$quiet" != "quiet" ]; then    
           echo Component $2 not found - is MTT_COMPONENTS set correctly?
        fi
         exit 1
      elif [ "$n_found" > "1" ]; then
         echo "Multiple versions of $2 found (see below) - use a more explicit alias"
         mtt -q find $2
         exit 2
      fi
    fi
  fi
  exit
fi

# Copy CRs from the library
if [ "$1" = "crcopy" ]; then
  # check that its not here already (or a _cr.r version)
  file_exists=`ls $2.cr $2_cr.r 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo $2.cr or $2_cr.r exists already - no action taken
    fi
  else
    path_name=$3
    if [ -z "$path_name" ]; then
      path_name=$MTT_LIB/cr/r
    fi
    echo Copying CR $2 to here from $3
    find $path_name -name "$2.cr" -exec cp {} . \;
  fi
  exit
fi


# Version control
VC=''

if [ "$3" = "vc" ]; then
  tidy=untidy;
  if [ -n "$4" ]; then
    log_message=$4
  else
    log_message="No Message"
  fi
  case $2 in
	abg )
		VC='ok'
		VCext='fig' ;;
	lbl )
		VC='ok'
		VCext='txt' ;;
	desc )
		VC='ok'
		VCext='tex' ;;
	simp )
		VC='ok'
		VCext='r' ;;
	rep )
		VC='ok'
		VCext='txt' ;;
	numpar )
		VC='ok'
		VCext='txt' ;;
	input )
		VC='ok'
		VCext='txt' ;;
	state )
		VC='ok'
		VCext='txt' ;;
	odes )
		VC='ok'
		VCext='h' ;;
	sspar )
		VC='ok'
		VCext='r' ;;
	*)
		echo Version control is not appropriate for representation $2
		exit  ;;
  esac
fi

# Classify the representation - needed for conversion route to postscript
PLOTTYPE='single';
case $2 in
	abg )
		REPTYPE='bg' ;;
	sabg )
		REPTYPE='bg' ;;
	cbg )
		REPTYPE='bg' ;;
    	input )
		REPTYPE='txt' ;;
	numpar )
		REPTYPE='txt' ;;
	state )
		REPTYPE='txt' ;;
	simpar )
		REPTYPE='txt' ;;
	obspar )
		REPTYPE='txt' ;;
	odes)
		REPTYPE='data'; PLOTTYPE='multiple' ;;
	odeso)
		REPTYPE='data'; PLOTTYPE='multiple' ;;
	sms)
		REPTYPE='data'; PLOTTYPE='multiple' ;;
	smso)
		REPTYPE='data'; PLOTTYPE='multiple' ;;
	odess)
		REPTYPE='data' ;;
	odesso)
		REPTYPE='data' ;;
	daes)
		REPTYPE='data'; PLOTTYPE='multiple' ;;
	daeso)
		REPTYPE='data'; PLOTTYPE='multiple' ;;
	ir)
		REPTYPE='data' ;;
	iro)
		REPTYPE='data' ;;
	sr)
		REPTYPE='data' ;;
	sro)
		REPTYPE='data' ;;
	lmfr)
		REPTYPE='data' ;;
	lpfr)
		REPTYPE='data' ;;
	nyfr)
		REPTYPE='data' ;;
	nifr)
		REPTYPE='data' ;;
	*)
		REPTYPE='tex' ;;
esac


## Set up the main arguments
sys=$1
rep=$2
lang=$3

## Make ps pdf if -pdf set
if [ "$lang" = "ps" ]; then
  lang=$ps
fi


# Create some strings
Subsystem=$1$subsystem;

Subsystem_=$Subsystem"_"
Subsystem_ese=$Subsystem"_ese"
Subsystem_def=$Subsystem"_def"
Subsystem_rdae=$Subsystem"_rdae"
Subsystem_dae=$Subsystem"_dae"
Subsystem_subs=$Subsystem"_subs"
Subsystem_cr=$Subsystem"_cr"
Subsystem_cbg=$Subsystem"_cbg"

## Create the make target name
target=${sys}_${rep}.${lang}

## Arguments
ARGS=$4; _ARGS=-$4; __ARGS=`echo $_ARGS | tr ',' '-'`

# Save up the argument list in a file; but only if argument has changed
#DIFF doesn't like empty files - so put a blank if empty
#if [ -z "$ARGS" ]; then
#  ARGS=' ';
#  _ARGS='';
#fi

#cat > $1_args.new <<EOF
#$ARGS
##EOF

#DIFF=`diff -bq $1_args.m $1_args.new 2>/dev/null`

#if [ -n "$DIFF" ]; then
#  mv $1_args.new $1_args.m
#fi

# Tidy mode - operate in the directory MTT-work
if [ "$tidy" = "tidy" ]; then
   mkdir -p MTT_work
   cp -p -u  Makefile Make *.* .* MTT_work  2>/dev/null
   cd MTT_work

   if [ -f ".octaverc" ]; then
     touch .octaverc
   else
     echo Copying .octaverc 
     cp $MTT_LIB/octave/.octaverc .
   fi

   if [ -f "useful-functions.hh" ]; then
     touch useful-functions.hh
   else
     echo Copying useful-functions.hh
     cp $MTT_CC/include/useful-functions.hh .
   fi

   if [ -z "$directory" ]; then
     Directory=''
   else
     Directory=$directory/MTT_work
   fi

     mtt -u -q  $mtt_switches -S "$Directory"  $1 $2 $3 $4
     mtt_status=$?

   # Exit on failure
   if [ "$mtt_status" != "0" ]; then
     echo Exiting MTT with error $mtt_status
     exit 1
   fi

  # Copy back form working directory
   if [ "$3" != "view" ] && [ "$3" != "hview" ] && [ -z "$reset" ]; then
      if [ "$3" = "html" ]; then
	  echo Moving $1_$2
          mv $1_$2 ..
      else
        if [ "$PLOTTYPE" = "multiple" -a -f $1_$2__ARGS.$ps ]; then
          echo Copying  $1_$2$__ARGS.$ps
          cp  $1_$2$__ARGS.$ps ..
        else
          echo Copying  $1$subsystem"_"$2.$lang
          cp  -p -u $1$subsystem"_"$2.$lang ..
        fi
      fi
    fi

   # Remove the MTT_work directory if very tidy
   if [ "$verytidy" = "verytidy" ]; then
    echo Removing all working files
    rm -rf ../MTT_work
  fi
exit
fi 

# User defined representations
## Copy from library if not already here
if [ -f "$MTT_REP/$2_rep.make" ]; then
  if [ -f "$2_rep.make" ]; then
    echo Using $2_rep.make
  else
    echo Copying $2_rep.make from $MTT_REP
    cp $MTT_REP/$2_rep.make .
  fi
fi

if [ -f "$2_rep.make" ]; then
   if [ -n "$4" ]; then
      filename=$1_$2-$4.$3
   else
      filename=$1_$2.$3
   fi
    
   if [ -f "$filename" ]; then
      echo $filename exists
   else
     if [ -n "$Verbose" ]; then
      echo make -s -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$4" "OPTS=$mtt_switches" 
     fi
      make -s -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$4" "OPTS=$mtt_switches"
      if [ -n "$4" ]; then
         echo Copying  $1_$2$__ARGS.$ps
         cp  $1_$2$__ARGS.$ps ..
      fi
   fi
    exit
fi

## Check for pre version 4.0 integration method specification.
if [ $level = "0" ]; then
  if [ -f "$1_simpar.txt" ]; then
    method_line=`grep -i METHOD  $1_simpar.txt`
    if [ -n "`echo $method_line | grep -i euler`" ]; then
      echo Obsolete $1_simpar.txt contains: $method_line
      echo "    please use mtt -i euler in future"
      mtt_switches="$mtt_switches -i euler";
    elif [ -n "`echo $method_line | grep -i implicit`" ]; then
      echo Obsolete $1_simpar.txt contains: $method_line
      echo "    please use mtt -i implicit in future"
      mtt_switches="$mtt_switches -i implicit";
    fi
  fi
fi

if [ -n "$reset" ]; then
  if [ -f "$1_$2.$3" ]; then
    echo Resetting time stamp on $1_$2.$3
    touch $1_$2.$3
  else
    echo $1_$2.$3 does not exist - no action taken
  fi
  exit;    
fi


if [ -n "$sensitivity" ]; then
  sys_s=`echo $1 | cut -c 2-`
  sys_abg=${sys_s}_abg
fi

## Check octave version
case `$MATRIX --version | awk -F\. '{print $2}'` in
    0) define_octave_dev="";;			# stable 
    1) define_octave_dev="-DOCTAVE_DEV";;	# development
    *) define_octave_dev="-DOCTAVE_DEV";;
esac

################################
# This is the main mtt programme
################################

#echo Target is $target, Subsystem is $Subsystem, options are $mtt_switches
##<<<<<<< mtt
##$MAKE  -S ${trace} ${verbose}  -f  -  ${target} << EOF
##=======
##$MAKE -S $verbose $verbose_make -f  -  $target << EOF
##>>>>>>> 1.316
$MAKE -S ${trace} $verbose $verbose_make -f  -  $target << EOF

# Cancel implicit rules I don't want
%.dvi: %.tex

# MTT implicit rules
## .oct files
$1_%.oct:  $1_%.cc $1_def.h $1_sympar.h $1_cr.h
	echo Creating $1_\$*.oct; $MKOCTFILE  $1_\$*.cc

.PRECIOUS: mtt_%.oct
mtt_%.oct: mtt_%.cc
	echo Compiling \$<
	${MKOCTFILE} $define_octave_dev \$<

## .cc files
.PRECIOUS: %.cc # Don't let mtt delete them
$1_%.cc:  $1_%.m
	mtt_m2cc.sh  $1 \$* cat 

mtt_%.cc: ${MTT_LIB}/cc/mtt_%.cc
	cp ${MTT_LIB}/cc/mtt_\$*.cc mtt_\$*.cc

mtt_%.hh: ${MTT_LIB}/cc/mtt_%.hh
	cp ${MTT_LIB}/cc/mtt_\$*.hh mtt_\$*.hh

## .o files
.PRECIOUS: $1_%.o
$1_%.o: $1_%.cc $1_def.h $1_sympar.h $1_cr.h
	echo Compiling $1_\$*.cc
	${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $< -DSTANDALONE

.PRECIOUS: mtt_%.o
mtt_%.o: mtt_%.cc
	echo Compiling mtt_\$*.cc
	${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $< -DSTANDALONE $define_octave_dev

# Generates code to write reduce code
$1_ode_write.r: $1_def.m
	def2write_r  $1 $2 $computation

ifeq ("$sensitivity","sensitivity")
ifeq ("$level","0")
$1_abg.fig: $sys_abg.fig
	abg2sensitivity_fig $sys_s
else # Either find the sensitivity model or fetch the model and create sensitivity model
$1_abg.fig:
	mtt -q -u $mtt_switches compcopy $1 || abg2sensitivity_fig $sys_s
endif
endif

ifneq ("$sensitivity","sensitivity")
ifneq ("$level","0")
# If level>0, try and get subsystem files; creating if necessary
$1_abg.fig:
	mtt -q -u $mtt_switches compcopy $1
endif
endif

# Create an arg file if it doesn't exist
$1_args.m:
	touch $1_args.m

#Create skeleton files (with titles) if not already there
#SUMMARY lbl*	label file (txt)
#SUMMARY lbl	label file (txt)
#SUMMARY lbl*	label file (view)
#SUMMARY lbl	label file (view)
#SUMMARY lbl*	label file (tex)
#SUMMARY lbl	label file (tex)
$1_lbl.txt: $1_abg.fig
	abg2lbl_fig2txt $1 $sensitivity

$1_lbl.tex: $1_lbl.txt
	lbl_txt2tex $1

#SUMMARY alias  name aliases for each subsystem (txt)
$1_alias.txt: $1_lbl.txt
	lbl2alias_txt2txt $1

#SUMMARY modpar  name modulated parameters for each subsystem (txt)
$1_modpar.txt: $1_lbl.txt
	lbl2modpar_txt $1

#SUMMARY modpar  name modulated parameters for each subsystem (r)
$1_modpar.r: $1_modpar.txt $1_struc.txt
	modpar_txt2r $1

#SUMMARY alias  name aliases for each subsystem (m)
$1_alias.m: $1_alias.txt
	alias_txt2m $1

##SUMMARY icd	interface definition for system (c)
##SUMMARY icd	interface definition for system (cc)
##SUMMARY icd	interface definition for system (m)
##SUMMARY icd	interface definition for system (txt)

$1_ICD.c: $1_ICD.txt
	ICD_txt2lang.sh $1 c

$1_ICD.cc: $1_ICD.txt
	ICD_txt2lang.sh $1 cc

$1_ICD.m: $1_ICD.txt
	ICD_txt2lang.sh $1 m

$1_ICD.txt: $1_icd.txt2
	icd2ICD_txt22txt.sh $1

$1_icd.txt2: $1_ese.r
	touch $1_icd.txt2

#SUMMARY icd	interface definitions for each subsystem (m)
$1_icd.m: $1_icd.txt
	icd_txt2m.sh $1

#SUMMARY icd	interface definitions for each subsystem (txt)
$1_icd.txt: $1_lbl.txt
	lbl2icd_txt2txt.sh $1

#SUMMARY cr	constitutive relationship for each subsystem (txt)
$1_cr.txt: $1_abg.m $1_sub.sh
	abg2cr_m2txt $1
 
	if [ "$level" = "0" ]; then \
	  mv $1_cr.txt MTT_cr.txt; \
	else \
	  cat $1_cr.txt >> MTT_cr.txt; \
	fi

	sh $1_sub.sh "rm -f " '_cr.txt' # Remove the txt.cr files
	sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' cr txt' #Create new ones
 
 
	if [ "$level" = "0" ]; then \
	  sort -u MTT_cr.txt> $1_cr.txt; \
	fi

#SUMMARY cr	constitutive relationship for each subsystem (r)
$1_cr.r: $1_cr.txt
	cr_txt2r $1

#SUMMARY cr	constitutive relationship header (c)
$1_cr.h: 
	echo Creating $1_cr.h
	echo "// CR headers for system $1" > $1_cr.h

# Cheat a bit and use the top level cr file for the subsystem as well
ifneq ($sub,)
$Subsystem_cr.r: $1_cr.r
	echo Creating $Subsystem_cr.r "(copying $1_cr.r)"
	cp $1_cr.r $Subsystem_cr.r
endif
#SUMMARY cr	constitutive relationship for each subsystem (tex)
#SUMMARY cr	constitutive relationship for each subsystem (view)
$1_cr.tex: $1_cr.r
	txt2tex $1 cr r

#SUMMARY sympar	symbolic parameters (txt)
#SUMMARY sympar*	symbolic parameters (view)
$1_sympar.txt: $1_type.sh $1_abg.m $1_aliased.txt
	mtt_make_sympar $1

#SUMMARY sympar	symbolic parameters (r)
$1_sympar.r: $1_sympar.txt
	sympar_txt2r $1
$1_sympar.m: $1_sympar.txt
	sympar_txt2m $1
$1_sympar.h: $1_sympar.txt
	sympar_txt2h.sh $1

#SUMMARY sympar	symbolic parameters (c)
# txt to c sympar conversion
$1_sympar.c: $1_sympar.txt
	sympar_txt2c $1

#SUMMARY sympar	symbolic parameters (tex)
# txt to tex (LaTeX) sympar conversion
$1_sympar.tex: $1_sympar.txt
	sympar_txt2tex $1

#SUMMARY logic	Dynamic switch logic (tex)
#SUMMARY logic	Dynamic switch logic (view)
$1_logic.tex: $1_logic.txt
	txt2tex $1 logic txt


#SUMMARY switch	Dynamic switch information (txt)
$1_switch.txt: $1_struc.txt
	struc2switch_txt $1
#$1_switchopen.m: $1_switch.txt $1_sympars.txt $1_logic.txt
#	switch_txt2m $1

#SUMMARY sympars sympar + dynamic switch information (txt)
$1_sympars.txt: $1_sympar.txt $1_switch.txt
	   echo Creating $1_sympars.txt
	   cat $1_sympar.txt $1_switch.txt > $1_sympars.txt

#SUMMARY simp	simplification information (r)
$1_simp.r:
	echo Creating $1_simp.r
	( \
	echo "%% Reduce commands to simplify output for system $1 ($1_simp.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	    echo 'ON ALLFAC; %Multiplicative factors'; \
	    echo 'OFF DIV; %Polynomial division'; \
	    echo 'OFF FACTOR; %Factorise polynomials'; \
	    echo 'OFF LIST; %Each term on a new line'; \
	    echo 'FOR ALL x,y LET pow(x,y) = x^y; %Readable pow function'; \
	echo 'END;'; \
	)> $1_simp.r

#SUMMARY subs  algebraic substitution (r)
$Subsystem_subs.r: 
	mtt $mtt_switches -q -u $1 sympar txt; 
	makesubs $Subsystem;

#SUMMARY obspar  GPC observability function parameters (r)
$1_obspar.r:
	echo Creating $1_obspar.r
	( \
	echo "%% Reduce  GPC observability function parameters for system $1 ($1_obspar.r)"; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'MTTGPCNy := 5;'; \
	echo 'MTTGPCNu := 0;'; \
	echo 'Matrix MTTdU(5,1);'; \
	echo 'MTTdU(1,1) := MTTdU1;'; \
	echo 'MTTdU(2,1) := MTTdU2;'; \
	echo 'MTTdU(3,1) := MTTdU3;'; \
	echo 'MTTdU(4,1) := MTTdU4;'; \
	echo 'MTTdU(5,1) := MTTdU5;'; \
	echo 'Matrix MTTUU(1,5);'; \
	echo 'MTTUU(1,1) := MTTu1;'; \
	echo 'MTTUU(1,2) := MTTu11;'; \
	echo 'MTTUU(1,3) := MTTu12;'; \
	echo 'MTTUU(1,4) := MTTu13;'; \
	echo 'MTTUU(1,5) := MTTu14;'; \
	echo 'END;'; \
	)> $1_obspar.r

#SUMMARY simpar	simulation information (txt)
$1_simpar.txt:
	echo Creating $1_simpar.txt
	( \
	echo '# -*-octave-*- Put Emacs into octave-mode'; \
	echo "# Simulation parameters for system $1 ($1_simpar.txt)"; \
	echo "# Generated by MTT on" `date`.; \
	cat $MTTPATH/trans/rcs_header.sh; \
	echo ;\
	echo 'FIRST        = 0.0;       # First time in simulation output'; \
	echo 'DT          = 0.1;        # Print interval'; \
	echo 'LAST        = 10.0;       # Last time in simulation'; \
	echo 'STEPFACTOR  = 1;          # Integration steps per print interval'; \
	echo 'WMIN        = -1;         # Minimum frequency = 10^WMIN'; \
	echo 'WMAX        = 2;          # Maximum frequency = 10^WMAX'; \
	echo 'WSTEPS      = 100;        # Number of frequency steps'; \
	echo 'INPUT       = 1;          # Index of the input'; \
	)> $1_simpar.txt

#SUMMARY simpar	simulation information (m)
$1_simpar.m: $1_simpar.txt $1_def.r $1_sympar.txt
	mtt_txt2m $1 simpar


#SUMMARY numpar	numerical parameter declaration -- default (txt) 
$1_numpar.txt : $1_sympar.txt $1_def.r
ifeq ($target,$1_numpar.txt)
	mtt_update $1 numpar update
else
	mtt_update $1 numpar
endif

#SUMMARY state	numerical state declaration  -- default (txt)
$1_state.txt : $1_struc.txt $1_sympar.txt $1_def.r
ifeq ($target,$1_state.txt)
	mtt_update $1 state update
else
	mtt_update $1 state
endif

#SUMMARY input	numerical state declaration  -- default (txt)
$1_input.txt : $1_struc.txt $1_sympar.txt
ifeq ($target,$1_input.txt)
	mtt_update $1 input update
else
	mtt_update $1 input
endif

#SUMMARY logic	Dynamic switch logic (txt)
$1_logic.txt : $1_def.r $1_struc.txt $1_sympar.txt
ifeq ($target,$1_logic.txt)
	mtt_update $1 logic update
else
	mtt_update $1 logic
endif

# Dummy target
FORCE:

$1_ode2odes_common.m    : $1_ae.m   $1_input.m   $1_logic.m   $1_numpar.m   $1_simpar.m   $1_state.m
	touch \$@
$1_ode2odes_common.cc   : $1_ae.cc  $1_input.cc  $1_logic.cc  $1_numpar.cc  $1_simpar.cc  $1_state.cc
	touch \$@
$1_ode2odes_common.o    : $1_ae.o   $1_input.o   $1_logic.o   $1_numpar.o   $1_simpar.o   $1_state.o
	@echo "Creating $1_ode2odes_common.o"
	ar -cr \$@ \$^
$1_ode2odes_common.oct  : $1_ae.oct $1_input.oct $1_logic.oct $1_numpar.oct $1_simpar.oct $1_state.oct
	touch \$@

$1_ode2odes_euler.m  $1_ode2odes_rk4.m    : $1_ode.m     $1_odeo.m
	touch \$@
$1_ode2odes_euler.cc $1_ode2odes_rk4.cc   : $1_ode.cc    $1_odeo.cc
	touch \$@
$1_ode2odes_euler.o  $1_ode2odes_rk4.o    : $1_ode.o     $1_odeo.o   mtt_euler.o
	@echo "Creating \$@"
	ar -cr \$@ \$^
$1_ode2odes_euler.oct   : $1_ode.oct   $1_odeo.oct mtt_euler.oct
	touch \$@

$1_ode2odes_implicit.m  : $1_cseo.m    $1_csex.m   $1_smxa.m   $1_smxax.m
	touch \$@
$1_ode2odes_implicit.cc : $1_cseo.cc   $1_csex.cc  $1_smxa.cc  $1_smxax.cc
	touch \$@
$1_ode2odes_implicit.o  : $1_cseo.o    $1_csex.o   $1_smxa.o   $1_smxax.o   mtt_implicit.o
	@echo "Creating $1_ode2odes_implicit.o"
	ar -cr \$@ \$^
$1_ode2odes_implicit.oct: $1_cseo.oct  $1_csex.oct $1_smxa.oct $1_smxax.oct mtt_implicit.oct
	touch \$@

$1_ode2odes_dassl.m	: $1_ode.m	$1_odeo.m
	touch \$@
$1_ode2odes_dassl.cc	: $1_ode.cc	$1_odeo.cc
	touch \$@
$1_ode2odes_dassl.o	: $1_ode.o	$1_odeo.o	mtt_dassl.o
	@echo "Creating \$@"
	ar -cr \$@ \$^
$1_ode2odes_dassl.oct	: $1_ode.oct	$1_odeo.oct	mtt_dassl.oct
	touch \$@

mtt_Solver.cc:	mtt_Solver.hh
mtt_AlgebraicSolver.cc: mtt_AlgebraicSolver.hh
$1_ode2odes_${algebraic_solver}.cc:	mtt_Solver.cc mtt_AlgebraicSolver.cc mtt_${algebraic_solver}.hh mtt_${algebraic_solver}.cc
$1_ode2odes_${algebraic_solver}.o:	mtt_Solver.o  mtt_AlgebraicSolver.o  mtt_${algebraic_solver}.o
	@echo "Creating $1_ode2odes_${algebraic_solver}.o"
	ar -cr \$@ \$^

#SUMMARY numpar	numerical parameter declaration (m) 
$1_numpar.m:  $1_numpar.txt $1_sympars.txt
	mtt_txt2m $1 numpar

#SUMMARY numpar	numerical parameter declaration (c) 
#SUMMARY numpar	numerical parameter declaration (view) 
$1_numpar.c:  $1_numpar.txt $1_sympar.c
	txt2c $1 numpar



#SUMMARY logic	logic input declaration (m) 
$1_logic.m:  $1_logic.txt $1_switch.txt
	mtt_txt2m $1 logic

#SUMMARY state	state declaration  -- default (txt)
#$1_state.txt: 
#	mtt $mtt_switches $1 struc txt; 
#	mtt $mtt_switches $1 ss r; 
#	struc2state_txt2txt $1

#SUMMARY state	state declaration (m) 
$1_state.m:  $1_state.txt $1_sympars.txt
	mtt_txt2m $1 state

#SUMMARY desc Verbal description of system (tex)
$1_desc.tex:
	makedesc $1


#SUMMARY params	symbolic parameter setting (r)
 $1_params.r: 
	echo Creating $1_params.r
	( \
	echo "%% Parameter file for system $1 ($1_params.r)"; \
	echo "%% This file provides symbolic parameters for simplification";\
	cat $MTTPATH/trans/m/rcs_header.txt; \
	echo 'END;'; \
	)> $1_params.r


#SUMMARY sspar	steady-state definition (r)
$1_sspar.r: 
	struc2sspar_txt2r $1

#SUMMARY sspar	steady-state parameters (tex)
#SUMMARY sspar	steady-state parameters (view)
$1_sspar.tex: $1_sspar.r
	txt2tex $1 sspar r

#SUMMARY rep*	report (txt)
#SUMMARY rep	report (tex)
#SUMMARY rep*	report (view)
#SUMMARY rep*	report (html)


ifeq ($documenttype,book)
$1_rep.txt:
	dir2rep $1 $dotdot;
else
$1_rep.txt:
	makerep_txt $1;
endif

#SUMMARY rbg	raw bond graph (m)
#Raw bond graph: fig file to mfile
$1_rbg.m: $1_abg.fig  $1_lbl.txt
	lbl2component $1 | sh || exit 1 # Grab specified components now
	rbg_fig2m $1
$1_cmp.m: $1_rbg.m
$1_fig.fig: $1_rbg.m

#SUMMARY sabg	stripped acausal bond graph (fig)
#SUMMARY sabg	stripped acausal bond graph (ps)
#SUMMARY sabg	stripped acausal bond graph (view)
$1_sabg.fig: $1_rbg.m


#Subsystem creation commands
#SUMMARY sub Executable subsystem list (sh)
ifeq ($start_at_abg,yes)
$1_sub.sh: $1_abg.m
	abg2sub_m2sh $1
else
$1_sub.sh: $1_abg.fig
	abg2sub_fig2sh $1
endif

#SUMMARY sub LaTeX subsystem list (tex)
#SUMMARY sub subsystem list (ps)
#SUMMARY sub subsystem list (view)
$1_sub.tex: $1_sub.sh
ifeq ($documenttype,section)
	sub_sh2tex $1
else
	sub_sh2tex -l $1
endif

#SUMMARY abg	acausal bond graph (m)
#Raw bond graph to acausal bond graph: mfile

ifneq ($start_at_abg,yes)
$1_abg.m: $1_rbg.m $1_alias.m $1_cmp.m $1_icd.m
	cmp2sub_m2sh $1
	(sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' abg m null  || exit 1') || exit 1
	rbg2abg_m $info_switch $1
endif

#SUMMARY cbg*	causal bond graph (m)
#Acausal bond graph to causal bond graph: mfile
$1_cbg.m: $1_abg.m
	abg2cbg_m  $info_switch $causality_switch $1

$1_type.sh: $1_cbg.m
	touch $1_type.sh

#SUMMARY cbg*	causal bond graph (fig)
#SUMMARY cbg*	causal bond graph (ps)
#SUMMARY cbg*	causal bond graph (view)
#Causal bond graph: mfile to fig conversion
$1_cbg.fig: $1_cbg.m  $1_fig.fig $1_type.sh
	sh $1_type.sh 'echo cbg_m2fig ' ' ' ' ' | sh

#SUMMARY ese	elementary system equations (r)
#SUMMARY def	definitions - system orders etc. (r)
#SUMMARY def	definitions - system orders etc. (m)
#SUMMARY def	definitions - system orders etc. (h)
#SUMMARY struc*	structure - list of inputs, outputs and states (txt)
#SUMMARY struc	structure - list of inputs, outputs and states (tex)
#SUMMARY struc*	structure - list of inputs, outputs and states (view)
#Elementary system equations + definitions
${sys}_ese.r: ${sys}_cbg.m
	   cbg2ese_m2r $partition $info_switch $Subsystem; #ese_tidy $1

$1_def.r: $1_ese.r
	touch $1_def.r
$1_struc.txt: $1_ese.r
	touch $1_struc.txt
$1_aliased.txt: $1_ese.r
	touch $1_aliased.txt
$1_struc.tex: $1_struc.txt
	struc_txt2tex $1
$1_struc.m: $1_struc.txt 
	struc_txt2m $1
$1_def.m: $1_def.r
	def_r2m $1; matlab_tidy $1_def.m;
$1_def.h: $1_def.m $1_sympar.txt
	def_m2h.sh $1

#SUMMARY rdae	raw differential-algebraic equations (r)
#SUMMARY dae	differential-algebraic equations (r)
#SUMMARY dae*	differential-algebraic equations (m)
#SUMMARY dae	differential-algebraic equations (tex)
#SUMMARY dae*	differential-algebraic equations (view)
#SUMMARY dae	differential-algebraic equations (ps)
#Differential-algebraic equations

${sys}_rdae.r: ${sys}_ese.r ${sys}_def.r $1_modpar.r ${Subsystem}_cr.r ${Subsystem}_subs.r
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} rdae r
endif
	mtt_prepend.sh -p $1_modpar.r $1_ese.r # Add modulated parameters to start
	ese2rdae_r ${cr_first} ${Subsystem}; tidy ${Subsystem}_rdae.r

${sys}_dae.r: ${Subsystem}_rdae.r ${Subsystem}_def.r ${Subsystem}_subs.r ${Subsystem}_cr.r
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} dae r
endif
ifeq ($rdae_is_dae,1)
	echo Copying $1_rdae.r to $1_dae.r
	cp $1_rdae.r  $1_dae.r
else
	rdae2dae_r ${fixcc} ${Subsystem}; tidy ${Subsystem}_dae.r
endif

$1_dae.m: $1_def.r $1_dae.r  $1_sympars.txt
	dae_r2m $1; matlab_tidy $1_dae.m; matlab_tidy $1_daeo.m
$1_dae.c: $1_def.r $1_dae.r  $1_sympar.r
	dae_r2c $1; c_tidy $1_dae.c
$1_dae.tex: $1_dae.r $1_simp.r
	dae_r2tex $partition $1; latex_tidy $1_dae.tex

#SUMMARY ae	algebraic equations - unknown inputs (r)
#SUMMARY ae	algebraic equations - unknown inputs (m)
#SUMMARY ae	algebraic equations - unknown inputs (cc)

$1_ae.r: $1_cse.r
	touch $1_ae.r
$1_ae.m: $1_ae.r
	mtt_r2m $1 ae

#SUMMARY cse	constrained-state equations (r)
#SUMMARY cse*	constrained-state equations (m)
#SUMMARY cse*	constrained-state equations (oct)
#SUMMARY cse	constrained-state equations (tex)
#SUMMARY cse*	constrained-state equations (view)
#SUMMARY cse	constrained-state equations (ps)
#Constrained-state equations
${sys}_cse.r: ${Subsystem}_dae.r ${Subsystem}_dae.r ${Subsystem}_def.r ${Subsystem}_subs.r 
ifneq ($partition,)
	echo Doing subsystems
	mtt_make_subsystems  ${sys} cse r
endif
	dae2cse_r $fixcc $optimise $Solve ${Subsystem}; tidy ${Subsystem}_cse.r #$1_subs.r
$1_csex.r: $1_cse.r
	touch $1_csex.r
$1_cseo.r: $1_cse.r
	touch $1_cseo.r

#$1_cse.m: $1_def.r $1_cse.r $1_sympar.r  $1_subs.r 
#	cse_r2m $1; matlab_tidy $1_cse.m
${sys}_cse.m: ${Subsystem}_def.r ${Subsystem}_cse.r ${sys}_sympars.txt
ifneq ($partition,)
	echo Doing subsystems
	mtt_cp_subrep ${sys} sympars txt
	mtt_make_subsystems  ${sys} cse m
endif
	mtt_r2m ${Subsystem} cse;#  matlab_tidy $1_cse.m; matlab_tidy $1_cseo.m; 

${sys}_cseo.m: ${Subsystem}_def.r ${Subsystem}_cseo.r ${sys}_sympars.txt
ifneq ($partition,)
	echo Doing subsystems
	mtt_cp_subrep ${sys} sympars txt
	mtt_make_subsystems  ${sys} cseo m
endif
	mtt_r2m ${Subsystem} cseo

${sys}_csex.m: ${Subsystem}_def.r ${Subsystem}_csex.r ${sys}_sympars.txt
ifneq ($partition,)
	echo Doing subsystems
	mtt_cp_subrep ${sys} sympars txt
	mtt_make_subsystems  ${sys} csex m
endif
	mtt_r2m ${Subsystem} csex

$1_cse.tex: $1_cse.r  $1_sympar.r $1_simp.r
	cse_r2tex $1 $2; latex_tidy $1_cse.tex


#SUMMARY scse	sensitivity constrained-state equations (r)
#SUMMARY scse	sensitivity constrained-state equations (tex)
#SUMMARY scse	sensitivity constrained-state equations (ps)

$1_scse.r: $1_cse.r $1_def.r 
	cse2scse_r  $1 "$4"; tidy $1_scse.r

#$1_cse.m: $1_def.r $1_cse.r $1_sympar.r  $1_subs.r 
#	cse_r2m $1; matlab_tidy $1_cse.m
$1_scse.m: $1_def.m $1_scse.r $1_sympars.txt
	mtt_r2m $optimise  -parameters $1 scse;  
	matlab_tidy $1_scse.m; matlab_tidy $1_scseo.m; 

$1_scse.tex: $1_scse.r  $1_sympar.r $1_simp.r
	cse_r2tex $1 $2; latex_tidy $1_scse.tex


#SUMMARY ode	ordinary differential equations (r)
#SUMMARY ode*	ordinary differential equations (m)
#SUMMARY ode	ordinary differential equations (c)
#SUMMARY ode	ordinary differential equations (tex)
#SUMMARY ode*	ordinary differential equations (view)
#SUMMARY ode	ordinary differential equations (ps)
#SUMMARY ode	ordinary differential equations (oct)
#Ordinary differential equations

ifeq ($dae_is_ode,1)
$1_ode.r: $1_dae.r
	echo Copying $1_dae.r to $1_ode.r
	cp $1_dae.r  $1_ode.r
else
$1_ode.r: $1_cse.r $1_cseo.r $1_def.r $1_sympar.r $1_subs.r
	cse2ode_r $optimise $1; tidy $1_ode.r
endif

$1_odeo.r: $1_ode.r
	touch $1_odeo.r

$1_ode.m: $1_def.r $1_ode.r
	mtt_r2m $optimise -parameters $1 ode m; #  matlab_tidy $1_ode.m
$1_odeo.m: $1_def.r $1_odeo.r
	mtt_r2m $1 odeo m

$1_odea.m: $1_ode.m
	touch $1_odea.m

$1_ode.tex: $1_ode.r  $1_sympar.r $1_simp.r
	ode_r2tex $1; latex_tidy $1_ode.tex


$1_lde.r: $1_dae.r
	dae2lde_r $optimise $1; tidy $1_lde.r

$1_lde.tex: $1_lde.r  $1_sympar.r $1_simp.r
	lde_r2tex $1; latex_tidy $1_lde.tex

# The main simulation programme
ifeq ($integration_method,implicit)
$1_ode2odes.m : $1_def.r $1_sympars.txt \
                $1_smxa.m $1_smxax.m\
                $1_simpar.m $1_numpar.m $1_state.m $1_input.m \
                $1_csex.m $1_cseo.m  $1_logic.m
ifeq ($using_oct,yes)
	touch $1_ode2odes.m # Create a dummy which wont' be used
	mtt $mtt_switches -q -u $1 ode2odes oct
else
	make_ode2odes $1 m $integration_method $algebraic_solver
endif
endif
ifneq ($integration_method,implicit)
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_ode.m $1_odeo.m  $1_logic.m
ifeq ($using_oct,yes)
	echo "*** Warning: Shouldn't be here! Creating dummy $1_ode2odes.m"
	touch $1_ode2odes.m # Create a dummy which wont' be used
	mtt $mtt_switches -q -u $1 ode2odes oct
else
	make_ode2odes $1 m $integration_method $algebraic_solver
endif

endif

#SUMMARY ode2odes Simulation function (m)
#SUMMARY ode2odes Simulation function (cc)
#SUMMARY ode2odes Simulation function (oct)
#SUMMARY ode2odes Simulation function (exe)
$1_ode2odes.exe: $1_def.h $1_sympar.h\
		 $1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o mtt_kpathsea.o
	echo Creating $1_ode2odes.exe
	${MTT_CXX} ${MTT_CXXFLAGS} -o $1_ode2odes.exe\
	$1_ode2odes.o $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o mtt_kpathsea.o\
	${MTT_LDFLAGS} ${MTT_CXXLIBS}

$1_ode2odes.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o
	echo Creating $1_ode2odes.o
	${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $1_ode2odes.cc -DSTANDALONE

$1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common.oct $1_ode2odes_${integration_method}.oct $1_ode2odes_${algebraic_solver}.o
	touch $1_ode2odes.m
	echo Creating $1_ode2odes.oct
	$MKOCTFILE $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc mtt_AlgebraicSolver.cc

$1_ode2odes.cc: $1_def.r $1_sympars.txt\
		$1_ode2odes_common.m $1_ode2odes_common.cc\
		$1_ode2odes_${integration_method}.m $1_ode2odes_${integration_method}.cc\
		mtt_Solver.cc mtt_AlgebraicSolver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh
	touch $1_ode2odes.m
	make_ode2odes $1 cc $integration_method $algebraic_solver

#Conversion of m to p to c
#SUMMARY ode	ordinary differential equations (c)
#SUMMARY ode	ordinary differential equations (p)
#SUMMARY state	state declaration (c) 
#SUMMARY state	state declaration (p) 
$1_simpar.p : $1_def.r $1_simpar.m
	mtt_m2p $1_simpar.m
$1_numpar.p : $1_def.r $1_numpar.m
	mtt_m2p $1_numpar.m
$1_state.p : $1_def.r $1_state.m
	mtt_m2p $1_state.m

#SUMMARY input	numerical input declaration (m) 
ifeq ($stdin,stdin)
$1_input.m : $1_def.r
	make_stdin $1 m
$1_input.p : $1_def.r
	make_stdin $1 p
$1_input.cc:
	make_stdin $1 cc
else
$1_input.m:  $1_input.txt $1_sympars.txt
	mtt_txt2m $1 input
$1_input.p : $1_def.r $1_input.m
	mtt_m2p $1_input.m
endif

$1_ode.p : $1_def.r $1_ode.m
	mtt_m2p $1_ode.m
$1_odeo.p : $1_def.r $1_odeo.m
	mtt_m2p $1_odeo.m
$1_csex.p : $1_def.r $1_cse.m
	mtt_m2p $1_csex.m
$1_cseo.p : $1_def.r $1_cseo.m
	mtt_m2p $1_cseo.m
$1_smx.p : $1_def.r $1_smx.m
	mtt_m2p $1_smx.m
$1_smxa.p : $1_def.r $1_smxa.m
	mtt_m2p $1_smxa.m
$1_smxax.p : $1_def.r $1_smxax.m
	mtt_m2p $1_smxax.m
$1_logic.p : $1_def.r $1_logic.m
	mtt_m2p $1_logic.m

ifeq ($integration_method,implicit)
$1_ode2odes.p : $1_ode2odes.m $1_def.r $1_smxa.p $1_smxax.p\
		$1_simpar.p $1_numpar.p $1_state.p $1_input.p \
		$1_csex.p $1_cseo.p  $1_logic.p
	mtt_m2p $1_ode2odes.m $integration_method $stdin
endif
ifneq ($integration_method,implicit)
$1_ode2odes.p : $1_ode2odes.m $1_def.r\
		$1_simpar.p $1_numpar.p $1_state.p $1_input.p \
		$1_ode.p $1_odeo.p  $1_logic.p
	mtt_m2p $1_ode2odes.m $integration_method $stdin
endif

$1_ode2odes.c: $1_ode2odes.p 
	mtt_p2c $info_switch $1 ode2odes

##SUMMARY sim Octave simulation function (m)

#ifeq ($computation,octave)
#$1_sim.m: $1_def.r $1_sympar.txt $1_cse.m $1_cseo.m $1_smxa.m $1_smxax.m $1_numpar.m $1_state.m
	mtt_make_sim $1 $integration_method $computation 
#endif

#ifeq ($computation,c)
#$1_sim.m: $1_def.r $1_sympar.txt $1_ode2odes.out $1_numpar.m $1_state.m
#	mtt_make_sim $1 $integration_method $computation 
#endif

#SUMMARY ssim Octave sensitivity simulation function (m)
$1_ssim.m: $1_def.r
	make_ssim $1 m

#SUMMARY sim Octave simulation function (m)
$1_sim.m: $1_def.r
	make_sim $1 m

#SUMMARY obs	observer equations for CGPC (r)
#SUMMARY obs*	observer equations for CGPC (m)
#SUMMARY obs	observer equations for CGPC (tex)
#SUMMARY obs*	observer equations for CGPC (view)
#SUMMARY obs	observer equations for CGPC (ps)
#Observer functions for GPC
$1_obs.r: $1_ode.r $1_def.r $1_obspar.r $1_subs.r
	ode2obs_r $1; tidy $1_obs.r
$1_obs.m: $1_def.r $1_sympars.txt $1_obs.r $1_obspar.r $1_numpar.m
	mtt_r2m $optimise  -parameters $1 obs
$1_obs.tex: $1_obs.r  $1_sympar.r $1_simp.r
	obs_r2tex $1; latex_tidy $1_obs.tex


#SUMMARY rfe	robot-form equations (r)
#SUMMARY rfe	robot-form equations (tex)
#SUMMARY rfe*	robot-form equations (view)
#SUMMARY rfe	robot-form equations (ps)
#Robot-form equations
$1_rfe.r: $1_cse.r $1_csm.r $1_def.r $1_sympar.r
	cse2rfe_r $1; tidy $1_rfe.r
$1_rfe.tex: $1_rfe.r  $1_sympar.r  $1_simp.r
	rfe_r2tex $1; latex_tidy $1_rfe.tex

#SUMMARY ss	steady-state equations (r)
#SUMMARY ss*	steady-state equations (m)
#SUMMARY ss	steady-state equations (tex)
#SUMMARY ss*	steady-state equations (view)
#SUMMARY ss	steady-state equations (ps)
#Steady-states
$1_ss.r: $1_def.r $1_sspar.r $1_cr.r $1_ode.r
	sspar2ss_r $1; tidy $1_ss.r
$1_ss.m: $1_def.r  $1_ss.r  $1_numpar.m
	ss_r2m $1; matlab_tidy $1_ss.m
$1_ss.tex: $1_def.r $1_ss.r $1_simp.r
	ss_r2tex $1; latex_tidy $1_ss.tex 


#SUMMARY dm	descriptor matrices (r)
#SUMMARY dm*	descriptor matrices (m)
#SUMMARY dm	descriptor matrices (tex)
#SUMMARY dm*	descriptor matrices (view)
#SUMMARY dm	descriptor matrices (ps)
#Linearised system: descriptor matrices
$1_dm.r: $1_dae.r $1_def.r $1_cr.r  $1_ss.r $1_sympar.r
	dae2dm_r $1; tidy $1_dm.r
$1_dm.m: $1_def.r $1_dm.r $1_sympars.txt
		mtt_r2m $optimise -parameters $1 dm
$1_dm.tex: $1_dm.r $1_sympar.r $1_simp.r 
	dm_r2tex $1; latex_tidy $1_dm.tex



#SUMMARY csm	constrained-state matrices (r)
#SUMMARY csm	constrained-state matrices (m)
#SUMMARY csm	constrained-state matrices (tex)
#SUMMARY csm	constrained-state matrices (view)
#SUMMARY csm    constrained-state matrices (ps)
#Linearised system: constrained-state matrices
$1_csm.r: $1_cse.r $1_def.r $1_cr.r $1_sspar.r
	cse2csm_r $1 csm; tidy $1_csm.r
$1_csm.m: $1_def.r $1_csm.r $1_sympars.txt
		mtt_r2m $optimise  -parameters $1 csm;  matlab_tidy $1_csm.m
$1_csm.tex: $1_csm.r  $1_sympar.r $1_simp.r
	csm_r2tex $1 csm; latex_tidy $1_csm.tex
#SUMMARY scsm	sensitivity constrained-state matrices (r)
#SUMMARY scsm	sensitivity constrained-state matrices (m)
#SUMMARY scsm	sensitivity constrained-state matrices (tex)
#SUMMARY scsm	sensitivity constrained-state matrices (view)
#SUMMARY scsm	sensitivity constrained-state matrices (ps)
#Linearised system: sensitivity constrained-state matrices
$1_scsm.r: $1_scse.r $1_def.r $1_cr.r $1_sympar.r $1_sspar.r
	cse2csm_r $1 scsm; tidy $1_scsm.r
$1_scsm.m: $1_def.r $1_scsm.r $1_sympars.txt
		csm_r2m $1 scsm;  matlab_tidy $1_scsm.m
$1_scsm.tex: $1_scsm.r  $1_sympar.r $1_simp.r
	csm_r2tex $1 scsm; latex_tidy $1_scsm.tex

#SUMMARY sm	state matrices (r)
#SUMMARY sm*	state matrices (m)
#SUMMARY sm	state matrices (icad)
#SUMMARY sm	state matrices (tex)
#SUMMARY sm	state matrices (c)
#SUMMARY sm*	state matrices (view)
#SUMMARY sm	state matrices (ps)
#Linearised system: state matrices
$1_sm.r: $1_csm.r $1_def.r $1_cr.r $1_ss.r $1_sympar.r
	csm2sm_r $optimise $1 sm; tidy $1_sm.r
$1_sm.m: $1_def.r $1_sm.r $1_sympars.txt 
		mtt_r2m $optimise  -parameters $1 sm
$1_sm.icad:  $1_sm.m $1_numpar.m
		sm_m2icad $1
$1_sm.c: $1_def.r $1_sm.r $1_sympar.c
		sm_r2c $1
$1_sm.tex: $1_sm.r  $1_sympar.r $1_simp.r
	sm_r2tex $1 sm; latex_tidy $1_sm.tex

#SUMMARY ssm	sensitivity state matrices (r)
#SUMMARY ssm	sensitivity state matrices (icad)
#SUMMARY ssm	sensitivity state matrices (tex)
#SUMMARY ssm	sensitivity state matrices (c)
#SUMMARY ssm	sensitivity state matrices (ps)
#Linearised system: sensitivity state matrices
$1_ssm.r: $1_scsm.r $1_def.r $1_cr.r $1_ss.r $1_sympar.r
	csm2sm_r $optimise $1 ssm; tidy $1_ssm.r
$1_ssm.m: $1_def.r $1_ssm.r $1_sympars.txt 
		mtt_r2m $optimise -parameters $1 ssm
$1_ssm.tex: $1_ssm.r  $1_sympar.r $1_simp.r
	sm_r2tex $1 ssm; latex_tidy $1_ssm.tex

#SUMMARY smx	state matrices with variable state x (r)
#SUMMARY smx	state matrices with variable state x (m)
#SUMMARY smxx	Sparse computation of Ax (m)
#SUMMARY smxtx	Sparse computation of ATx (m)
$1_smx.r: $1_def.r $1_def.m $1_ode.r $1_subs.r
		ode2smx_lang $1 r; tidy $1_smx.r

$1_smx.m: $1_def.r $1_def.m $1_cse.r $1_sympars.txt $1_subs.r
		cse2smx_lang $fixcc $optimise -parameters $1 smx m

$1_smxa.m: $1_def.r $1_def.m $1_cse.r  $1_sympars.txt $1_subs.r
		cse2smx_lang $fixcc $optimise -parameters $matrix_smxa $1 smxa m

$1_smxax.m: $1_def.r $1_def.m $1_cse.r $1_sympars.txt $1_subs.r
		cse2smx_lang $fixcc $optimise -parameters $1 smxax m

#SUMMARY smc	controller form state matrices etc. - siso only (r)
#SUMMARY smc	controller form state matrices etc. - siso only (tex)
#SUMMARY smc*	controller form state matrices etc. - siso only (m)
#SUMMARY smc*	controller form state matrices etc. - siso only (view)
#SUMMARY smc	controller form state matrices etc. - siso only (ps)
#Linearised system: controller form state matrices etc.
$1_smc.r: $1_sm.r $1_def.r $1_tf.r 
	sm2smc_r $1; tidy $1_smc.r
$1_smc.tex: $1_smc.r  $1_simp.r
	smc_r2tex $1; latex_tidy $1_smc.tex
$1_smc.m: $1_def.r $1_smc.r $1_numpar.m
		smc_r2m $1;  matlab_tidy $1_smc.m

#SUMMARY smo	observer form state matrices etc. - siso only (r)
#SUMMARY smo	observer form state matrices etc. - siso only (tex)
#SUMMARY smo*	observer form state matrices etc. - siso only (m)
#SUMMARY smo*	observer form state matrices etc. - siso only (view)
#SUMMARY smo	observer form state matrices etc. - siso only (ps)
#Linearised system: observer form state matrices etc.
$1_smo.r: $1_sm.r $1_def.r $1_tf.r 
	sm2smo_r $1; tidy $1_smo.r
$1_smo.tex: $1_smo.r  $1_simp.r
	smo_r2tex $1; latex_tidy $1_smo.tex
$1_smo.m: $1_def.r $1_smo.r $1_numpar.m
		smo_r2m $1;  matlab_tidy $1_smo.m

#SUMMARY ssk	State-space controller gain - siso only (r)
#SUMMARY ssk	State-space controller gain - siso only (tex)
#SUMMARY ssk*	State-space controller gain - siso only (m)
#SUMMARY ssk*	State-space controller gain - siso only (view)
#SUMMARY ssk	State-space controller gain - siso only (ps)
#Linearised system: State-space controller gain
$1_ssk.r: $1_def.r $1_smc.r 
	smc2ssk_r $1; tidy $1_ssk.r
$1_ssk.tex: $1_ssk.r  $1_simp.r
	ssk_r2tex $1; latex_tidy $1_ssk.tex
$1_ssk.m: $1_def.r $1_ssk.r $1_numpar.m
		ssk_r2m $1;  matlab_tidy $1_ssk.m

#SUMMARY ssl	State-space observer gain - siso only (r)
#SUMMARY ssl	State-space observer gain - siso only (tex)
#SUMMARY ssl*	State-space observer gain - siso only (m)
#SUMMARY ssl*	State-space observer gain - siso only (view)
#SUMMARY ssl	State-space observer gain - siso only (ps)
#Linearised system: State-space observer gain
$1_ssl.r: $1_def.r $1_smo.r 
	smo2ssl_r $1; tidy $1_ssl.r
$1_ssl.tex: $1_ssl.r  $1_simp.r
	ssl_r2tex $1; latex_tidy $1_ssl.tex
$1_ssl.m: $1_def.r $1_ssl.r $1_numpar.m
		ssl_r2m $1;  matlab_tidy $1_ssl.m

#SUMMARY tf	transfer function (r)
#SUMMARY tf*	transfer function (m)
#SUMMARY tf	transfer function (tex)
#SUMMARY tf*	transfer function (view)
#SUMMARY tf	transfer function (ps)
#Linearised system: transfer function
$1_tf.r: $1_dm.r $1_sympar.r 
	dm2tf_r $1; tidy $1_tf.r
$1_tf.m: $1_def.r $1_sympars.txt $1_tf.r 
	tf_r2m $1; matlab_tidy $1_tf.m
$1_tf.tex: $1_def.r $1_tf.r $1_sympar.r $1_simp.r
	tf_r2tex $1; latex_tidy $1_tf.tex

#SUMMARY pkim	partialyy-known system identification matrix (r)
#SUMMARY pkim	partialyy-known system identification matrix (tex)
#SUMMARY pkim	partialyy-known system identification matrix (view)
#SUMMARY pkim	partialyy-known system identification matrix (ps)
$1_pkim.r: $1_tf.r $1_sympar.r 
	tf2pkim_r $1; tidy $1_pkim.r
$1_pkim.tex: $1_def.r $1_pkim.r $1_simp.r
	pkim_r2tex $1; latex_tidy $1_pkim.tex

#SUMMARY ctf    controller transfer function (r)
#SUMMARY ctf	controller transfer function (m)
#SUMMARY ctf	controller transfer function (tex)
#SUMMARY ctf	controller transfer function (view)
#SUMMARY ctf	controller transfer function (ps)
#Linearised system: transfer function
$1_ctf.r: $1_dm.r $1_ssk.r  $1_ssl.r   $1_sm.r  
	ssk2ctf_r $1; tidy $1_ctf.r
$1_ctf.m: $1_def.r $1_ctf.r 
	ctf_r2m $1; matlab_tidy $1_ctf.m
$1_ctf.tex: $1_def.r $1_ctf.r $1_sympar.r $1_simp.r
	ctf_r2tex $1; latex_tidy $1_ctf.tex

#SUMMARY ir	impulse response - state (m)
#SUMMARY ir	impulse response - state (dat)
#SUMMARY ir	impulse response - state (ps)
#SUMMARY ir	impulse response - state (view)

#SUMMARY iro	impulse response - output (m)
#SUMMARY iro	impulse response - output (dat)
#SUMMARY iro	impulse response - output (ps)
#SUMMARY iro	impulse response - output (view)

#SUMMARY sr	step response - state (m)
#SUMMARY sr	step response - state (dat)
#SUMMARY sr	step response - state (ps)
#SUMMARY sr	step response - state (view)

#SUMMARY sro*	step response - output (m)
#SUMMARY sro	step response - output (dat)
#SUMMARY sro	step response - output (ps)
#SUMMARY sro*	step response - output (view)

#SUMMARY odes	ode solution - state (m)
#SUMMARY odes*	ode solution - state (dat)
#SUMMARY odes*  ode solution - state & output for SciGraphica (sg)
#SUMMARY odes*	ode solution - state (ps)
#SUMMARY odes*	ode solution - state (view)

#SUMMARY sms	ode (in state matrix form) solution - state & output (c)

#SUMMARY odeso	ode solution - output (m)
#SUMMARY odeso*	ode solution - output (dat)
#SUMMARY odeso*	ode solution - output for spreadsheet (sdat) 
#SUMMARY odeso	ode solution - output (ps)
#SUMMARY odeso*	ode solution - output (view)

#SUMMARY daes   dae solution - state (m)
#SUMMARY daes	dae solution - state (dat)
#SUMMARY daes	dae solution - state (ps)
#SUMMARY daes	dae solution - state (view)

#SUMMARY daeso  dae solution - output (m)
#SUMMARY daeso	dae solution - output (dat)
#SUMMARY daeso	dae solution - output (ps)
#SUMMARY daeso	dae solution - output (view)

#Time responses
$1_ir.m: $1_sm.m $1_numpar.m $1_def.m $1_simpar.m
	sm2ir_m $1 '$ARGS'
$1_iro.m: $1_ir.m
	touch $1_iro.m
$1_ir.dat: $1_ir.m
	m2dat $1_ir
$1_iro.dat: $1_iro.m
	m2dat $1_iro
$1_sr.m: $1_sm.m $1_numpar.m $1_simpar.m $1_def.m
	sm2sr_m $1 
$1_sr.dat: $1_sr.m
	m2dat $1_sr
$1_sro.m: $1_sr.m
	touch $1_sro.m$
$1_sro.dat: $1_sro.m
	m2dat $1_sro
1_odes.c: $1_ode.c $1_def.r $1_sympar.r
	ode2odes_r2c $1 
$1_sms.c: $1_sm.c $1_def.r $1_sympar.r
	sm2sms_r2c $1

.PRECIOUS: $1_odes.dat2
ifeq ($computation,octave)
ifeq ($using_oct,yes)
$1_odes.dat2: $1_ode2odes.oct
	time octave_ode2odes $1
else
$1_odes.dat2: $1_ode2odes.m
	time octave_ode2odes $1
endif
endif

$1_ode2odes.out: $1_ode2odes.c $1_cr.h
	echo Creating $1_odes.out by compiling $1_ode2odes.c 
	$CC $1_ode2odes.c -lp2c -lm -o $1_ode2odes.out

ifeq ($computation,c)
$1_odes.dat2: $1_ode2odes.out
	echo Creating $1_odes.dat2 using c version
	    time ./$1_ode2odes.out>$1_odes.dat2
endif

ifeq ($computation,cc)
$1_sim.exe: $1_ese.r 
	mtt $mtt_switches -q $1 sim exe

$1_odes.dat2: $1_ode2odes.exe 
	echo Creating $1_odes.dat2 using cc version $ARGS
	    time ./$1_ode2odes.exe $ARGS >$1_odes.dat2
endif


#$1_odeso.m: $1_odes.m
#	touch $1_odeso.m
#$1_smso.m: $1_sms.m
#	touch $1_smso.m
#$1_daes.m: $1_dae.m $1_numpar.m  $1_def.m $1_input.m $1_simpar.m
#	dae2daes_m $1 '$ARGS'
#$1_daeso.m: $1_daes.m
#	touch $1_daeso.m


#Conversion of data files from dat to sdat format
$1_odeso.sdat: $1_odeso.dat $1_struc.txt
	odeso_dat2sdat $1

$1_odes.sdat: $1_odes.dat $1_struc.txt
	odes_dat2sdat $1

#Conversion of data to SciGraphica
$1_odes.sg: $1_struc.m $1_odes.dat2
	echo Creating $1_odes.sg
	dat22sg.sh $1

#SUMMARY odess	ode numerical steady-states - states (m)
#SUMMARY odess	ode numerical steady-states - states (dat)
#SUMMARY odess	ode numerical steady-states - states (ps)
#SUMMARY odess	ode numerical steady-states - states (view)

#SUMMARY odesso	ode numerical steady-states - outputs (m)
#SUMMARY odesso	ode numerical steady-states - outputs (dat)
#SUMMARY odesso	ode numerical steady-states - outputs (ps)
#SUMMARY odesso	ode numerical steady-states - outputs (view)

#Numerical steady states
$1_odess.dat2: $1_ode.m $1_odeo.m $1_numpar.m  $1_input.m $1_simpar.m
	ode2odess_m2dat2 $1 
#$1_odess.m: $1_ode.m $1_odeo.m $1_numpar.m  $1_input.m $1_simpar.m
#	ode2odess_m $1 
#$1_odesso.m: $1_odess.m
#	touch $1_odesso.m


#SUMMARY fr	frequency response (m)
#SUMMARY fr	frequency response (dat)
#SUMMARY fr	frequency response (ps)
#SUMMARY fr	frequency response (view)

#SUMMARY lmfr	loglog modulus frequency response (m)
#SUMMARY lmfr	loglog modulus frequency response (dat)
#SUMMARY lmfr	loglog modulus frequency response (ps)
#SUMMARY lmfr*	loglog modulus frequency response (view)

#SUMMARY lpfr	semilog phase frequency response (m)
#SUMMARY lpfr	semilog phase frequency response (dat)
#SUMMARY lpfr	semilog phase frequency response (ps)
#SUMMARY lpfr*	semilog phase frequency response (view)

#SUMMARY nyfr	Nyquist style frequency response (m)
#SUMMARY nyfr	Nyquist style frequency response (dat)
#SUMMARY nyfr	Nyquist style frequency response (ps)
#SUMMARY nyfr	Nyquist style frequency response (view)

#SUMMARY nifr	Nichols style frequency response (m)
#SUMMARY nifr	Nichols style frequency response (dat)
#SUMMARY nifr	Nichols style frequency response (ps)
#SUMMARY nifr	Nichols style frequency response (view)


#Frequency responses
$1_fr.m: $1_dm.m $1_numpar.m $1_def.m $1_simpar.m
	dm2fr_m $1 
$1_fr.dat: $1_sr.m
	m2dat $1_fr
$1_lmfr.dat: $1_fr.m
	m2dat $1_lmfr
$1_lpfr.dat: $1_fr.m
	m2dat $1_lpfr
$1_nyfr.dat: $1_fr.m
	m2dat $1_nyfr
$1_nifr.dat: $1_fr.m
	m2dat $1_nifr


ifeq ($REPTYPE,txt)
#Generic conversion of txt files to tex files
$1_$2.tex: $1_$2.txt
	txt2tex $1 $2 txt
 endif

#Conversion of dat2 files  to dat format
$1_odeso.dat: $1_odes.dat2 $1_def.r
	echo Creating $1_odeso.dat
	dat22dat $1 ode so
$1_odes.dat: $1_odes.dat2 $1_def.r
	echo Creating $1_odes.dat
	dat22dat $1 ode s
$1_odesso.dat: $1_odess.dat2 $1_def.r
	echo Creating $1_odesso.dat
	dat22dat $1 odes so
$1_odess.dat: $1_odess.dat2 $1_def.r
	echo Creating $1_odess.dat
	dat22dat $1 odes s

#Generic conversion of data files from dat to (gplot) gdat format 
$1_$2.gdat: $1_$2.dat $1_struc.txt  $1_args.m
	dat2gdat $1 $2 "$ARGS" "$NyquistStyle"

## Conversion of gdat to fig files
ifeq ($REPTYPE,data)
$1_$2.fig: $1_$2.gdat
	gdat2fig $1_$2

ifneq ($ARGS,) ## Multiple plots
	echo Creating $1_$2$__ARGS.fig
	mv $1_$2.fig $1_$2$__ARGS.fig
	rm -f $1_$2.gdat
endif

## Conversion of gdat fig files to ps/pdf
ifeq ($ARGS,) # single plot
$1_$2.$ps : $1_$2.fig
	echo Creating $1_$2.$ps
	fig2dev -L$eps $1_$2.fig > $1_$2.$ps
else ## Multiple plots
$1_$2.$ps : $1_$2.fig
	echo Creating $1_$2$__ARGS.$ps
	fig2dev -L$eps $1_$2$__ARGS.fig > $1_$2$__ARGS.$ps
endif

endif


#Generic conversion of Latex to latex document
mtt.sty:
	echo Copying mtt.sty to here
	cp $MTTPATH/trans/mtt.sty .
$1_$2.doc: $1_$2.tex
	makedoc "$mtt_switches" "$1" "$2" "$3" "$4" "$documenttype" "$ps"


#Create PostScript version of fig files
ifeq ($REPTYPE,bg)
$1_$2.$ps : $1_$2.fig
	echo Creating $1_$2.$ps
	multi_command2 "fig2dev -L$eps" $1 $2.fig $2.$ps | sh
endif


ifeq ($REPTYPE,tex)
#Generic conversion of LaTeX doc to dvi or pdf
$1_$2.$ps: $1_$2.doc
	doc2$ps $1_$2 "$documenttype"
endif


ifeq ($REPTYPE,tex)
#Create html version of dvi file
$1_$2.html: $1_$2.dvi $1_$2.doc
	echo Creating $1_$2/$1_$2.html
	$LATEX2HTML $1_$2.doc>latex2html.log 2>latex2html.log
endif

#Default view
ifeq ($REPTYPE,bg)
$1_$2.view : $Subsystem_$2.pview
endif

ifeq ($REPTYPE,data)
$1_$2.view: $1_$2.$ps
ifeq ($ARGS,) # single plot
	echo Creating view of $1_$2 - $ps file
	$psview $1_$2.$ps&
else
	echo Creating view of $1_$2$__ARGS - $ps file
	$psview $1_$2$__ARGS.$ps&
endif
endif

ifeq ($REPTYPE,tex)
$1_$2.view : $1_$2.pview
endif

ifeq ($REPTYPE,txt)
$1_$2.view : $1_$2.tview
endif

# Hypertext view
$1_$2.hview: $1_$2.html
	$HTMLVIEW $1_$2/$1_$2.html&

#View a ps file
$Subsystem_$2.pview: $1_$2.$ps
	echo Creating view of $Subsystem_$2 - $ps file
	mtt_multi $psview $Subsystem $2 $ps $viewlevel  | sh 

#View a gdat file
$1_$2.dview: $1_$2.gdat
	echo Creating view of $1_$2
	gdat2view $1_$2 '$ARGS'&

#View a tex file
$1_$2.tview: $1_$2.dvi
	echo Creating view of $1_$2
	$DVIVIEW $1_$2.dvi&

#Report generation
$1_rep.make: $1_rep.txt
	rep_txt2make $1 "$mtt_switches"

$1_reps_made:
	rep_txt2sh $1 "$mtt_switches";  touch $1_reps_made

$1_rep.tex: $1_rep.txt $1_reps_made
	rep_txt2tex $1 "$documenttype" "$directory";

#SUMMARY abg Acausal bond graph report (tex)
$1_abg.tex: $1_sub.sh
	abg2tex $pdf ${sensitivity_switch} $1

#SUMMARY tf Transfer function (mml)
$1_$2.mml: $1_$2.r
	mtt_r2mml $1 $2


# Version control system - uses RCS
RCS:
	echo Creating RCS
	mkdir RCS
$1_$2.vc: RCS 
	echo Version control on $1_$2.$VCext with message: $log_message
	ci -m"$log_message" -I $1_$2.$VCext </dev/tty  ; co -l $1_$2.$VCext 

EOF
# Remember the exit status of make
make_status=$?

# Tidy up.
# echo Removing log files and other garbage
  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt 
  rm -f  mtt_info.txt warning.txt
#  rm -f *_*.idx *_*.ind *_*.ilg  *_*.lof *_*.toc

# Remove logs if not debugging
if [ "$debug" != "debug" ]; then
  rm -f *.log
else
  echo Debugging - log files retained in LOGFILES  
  mkdir -p LOGFILES
  mv -f *.log LOGFILES
fi

#Print what's going on if in verbose mode
if [ -n "$Verbose" ]; then
    echo Finishing mtt  $mtt_switches  $1 $2 $3 $4 at level $level
fi

if [ "$make_status" != "0" ]; then
    echo Exiting MTT with error $make_status
    exit 1
fi

Deleted mttroot/mtt/bin/mtt_backup version [c4fb75f9d6].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
# Does a backup with date of selected files.


while [ -n "`echo $1 | grep '^-'`" ]; do
case $1 in
    -d)
         format=date;
	 shift
	;;
    -v)
         format=version;
	 shift
	;;
    -h)
         echo "Usage: mtt_backup [-d|-v] [lib|doc]";
	 exit
	;;
    *)
         format=date;
esac
done

#Name of archive
if [ -z "$1" ]; then
    mtt="mtt"
    dirs='mtt mtt-lib mtt-cc mtt-doc'
else
    mtt="mtt-$1"
    dirs=$mtt
fi

## Create appropriate filename
case $format in
    date)
         filename=`date | awk '{printf("%s_%s%s_%s.tgz\n", mtt, $2,$3,$6)}' mtt=$mtt`;
	 shift
	;;
    version)
         filename=`mtt --version | awk '{printf("%s-%s.tar.gz\n", mtt, $NF)}' mtt=$mtt`;
	 shift
	;;

    *)

esac

echo Backup file $filename



#Check whether archive exists here
if [ -f "$filename" ]; then
    echo File $filename already exists - exiting
    exit    
fi

# Listing files to ignore
#echo Finding irrelevant files
#find $dirs -name '*.*' -print |\
#  grep 'dvi$\|ps$\|gif$\|log$\|dat$\|MTT_work\|core\|~$' >IGNORE
#wc IGNORE | awk '{print "Ignoring", $1, "files"}'

#echo examples >> IGNORE

#Inform user
echo Backing up $dirs to $filename

#Tar the files
#tar --exclude-from IGNORE --create --gzip --file $filename $dir
tar --create --gzip --file $filename $dirs
#Size info
ls -l $filename
#

Deleted mttroot/mtt/bin/mtt_backups version [6f813c5536].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
# Does a backup with date of all mtt components
# $Log$
# Revision 1.2  2000/10/03 12:17:58  peterg
# Prints usage line
#

if [ -z "$1" ]; then
   echo "Usage: mtt_backups [-v|-d]"
   exit    
fi
mtt_backup $1
mtt_backup $1 cc
mtt_backup $1 lib
mtt_backup $1 doc

Deleted mttroot/mtt/bin/mtt_check_var version [afd404bde7].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_check_var

# P.J.Gawthrop July 1997
# Copyright (c) P.J.Gawthrop 1997


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2  1997/12/04  10:41:15  peterg
# Added third argument to print env. variables.
#
## Revision 1.1  1997/07/27 13:11:37  peterg
## Initial revision
##
###############################################################

var=$1
name=$2
print=$3
software=$4

if [ -z "$1"  ]; then
 echo '*** MTT WARNING Environment variable' $name 'not set. *****'
 echo "Please check that software package $software has been correctely installed"
 echo
 exit
fi

if [ "$print" = "print" ]; then
 echo Environment variable $name set to $var
fi

Deleted mttroot/mtt/bin/mtt_check_vars version [aa8113cf2e].

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
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




























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_check_vars

# P.J.Gawthrop July 1997
# Copyright (c) P.J.Gawthrop 1997


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8.2.1  2001/03/06 03:48:43  geraint
## Print additional environment variable for "mtt -p".
## MTT_LDFLAGS defaults to " " to avoid installation warning.
##
## Revision 1.8  2000/12/27 13:11:42  peterg
## *** empty log message ***
##
## Revision 1.7  2000/08/04 15:48:30  peterg
## Added PDF
##
## Revision 1.6  2000/05/22 12:37:24  peterg
## *** empty log message ***
##
## Revision 1.5  2000/05/22 12:34:07  peterg
## Added MTT_REP
##
## Revision 1.4  1998/07/30 17:30:41  peterg
## Added some more paths
##
## Revision 1.3  1998/01/23 13:33:47  peterg
## Removed OCTAVE_PATH
## Removed RMATRIX
##
# Revision 1.2  1997/12/04  10:41:49  peterg
# Added -p argument to print environment variables
#
## Revision 1.1  1997/07/27 13:12:03  peterg
## Initial revision
##
###############################################################

#Look for a command line argument
while [ -n "`echo $1 | grep '-'`" ]; do
  case $1 in
	-p )
		print=print ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

# Octave
#mtt_check_var "$OCTAVE_PATH" "OCTAVE_PATH" "$print" "Octave"

# LaTeX
#mtt_check_var "$TEXFORMATS" "TEXFORMATS" "$print" "LaTeX"
#mtt_check_var "$TEXINPUTS" "TEXINPUTS" "$print" "LaTeX"
#mtt_check_var "$TEXFONTS" "TEXFONTS" "$print" "LaTeX"

# MTT variables
mtt_check_var "$MAKE" "MAKE" "$print" "MTT"
mtt_check_var "$MTTPATH" "MTTPATH" "$print" "MTT"
mtt_check_var "$MTT_CRS" "MTT_CRS" "$print" "MTT"
mtt_check_var "$MTT_COMPONENTS" "MTT_COMPONENTS" "$print" "MTT"
mtt_check_var "$MTT_EXAMPLES" "MTT_EXAMPLES" "$print" "MTT"
mtt_check_var "$MTT_LIB" "MTT_LIB" "$print" "MTT"
mtt_check_var "$MTT_REP" "MTT_REP" "$print" "MTT"
mtt_check_var "$MATRIX" "MATRIX" "$print" "MTT"
mtt_check_var "$SYMBOLIC" "SYMBOLIC" "$print" "MTT"
mtt_check_var "$FIG" "FIG" "$print" "MTT"
mtt_check_var "$PSVIEW" "PSVIEW" "$print" "MTT"
mtt_check_var "$PDFVIEW" "PDFVIEW" "$print" "MTT"
mtt_check_var "$HTMLVIEW" "HTMLVIEW" "$print" "MTT"
mtt_check_var "$DVIVIEW" "DVIVIEW" "$print" "MTT"
mtt_check_var "$CC" "CC" "$print" "MTT"
mtt_check_var "$LATEX2HTML" "LATEX2HTML" "$print" "MTT"
mtt_check_var "$MKOCTFILE" "MKOCTFILE" "$print" "MTT"
mtt_check_var "$MTT_CXX" "MTT_CXX" "$print" "MTT"
mtt_check_var "$MTT_CXXFLAGS" "MTT_CXXFLAGS" "$print" "MTT"
mtt_check_var "$MTT_CXXLIBS" "MTT_CXXLIBS" "$print" "MTT"
mtt_check_var "$MTT_CXXINCS" "MTT_CXXINCS" "$print" "MTT"
mtt_check_var "$MTT_LDFLAGS" "MTT_LDFLAGS" "$print" "MTT"


Deleted mttroot/mtt/bin/mtt_find version [f98e05dd96].

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
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

























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_find
# mtt_find path name operation
# P.J.Gawthrop Nov 1996
# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1998/07/17 19:47:35  peterg
## Minor changes
##
## Revision 1.5  1998/07/17 07:50:33  peterg
## Now handles library name
## Returns a status
##   0 if exactly one result
##   1 if no results
##   2 if two or more results
##   3 if utterly confused
##
## Revision 1.4  1998/07/16 20:40:24  peterg
## Cleaned up algorithms
##
## Revision 1.3  1998/07/16 09:15:34  peterg
## Now prints:
## 	dir
## 	name_lbl.txt
##         access time
##
## Revision 1.2  1997/09/04 09:15:19  peterg
## Includes summary line as well as description lines
##
## Revision 1.1  1996/11/10 10:48:45  peterg
## Initial revision
##
###############################################################

# Set up dummy file
rm -f mtt_junk
touch mtt_junk

# Interpret the arguments
path="$1"

if [ -n "$2" ]; then
    name=`basename $2`
    longname=$2
    Name="-name $name"
else
    name='*'
fi

# If this is non-empty just print the path
path_only=$3

# Find all dirs in path with same name as component
# AND the path contains the full (name+library) name
paths=`echo $path | tr ":" " "`
foundpath=`\
for thepath in $paths; do
    find $thepath -type d  $Name -print 
done |\
sort -u |\
grep "$longname"`

# If empty set foundpath to the simple components path
if [  -z "$foundpath"  ]; then
  foundpath="$MTT_LIB/comp/simple"
fi

# If non-null result, check that the name_ext file exists in dir name
# and print dirname and file name and last access time
if [ -n "$foundpath" ]; then
  if [ -n "$path_only" ]; then
    format='%h\n';
  else
    format='%h\t%f\t%Ac\n';
  fi
  for thepath in $foundpath ;  do
    if [ "$thepath" = "$MTT_COMPONENTS/simple" ]; then
        ext='cause.m'; # finds _cause.m
        simple='simple';
    else
        ext='lbl.txt'; # finds _lbl.txt
    fi    
     dirname=`basename $thepath`
     if [ -n "$simple" ]; then
      fullname="$name"_"$ext"
    else
      fullname="$dirname"_"$ext"
    fi
  find $thepath -maxdepth 1 -name $fullname  -printf $format;
 done |\
 tee mtt_junk
fi

# Check exit status and return 
hits=`wc mtt_junk | awk '{print $1}'`
rm -f mtt_junk

if [ $hits = "1" ]; then
    exit 0
elif [ $hits = "0" ]; then
    exit 1
elif [ $hits > "1" ]; then
    exit 2
else
    exit 3
fi





Deleted mttroot/mtt/bin/mtt_help version [67aeffb88f].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194


































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_help

# P.J.Gawthrop Nov 1996
# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.13  2000/04/04 15:22:44  peterg
## Major changes: simple components now work
## Single components now work
##
## Revision 1.12  1998/07/21 08:47:59  peterg
## Default null $2 (regexp) to '^' - ie match any line
##
## Revision 1.11  1998/07/16 20:41:05  peterg
## Now uses new mtt_help
##
## Revision 1.10  1998/05/18 08:35:19  peterg
## Surround arguments to tr with ""
##
## Revision 1.9  1998/03/26 08:23:02  peterg
## Use mixed case Topic for *) part of case sttement
##
## Revision 1.8  1998/03/22 21:13:17  peterg
## Fixed bug in above
##
## Revision 1.7  1998/03/22 20:21:11  peterg
## $topic now converted to lower case.
##
## Revision 1.6  1997/09/04 09:35:04  peterg
## Changed $ext to give accurate match -- matches t ot m at end of
## filename
##
# Revision 1.5  1997/09/04  09:21:01  peterg
# Added context-dependent sort.
#
# Revision 1.4  1997/09/04  09:16:29  peterg
# Removed sort -u
#
## Revision 1.3  1996/11/09 21:10:20  peterg
## Tidied up searches by putting everyrhing into lib.
##
# Revision 1.2  1996/11/02  10:22:54  peterg
# Now browses crs.
#
## Revision 1.1  1996/11/01 12:34:54  peterg
## Initial revision
##
###############################################################

comment='#';
Topic=$1
topic=`echo $Topic | tr "[A-Z]" "[a-z]"`

if [ -n "$2" ]; then
    regexp=$2;
else
    regexp='^';
fi

if [ "$topic" = "" ]; then
    echo 'Usage: mtt help representations'
    echo '       mtt help simple'
    echo '       mtt help components'
    echo '       mtt help examples' 
    echo '       mtt help CRs'    
    echo '       mtt help representations <match_string>'
    echo '       mtt help components <match_string>'
    echo '       mtt help examples  <match_string>'
    echo '       mtt help CRs <match_string>'
    echo '       mtt help <component_or_example_or_CR_name>'
  exit
fi

ext='_[cl]*.*[mt]'
summary='[%#]SUMMARY'
description='[%#]DESCRIPTION'
alias='[%#]ALIAS'
lbl="_lbl.txt"

case $topic in
  components)
    key=$summary 
    find_path="$MTT_COMPONENTS"
    name=''
    sort='sort -u'
    blurb="components";;

  simple)
    key=$summary 
    find_path="$MTT_COMPONENTS/simple"
    name=''
    sort='sort -u'
    blurb="simple components";;

  crs) 
    key=$summary 
    find_path=$MTT_CRS/r
    name='*.cr'
    sort='sort -u'
    blurb="constitutive relationships";;

  examples) 
    key=$summary 
    find_path=$MTT_EXAMPLES
    name=''
    all='all'
    sort='sort -u'
    blurb="Examples";;

  representations)
    key=$summary 
    find_path=$MTTPATH
    name='mtt'
    all='all'
    sort='sort -u'
    blurb="Representations";;

  *)
    other=OTHER;
    key="$summary|$description|$alias" 
    find_path=$MTT_LIB
    name=$Topic
    all='all'
    sort='cat'
    blurb=$Topic;;     
esac

subtopic=$2
if [ "$subtopic" = "" ]; then
  subtopic='.'
fi;


case $topic in
    representations)
         echo $comment $blurb
         mtt2reps_txt

	;;
    crs)
	echo  $comment $blurb
        find $find_path -name "$name" -print |\
        awk '{print "grep", key, $1}' key=$key | sh |\
        sed "s/$key //" | $sort
	;;
    *)
	
    fullnames=`mtt_find $find_path "$name" | awk '{printf("%s/%s\n",$1,$2)}'`
    N=`echo $fullnames | wc -w`;
    if [ -z "$fullnames" ]; then
	echo $comment No $blurb found.
    else
    echo $comment $N $blurb found.
    for fullname in $fullnames; do
        name=`basename $fullname`
	if [ -n "$other" ]; then
	cat $fullname | egrep $key 
	else
        info=`cat $fullname | egrep $key | awk '{for (i=2;i<=NF;i++) print $i}'`
	category=`echo $fullname |   sed "s!$find_path/!!" ` 
        category=`dirname $category`
	echo $category $name $info
	fi
    done
    fi
  esac
exit


  awk '{print "cat " $1 "/" $2}'  | sh |\
  egrep $key  | egrep $regexp  |\
  sed "s/$summary[	]*//" |\
  sed "s/$description[	]*/  /" |\
  sed "s/$alias[	]*/  Alias: /" |\
  sed "s!$find_path/!!" |\
  $sort








Deleted mttroot/mtt/bin/mtt_pause version [9430af6a72].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#! /bin/sh

## mtt_pause: Just waits for an EOF
## P J Gawthrop April 2000
## Copyright (C) 2000 by Peter J. Gawthrop

echo $*

mtt $*
cat>/dev/null

Deleted mttroot/mtt/bin/mtt_rename version [f11f51dae2].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_rename

# P.J.Gawthrop Jan 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  2002/04/22 08:05:26  gawthrop
## New regexp.
##
## Revision 1.5  2000/12/27 13:11:42  peterg
## *** empty log message ***
##
## Revision 1.4  1998/08/15 13:50:22  peterg
## Doesn't zap preexisting files
##
## Revision 1.3  1998/08/14 15:37:38  peterg
## rename now copies - no delete
##
## Revision 1.2  1998/01/06 13:57:39  peterg
## Now removes old version after copying
##
# Revision 1.1  1998/01/06  13:48:23  peterg
# Initial revision
#
###############################################################

old_name=$1
new_name=$2
extension=$3

left='[^a-zA-Z]'
right=$left
if [ -f "$new_name$extension" ]; then
   echo  "$new_name$extension already exists -- no action taken"
   exit
fi
if ls $old_name$extension > /dev/null 2>&1 
    then
	echo Renaming $old_name$extension to $new_name$extension
	sed \
         -e "s/\($left\)$old_name\($right\)/\1$new_name\2/g" \
         -e "s/^$old_name\($right\)/$new_name\1/g" \
        <$old_name$extension >$new_name$extension
fi



Deleted mttroot/mtt/bin/mtt_rename_all version [2428ae4c1a].

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


























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_rename_all

# P.J.Gawthrop Jan 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  2000/03/17 11:50:18  peterg
## Added pic.fig -- schematic
##
## Revision 1.6  1998/07/22 15:20:06  peterg
## Added state.txt
##
## Revision 1.5  1998/04/13 09:15:36  peterg
## Added obspar
##
## Revision 1.4  1998/03/27 07:38:32  peterg
## simpar.r ---> simpar.txt
##
## Revision 1.3  1998/03/26 14:47:43  peterg
## Addes subs and cr
##
## Revision 1.2  1998/03/02 17:14:06  peterg
## Added simpar to list
##
## Revision 1.1  1998/01/06 13:57:59  peterg
## Initial revision
##
###############################################################

old_name=$1
new_name=$2

mtt_rename $old_name $new_name _abg.fig
mtt_rename $old_name $new_name _cr.r
mtt_rename $old_name $new_name _desc.tex
mtt_rename $old_name $new_name _input.txt
mtt_rename $old_name $new_name _lbl.txt
mtt_rename $old_name $new_name _logic.txt
mtt_rename $old_name $new_name _numpar.txt
mtt_rename $old_name $new_name _obspar.r
mtt_rename $old_name $new_name _odes.h
mtt_rename $old_name $new_name _rep.txt
mtt_rename $old_name $new_name _pic.fig
mtt_rename $old_name $new_name _simp.r
mtt_rename $old_name $new_name _simpar.txt
mtt_rename $old_name $new_name _sspar.r
mtt_rename $old_name $new_name _state.txt
mtt_rename $old_name $new_name _subs.r

Deleted mttroot/mtt/bin/mtt_version version [6c3f7fc85e].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_version
# Prints out version of a GNU-style tool

# P.J.Gawthrop May 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1999/12/20 02:08:38  peterg
## Added second arg option
##
## Revision 1.2  1998/05/28 09:31:44  peterg
## Cosmetic changes
##
## Revision 1.1  1998/05/28 09:31:13  peterg
## Initial revision
##
###############################################################

if [ -z "$2" ]; then
    echo Trying $1 ...
    ver=`$1 --version | head -1`
     if [ -n "$ver" ]; then
        echo is OK and has version $ver.
    else
        echo Either $1 does not exist or is not the GNU version.
    fi
else
    echo $1: $2
fi








Deleted mttroot/mtt/bin/mtt_versions version [4c7a6f1126].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_versions

# P.J.Gawthrop May 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/05/28 09:24:41  peterg
## Initial revision
##
###############################################################

echo Versions of mtt and its components on `date`

## gnu standard --version
mtt_version mtt

echo Doing the GNU components
mtt_version awk
mtt_version basename
mtt_version cat
mtt_version cp
mtt_version dirname
mtt_version gcc
mtt_version grep
mtt_version head
mtt_version make
mtt_version octave
mtt_version sed
mtt_version tail
mtt_version tr

## Non standards
echo Doing the non-GNU components

echo Trying xfig ...
xfig -help 2> mtt_junk; version=`grep Xfig mtt_junk`
echo is OK and has version $version

echo Trying fig2dev ...
fig2dev -h > mtt_junk; version=`grep -i patchlevel mtt_junk`
echo is OK and has version $version

echo Trying reduce ...
reduce >mtt_junk <<EOF
bye;
EOF
version=`grep  REDUCE mtt_junk`
echo is OK and has version $version


Deleted mttroot/mtt/bin/mtt_xargs.sh version [0e001e0d54].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
#! /bin/sh

cmd=$1
for arg in $2; do
	eval $cmd $arg
done

Deleted mttroot/mtt/bin/mttrc version [f41c538d71].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210


















































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mttrc - sets up paths etc for mtt
# Usage: mttrc 

# Copyright (c) P.J.Gawthrop 1996,1977.


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.24  2001/10/15 14:28:35  gawthrop
## Now has . at start of components library path $MTT_COMPONENTS
##
## Revision 1.23  2001/07/24 22:32:49  gawthrop
## Use gv, not ghostview
##
## Revision 1.22  2001/04/12 03:08:00  geraint
## Improved sh->csh conversion, reduces environment namespace pollution.
## Still need to do proper if [ -z $MTT_BASE ] ... else ... fi conversion.
##
## Revision 1.21  2001/04/10 13:56:13  gawthrop
## Uses standard mkoctfile
##
## Revision 1.20  2001/04/10 13:08:19  gawthrop
## Smoother translation to .cs using sh2csh
##
## Revision 1.19  2001/03/30 15:13:49  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.18  2001/03/19 02:28:52  geraint
## Branch merge: merging-ode2odes-exe back to MAIN.
##
## Revision 1.17.2.4  2001/03/06 03:48:43  geraint
## Print additional environment variable for "mtt -p".
## MTT_LDFLAGS defaults to " " to avoid installation warning.
##
## Revision 1.17.2.3  2001/03/01 05:05:53  geraint
## Minor revisions.
##
## Revision 1.17.2.2  2001/02/23 03:53:53  geraint
## Minor revisions. (ode2odes.exe works on GNU/Linux and ~GNU/Irix)
##
## Revision 1.17.2.1  2001/02/22 06:41:40  geraint
## Initial merge of ode2odes.exe into main mtt.
## standalone_rep.make deleted: rules moved to mtt, variables to mttrc.
##
## Revision 1.17  2000/12/27 16:46:13  peterg
## Stripped the mtt- from paths
##
## Revision 1.16  2000/12/27 15:16:44  peterg
## If then else format
##
## Revision 1.15  2000/12/27 14:57:43  peterg
## Now takes the base path as an argument
##
## Revision 1.14  2000/12/27 13:11:43  peterg
## *** empty log message ***
##
## Revision 1.13  2000/10/03 12:12:14  peterg
## New path structure to account for three way split in mtt tree
##
## Revision 1.12  2000/09/18 12:17:07  peterg
## Now includes to control system toolbox in OCTAVE_PATH
## Don't use -path stuff - use :: instead.
##
## Revision 1.11  2000/05/21 17:55:15  peterg
## New rep path
##
## Revision 1.10  2000/05/16 11:41:23  peterg
## *** empty log message ***
##
## Revision 1.9  1999/03/11 04:02:19  peterg
## Revised so that sh2csh does its stuff.
##
## Revision 1.8  1998/07/17 19:48:46  peterg
## *** empty log message ***
##
## Revision 1.7  1998/03/24 09:11:49  peterg
## Compatible with .csh version
##
## Revision 1.6  1998/03/13 11:53:29  peterg
## reduce --> reduce 64
##
## Revision 1.5  1998/01/16 08:55:01  peterg
## MAKE=make
##
## Revision 1.4  1998/01/06 09:14:51  peterg
## Added latex2html to setup
##
# Revision 1.3  1998/01/06  09:11:26  peterg
# Removed matlab from the setup
#
# Revision 1.2  1997/12/04  10:49:16  peterg
# Put under RCS at last
# Added CC variable
#
###############################################################

## When using csh, replace $1 by the mtt base path, eg /usr/share/mtt/latest
export MTT_BASE=$1

if [ -z "$MTT_BASE" ]; then
  echo mttrc requires one argument: eg mttrc /usr/share/mtt/latest
else
  echo Setting paths with base $MTT_BASE
  # The following line sets up the make to use -- gmake is the standard 
  # but you may wish to use lsmake for parallelism
  export MAKE='make'
  
  # The following sets up the c compiler
  export CC='gcc'
  
  # Setup the paths
  export MTTPATH=$MTT_BASE/bin
  export MTT_LIB=$MTT_BASE/lib
  export MTT_DOC=$MTT_BASE/doc
  export MTT_CC=$MTT_BASE/cc
  
  export MTT_COMPONENTS=.:$MTT_LIB/comp
  export MTT_CRS=$MTT_LIB/cr
  export MTT_EXAMPLES=$MTT_LIB/examples
  export MTT_REP=$MTT_LIB/rep
  
  export PATH=$PATH\:$MTTPATH\:$MTTPATH/trans\:$MTT_CC
  
  #Setup octave
  export MATRIX_PATH=$MTTPATH/trans/m//
  export MATRIX_PATH=$MATRIX_PATH\:$MTT_LIB/comp/simple//
  export MATRIX_PATH=$MATRIX_PATH\:$MTT_LIB/control//
  export MATRIX_PATH=$MATRIX_PATH\:$MTT_LIB/octave//\:\:
  
  export OCTAVE_PATH=.\:$MATRIX_PATH
  export MATRIX="octave"
  
  # Setup the symbolic stuff
  export SYMBOLIC='reduce 64'
  
  
  # Setup xfig
  export FIG="xfig  \
  	-startfontsize 20 \
  	-metric \
  	-portrait \
  	-startgridmode 2 \
  	-pheight 21 \
  	-pwidth 30 \
  	-library_dir $MTT_LIB/xfig/\
  	"
  
  # Setup ps viewer
  export PSVIEW='gv'
  
  # Setup pdf viewer
  export PDFVIEW='acroread'
  
  # Setup html viewer
  export HTMLVIEW='netscape'
  
  # Setup dvi viewer
  export DVIVIEW='xdvi'
  
  # Setup latex2html
  export LATEX2HTML="latex2html -contents_in_navigation -index_in_navigation -address http://mtt.sourceforge.net"
  
  # Ascend stuff
  export ASCENDLIBRARY=$MTTPATH/ascend/lib
  
  # Oct file generation - use version with no optimisation.
  #export MKOCTFILE=$MTT_LIB/octave/mkoctfile # This for no optimisation
    export MKOCTFILE=mkoctfile

  # ode2odes.exe stuff

    # local system

    PLAT="i686-pc-linux-gnu"
    PREFIX="/usr"
    GCCVERS="2.95.2"

    # include paths

    IOCTAVE="-I${PREFIX}/include/octave/ -I${PREFIX}/include/octave/octave"

    # library paths

    OCTAVEVERS=`octave --version | awk '{ print $4 }'`
    LOCTAVE="-L${PREFIX}/lib/octave-${OCTAVEVERS} -loctave -lcruft -loctinterp"
    LSYSTEM="-ldl -lm -lncurses -lkpathsea -lreadline -lblas -llapack -lfftw -lg2c"

    # compiler options

    DEBUG="-g"
    OPTIM="-O3"
    FLAGS="-fno-rtti -fno-exceptions -fno-implicit-templates"

    # exported variables

    export MTT_CXX="g++"
    export MTT_CXXFLAGS="${DEBUG} ${OPTIM} ${FLAGS}"
    export MTT_CXXLIBS="${LOCTAVE} ${LSYSTEM}"
    export MTT_CXXINCS="-I. ${IOCTAVE}"
    export MTT_LDFLAGS=" "
fi

Deleted mttroot/mtt/bin/mttrc.csh version [689359fe62].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210


















































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/csh
## Automatically generated from bashrc on Wed May  9 09:02:08 BST 2001 - DO NOT EDIT
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mttrc - sets up paths etc for mtt
# Usage: mttrc 

# Copyright (c) P.J.Gawthrop 1996,1977.


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.22  2001/04/12 03:08:00  geraint
## Improved sh->csh conversion, reduces environment namespace pollution.
##
## Revision 1.21  2001/04/10 13:56:13  gawthrop
## Uses standard mkoctfile
##
## Revision 1.20  2001/04/10 13:08:19  gawthrop
## Smoother translation to .cs using sh2csh
##
## Revision 1.19  2001/03/30 15:13:49  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.18  2001/03/19 02:28:52  geraint
## Branch merge: merging-ode2odes-exe back to MAIN.
##
## Revision 1.17.2.4  2001/03/06 03:48:43  geraint
## Print additional environment variable for "mtt -p".
## MTT_LDFLAGS defaults to " " to avoid installation warning.
##
## Revision 1.17.2.3  2001/03/01 05:05:53  geraint
## Minor revisions.
##
## Revision 1.17.2.2  2001/02/23 03:53:53  geraint
## Minor revisions. (ode2odes.exe works on GNU/Linux and ~GNU/Irix)
##
## Revision 1.17.2.1  2001/02/22 06:41:40  geraint
## Initial merge of ode2odes.exe into main mtt.
## standalone_rep.make deleted: rules moved to mtt, variables to mttrc.
##
## Revision 1.17  2000/12/27 16:46:13  peterg
## Stripped the mtt- from paths
##
## Revision 1.16  2000/12/27 15:16:44  peterg
##
## Revision 1.15  2000/12/27 14:57:43  peterg
## Now takes the base path as an argument
##
## Revision 1.14  2000/12/27 13:11:43  peterg
## *** empty log message ***
##
## Revision 1.13  2000/10/03 12:12:14  peterg
## New path structure to account for three way split in mtt tree
##
## Revision 1.12  2000/09/18 12:17:07  peterg
## Now includes to control system toolbox in OCTAVE_PATH
## Don't use -path stuff - use :: instead.
##
## Revision 1.11  2000/05/21 17:55:15  peterg
## New rep path
##
## Revision 1.10  2000/05/16 11:41:23  peterg
## *** empty log message ***
##
## Revision 1.9  1999/03/11 04:02:19  peterg
## Revised so that sh2csh does its stuff.
##
## Revision 1.8  1998/07/17 19:48:46  peterg
## *** empty log message ***
##
## Revision 1.7  1998/03/24 09:11:49  peterg
## Compatible with .csh version
##
## Revision 1.6  1998/03/13 11:53:29  peterg
## reduce --> reduce 64
##
## Revision 1.5  1998/01/16 08:55:01  peterg
## MAKE=make
##
## Revision 1.4  1998/01/06 09:14:51  peterg
## Added latex2html to setup
##
# Revision 1.3  1998/01/06  09:11:26  peterg
# Removed matlab from the setup
#
# Revision 1.2  1997/12/04  10:49:16  peterg
# Put under RCS at last
# Added CC variable
#
###############################################################

## When using csh, replace /home/peterg/Development/mttroot/mtt by the mtt base path, eg /usr/share/mtt/latest
setenv MTT_BASE /home/peterg/Development/mttroot/mtt

  echo Setting paths with base $MTT_BASE
  # The following line sets up the make to use -- gmake is the standard 
  # but you may wish to use lsmake for parallelism
  setenv MAKE 'make'
  
  # The following sets up the c compiler
  setenv CC 'gcc'
  
  # Setup the paths
  setenv MTTPATH $MTT_BASE/bin
  setenv MTT_LIB $MTT_BASE/lib
  setenv MTT_DOC $MTT_BASE/doc
  setenv MTT_CC $MTT_BASE/cc
  
  setenv MTT_COMPONENTS $MTT_LIB/comp
  setenv MTT_CRS $MTT_LIB/cr
  setenv MTT_EXAMPLES $MTT_LIB/examples
  setenv MTT_REP $MTT_LIB/rep
  
  setenv PATH $PATH\:$MTTPATH\:$MTTPATH/trans\:$MTT_CC
  
  #Setup octave
  setenv MATRIX_PATH $MTTPATH/trans/m//
  setenv MATRIX_PATH $MATRIX_PATH\:$MTT_LIB/comp/simple//
  setenv MATRIX_PATH $MATRIX_PATH\:$MTT_LIB/control//
  setenv MATRIX_PATH $MATRIX_PATH\:$MTT_LIB/octave//\:\:
  
  setenv OCTAVE_PATH .\:$MATRIX_PATH
  setenv MATRIX "octave"
  
  # Setup the symbolic stuff
  setenv SYMBOLIC 'reduce 64'
  
  
  # Setup xfig
  setenv FIG "xfig  \
  	-startfontsize 20 \
  	-metric \
  	-portrait \
  	-startgridmode 2 \
  	-pheight 21 \
  	-pwidth 30 \
  	-library_dir $MTT_LIB/xfig/\
  	"
  
  # Setup ps viewer
  setenv PSVIEW 'ghostview'
  
  # Setup pdf viewer
  setenv PDFVIEW 'acroread'
  
  # Setup html viewer
  setenv HTMLVIEW 'netscape'
  
  # Setup dvi viewer
  setenv DVIVIEW 'xdvi'
  
  # Setup latex2html
  setenv LATEX2HTML "latex2html -contents_in_navigation -index_in_navigation -address http://mtt.sourceforge.net"
  
  # Ascend stuff
  setenv ASCENDLIBRARY $MTTPATH/ascend/lib
  
  # Oct file generation - use version with no optimisation.
  #setenv MKOCTFILE $MTT_LIB/octave/mkoctfile # This for no optimisation
    setenv MKOCTFILE mkoctfile

  # ode2odes.exe stuff

    # local system

set PLAT="i686-pc-linux-gnu"
#    PREFIX="/usr/local"
set PREFIX="/usr"
set GCCVERS="2.95.2"
set SRCOCTAVE="/cvs/octave"

#    PLAT="mips-sgi-irix6.5"
#    PREFIX="/usr/people/bevangp/GNU"
#    GCCVERS="2.95.2"
#    SRCOCTAVE="${PREFIX}/../build/octave-2.1.33"

    # include paths

set IOCTAVE="-I${PREFIX}/include/octave"

    # library paths

#    LOCTAVE="-L${PREFIX}/lib/octave -loctave -lcruft -loctinterp"
set LOCTAVE="-L${PREFIX}/lib/octave -loctave -lcruft -loctinterp"
set LKPATHSEA="-L${SRCOCTAVE}/kpathsea -lkpathsea"
set LREADLINE=" -L${SRCOCTAVE}/readline -lreadline"
set LSYSTEM="-ldl -lm -lncurses"
set LF2C="-L${PREFIX}/lib/gcc-lib/${PLAT}/${GCCVERS} -lg2c"

    # compiler options

set DEBUG="-g"
set OPTIM="-O3"
set FLAGS="-fno-rtti -fno-exceptions -fno-implicit-templates"

    # exported variables

    setenv MTT_CXX "g++"
    setenv MTT_CXXFLAGS "${DEBUG} ${OPTIM} ${FLAGS}"
    setenv MTT_CXXLIBS "${LOCTAVE} ${LKPATHSEA} ${LREADLINE} ${LF2C} ${LSYSTEM}"
    setenv MTT_CXXINCS "-I. ${IOCTAVE}"
    setenv MTT_LDFLAGS " "

Deleted mttroot/mtt/bin/sh2csh version [4b9c1fb401].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  2001/04/12 03:08:00  geraint
## Improved sh->csh conversion, reduces environment namespace pollution.
## Still need to do proper if [ -z $MTT_BASE ] ... else ... fi conversion.
##
## Revision 1.2  1999/03/11 04:12:26  peterg
## Put in heading.
##
## Revision 1.1  1999/03/11 04:02:45  peterg
## Initial revision
##
###############################################################

#Converts mttrc to csh form.

date=`date`
wd=`pwd`
base=`dirname $wd`

echo Converting $1 to $1.csh using $base as default 

cat<<EOF >$1.csh
#!/bin/csh
## Automatically generated from bashrc on $date - DO NOT EDIT
EOF

# grep -v lines need to be replaced with proper if...then conversion
cat $1 |\
 sed 's/export[ \t]*\([A-Za-z0-9_]*\)=/setenv\ \1\ /' |\
 sed 's/^\([\ \t]*\)\([A-Za-z0-9_]*\)=/set\ \2=/' |\
 grep -v "if \[ -z " |\
 grep -v "echo mttrc requires one argument: eg mttrc /usr/share/mtt/latest" |\
 grep -v "else" |\
 grep -v -e "^fi" |\
 sed "s%\$1%$base%" \
>>$1.csh


echo done.


Deleted mttroot/mtt/bin/trans/ICD_txt2lang.sh version [456d58a25f].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

sys=$1
lang=$2

ICD=${sys}_ICD.${lang}
txt=${sys}_ICD.txt
struc=${sys}_struc.txt

case ${lang} in
    c)	lb='['; rb=']'; offset=0; comment='//';;
    cc)	lb='('; rb=')'; offset=1; comment='//';;
    m)	lb='('; rb=')'; offset=0; comment='#';;
    *)	echo Language ${lang} not yet supported.; exit -1;;
esac

echo Creating ${ICD}

cat <<EOF > ${ICD}
${comment} Interface Control Definition mappings for system ${sys}
${comment} ${ICD}: Generated by MTT `date`

EOF

# ICD.txt Format:
# Input|Output ICD_Name PortName Causality: causality Units: units
# $1           $2       $3       $4         $5        $6     $7

cat <<EOF >> ${ICD}

${comment} Inputs

EOF
for name in `cat ${txt} | awk '($1 == "Input:") { print $3 }'`
do
    num=`grep ${name} ${struc} | awk '($1 == "input") { print $2 }'`
    grep ^Input ${txt} |\
	awk '($3 == name) { printf ("\tmttu%c%d%c\t= %s;\n", lb, num-offset, rb, $2) }'\
	lb=${lb} rb=${rb} name=${name} num=${num} offset=${offset} >> ${ICD}
done

cat <<EOF >> ${ICD}

${comment} Outputs

EOF
for name in `cat ${txt} | awk '($1 == "Output:") { print $3 }'`
do
    num=`grep ${name} ${struc} | awk '($1 == "output") { print $2 }'`
    grep ^Output ${txt} |\
	awk '($3 == name) { printf ("\t%-30s = mtty%c%d%c;\n", $2, lb, num-offset, rb) }'\
	lb=${lb} rb=${rb} name=${name} num=${num} offset=${offset} >> ${ICD}
done

Deleted mttroot/mtt/bin/trans/abg2cbg_m version [5440b5dfe8].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188




























































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2cbg_m
#
# Acausal bond graph to causal bond graph: mfile format

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.16  2001/07/26 04:07:28  gawthrop
## Changed a to w on open (Geraint's suggestion)
## Explictly close files
##
## Revision 1.15  2001/07/23 23:24:02  gawthrop
## Now only writes to type.sh and cbg.m when causality is complete
##
## Revision 1.14  2000/12/28 12:16:13  peterg
## *** empty log message ***
##
## Revision 1.13  1998/07/27 20:30:12  peterg
## *** empty log message ***
##
## Revision 1.12  1998/07/10 08:43:46  peterg
## Added -I switch
##
## Revision 1.11  1998/01/23 13:29:54  peterg
## $RMATRIX --> $MATRIX
##
# Revision 1.10  1996/12/04  21:51:02  peterg
# Now uses filenum instead of line name.
# Uses fopen
#
# Revision 1.9  1996/11/06  15:49:33  peterg
# Cahged $MATRIX to $RMATRIX
#
# Revision 1.8  1996/08/25  09:31:49  peter
# More error handling.
#
## Revision 1.7  1996/08/25 09:22:55  peter
## # Print errors, if any.
## mtt_error error.txt
##
## Revision 1.6  1996/08/24 14:36:01  peter
## Error handling included.
##
## Revision 1.5  1996/08/19 15:38:31  peter
## Removed bug work round.
##
## Revision 1.4  1996/08/16 14:28:45  peter
## Some debugging lines removed.
##
## Revision 1.3  1996/08/08 18:06:55  peter
## Unified naming scheme.
##
## Revision 1.2  1996/08/05 11:25:00  peter
## Removed bonds argument from abg2cbg.
## Removed call to $1_abg.
##
## Revision 1.1  1996/08/04 17:45:11  peter
## Initial revision
##
###############################################################

# The causal BG is described by four matrices
# (the same structure as the acausal BG except that Causality is 1 ot -1):
#   junctions: describes the junctions -
#     Column 1   Index of component (see components)
#     Column 2.. Indices of bonds on junction (see jbonds)
#                  rows may be padded with zeros
#
#    cjbonds:    describes the true bonds -
#     Column 1     Index of component (see components)
#     Column 2     Direction
#                    1 away from junction
#                   -1 towards junction
#     Column 3    Effort causality 
#                     1 stroke at arrow end
#                    -1 stroke at other end
#                     0 no stroke (ie acausal)
#     Column 4    Flow causality 
#                     1 stroke at arrow end
#                    -1 stroke at other end
#                     0 no stroke (ie acausal)
#     Columns 5:6  x,y coordinates of non-arrow end (in Fig)
#     Columns 7:8  x,y coordinates of arrow end (in Fig)
#
#   mbonds:    describes the modulation bonds -
#     Column 1     Index of component at non-arrow end
#     Column 2     Index of component at arrow end
#     Columns 4:5  x,y coordinates of non-arrow end (in Fig)
#     Columns 6:7  x,y coordinates of arrow end (in Fig)
#
#   components: describes the comonents -
#     Column 1     Type of component
#                    0  0-junction
#                    1  1-junction
#                    2  R component
#                    3  C component
#                    4  I component
#                    11 TF component
#                    12 GY component
#                    13 A  component
#     Column 2     Flag for explicit junction
#                    4  Explicit component (4 means text type)
#                    0  Implicit component
#     Column 3-14    fig file information (see fig documentation)
#
# Lists of under- and over-causal junctions are displayed.
#
# P.J.Gawthrop May 1996
# Copyright (c) P.J.Gawthrop, 1996.


# P.J.Gawthrop May 1996
# Copyright (c) P.J.Gawthrop, 1996.

derivative=0;blurb=integral
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;;
	-derivative )
                derivative=1; blurb=derivative;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

infofile='mtt_info.txt'
errorfile='mtt_error.txt'
typefile="$1_type.sh"

# Remove the old log file
rm -f abg2cbg_m.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile


#Inform user
echo "Creating $1_cbg.m (maximise $blurb causality)"
echo Creating $1_type.sh

## Start the type.sh file
mtt_header $1 type sh > $typefile

# Use matrix manipulation to accomplish the transformation
$MATRIX << EOF  >abg2cbg_m.log  #2>mtt_error.txt

  infofilenum  = fopen("$infofile",'w');
  errorfilenum = fopen("$errorfile",'w');
  typefilenum  = fopen("$typefile",'w');

  %Convert from acausal to causal bond graph in m-file form.
  system_name='$1';

  port_bonds = [];
  port_direction = [];
  port_status = [];
  [cbonds,status] = abg2cbg(system_name, '', '', port_bonds, port_direction, port_status, ...
      $derivative,typefilenum, infofilenum, errorfilenum);

    ## close the files
    fclose(infofilenum);
    fclose(errorfilenum);
    fclose(typefilenum);

EOF

cat $typefile | sort -u > ${typefile}.tmp
mv ${typefile}.tmp $typefile

if [ "$info" = "info" ]; then
  cat $infofile
fi

# cp $1_$1_cbg.m $1_cbg.m 2>> mtt_error.txt 

# Print errors, if any.
mtt_error mtt_error.txt

Deleted mttroot/mtt/bin/trans/abg2cr_m2txt version [8b839d7a30].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2cr_m2txt

# Abg file to constitutive relationship conversion
# P.J.Gawthrop march 2000
# Copyright (C) 2000 by Peter J. Gawthrop



# Inform user
if [ -f "$1_cr.txt" ]; then
    echo "Using  $1_cr.txt"
    exit
else
    echo "Creating $1_cr.txt"
fi


rm -f mtt_error


# This is the main transformation using awk 
# And remove crs with same name as system
grep 'cr = ' $1_abg.m | awk '
BEGIN {
# Include lin cr anyway.
print "lin"
}
{
  crs=substr($3,2,length($3)-3);
    N=split(crs,cr,";");
      for (i=1;i<=N;i++){
        if (length(cr[i])>0)
        print cr[i];
      }
}'  2>mtt_error.txt | sort -u | grep -v none | grep -v '\$[0-9]'> $1_cr.txt

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




Deleted mttroot/mtt/bin/trans/abg2lbl_fig2txt version [3e21c7fb36].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332












































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2lbl_fig2txt
#
# Acausal bond graph to causal bond graph: mfile format

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.24  2001/08/02 03:24:48  geraint
## Replaced mtt_version.sh with mtt_banner.sh - I think this was the intent.
##
## Revision 1.23  2001/07/26 04:08:35  gawthrop
## Removed lines deleting _type.sh and cbg.m
##  -- how did they get there ??
##
## Revision 1.22  2001/07/08 03:28:11  gawthrop
## Fixed a bug: abg2sympar_m2txt neads a _lbl.txt file when using
## "usinglabel" option
##
## Revision 1.21  2001/07/06 00:46:50  gawthrop
## Added -cr option -- forces cr to be loaded before the ese.r file
## This avoids causality problems when using multi-port Rs to represent
## arbitary equations
##
## Revision 1.20  2001/07/04 05:19:57  gawthrop
## Added RT & CT to list
##
## Revision 1.19  2001/07/03 23:51:10  gawthrop
## Now puts outline #Summary and #Description lines at top of lbl file
##
## Revision 1.18  2001/06/13 18:24:10  gawthrop
## Made "lin" default in place of "none"
## Still needs arg and cr alias clashes to be sorted ....
##
## Revision 1.17  2001/06/13 10:41:06  gawthrop
## Further changes towards aouto creation of lbl files.
## Prettified lbl files
##
## Revision 1.16  2001/06/11 19:43:49  gawthrop
## MTT is now much more sophisticated in generating lbl files
## Labels can contain maths
## Repetative components are now broken
##
## Revision 1.15  2001/06/11 16:53:49  gawthrop
## Now uses abg2sympar_m2txt to get the arguments
##
## Revision 1.14  2001/06/11 15:06:58  gawthrop
## Now handles user-defined components
##
## Revision 1.13  2001/06/04 08:13:37  gawthrop
## Various changes to support PPP
##
## Revision 1.12  2001/05/08 15:18:10  gawthrop
## Added trig and hyperbolic functions to argument exclusion list
##
## Revision 1.11  2000/09/19 11:14:30  peterg
## Now writes the first component type header correctely
##
## Revision 1.10  2000/01/26 10:11:10  peterg
## Added I component
##
## Revision 1.9  1999/11/10 00:47:08  peterg
## Replaced ifs by a table of cr/arg information
##
## Revision 1.8  1999/11/09 22:32:41  peterg
## Under RCS ready for using arrays to contaain defaults.
##
## Revision 1.7  1998/07/04 10:37:21  peterg
## Major revision to include:
## 	aliases
## 	new Style
## 	prettyfied
##
## Revision 1.6  1998/03/05 10:09:47  peterg
## Corrected bug in writing "other" components
##
## Revision 1.5  1998/03/02 09:26:18  peterg
## Now does default CR and args for the basic components only
## SS,I,R,C,GY,TF
## C now has a default of effort input.
##
## Revision 1.4  1998/02/23 16:20:33  peterg
## Summary line just contains the model name
##
## Revision 1.3  1997/05/09 14:21:35  peterg
## Default to flow,component_name
##
# Revision 1.2  1997/03/19  12:08:01  peterg
# No longer writes out non-unique names - now done in rbg_fig2m
#
# Revision 1.1  1997/03/18  13:55:01  peterg
# Initial revision
#
###############################################################


# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997

infofile='mtt_info.txt'
typefile="$1_type.sh"
sensitivity=$2;
system=$1
outfile=$1_lbl.txt

if [ -n "$sensitivity" ]; then
    sys="-s ${system}"
else
    sys=${system}
fi

# Remove unwanted files
rm -f abg2lbl_fig2txt.log
rm -f $infofile
rm -f mtt_junk*

## Create lbl files beneath this one
mtt -q -u -l 1 ${sys} sub sh # Create the list
sh $1_sub.sh "abg2lbl_fig2txt " " $sensitivity"

if [ -f "$1_lbl.txt" ]; then
  ##echo "$1_lbl.txt exists in `pwd` - no action taken"
  exit
##else 
  ##echo "$1_lbl.txt dosn not exist in `pwd` "
fi

#Inform user
if [ -n "$sensitivity" ]; then
    echo "Creating ${outfile} (sensitivity version)"
else
    echo "Creating ${outfile}"
fi

write_header()

{
cat<<EOF
#SUMMARY ${system}
#DESCRIPTION Detailed description here

## System ${system}, representation lbl, language txt
## File ${system}_lbl.txt
## Generated by MTT on `date`

EOF
cat $MTT_DOC/mtt_banner.sh


}

write_blurb()
{
cat <<EOF

## Each line should be of one of the following forms:
##	     a comment (ie starting with #)
##	     component-name	cr_name	arg1,arg2,..argn
##	     blank

## ---- Component labels ----
EOF
}

create_lbl_body()
{

## Find names of all components
grep -v '\[[0-9]*:[0-9]*\]' $1_abg.fig  |\
awk '/:/ {print $NF}'  | \
sed 's/\\001//' | \
sort | \
tee $1_raw_list | \
sort -u> $1_unique_raw_list


#Write out non-unique names
#echo 'Non-unique names (if any):'
#diff $1_unique_raw_list  $1_raw_list | grep '>' | sed 's/>/	/'

#Write out the outline lbl file
grep -v  '\[[0-9]*\]'  $1_unique_raw_list | \
awk --field-separator ':' '
 BEGIN {
    OldComponent="None";
    default_cr = "lin";
 }
 { 
  Component = $1;
  Name = $2;
  Arg = $3;

##Aliases
  if (Component == "SS") {
    port_alias[++j] = Name;
  }
  else {
    alias[++i] = Name;
    if (length(sensitivity)>0) {
      s_arg = sprintf("%ss",Name);
      alias[++i] = s_arg;
      s_arg = sprintf(";%s",s_arg);
      Component_type = Component;
      Component = substr(Component,2);
      lin = "slin"
    }
   else {
      Component_type = Component;
      lin = "lin";
    }
  
 }

    ## Table of components
    cr["SS"] = "SS";  arg["SS"] = "external,external";

    cr["Se"] = "SS";  arg["Se"] = sprintf("external%s", s_arg);
    cr["Sf"] = "SS";  arg["Sf"] = sprintf("external%s", s_arg);

    cr["De"] = "SS";  arg["De"] = "external";
    cr["Df"] = "SS";  arg["Df"] = "external";

    cr["R"] = lin;  arg["R"]  = sprintf("flow,%s%s", Name, s_arg);
    cr["C"] = lin;  arg["C"]  = sprintf("effort,%s%s", Name, s_arg);
    cr["I"] = lin;  arg["I"]  = sprintf("flow,%s%s", Name, s_arg);

    cr["CS"] = "lin";  arg["CS"]  = sprintf("effort,%s;%s_x0%s", Name, Name, s_arg);
    cr["IS"] = "lin";  arg["IS"]  = sprintf("flow,%s;%s_x0%s", Name, Name, s_arg);
    cr["INTFS"] = "lin";  arg["INTFS"]  = sprintf("%s_x0%s", Name, s_arg);

    cr["TF"] = "lin";  arg["TF"]  = sprintf("flow,%s%s", Name, s_arg);
    cr["GY"] = "lin";  arg["GY"]  = sprintf("flow,%s%s", Name, s_arg);

    cr["AE"] = "lin";  arg["AE"]  = sprintf("%s%s", Name, s_arg);
    cr["AF"] = "lin";  arg["AF"]  = sprintf("%s%s", Name, s_arg);

    cr["CDx"] = "lin";  arg["CDx"]  = sprintf("%s%s", Name, s_arg);


    cr["FMR"] = lin;  arg["FMR"]  = sprintf("effort,%s%s", Name, s_arg);

    cr["RS"] = lin;  arg["RS"]  = sprintf("flow,%s%s", Name, s_arg);
    cr["RT"] = lin;  arg["RT"]  = sprintf("flow,%s%s", Name, s_arg);
    cr["CT"] = lin;  arg["CT"]  = sprintf("effort,%s%s", Name, s_arg);

    ## Put in the explicit arguments
    if (length(Arg)>0) {
      arg[Component] = Arg;
      if (match(Arg,"=")>0) # Its an equation type cr
        cr[Component] = "cr"
      else # assume a linear cr
        cr[Component] = "lin";
    }

  ## Print component header 
  if (Component !~ OldComponent) print "\n## Component type", Component_type

  ## Print Component
    printf("\t%s\t", Name);
    if (Component in cr)
      printf("%s\t\t", cr[Component])
    else 
      printf("%s\t\t", default_cr);

   if (Component in arg)
      printf("%s\t\t\n", arg[Component])
    else {
	print "lbl2args_txt2out", Component_type | "/bin/sh"; close("/bin/sh")
    }

    OldComponent=Component;
    delete arg[Component]; # Zap the element
    delete cr[Component]; # Zap the element
  }
  END{
    print "\n## Port aliases" >> "mtt_junk_alias.txt";
    for (k=1;k<=j;k++){
      if (port_alias[k] ~ "\\["){ # Only do ports
        port_name = substr(port_alias[k],2,length(port_alias[k])-2);
        if (length(sensitivity)==0)
          print "#ALIAS\t" port_name "\t" port_name >> "mtt_junk_alias.txt";
        else
          print "#ALIAS\t" port_name "\t" port_name "_1," port_name "_2" >> "mtt_junk_alias.txt";
      }
    }

#    print "\n% Argument aliases" >> "mtt_junk_alias.txt";
#    for (k=1;k<=i;k++){
#      print "%ALIAS\t\$" k "\t" alias[k] >> "mtt_junk_alias.txt";
#    }
 }' sensitivity=$sensitivity
}

create_arg_aliases()
{
cat <<EOF

## Argument aliases
EOF
abg2sympar_m2txt ${system} ${system} use_label_file |\
awk '{printf("#ALIAS\t$%i\t%s\n", ++i, $1)}'
}

## Main 

create_lbl_body $1> $1_lbl.txt
create_arg_aliases > mtt_args.txt # using $1_lbl.txt
mv $1_lbl.txt mtt_junk_lbl.txt

write_header            > ${outfile}
cat mtt_junk_alias.txt >> ${outfile}
cat mtt_args.txt       >> ${outfile}
write_blurb            >> ${outfile}
cat mtt_junk_lbl.txt   >> ${outfile}
## Put a blank line at end
cat >> ${outfile} <<EOF

EOF
## Clean up
rm -f mtt_junk*





Deleted mttroot/mtt/bin/trans/abg2sabg_fig version [b4a5f4fe24].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2sabg_fig
#
# Acausal bond graph to causal bond graph: mfile format

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


# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997

infofile='mtt_info.txt'
typefile="$1_type.sh"

# Remove the old log file
rm -f abg2sabg_fig.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile


#Inform user
echo Creating $1_sabg.txt

awk '{\
    Depth=7;\
    print $Depth}' $1_abg.fig

Deleted mttroot/mtt/bin/trans/abg2sensitivity_fig version [868b237a9b].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## Converts abg.fig to sensitivity version

## Copyright (C) 1999 by Peter J. Gawthrop

filename=$1_abg.fig
sfilename=s$filename

if [ -f "$sfilename" ]; then
    echo $sfilename exists -- no action taken
    exit
fi

if [ -f $filename ]; then
    echo Using existing $filename
else
    echo "Looking for $1 in library"
    mtt -q  compcopy $1  
fi


echo Creating $sfilename   

awk '
  function modulo10(x) {
    return x-int(x/10)*10
    }
  {

  level_index = 4;
  if ( match($NF,"001")&&(modulo10($level_index)==0)&&(index($NF,"[") != 1) ){
    last = $NF
    if ( (index($NF,"0") != 1)&&(index($NF,"1") != 1)&&(index($NF,"SS") != 1) ) {
      $NF = sprintf("s%s", $NF);
      print $0;
    }
    else {
      x_1_index = 10;
      x_2_index = 12;
      y_1_index = 11;
      y_2_index = 13;
      colour_index=3;
      yellow = 6;

      ## save details 
      colour=$colour_index;
      component=$NF;
      x_1 = $x_1_index;
      x_2 = $x_2_index;
      y_1 = $y_1_index;
      y_2 = $y_2_index;
      
      ## print the label
      $colour_index = yellow;
      $NF = "[1,2]\\001";
      $x_1_index = x_1+1;
      $x_2_index = x_2+1;
      $y_1_index = y_1+1;
      $y_2_index = y_2+1;
      print $0;

      ## print the component
      $colour_index = colour;
      $NF = component;
      $x_1_index = x_1;
      $x_1_index = x_1;
      $y_1_index = y_1;
      $y_2_index = y_2;
      print $0;

      
    }
  }
  else
    print $0;
'} < $filename >$sfilename



Deleted mttroot/mtt/bin/trans/abg2sub_fig2sh version [a2d914eff3].

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
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











































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2sub_m2sh
  ###################################### 
  ##### Model Transformation Tools #####
  ######################################
  
  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.3  2001/10/15 14:27:34  gawthrop
  ## Now handles [1:N] style port labels
  ##
  ## Revision 1.2  2001/07/23 23:26:23  gawthrop
  ## Removed some boring user feedback
  ##
  ## Revision 1.1  2001/06/11 19:47:49  gawthrop
  ## Makes the sub.sh file directly from the abg.fig file
  ## Used for making lbl files (abg2lbl_fig2txt)
  ##
  ##
  ###############################################################

# Copyright (C) 1996--2002 by Peter J. Gawthrop



get_valid_components()

{
awk '
function modulo10(x) {
  return x-int(x/10)*10
    }
BEGIN{
  polyline = 2;
  text = 4;
  compound_object = 6;

}
{
object = $1;
zero_depth =  (modulo10($4)==0)&&(object==text);
if (zero_depth) print $0

}' < $1_abg.fig

}
#if [ -f "$1_sub.sh" ]; then
#    echo Using "$1_sub.sh"
#    exit
#else
    #Inform user
    echo Creating $1_sub.sh    
#fi

echo '# Commands to generate subsystem representations'>  $1_sub.sh
echo "# File $1_sub.sh"			>> $1_sub.sh
echo "# Generated by MTT on `date`."	>> $1_sub.sh
echo					>> $1_sub.sh

# Get a list of all components from the _abg file
get_valid_components $1 |\
grep -v '\[[0-9]*:[0-9]*\]' |\
grep -v '\[.*\]' |\
awk '{if ($1==4) split($14,a,":"); print a[1]}'  |\
sed 's/\\001//' |\
sort -u > mtt_tmp1

# Remove all components starting with 0 or 1
grep -v '^[01]' < mtt_tmp1 > mtt_tmp4

# Get a list of all standard simple components
ls $MTT_LIB/comp/simple |\
  awk '/_cause.m/{split($1,a,"_");print(a[1])}'  >mtt_tmp2

# Get a list of all standard compound components
#ls $MTTPATH/comp/compound |\
#  awk '/_abg.m/{split($1,a,"_");print(a[1])}'  >> mtt_tmp2

# Sorted combined list
cat mtt_tmp2 | \
  sed  's/^zero$/0/' |\
  sed  's/^one$/1/' |\
  sort -u >mtt_tmp3

# Print the non-standard components
comm mtt_tmp4 mtt_tmp3 |\
  awk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \
  >>$1_sub.sh

# Clean up mtt_tmp files
#rm -f mtt_tmp?








Deleted mttroot/mtt/bin/trans/abg2sub_m2sh version [bfd41abfe9].

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
68
69
70
71
72
73
74
75











































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2sub_m2sh

# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  2000/03/17 09:53:10  peterg
## Removed irritating echo Using "$1_sub.sh"
##
## Revision 1.1  2000/03/15 21:23:20  peterg
## Initial revision
##
###############################################################


if [ -f "$1_sub.sh" ]; then
    #echo Using "$1_sub.sh"
    exit
else
    #Inform user
    echo Creating $1_sub.sh    
fi


echo '# Commands to generate subsystem representations'>  $1_sub.sh
echo "# File $1_sub.sh"			>> $1_sub.sh
echo "# Generated by MTT on `date`."	>> $1_sub.sh
echo					>> $1_sub.sh

# Get a list of all components for the _abg file
awk '/type = / {print substr($3,2,length($3)-3)}' $1_abg.m |\
sort -u > mtt_tmp1

# Remove all components starting with 0 or 1
grep -v '^[01]' < mtt_tmp1 > mtt_tmp4

# Get a list of all standard simple components
echo ls $MTT_LIB/comp/simple
ls $MTT_LIB/comp/simple |\
  awk '/_cause.m/{split($1,a,"_");print(a[1])}'  >mtt_tmp2

# Get a list of all standard compound components
#ls $MTTPATH/comp/compound |\
#  awk '/_abg.m/{split($1,a,"_");print(a[1])}'  >> mtt_tmp2

# Sorted combined list
cat mtt_tmp2 | \
  sed  's/^zero$/0/' |\
  sed  's/^one$/1/' |\
  sort -u >mtt_tmp3

# Print the non-standard components
comm mtt_tmp4 mtt_tmp3 |\
  awk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \
  >>$1_sub.sh

# Clean up mtt_tmp files
#rm -f mtt_tmp?








Deleted mttroot/mtt/bin/trans/abg2sympar_m2txt version [538470dfa1].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2sympar_m2txt

# Label file to symbolic parameters conversion
# Copyright (C) 2000 by Peter J. Gawthrop

# Inform user
##echo "Creating $1_sympar.txt" with $1 $2 $3

# Separation characters
SEPS='^=*;+/()-'
# Replace by ,
REPS='[,*]'

SystemName=$2
UseLabelFile=$3

if [ -n "$UseLabelFile" ]; then ## Take input from lbl.txt
     strip_comments < $1_lbl.txt  | tr $SEPS $REPS |\
     awk '{printf("%s %s \"%s\",\n",$1,$2,$3)}' > mtt_stripped_file
else ## Take input from _abg.m
     cat $1_abg.m | grep "arg =" | tr $SEPS $REPS > mtt_stripped_file
fi

rm -f mtt_error
# This is the main transformation using gawk
cat mtt_stripped_file | \
awk '
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 {
  var = "[%|#][PAR|VAR]";
  not_an_arg = "effort flow state internal external zero unknown\
                mtt_e mtt_f\
		sqrt exp log sign sin asin cos acos tan atan \
		sin asin cos acos tan atan \
		sinh asinh cosh acosh tanh atanh \
                none abs";
  arg_line = "arg = ";
}
{
  ## Explicit VAR declarations
  if (match($1,var)>0) print $2 "\t" system_name;

   ## Implicit declarations from the arg list
##  if (match($1,"arg")>0) {
    args= substr($3,2,length($3)-3);
    if (length(args)>0)
      printf("%s\t%s\n", args,system_name)
##  }
}' system_name=$SystemName |\
grep -v '^\$' | mtt_strip_args | sort -u > mtt_stripped_args


## Now get the explicit declarations
if [ -n "$UseLabelFile" ]; then ## Take input from lbl.txt
    ext=_lbl.txt
else
    ext=_abg.m
fi

strip_pars.sh $1${ext} $1 |  sort -u > mtt_explicit_args

## And write sorted list
cat  mtt_explicit_args mtt_stripped_args 


Deleted mttroot/mtt/bin/trans/abg2tex version [f4bd38e131].

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
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
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




















































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg2tex
# Creates a tex file describing the system abg
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  2000/11/27 17:45:00  peterg
## Removed "System" from  heading
##
## Revision 1.1  2000/11/27 15:11:15  peterg
## Initial revision
##
## Revision 1.7  1997/12/06 16:20:37  peterg
## Added another argument - the label
##
## Revision 1.6  1997/12/06 15:49:35  peterg
## Changed order of fig arguments to put filename first.
##
## Revision 1.5  1997/08/15 11:32:05  peterg
## Removed an echo left in by mistake
##
# Revision 1.4  1997/08/15  11:19:25  peterg
# Minto cosmetics.
#
## Revision 1.3  1997/05/21 12:07:22  peterg
## Replaced echo by cat -- much simpler.
##
## Revision 1.2  1997/05/19 16:25:53  peterg
## Explicit include of tex files .. latex2html seems to prefer this!
##
# Revision 1.1  1997/05/19  11:30:00  peterg
# Initial revision
#
###############################################################

#Look for a command line argument
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-pdf )  pdf='-pdf'
                ;;
	-s )  sensitivity='-s'
                ;;

	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done


if [ -z "$2" ]; then
  filename="$1_abg.tex";
  echo > $filename
  echo Creating $filename
  subsection='section'
else
  filename=$2
  subsection='subsection'
fi


#Section heading (if not at top level)
if [ -n "$2" ]; then
cat<<EOF >> $filename

%% Subsystem $1
  \subsection{\textbf{$1}}
    \label{sec:$1}
    \index{\textbf{$1} -- abg} 

EOF
else
mtt -q -u ${sensitivity} $1 abg m # Make sure all the subsystems exist -- nasty kludge
cat<<EOF > $filename
   % abg report for system $1 ($filename)
   % Generated by MTT at `date`
EOF
fi

# Figure
##echo mtt -q -u $pdf $1 abg ps
mtt -q -u  $pdf $1 abg ps
cat <<EOF  >> $filename

   \fig{`pwd`/$1_abg}{$1_abg.ps}{0.9}{System \textbf{$1}: acausal bond graph}

EOF

# Description
mtt -q -u $1 desc tex
# Put in absolute pathnames in figures -- and fix bug in old desc files
sed "s;fig{;fig{`pwd`/;g" < $1_desc.tex |\
sed "s/Ref{$1_abg}/Ref{fig:$1_abg.ps}/" >> $filename

# Label file
mtt -q -u $1 lbl tex
cat<<EOF  >> $filename
 \sub$subsection{Summary information} 
 \label{sec:$1_lbl} 
 \index{\textbf{$1} -- lbl} 
EOF
cat $1_lbl.tex   >> $filename


# CRs
#mtt -q -u $1 cr tex
#cat<<EOF  >> $filename
# \sub$subsection{Constitutive relationships} 
# \label{sec:$1_cr} 
# \index{\textbf{$1} -- cr} 
#EOF
#cat $1_cr.tex   >> $filename

# Subsystems
mtt -q -u $1 sub tex 
cat<<EOF  >> $filename
 \sub$subsection{Subsystems} 
 \label{sec:$1_sub} 
 \index{\textbf{$1} -- subsystems} 
EOF
cat $1_sub.tex   >> $filename

#Now do the subsystems (if at top level)
if [ -z "$2" ]; then
 sub2subs $1 | sort -u | \
  awk '{print "abg2tex", pdf, $1, filename}' pdf=$pdf filename=$filename | sh
fi











Deleted mttroot/mtt/bin/trans/abg_m2a4c version [18547a7f99].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: abg_m2a4c
#
# Acausal bond graph to ascend format

infofile='mtt_info.txt'
errorfile='mtt_error.txt'


# Remove the old log file
rm -f abg_m2a4c_m.log
rm -f $1_abg.a4c



#Inform user
echo "Creating $1_abg.a4c" 

# Use matrix manipulation to accomplish the transformation
octave -q << EOF  >$1_abg.a4c
    ABG = $1_abg;
    name = "$1";
    abg_m2a4c(ABG,name);
EOF

if [ "$info" = "info" ]; then
  cat $infofile
fi

Deleted mttroot/mtt/bin/trans/alias_txt2m version [f172c72e17].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: alias_m
# Creates the component aliases in text form

# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/07/02 09:21:55  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_alias.m

#Create the alias file complete with headers.
echo "function alias = $1_alias" > $1_alias.m
echo "%% Alias file ($1_alias.m)" >> $1_alias.m
echo "%% Generated by MTT at `date`" >> $1_alias.m

#Write out the variables 
awk '{
       if (NF==2) {i++; print "alias."$1 "\t = \""$2"\";"}
     
     }
     END{
       if (i==0) print "alias = 0;"
        }' $1_alias.txt >> $1_alias.m









Deleted mttroot/mtt/bin/trans/awk/lbl2cr.awk version [aa06076c55].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###################################### 
##### Model Transformation Tools #####
######################################

# gawk script: lbl2cr.awk
# Label file to symbolic parameters conversion
# P.J.Gawthrop August 1996
# 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.
##
# Revision 1.6  1997/03/22  15:15:44  peterg
# Ignores symbolic ($i) crs.
#
# Revision 1.5  1997/03/20  12:05:31  peterg
# Now just writes out the cr name.
#
# Revision 1.4  1996/11/09  20:38:45  peterg
# Put in new lib pat
#
## Revision 1.3  1996/11/04 14:51:14  peterg
## Added none to no cr list
##
# Revision 1.2  1996/11/02  10:22:22  peterg
# Now ignores SS lines.
#
###############################################################


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 {
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++) {
      first_char = substr(cr[i],1,1);
      if ( (matches(not_a_cr,cr[i])==0) &&
         (match(numeric,first_char)==0) &&
         (matches(is_a_SS,$3)==0))
	 print cr[i];
    }
  }
}

Deleted mttroot/mtt/bin/trans/awk/lbl2sympar.awk version [c5c057bec5].

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
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











































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###################################### 
##### Model Transformation Tools #####
######################################

# gawk script: lbl2sympar.awk
# Label file to symbolic parameters conversion
# P.J.Gawthrop August 1996
# 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
## Changed SS field fudge.
##
## Revision 1.9  1998/02/16 16:09:57  peterg
## And taken it out again!
##
## Revision 1.8  1998/02/16 12:08:38  peterg
## Put back the matrix declaration
##
# Revision 1.7  1997/03/18  17:25:24  peterg
# Now just generates names - formatting removed.
#
# Revision 1.6  1996/12/07  20:02:43  peterg
# Fixed symbolic parameter bug.
#
## Revision 1.5  1996/12/07 18:06:50  peterg
## Now detects symbolic args ($1 etc) and ignores them.
##
# Revision 1.4  1996/08/30  18:45:32  peter
# Removed header stuff.
#
## Revision 1.3  1996/08/30 10:30:54  peter
## Switched order of args in matches.
##
## Revision 1.2  1996/08/30 09:35:10  peter
## Fixed problem with global variable in function.
##
## Revision 1.1  1996/08/24 13:34:48  peter
## Initial revision
##
###############################################################



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) \
	   && (length(arg[i])>0) \
	   && (matches(symbols,arg[i]) ==0) ) {
	 print arg[i] "\t" name;
	  }
    }
  }
}





Deleted mttroot/mtt/bin/trans/awk/rbg_fig2m.awk version [3569101684].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755



















































































































































































































































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###################################### 
##### Model Transformation Tools #####
######################################

# gawk script: rbg_fig2m.awk
# Raw  bond-graph conversion from fig to matlab
# P.J.Gawthrop June 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.41  2001/06/13 10:41:06  gawthrop
## Further changes towards aouto creation of lbl files.
## Prettified lbl files
##
## Revision 1.40  2001/06/11 19:43:50  gawthrop
## MTT is now much more sophisticated in generating lbl files
## Labels can contain maths
## Repetative components are now broken
##
## Revision 1.39  2001/05/09 08:50:02  gawthrop
## Uses _art.fig to transmit the art work to the cbg.fig rep.
##
## Revision 1.38  2001/03/23 14:57:31  gawthrop
## Now puts space after header fields + writes _port.fig
##
## Revision 1.37  2000/09/14 08:43:32  peterg
## Add additional directional informatiuon to rbonds:
## 	cols 7-8 Arrow end directional bond
## 	cols 9-10 Arrow end directional bond
##
## Revision 1.36  1999/11/19 04:00:26  peterg
## Changed a comment to be more accurate.
##
## Revision 1.35  1999/07/25 22:19:45  peterg
## Fixed bug with false objects when compound objects present.
## -- Reset object to 0 after processing text.
##
## Revision 1.34  1999/02/17 06:23:49  peterg
## Bugs arising from Fig 3.2 fixed
##
## -- depth now zero modulo 10 (3.2 defaults to depth 100!!)
## -- horrible bug using = in place of == fixed.
##
## Revision 1.33  1998/08/10 15:51:06  peterg
## Comments may now be prefaced by # as well as %
##
## Revision 1.32  1998/07/27 20:30:03  peterg
## *** empty log message ***
##
## Revision 1.31  1998/04/16 13:18:13  peterg
## Now ignores spurious ports (in lbl but not Figure \ref{) but gives
## warning
##
## Revision 1.30  1998/04/12 15:01:17  peterg
## Converted to uniform port notation - always use []
##
## Revision 1.29  1998/04/12 12:35:32  peterg
## Named and unnamed SS handled in a uniform manner - in particular, the
## attributes are passed through
## wrote_component function used.
##
## Revision 1.28  1998/04/06 08:41:48  peterg
## Fixed bug due to adding (and then removing) 0 and 1 as port types
##
## Revision 1.27  1998/04/04 10:54:58  peterg
## Remove a debugging print statement
##
## Revision 1.26  1998/04/04 07:29:26  peterg
## SS now only port component
##
## Revision 1.25  1998/04/03 15:07:20  peterg
## Now correctly write 0/1 port names
##
## Revision 1.24  1998/04/03 14:02:50  peterg
## Added 0 and 1 to list of possible ports
##
## Revision 1.23  1998/02/01 18:37:41  peterg
## Don't print irritating warnings about ports listed in lbl files.
##
# Revision 1.22  1997/08/09  14:42:39  peterg
# Added underscore to port regexp
#
## Revision 1.21  1997/08/04 12:49:17  peterg
## Modified to use named (as opposed to numbered) ports.
## Generates a list of component ports in the .rbg file.
## As octave handles string vectors properly, the .cmp file format is not
## really necessary - but I've let it be for the moment.
##
## Revision 1.20  1997/03/19 12:02:01  peterg
## Now writes an error message if a lable is used twice in the fig file.
##
# Revision 1.19  1997/03/19  09:49:39  peterg
# Ports now written in cmp file.
#
# Revision 1.18  1997/03/19  09:42:08  peterg
# Now writes out the following additional fig  files:
# _head.fig	The fig header
# _bnd.fig	The bonds actually used
# _cmp.fig	The components actually used.
#
# Revision 1.17  1997/01/02  11:21:17  peterg
# Now assumes all components bonds etc at depth zero in fig file.
# Ie anything at depth>0 is ignored.
# Thanks to Donald for suggesting this.
#
## Revision 1.16  1996/12/30 20:00:29  peterg
## Fixed bent-bond bug.
## NB unfixed problems:
## 1. xfig writes multi line fields if more than about 5 segments.
## 2. rbg2abg takes a multi-segment bond as a straignt line between the
## end points - so computation of stroke and arrow directions may be
## iffy.
##
## Revision 1.15  1996/12/30 19:23:35  peterg
##  Allows for bent bonds - ie bonds with more than 2 line segments.
##
## Revision 1.14  1996/12/21 19:47:53  peterg
## Changed \* to \\*
##
## Revision 1.13  1996/12/21 19:47:23  peterg
## Put back under VC
##
# Revision 1.12  1996/08/24  16:30:12  peter
# Fixed error in nonport_regexp.
#
## Revision 1.11  1996/08/19 10:48:57  peter
## Added `-' to the component regexp.
##
## Revision 1.10  1996/08/19 09:03:13  peter
## Parses repetative components: ie suffixed by *n.
##
## Revision 1.9  1996/08/09 08:23:11  peter
## Fixed bug: ports not recognised.
##
## Revision 1.8  1996/08/05 20:12:43  peter
## Now writes a _fig.fig file.
##
## Revision 1.7  1996/08/05 18:44:56  peter
## Now writes out a _cbg file without ----- symbol.
##
## Revision 1.6  1996/08/05 12:17:37  peter
## n_ports now appear in the _abg file instead.
##
## Revision 1.5  1996/08/05 12:01:28  peter
## The _cmp function now returns the number of ports.
##
## Revision 1.4  1996/08/05 10:14:46  peter
## Made ports appear, in order, at top of component lists
##
## Revision 1.3  1996/08/04 20:32:28  peter
## Stopped complaint about missing lbl entry for port components
##
## Revision 1.2  1996/08/04 20:05:25  peter
## Included port components - eg SS:[1]
##
## Revision 1.1  1996/08/04 20:01:58  peter
## Initial revision
##
###############################################################


##############################################################
# This (g)awk script reads a fig file in fig 3.1 format.
# It interprets the picture as: bonds, arrows and components
# as follows:
#
# Bonds are firm (not dashed etc) polylines with n line segments - 
#  fig represents this by  a firstline record where
#    field 1 = 2 (always 2)
#    field 2 = 1 (polyline)
#    field 3 = 0 (style is a firm line)
#    field 7 = 0 (depth is zero [top level])
#    field 14 = 0 (no forward arrow)
#    field 15 = 0 (backward arrow) 
#    field 16 = Number of point in line (points=segments+1)
#  a data field starting with a tab followed by  points (x,y) cordinates
#
#
# Strokes are polylines with 1 line segment and and no arrow 
#  fig represents this by  a firstline record where
#    field 1 = 2 (always 2)
#    field 2 = 1 (polyline)
#    field 3 = 0 (style is a firm line)
#    field 14 = 0 (no forward arrow)
#    field 15 = 0 (backward arrow) 
#    field 16 = Number of point in line =2
#  a data field starting with a tab followed by 2 (x,y) cordinates
#
# Arrows are polylines with 1 line segment and an arrow 
#  fig represents this by  a firstline record where
#    field 1 = 2 (always 2)
#    field 2 = 1 (polyline)
#    field 3 = 0 (style is a firm line)
#    field 14 = 1 for a forward arrow  
#    field 15 = 1 for a backward arrow 
#  an additional data files
#  a data field starting with a tab followed by 2(x,y) cordinates
#
# Components appear in two files -- the fig file and the lbl file
# these two files are concatenated with the lbl file first
#  	The lbl file represents components by 3 fields
#		field  1 is the name
#		field  2 is the CR name
#		field  3 is the CR arguments
#  	The fig file represents components by 14 fields
#             field 1 = 4
#		fields 12 and 13 are the coordinates
#		field 14 is the type:name string terminated by \001
# To prevent text being confused with components, components consist
# of alphanumeric characters and : and _ only.
# The lbl file is used to sort the components.
##############################################################

function modulo10(x) {
  return x-int(x/10)*10
    }

function exact_match(name1, name2) {
  return ((match(name1,name2)>0)&&(length(name1)==length(name2)))
    }

function write_component(i) {
    name = label[i,1];
    cr   = label[i,2];
    arg  = label[i,3];
    if (length(x[name])==0) {
        # print error - its in lbl but not fig file
        printf(warning_l, name);
    }
    else {
      component_index++;
      print x[name], y[name], info[name] >> b_file;
      printf("if i==%1.0f\n", component_index) 	>> c_file;
      printf("\tcomp_type = %s%s%s;\n", q, comp_type[name], q) >> c_file;
      printf("\tname = %s%s%s;\n", q, name, q) >> c_file;
      printf("\tcr = %s%s%s;\n", q, cr, q) >> c_file;
      printf("\targ = %s%s%s;\n", q, arg, q) >> c_file;
      printf("\trepetitions = %s;\n",  reps[name]) >> c_file;
      print "end" >> c_file
	}
  }

function process_lbl() {
# This puts the components in the lable file at the top of the list
# and saves up the corresponding CR and arguments
# note that there may be more than one component per label
  if ((match($1,comment_regexp)==0)&&(NF>0))
    { 
      i_label++;
      name = $1;
      CR   = $2;
      args = $3;

      label[i_label,1] = name; 
      label[i_label,2] = CR;
      label[i_label,3] = args;
	}
}

function fig_info() {
# Grabs the fig-file information for a component
  return(sprintf("%s %s %s %s %s %s %s %s %s %s %s ", \
		 $1, $2, $3, $4, $5, $6, $7, \
		 $8, $9, $10, $11))
	 }

function process_text() {
# The text string is field 14 onwards
  str = $14; 
  for (i=15; i<=NF; i++) {
    str = sprintf("%s %s", str, $i)
      }

# The depth is field 4 (for strings)
  depth = modulo10($4);

# It is terminated by \001 - so delete this termination
  str = substr(str,1,length(str)-4);

# Zap maths
  ##gsub(/[()-+*/]/,"",str); 

# Loose the cr stuff (if present)
  if (depth==0) {
      N=split(str,a,delimiter);
      if (N==3)
	  str=sprintf("%s%s%s", a[1],delimiter,a[2]);
    }

# A component string contains only alphanumeric  _ and :
  isa_plain_component = match(str, component_regexp)==0;
# It must also be specified at depth 0 (modulo 10)
  isa_plain_component = isa_plain_component && (depth==0);

# A port is a string within []
  isa_port = (match(str, port_regexp)>0)

# It must also be specified at depth 0
  isa_port = isa_port && (depth==0);

# Vector port definitions
  isa_PORT = ((match(str, PORT_regexp)>0) && (depth==0));

  if (isa_PORT) {
    print str
  }

# A port component is an SS  followed by a port string
  isa_port_component = 0;
  if (match(str, delimiter)) {
    split(str,a,delimiter);
    isa_port_component = (match(a[1], port_component_regexp))&&
      (match(a[2], port_regexp)>0)
      }

# It must also be specified at depth 0
  isa_port_component = isa_port_component && (depth==0);

# A component is a plain or a port component
  isa_component = isa_plain_component||isa_port_component;

# Coordinates in fields 12 & 13
  x_coord = $12;
  y_coord = $13;

# Do the ports
  if (isa_port) {
    i_port++;
    port_name = str;
    ports[i_port] = sprintf("%s %s %s", x_coord, y_coord, port_name);
  }

# Do the port components
#  if (isa_port_component) {
#    i_port_component++;
#    type = a[1];
#    # Port name is the bit between the []
#    port_label  = substr(a[2],2,length(a[2])-2);
#    x_port[i_port_component] = x_coord;
#    y_port[i_port_component] = y_coord;
#    info_port[i_port_component] = fig_info();
#    port_labels[i_port_component] = port_label;
#      }

# Do the components
  if (isa_component) {
    i_text++;

# Get repetitions (if any)
    if (match(str,repetition_regexp) > 0) {
      split(str,b,repetition_delimiter);
      repetitions = b[2];
      str = b[1];
	}
    else {
      repetitions = "1";
    };

    named_component = (match(str,delimiter) > 0);
    if (named_component) {
      split(str,a,delimiter);
      type = a[1];
      name = a[2];
# Check  if name is in label file and if used already
      found = 0; name_used = 0;
      for (i=1; i<=i_label; i++) {
	  lname = label[i,1];
	if ( lname==name ) {
	  found = 1;
	  if (name in used) {
	    name_used = 1;
	    CR = label[i,2];
	    args = label[i,3];
	  }
	  else {
	    used[name] = 1
	      }
	  break
	    }
      }

if (!found) {
printf(warning_f, name);
i_label++;
CR = default_cr;
args = "";
label[i_label,1] = name; 
label[i_label,2] = CR;
label[i_label,3] = args
}

# Give it a new entry if already used
#  -- also tell user as it is an error now(?)
      if (name_used) {
	printf(warning_u, name);
	i_label++;
	i_name++;
	name = sprintf("%1.0f", i_name);
	label[i_label,1] = name; 
	label[i_label,2] = CR;
	label[i_label,3] = args
	  }
    }

# Unnamed component
    if (named_component==0) {
      i_name++;
      name = sprintf("mtt%i", i_name);
      type = str;
      i_label++;
      label[i_label,1] = name;
      label[i_label,2] = default_cr;
      label[i_label,3] = default_args
	}

# Save in associative arrays by name	
    comp_type[name] = type;
    x[name] = x_coord;
    y[name] = y_coord;
    info[name] =  fig_info();
    reps[name] = repetitions;
  }

}

#Euclidean length of a line between (first_x,first_y) and (second_x,second_y)
function line_length(first_x,first_y,second_x,second_y) {
  x_length = second_x-first_x;
  y_length = second_y-first_y;
  return sqrt( x_length*x_length +  y_length*y_length );
}

# Returns 1 if (bond) arrow at beginning of field or 2 if arrow at end of field
function arrow_end(first_x,first_y,second_x,second_y,penultimate_x,penultimate_y,last_x,last_y) {
  if ( line_length(first_x,first_y,second_x,second_y) < line_length(first_x,first_y,second_x,second_y) ) {
  return 1
  }
  else {
  return 2
  }
}

function process_bond() {

  arg_count++;
  if ( (arg_count-arrow)==1 ) 
    {

#Save up bond coords - no arrow and more segments than a stroke has.
# Allows for bent bonds - but just write out the relevant coordinates
	if ( (!arrow)&& (NF>2*stroke_coords+1) ) {
	    i_bond++;
	    a_end = arrow_end($2,$3,$4,$5,$(NF-3),$(NF-2),$(NF-1),$NF);
	    if (a_end==1) {
		arrow_end_vector_x = $6-$4; 
		arrow_end_vector_y = $7-$5; 
		other_end_vector_x = $(NF-1)-$(NF-3);
		other_end_vector_y = $(NF)-$(NF-2);
		bonds[i_bond] = sprintf("%s %s %s %s %s %s %s %s %s %s", \
					$2, $3, $4, $5, $(NF-1), $(NF),
					arrow_end_vector_x,
					arrow_end_vector_y,
					other_end_vector_x,
					other_end_vector_y);
	    }
	    else {
		other_end_vector_x = $4-$2; 
		other_end_vector_y = $5-$3; 
		arrow_end_vector_x = $(NF-3)-$(NF-5);
		arrow_end_vector_y = $(NF-2)-$(NF-4);
		bonds[i_bond] = sprintf("%s %s %s %s %s %s %s %s %s %s", \
					$2, $3, $(NF-3),$(NF-2),$(NF-1),$NF,
					arrow_end_vector_x,
					arrow_end_vector_y,
					other_end_vector_x,
					other_end_vector_y);
	    }
      }
      
#Save up arrow coords 
      if ( (arrow)&&(NF==(2*arrow_coords+1)) ) {
	i_arrow++;
	arrows[i_arrow] = sprintf("%s %s %s %s",  $2, $3, $4, $5);
      }
      
#Save up stroke coords
      if ( (!arrow)&&(NF==(2*stroke_coords+1)) ) {
	i_stroke++;
	strokes[i_stroke] = sprintf("%s %s %s %s",  $2, $3, $4, $5);
      }
    }
}

function write_fig() {
# Create _fig.fig file from _abg file - not components
# and write out the components in a _cmp.fig file
# and write out the bonds in a _bnd.fig file

# The artwork -- not header and not zero depth
    
    if ((NF>2)&&(!zero_depth)) {
	art=$0;
	sub("----","    ",art)
	printf("%s\n", art) >> art_file
	    }
	    

#Everything except components
  if ( ((object!=text)||(isa_component==0)) ) {
    #Replace the data_symbol
    if (exact_match($1,data_symbol)) {
      field_1 = out_data_symbol
	}
    else {
      field_1 = $1
      }

    printf("%s",field_1)   >> fig_file
      for (i=2; i<=NF; i++)
	printf(" %s", $i)  >> fig_file;
    if (NF==1) 
	printf(" ")   >> fig_file; # Put space after header fields
    printf("\n") >> fig_file
    }

# Header
  if ( NF<3 ) {
	printf("%s", $1)  >> head_file;
        for (i=2; i<=NF; i++)
	  printf(" %s", $i)  >> head_file;
	if (NF==1) 
	    printf(" ")   >> head_file; # Put space after header fields
	printf("\n") >> head_file
    }
# Bonds
  if (isa_bond) {

    #Replace the data_symbol
    if (exact_match($1,data_symbol)) {
      field_1 = out_data_symbol
	}
    else {
      field_1 = $1
	}

    printf field_1   >> bnd_file
      for (i=2; i<=NF; i++)
	printf(" %s", $i)  >> bnd_file;
    printf("\n") >> bnd_file
      }

# Components & ports
  if ( isa_component||isa_port ) {
      for (i=1; i<=NF; i++)
	  printf(" %s", $i)  >> cmp_file;
      printf("\n") >> cmp_file
	  }

# Ports
  if ( isa_port_component ||isa_port) {
      for (i=1; i<=NF; i++)
	  printf(" %s", $i)  >> port_file;
      printf("\n") >> port_file
}
}

function process_fig() {
# Test for the fig format first line and data line
  data_line = (match($1,data_symbol)>0);
  first_line = (data_line==0)&&(NF>min_line_length);

#Process firstline
  if (first_line) {
    object = $1;
    sub_type = $2;
    style = $3;
    zero_depth = ((modulo10($7)==0)&&(object==polyline)) || ((modulo10($4)==0)&&(object==text))
    f_arrow = ($14==1)&&(object=polyline);
    b_arrow = ($15==1)&&(object=polyline);
    arrow = f_arrow||b_arrow;
    arg_count = 0;
  }

#Process text
  if (object==text) {
    process_text();
    object = 0; # Text on one line so reset object to zero- avoids compound problem
      }

# Process bond
isa_bond = (zero_depth &&\
       (object==polyline)&& \
       (sub_type==sub_polyline)&& \
       (style==firm_style) \
       );   

if ( isa_bond && data_line)
{
    process_bond()
      }   

if (isa_fig_file){
     write_fig()
    }

    }

BEGIN {
  sys_name = ARGV[1];
  delete ARGV[1];

  b_file = sprintf("%s_rbg.m", sys_name);
  c_file = sprintf("%s_cmp.m", sys_name);
  fig_file = sprintf("%s_fig.fig", sys_name);
  cmp_file = sprintf("%s_cmp.fig", sys_name);
  port_file = sprintf("%s_port.fig", sys_name);
  bnd_file = sprintf("%s_bnd.fig", sys_name); 
  head_file = sprintf("%s_head.fig", sys_name);
  art_file = sprintf("%s_art.fig", sys_name);

  warning_f = "WARNING %s \t in fig file but not lbl file  - using\n";
  warning_l = "WARNING %s \t in lbl file but not fig file  - ignoring\n";
  warning_p = "ERROR system ports are not consecutively numbered\n";
  warning_u = "ERROR %s has already appeared in the fig file\n";

  comment_regexp = "%|#"
  data_symbol = "----";
  out_data_symbol = "\t";
  default_cr = "";
  default_args = "";
  delimiter = ":";
  repetition_delimiter = "*";
  repetition_regexp = "\\*";
  q = "\047";
  terminator = "\\001";
  component_regexp = "[^0-9a-zA-Z_:*-]";
  port_regexp = "^[[a-zA-Z0-9_,]*]";
  nonport_regexp = "[a-zA-Z]";
  PORT_regexp = "^PORT .*=";  
  port_component_regexp = "SS";
  isa_fig_file = 0;
  min_line_length = 10;
  object = 0;
  polyline = 2;
  sub_polyline=1; 
  firm_style = 0;
  text = 4;
  compound_object = 6;
  bond_coords = 3;
  stroke_coords = 2;
  arrow_coords = 2;

  i_bond = 0;
  i_port = 0;
  i_stroke = 0;
  i_arrow = 0;
  i_label = 0;
  i_text = 0;
  i_name = 0;
  i_port_component = 0;

  component_index = 0;
}
{
# Start of .fig file?
  if ($1=="#FIG") {
    isa_fig_file=1;
  }
  if (isa_fig_file==0) {
    process_lbl()    
      }
  else {
    process_fig()
      }
}

END {
#Print out the Octave functions
  printf("function [rbonds, rstrokes,rcomponents,port_coord,port_name,port_list] = %s_rbg\n", sys_name) > b_file;
  printf("%% [rbonds,rstrokes,rcomponents,port_coord,port_name,port_list] = %s_rbg\n", sys_name) > b_file;
  printf("%% Generated by MTT\n\n") > b_file;

  printf("function [comp_type, name, cr, arg, repetitions] = %s_cmp(i)\n",\
		 sys_name) > c_file;
  printf("%% [comp_type, name, cr, arg, repetitions] = %s_cmp\n", sys_name) > c_file;
  printf("%% Generated by MTT\n\n") > c_file;

  printf("rbonds = [\n") >> b_file;
  for (i = 1; i <= i_bond; i++)
    print  bonds[i] >> b_file;
  for (i = 1; i <= i_arrow; i++)
    print  arrows[i], "-1 -1" >> b_file;
  printf("];\n") >> b_file;
  
  printf("rstrokes = [\n") >> b_file;
  for (i = 1; i <= i_stroke; i++)
    print  strokes[i] >> b_file;
  printf("];\n") >> b_file;

  printf("rcomponents = [") >> b_file;
  j = 0;


# Do the port components, in order of appearance, first.
  for (i = 1; i <= i_label; i++) {
    name = label[i,1];
    if (match(name,port_regexp))
      write_component(i);
  }

# Now do the ordinary components, in order of appearance, last.
  for (i = 1; i <= i_label; i++) {
    name = label[i,1];
    if (!match(name,port_regexp))
      write_component(i);  
}
  printf("];\n") >> b_file;

# Print the (internal) ports list
  printf("port_coord = [\n") >> b_file;
  for (i = 1; i <= i_port; i++) {
    split(ports[i],a, " ");
    printf("%s %s\n", a[1], a[2]) >> b_file;
  }
  printf("];\n\n") >> b_file;

  printf("port_name = [\n") >> b_file;
  for (i = 1; i <= i_port; i++) {
    split(ports[i],a, " ");
    # Dont Remove the []
    # name = substr(a[3],2,length(a[3])-2);
    name = a[3];
    printf("'%s'\n", name) >> b_file;
  }
  printf("];\n\n") >> b_file;

# Print the (external) port list - ignore spurious ports (in lbl, not fig)
  printf("port_list = [\n") >> b_file;
  for (i = 1; i <= i_label; i++) {
    name = label[i,1];
    if (length(x[name])>0) {
      if (match(name,port_regexp))
	printf("'%s'\n", name) >> b_file;
    }
  }
  printf("];\n\n") >> b_file;
  
}



Deleted mttroot/mtt/bin/trans/awk/rep_txt2make.awk version [1a899189e1].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###################################### 
##### Model Transformation Tools #####
######################################

# gawk script: rep_txt2make
# Converts the text file describing a report to makefile dependencies
# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.3  1997/05/19  15:40:04  peterg
# Pass mtt swithches to the new make file
#
# Revision 1.2  1996/11/21  15:57:28  peterg
# Now runs mtt quietly.
#
# Revision 1.1  1996/08/18  19:59:00  peter
# Initial revision
#
###############################################################


{
  if (NF==2)
    if( match("tex txt r m ps",$2)>0)
      print "mtt -q", switches, system_name, $1, $2
}



Deleted mttroot/mtt/bin/trans/awk/rep_txt2tex.awk version [3c9239d1bd].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###################################### 
##### Model Transformation Tools #####
######################################

# gawk script: rep_txt2tex
# Converts the text file describing a report to a report.
# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.5  1997/05/22  11:12:34  peterg
# Chaged figure label.
#
## Revision 1.4  1997/05/22 07:36:35  peterg
## \ref --> \Ref
##
## Revision 1.3  1997/05/19 16:43:34  peterg
## Explicit include of tex files 'cos latex2html prefers this!
##
# Revision 1.2  1997/05/19  16:11:10  peterg
# Modified section headers.
#
# Revision 1.1  1996/08/18  19:58:49  peter
# Initial revision
#
###############################################################


BEGIN {
  split(ARGV[1],a,"_");
  system_name = a[1];
  args = ARGV[2];
  comment="\%";
}
{
  if ((match($1,comment)==0)&&(NF==2)) {
    Representation = $1;
    Language = $2;
    Rep_lang = sprintf("%s_%s", Representation, Language);
    section_head = sprintf("System \\textbf{%s}: representation \\textbf{%s}, language \\textbf{%s}", \
			   system_name,Representation,Language);
# section headings
    print "\\section{" section_head "}";
    print "\\label{" Rep_lang "}";
    print "\\index{\\textbf{" system_name "} -- " Representation "}";

# tex files
    if( match("tex",Language)>0) {
      # printf("  \\input{%s_%s.%s}\n", system_name, Representation, Language);
      command = sprintf("cat %s_%s.%s", system_name, Representation, Language);
      system(command);    }
# text files
    if( match("txt r m c h",Language)>0) {
      print "  \\begin{verbatim}";
      command = sprintf("cat %s_%s.%s", system_name, Representation, Language);
      system(command);
      print "  \\end{verbatim}";  
    }
# ps files
    if( match("ps",Language)>0) {
      printf("This representation is given as Figure \\Ref{fig:%s}.\n", Rep_lang);
      print "  \\begin{figure}";
      printf("   \\shadowbox{ \\epsfig{file=%s_%s.%s,width=0.9\\linewidth} }\n", \
	     system_name, Representation, Language);
      printf("    \\caption{System \\textbf{%s}, representation %s}\n", system_name, Representation);
      printf("    \\label{fig:%s}\n", Rep_lang);
      print "  \\end{figure}";
    }
  }
}
END {

}



Deleted mttroot/mtt/bin/trans/awk/tex2doc.awk version [a8fccd0d60].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
###################################### 
##### Model Transformation Tools #####
######################################

# gawk script: tex2doc
# Encapsulates a tex file in a document.
# P.J.Gawthrop August 1996
# 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}"
}

Deleted mttroot/mtt/bin/trans/c-tidy version [28f2822d80].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1997/02/04 18:50:07  peterg
## Initial revision
##
## Revision 1.2  1996/08/20 08:26:06  peter
## Version control header added.
##
###############################################################

# Bourne shell script: c_tidy
# Tidies up C format files
# P.J.Gawthrop 14 June 1990 13 Nov 1990, 19 Nov 93, April 1994, Dec 1994, 
# June 1995
# Copyright (c) P.J.Gawthrop, 1990, 1994, 1995.

# Remove blank lines
cat $1 | \
tr -s '\012' '\012'\
>junk
mv junk $1







Deleted mttroot/mtt/bin/trans/c_tidy version [58bf61dcc7].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1997/02/04 18:52:34  peterg
## Copied from matlab tidy -- removed everthing except removal of blank
## lines
##
## Revision 1.1  1997/02/04 18:50:07  peterg
## Initial revision
##
## Revision 1.2  1996/08/20 08:26:06  peter
## Version control header added.
##
###############################################################

# Bourne shell script: c_tidy
# Tidies up C format files
# P.J.Gawthrop 14 June 1990 13 Nov 1990, 19 Nov 93, April 1994, Dec 1994, 
# June 1995
# Copyright (c) P.J.Gawthrop, 1990, 1994, 1995.

# Remove blank lines
cat $1 | \
tr -s '\012' '\012'\
>junk
mv junk $1







Deleted mttroot/mtt/bin/trans/can_r2m version [4c4db15907].

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
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


























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: can_r2m
# Reduce canonical forsm to matlab
# P.J.Gawthrop  January 8th 1998
# Copyright (c) P.J.Gawthrop 1998

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



# Inform user
echo Creating $1_can.m

# Remove the old log file
rm -f can_r2m.log

# Use reduce to accomplish the transformation
reduce >can_r2m.log << EOF

%Read in the definitions file
IN "$1_def.r";

%Read the reduce state-space A,B,C and D matrices file
IN "$1_can.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read in the parameter file
IN "$1_sympar.r";

OUT "$1_can.m";
%Headings - Matlab style
%(Note. The ;; are deleted by for2mat)

write "function [A_c,B_c,C_c,D_c,Con,Obs,K,L,A_comp,B_comp,C_comp] = $1_can;;";
write "%function [A_c,B_c,C_c,D_c,Con,Obs,K,L,A_comp,B_comp,C_comp] = $1_can;;";

write "%Canonical forms and controller design for system $1";
write "%File $1_can.m";
write "%Generated by MTT";
write "";

IF MTTNvar>0 THEN
BEGIN
  write "% Set the parameters";
  write "global ...;;";
  FOR i := 1:MTTNx DO
    write "alpha_c",i, " alpha_o",i, "...;;";
  
  FOR i := 1:MTTNvar DO
    BEGIN
      IF numberp(MTTVar(i,1)) 
      THEN 
      BEGIN
        % Do nowt
      END
      ELSE  
      BEGIN
        write MTTVar(i,1), " ...";
      END;
    END;
    write " ";
END;


%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
OFF period$

write "MTTA_c = zeros(", MTTNx, ",", MTTNx, ");";
write "MTTB_c = zeros(", MTTNx, ",", MTTNu, ");";
write "MTTC_c = zeros(", MTTNy, ",", MTTNx, ");";
write "MTTD_c = zeros(", MTTNy, ",", MTTNu, ");";

write "MTTCon = zeros(", MTTNx, ",", MTTNx, ");";
write "MTTObs = zeros(", MTTNx, ",", MTTNx, ");";

write "MTTK = zeros(", MTTNy, ",", MTTNx, ");";
write "MTTL = zeros(", MTTNx, ",", MTTNu, ");";

write "MTTA_comp = zeros(", MTTNx, ",", MTTNx, ");";
write "MTTB_comp = zeros(", MTTNx, ",", MTTNy, ");";
write "MTTC_comp = zeros(", MTTNu, ",", MTTNx, ");";


ON NERO;	% Suppress zero elements.
MTTA_c := MTTA_c;
MTTB_c := MTTB_c;
MTTC_c := MTTC_c;
MTTD_c := MTTD_c;

MTTCon := MTTCon; 
MTTObs := MTTObs; 


MTTK := MTTK; 
MTTL := MTTL;

MTTA_comp := MTTA_comp;
MTTB_comp := MTTB_comp;
MTTC_comp := MTTC_comp;
MTTD_comp := MTTD_comp;


OFF FORT;
write "";

SHUT "$1_can.m";

Deleted mttroot/mtt/bin/trans/can_r2tex version [5939f4edfe].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: can_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

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


# Inform user
echo Creating $1_can.tex

# Remove the old log file
rm -f can_r2tex.log

# Use reduce to accomplish the transformation
reduce >can_r2tex.log<< EOF

%Read the definitions file
in "$1_def.r";

%Read the canonical-form matrices file
in "$1_can.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;

OUT "$1_can.tex";

%Write out the canonical matrices
write "%Canonical-form  matrices $1";
write "%File: $1_can.tex";
write"";


% Controllable form
MTT_Matrix := MTTA_c$ 
MTT_Matrix_name := "MTTA_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB_c$ 
MTT_Matrix_name := "MTTB_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC_c$ 
MTT_Matrix_name := "MTTC_c"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$


% Observable form
MTT_Matrix := MTTA_o$ 
MTT_Matrix_name := "MTTA_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB_o$ 
MTT_Matrix_name := "MTTB_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC_o$ 
MTT_Matrix_name := "MTTC_o"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Controllability matrix";
MTT_Matrix := MTTCon$ 
MTT_Matrix_name := "MTTCon"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  -Observability matrix";
MTT_Matrix := MTTObs$ 
MTT_Matrix_name := "MTTObs"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  -Controllability matrix - controller form";
MTT_Matrix := MTTCon_c$ 
MTT_Matrix_name := "MTTCon_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Transformation matrix - controller form";
MTT_Matrix := MTTT_c$ 
MTT_Matrix_name := "MTTT_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Gain matrix - controller form";
MTT_Matrix := MTTK_c$ 
MTT_Matrix_name := "MTTK_c"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTK$ 
MTT_Matrix_name := "MTTK"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$


write "%  -Observability matrix - Observer form";
MTT_Matrix := MTTObs_o$ 
MTT_Matrix_name := "MTTObs_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Transformation matrix - Observer form";
MTT_Matrix := MTTT_o$ 
MTT_Matrix_name := "MTTT_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Observer Gain matrix - observer form";
MTT_Matrix := MTTL_o$ 
MTT_Matrix_name := "MTTL_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNy$
LaTeX_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTL$ 
MTT_Matrix_name := "MTTL"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNy$
LaTeX_Matrix()$


% Controllable form
MTT_Matrix := MTTA_comp$ 
MTT_Matrix_name := "MTTA_comp"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB_comp$ 
MTT_Matrix_name := "MTTB_comp"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC_comp$ 
MTT_Matrix_name := "MTTC_comp"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$



write "\begin{equation}";
  write "MTTur = {", MTTu_r, "}";
write "\end{equation}";

SHUT "$1_can.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/cbg2ese_m2r version [0a2c9156c8].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378


























































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cbg2ese_m
#
#
# P.J.Gawthrop June 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
##
## $Log$
## Revision 1.30  2001/07/12 04:02:53  gawthrop
## Now fixes multiports for input and output as well as state
##
## Revision 1.29.2.1  2001/06/26 22:29:05  geraint
## mtt_xargs.sh eliminates Arg list too long error for large models.
## (UNIX xargs does not work if the environment is too large).
##
## Revision 1.29  2001/03/29 19:24:14  gawthrop
## Can now use c representations of crs when using -c option
##
## Revision 1.28  2001/02/05 17:19:52  gawthrop
## Now gives unique names to the states of multiports. Second name
## onwards labeled with port number
##
## Revision 1.27  2000/12/05 12:09:56  peterg
## Changed function name to name()
##
## Revision 1.26  2000/12/05 09:04:54  peterg
## *** empty log message ***
##
## Revision 1.25  2000/12/01 14:51:26  peterg
## Major changes towards partioning
##
## - generates sub ese, def and struc
## - generates indices for conversion of subsystem in/out/state - but not used yet
##
## Revision 1.24  2000/11/30 15:12:55  peterg
## Zapped the declaration of subsystem connections - now in individual
## .def files
##
## Revision 1.23  2000/11/30 15:07:28  peterg
## Sorted out mtt_getsize
##
## Revision 1.22  2000/11/12 17:18:30  peterg
## Changed ' to "
##
## Revision 1.21  2000/10/16 08:40:35  peterg
## Whoops! Must touch mtt_aliased
##
## Revision 1.20  2000/10/16 08:36:31  peterg
## Creat empty _aliased file if it doesn't exist
##
## Revision 1.19  2000/10/12 19:25:39  peterg
## Now generateds the _aliased.txt file
##
## Revision 1.18  2000/09/15 08:09:42  peterg
## Removed another debugging line
##
## Revision 1.17  2000/09/15 08:06:17  peterg
## Removed debug lines
##
## Revision 1.16  2000/09/02 15:55:51  peterg
## *** empty log message ***
##
## Revision 1.15  1998/07/08 14:43:12  peterg
## Restored inforfile
##
## Revision 1.14  1998/07/08 08:26:26  peterg
## Added -I option -- if set prints out the information messages
##
## Revision 1.13  1998/05/12 14:49:10  peterg
## Don't write END; any more - ese-tidy does this now!
##
## Revision 1.12  1998/01/23 13:30:46  peterg
## $RMATRIX --> $MATRIX
##
## Revision 1.11  1997/12/16 18:05:03  peterg
## Increased size of structure vector by on to include unknown_inputs as
## 6th element
##
## Revision 1.10  1997/04/15 09:18:26  peterg
## Added structure file
##
# Revision 1.9  1996/12/07  18:21:25  peterg
# Now uses fopen + file number
#
## Revision 1.8  1996/12/05 10:05:28  peterg
## Removed the Octave switch: empty_list_elements_ok = 1;
## This is now in .octaverc
##
# Revision 1.7  1996/08/30  11:29:49  peter
# Added constitutive relationship to argument list.
# Put in explicit argument list to cbg2ese.
#
# Revision 1.6  1996/08/26  13:25:07  peterg
# Corrected error handling.
#
# Revision 1.5  1996/08/24  14:38:11  peter
# Error handling included.
#
## Revision 1.4  1996/08/19 09:02:12  peter
## Errors go to user - not log.
##
## Revision 1.3  1996/08/18 20:05:55  peter
## Included zero outputs.
##
## Revision 1.2  1996/08/08 18:08:37  peter
## Sorted out file naming scheme.
##
## Revision 1.1  1996/08/08 15:57:15  peter
## Initial revision
##
###############################################################

while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;;
	-partition )
                partition=yes;
                blurb='with partitioning';
		;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done


infofile='mtt_info.txt';
structurefile="$1_struc.txt";
eqnfile="$1_ese.r";
deffile="$1_def.r";


# Remove the old log file
rm -f cbg2ese_m.log

# Remove the info and error files
rm -f mtt_info.txt
rm -f mtt_error.txt
rm -f mtt_aliased.txt

# Remove relevent ese files
rm -f $1_ese.r $1_*_ese.r 

#Inform user
echo Creating $eqnfile $blurb
echo Creating $deffile
echo Creating $structurefile

# Use matrix manipulation to accomplish the transformation
# This creates an ese file for every subsystem.
$MATRIX << EOF > cbg2ese_m2r.log 2>mtt_error.txt

infofile = "$infofile";;
infofilenum = fopen(infofile,"w");
structurefile = "$structurefile";;
structurefilenum = fopen(structurefile,"w");
deffile = "$1_def.r";
deffilenum = fopen(deffile,"w");

system_name = "$1";
system_type = "";
system_cr = "";
system_args = "";
full_name = "";
full_name_repetition = "";

% Structure matrix [states,nonstates,inputs,outputs,zero_outputs]

structure = zeros(1,7);  # Initialise structure vector

structure = cbg2ese(system_name, system_type, system_cr, ...
                     system_args, full_name, full_name_repetition, ...
                     1, structure, structurefilenum, infofilenum);
makedef(structure,deffilenum);
EOF

echo "END;" >> $1_def.r

if [ "$info" = "info" ]; then
  cat $infofile
fi

if [ -z "$partition" ]; then
  ## Don't partition

  # Create the composite ese file
  mtt_xargs.sh cat "$1_ese.r $1_*_ese.r $1_modpar.r"  > $1_ese.tmp 2>> /dev/null

  mv $1_ese.tmp $1_ese.r

  # Zap the sub ese files
  mtt_xargs.sh "rm -f" "$1_*_ese.r"

  echo "END;" >> $1_ese.r

else # Partition the system

  # Save up the full def file
  mv $1_def.r mtt_all_def.r

## Recreate def file from the ese file directly
makedef ()
{

echo Creating $1_def.r

Nx=`mtt_getsize -external $1 dX`
Nz=`mtt_getsize -external $1 z`
Ny=`mtt_getsize -external $1 y`
Nu=`mtt_getsize -external $1 u`
Nui=`mtt_getsize -external $1 ui`
Nuc=`mtt_getsize -internal $1 u`

# echo Ny $Ny Nu $Nu Nx $Nx Nui $Nui Nuc $Nuc

## Definitions file
octave -q <<EOF
  deffile = '$1_def.r';
  deffilenum = fopen(deffile,'w');

  ## Set up the structure vector
  structure = zeros(1,7);  
  structure(1) = $Nx; # States
  structure(2) = $Nz; # Non-states
  structure(3) = $Nu; # Inputs
  structure(4) = $Ny; # Outputs
  structure(5) = 0;   # Zero outputs
  structure(6) = $Nui; #Internal inputs 
  structure(7) = $Nuc; # Connecting inputs

  makedef(structure,deffilenum);  #Create definitions
EOF

echo "END;" >> $1_def.r
}


get_indices ()
{
  sys=$1
  which=$2
  awk '{if ($1==which) print $2}' which=$which < ${sys}_struc.txt
}

convert_indices ()
{
  sys=$1
  Which="input output state"
  for which in $Which; do
  
    indices=`get_indices ${sys} $which`
  
    case $which in
      input)
  	name=u
  	;;
      output)
  	name=y
  	;;
      state)
  	name=x
  	;;
      *)
  	
    esac
  
    new=0
    for old in $indices; do
      new=`expr $new + 1`
      pattern="MTT${name}(${old},1)"
      replacement="MTT${name}(${new},1)"
      mv ${sys}_ese.r mtt_junk
      sed "s/$pattern/$replacement/" <mtt_junk >${sys}_ese.r
    done
  done
}
  # Find subsystems
  subsystems=`mtt_get_subsystems $1`

  # Top level  
  makedef $1;
  echo "END;" >> $1_ese.r

  ## Subsystems
  for subsystem in $subsystems; do
    echo Connecting $subsystem
#    Ny=`mtt_getsize -internal ${subsystem}_1 y`
#    Nu=`mtt_getsize -internal ${subsystem}_1 u`
#    Nx=`mtt_getsize -internal ${subsystem}_1 u`
#    echo Ny $Ny Nu $Nu Nx $Nx


#    echo MATRIX "MTT_"$subsystem"_uc("$Nu",1);"  >> $1_def.r

    echo >> $1_ese.r
    echo %Subsystem input connections for $subsystem  >> $1_ese.r
    octave -q <<EOF                            >> $1_ese.r
    for i=1:$Nu
      printf("MTT_%s_uc(%i,1) := %s_1_MTTu%i;\n", "$subsystem", i, "$subsystem", i);
    endfor;
EOF
  ## Subsystems (Only works when no repetitions at this level)
  esefile=${subsystem}_ese.r
  echo Creating $esefile
  mtt_xargs.sh cat "${subsystem}_1_ese.r ${subsystem}_1_*_ese.r" > $esefile 2> /dev/null
  echo "END;" >> $esefile

  ## Def file for subsystem
  makedef ${subsystem}
  
  echo Creating ${subsystem}_struc.txt
  grep $subsystem < $1_struc.txt > ${subsystem}_struc.txt

  echo Converting subsystem indices
  convert_indices ${subsystem}

  done

fi


# Create the _alised file
touch mtt_aliased.txt
echo Creating $1_aliased.txt
mv mtt_aliased.txt $1_aliased.txt

# Sort the struc file
mv $structurefile junk
sort -k 1,1 -k 2,2n junk >$structurefile

# Relabel states with multiple ports
relabel_multiple_definitions(){
  mv $structurefile junk
  awk '
  BEGIN{
     var_type_index=1;  
     oldname="";
  }
  {
     name=$4;
     newname=name;
     if ($1==var_type) {
       if (name==oldname)
         newname = sprintf("%s_%i",name, ++var_type_index);
       else
         var_type_index=1; 
   }
     $4 = newname
     for (i=1;i<NF;i++) printf("%s\t",$i);
     printf("%s\n", $NF)
     oldname = name;
  '} < junk var_type=$1> $structurefile
}

relabel_multiple_definitions input;
relabel_multiple_definitions output;
relabel_multiple_definitions state;

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







Deleted mttroot/mtt/bin/trans/cbg_m2fig version [f290f42a19].

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
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






























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cbg_m2fig
#
# Causal bond graph:  mfile format to fig file format
# The resultant fig file is the original _abg.fig with
# additional causal strokes superimposed.
#
# P.J.Gawthrop May 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.12  2001/03/23 14:55:03  gawthrop
## Fixed cosmetic bugs -- component display
##
## Revision 1.11  2000/12/28 12:19:49  peterg
## *** empty log message ***
##
## Revision 1.10  2000/09/14 12:04:48  peterg
## New 2 parameter version
##
## Revision 1.9  1998/01/23 13:31:23  peterg
## $RMATRIX --> $MATRIX
##
## Revision 1.8  1996/12/07 19:23:07  peterg
## Registered agian.
##
# Revision 1.7  1996/11/09  19:04:34  peterg
# Removed cp $1_$1_cbg.fig $1_cbg.fig.
#
## Revision 1.6  1996/11/06 15:58:46  peterg
## Changed Matrix to RMATRIX
##
# Revision 1.5  1996/11/02  10:16:50  peterg
# Changed stroke length to 150
#
# Revision 1.4  1996/08/25  09:28:59  peter
# More error handling.
#
## Revision 1.3  1996/08/24 14:40:31  peter
## Error handling included.
##
## Revision 1.2  1996/08/08 18:07:31  peter
## Sorted out naming scheme for files
##
## Revision 1.1  1996/08/05 20:13:56  peter
## Initial revision
##
###############################################################


# Remove the old log file
rm -f cbg_m2fig.log
rm -f mtt_info.txt

# The following sets up the fig header file for the system
# and each sub system.
# (ls $1_*_cbg.m \
# | sed 's/\(.*_\)\(.*_\)cbg.m/cp \2fig.fig \1\2cbg.fig/' \
#| sh ) 2>mtt_error.txt

#sh $1_type.sh 'cp ' '_fig.fig ' '_cbg.fig'> mtt_error.txt

# Copy the unchaging part of the figure file
cat $1_head.fig $1_port.fig $1_bnd.fig $1_art.fig> $2_cbg.fig

#Inform user
echo Creating $2_cbg.fig -- component type $1

# Use  matrix manipulation to accomplish the transformation
$MATRIX   <<EOF  2>mtt_error.txt > cbg_m2fig.log

  system_type = "$1"
  system_name = "$2"

  thick = 3; length = 150; red = 4; blue = 1; green = 12; font = 18;
  cbg2fig(system_name, system_type, '', ...
          length, thick, blue, ...
          font, green, red);
EOF

#cp $1_$1_cbg.fig $1_cbg.fig 2>> mtt_error.txt

# Print errors, if any.
mtt_error mtt_error.txt

Deleted mttroot/mtt/bin/trans/cmp2cmp_m version [3837859c2d].

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
68
69
70
71
72








































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cmp2cmp_m
# Revises the component file (cmp) to account for aliases.

# Copyright (c) P.J.Gawthrop 1998

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

# Inform user
echo Revising $1_cmp.m

# Copy the alias and cmp files.
cat $1_alias.txt $1_cmp.m > junk

#Create the cmp file complete with headers.
#echo "# Component file ($1_cmp.m)" #> $1_cmp.m
#echo "# Revised by MTT at `date`" #>> $1_cmp.m

#Write out the variables 
awk '
BEGIN{
alias_file=1
Parameter_Regexp = "^_Parameter_"
Line_Regexp = "cr|arg"
quote = "\047"
}
{
  if (alias_file) {
    if (match($1,Parameter_Regexp)>0){
      alias[$2] = $1;
      sub(Parameter_Regexp,"$",alias[$2]); # Replace by $ format
    }
  }
  else {
    if (match($1,Line_Regexp)){
      cr_or_args = substr($3,2,length($3)-3); # It it a cr or arg line
      N=split(cr_or_args,a,";"); # Split into parts
      for (i=1;i<=N;i++){
        if (a[i] in alias)       # Replace by alias
          a[i] = alias[a[i]];
      }
      cr_or_args = a[1];         # Recombine
      for (i=2;i<=N;i++)
        cr_or_args = sprintf("%s;%s", cr_or_args, a[i]);
      print   "\t" $1 "\t" $2 "\t" quote cr_or_args quote
    }
    else
      print $0
  }
  if ($1=="###_END_OF_ALIAS_###")
    alias_file=0;
}' <junk > $1_cmp.m

rm -f junk








Deleted mttroot/mtt/bin/trans/cmp2sub_m2sh version [db33551972].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cmp2sub_m2sh

# Copyright (c) P.J.Gawthrop 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  2000/01/18 14:22:58  peterg
## Now exits if file already exists
##
## Revision 1.6  1999/08/25 21:20:07  peterg
## Don't list components starting with 0 ot 1
##
## Revision 1.5  1996/11/09 21:09:43  peterg
## Added lib path.
##
# Revision 1.4  1996/11/03  21:19:55  peterg
# Generates generic commands in form $1name$2.
#
## Revision 1.3  1996/11/01 12:48:21  peterg
## Run mtt in quiet mode.
##
## Revision 1.2  1996/10/20 19:22:41  peterg
## Cleans up after itself.
##
## Revision 1.1  1996/10/20 19:19:50  peterg
## Initial revision
##
###############################################################

if [ -f "$1_sub.sh" ]; then
    echo Using "$1_sub.sh"
    exit
else
    #Inform user
    echo Creating $1_sub.sh    
fi


echo '# Commands to generate subsystem representations'>  $1_sub.sh
echo "# File $1_sub.sh"			>> $1_sub.sh
echo "# Generated by MTT on `date`."	>> $1_sub.sh
echo					>> $1_sub.sh

# Get a list of all components for the _cmp file
awk '/comp_type = / {print substr($3,2,length($3)-3)}' $1_cmp.m |\
sort -u > mtt_tmp1

# Remove all components starting with 0 or 1
grep -v '^[01]' < mtt_tmp1 > mtt_tmp4

# Get a list of all standard simple components
ls $MTT_LIB/comp/simple |\
  awk '/_cause.m/{split($1,a,"_");print(a[1])}'  >mtt_tmp2

# Get a list of all standard compound components
#ls $MTTPATH/comp/compound |\
#  awk '/_abg.m/{split($1,a,"_");print(a[1])}'  >> mtt_tmp2

# Sorted combined list
cat mtt_tmp2 | \
  sed  's/^zero$/0/' |\
  sed  's/^one$/1/' |\
  sort -u >mtt_tmp3

# Print the non-standard components
comm mtt_tmp4 mtt_tmp3 |\
  awk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \
  >>$1_sub.sh

# Clean up mtt_tmp files
#rm -f mtt_tmp?








Deleted mttroot/mtt/bin/trans/cmp2sub_m2txt version [1729bdb196].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: makecr

# Copyright (c) P.J.Gawthrop 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1996/09/12 19:28:55  peter
## Added rcs header.
##
## Revision 1.4  1996/09/12 12:06:38  peter
## Removed reducndant lines.
##
## Revision 1.3  1996/09/12 12:05:01  peter
## Removed default crs.
##
## Revision 1.2  1996/09/10 16:18:37  peter
## Uses default constitutive relationship mtt/cr/r
##
## Revision 1.1  1996/08/24 14:53:06  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_cr.r

echo % Default CR file			>  $1_cr.r
echo % File $1_cr.r			>> $1_cr.r
echo % Generated by MTT on `date`.	>> $1_cr.r
echo					>> $1_cr.r
cat $MTTPATH/trans/m/rcs_header.txt	>> $1_cr.r
echo 'END;'				>> $1_cr.r








Deleted mttroot/mtt/bin/trans/contents.tex version [23a4ae4ea9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Contents etc for MTT documents


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/12/07 11:52:30  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  \tableofcontents
  \newpage
  \listoffigures
  \newpage

Deleted mttroot/mtt/bin/trans/convert_simpar.sh version [884ce541cf].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## Gets rid of redundant METHOD lines.
echo Converting $1
## backup
cp $1 $1_old
sed 's/METHOD/## METHOD/'< $1_old > $1



Deleted mttroot/mtt/bin/trans/cr_txt2r version [50e5d67b45].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135







































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################


# Bourne shell script: cr_txt2r

# Label file to constitutive relationship conversion
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11  2000/08/01 07:34:33  peterg
## Replaced printf by echo
##
## Revision 1.10  2000/02/25 09:10:12  peterg
## Changed -e to -f in if [ -f "$crf" ]; then
##  -- cuased probs on SUN
##
## Revision 1.9  2000/02/16 15:58:17  peterg
## Set level='' not $2
##
## Revision 1.8  1998/11/20 09:48:31  peterg
## Remove the _lower stuff -- see idf this works now.
##
## Revision 1.7  1998/04/14 17:46:28  peterg
## To avoid clashes when creating for more thsan one top level file, adds
## _lower attribute to lower lecel constitutive relationship files.
## .constitutive relationship files only in top level _constitutive
## relationship files.
##
## Revision 1.6  1998/04/14 13:54:15  peterg
## Uses the _sub.sh rep to recursively generate and include sub systems.
##
## Revision 1.5  1998/03/09 13:36:00  peterg
## Cosmetic change
##
## Revision 1.4  1998/03/06 15:54:41  peterg
## Put message bcak in in simpler form
##
## Revision 1.3  1998/03/06 15:51:06  peterg
## Zapped the irritating error message
##
## Revision 1.2  1998/03/04 15:32:53  peterg
## Major revision.
## Now just includes cr files using in"";
## Two sorts of CR:
## 	generic (.cr)
## 	tied to a system (_cr.r)
##
## Revision 1.1  1998/03/04 15:31:14  peterg
## Initial revision
##
# Revision 1.3  1997/04/09  12:59:43  peterg
# Looks for .cr file in current directory - copies from library if they
# don't already exist.
#
# Revision 1.2  1997/04/09  09:25:55  peterg
# Now copies .cr files from linrary to here (if they don't exist
# already).
#
# Revision 1.1  1997/04/09  09:08:12  peterg
# Initial revision
#
###############################################################

# The level of the recursion null at top level; _lower at lower levels.

level='' ## Used to be $2 - now set to null.

crfile=$1_cr.r
CRFILE=$1_cr.r

if [ -f "$crfile" ]; then
    echo "Using    $crfile"
else
    # Inform user
    echo "Creating $crfile"

    echo "% Constitutive relation file for $1 ($crfile)" > $crfile
    echo "% Generated by MTT at `date`" >> $crfile

    echo  >> $crfile

    # Recursively create subsystem CR files -- at lower level
    sh $1_sub.sh 'cr_txt2r ' ' _lower' 
    
    # Include subsystem CR files
    sh $1_sub.sh 'echo ' "_cr.r" |\
    awk '{
      print "in \"" $1 "\";"
    }'  >> $crfile

##  if [ -z "$level" ]; then

    # Copy .cr files
    awk '{
	 if (NF>0) {
         print "mtt -q -u crcopy " $1; 
         }
    }' $1_cr.txt  | sh

    # Include the .cr files
#    awk '{
#	 if (NF>0) {
#         print "in \"" $1 ".cr\";"
#         }
#    }' $1_cr.txt  >> $crfile

    ## list of the crs
    crs=`cat $1_cr.txt`
    for cr in $crs; do
        crf=$cr'_cr.r'
	if [ -f "$crf" ]; then
##	   printf "\045 (%s exists)\n" $crf >> $crfile
	   echo "% ($crf exists)"  >> $crfile
	else
##	   printf 'in "%s.cr";\n' $cr >> $crfile
	   echo 'in "'$cr.cr'";' >> $crfile
	fi
    done
##  fi
echo 'END;' >> $crfile

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


Deleted mttroot/mtt/bin/trans/cse2csm_r version [5225d88b5f].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse2csm_r
# Constrained-state equation to linear constrained-state matrices conversion
# P.J.Gawthrop  6th September 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  2000/04/07 19:11:59  peterg
## reduce --> $SYMBOLIC
##
## Revision 1.6  2000/04/06 11:27:56  peterg
## Removed the in _cr.r
##
## Revision 1.5  1999/12/08 02:04:46  peterg
## Removed bug - uj := MTTU(j,1); not commented out
##
## Revision 1.4  1999/11/22 23:49:50  peterg
## Writes out the new MTTNx and MTTNy
##
## Revision 1.3  1999/11/22 23:38:51  peterg
## Now does scse 2 scsm as well.
## Uses mkid.
##
## Revision 1.2  1998/07/13 09:56:31  peterg
## Back under RCS for major revision
##
# Revision 1.1  1996/08/25  10:13:37  peter
# Initial revision
#
###############################################################

# Inform user
echo Creating $1_$2.r

case $2 in
    csm)
	rep=cse;
	;;
    scsm)
	rep=scse;
	;;
    *)
	echo Representation must be csm or scsm;
        exit
esac
# Remove the old log file
rm -f cse2csm_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC >cse2csm_r.log << EOF

in "$1_def.r";
in "$1_$rep.r";
%%in "$1_cr.r";
%%in "$1_sympar.r";

OFF Echo;
OFF Nat;

% Get rid of the old mttx and u - now use mkid instead
clear MTTx, MTTu;

IF (MTTNx>0) THEN
BEGIN
% Find MTTA : the A matrix
matrix MTTA(MTTNx,MTTNx);

  FOR j := 1:MTTNx DO
    BEGIN
    %xj := MTTX(j,1);
    xj := mkid(MTTx,j);
    FOR i := 1:MTTNx DO
      MTTA(i,j) := df(MTTEdx(i,1), xj, 1);
    END;
END;

IF (MTTNx>0) AND (MTTNu>0) THEN
BEGIN
% Find MTTB : the B matrix
matrix MTTB(MTTNx,MTTNu);

  FOR j := 1:MTTNu DO
    BEGIN
    %uj := MTTU(j,1);
    uj := mkid(MTTu,j);
    FOR i := 1:MTTNx DO
      MTTB(i,j) := df(MTTEdx(i,1), uj, 1);
    END;
END;

IF (MTTNx>0) AND (MTTNy>0) THEN
BEGIN
% Find MTTC : the C matrix
matrix MTTC(MTTNy,MTTNx);

  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNx DO
    BEGIN
      %xj := MTTX(j,1);
      xj := mkid(MTTx,j);
      MTTC(i,j) := df(MTTY(i,1), xj, 1);
    END;
END;

IF (MTTNy>0) AND (MTTNu>0) THEN
BEGIN

% Find MTTD : the D matrix
matrix MTTD(MTTNy,MTTNu);

  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNu DO
    BEGIN
      %uj := MTTU(j,1);
      uj := mkid(MTTu,j);
      MTTD(i,j) := df(MTTY(i,1), uj, 1);
    END;
END;

%Substitute the ss values
in "$1_sspar.r";

%Create the output file
OUT "$1_$2.r";

% Constants

write "% New constants";
write "MTTNx := ", MTTNx, ";";
write "MTTNy := ", MTTNy, ";";


%Write out the matrices.
IF MTTNx>0 THEN
BEGIN
  write "matrix MTTE(", MTTNx, ",", MTTNx, ");";
  FOR i := 1:MTTNx DO
   FOR j := 1:MTTNx DO IF MTTE(i,j) NEQ 0 THEN
      write "MTTE(", i, ",", j, ") := ", MTTE(i,j);

  write "matrix MTTA(", MTTNx, ",", MTTNx, ");";
  FOR i := 1:MTTNx DO
   FOR j := 1:MTTNx DO IF MTTA(i,j) NEQ 0 THEN
      write "MTTA(", i, ",", j, ") := ", MTTA(i,j);
END;

IF MTTNx>0 THEN
IF MTTNu>0 THEN
BEGIN
  write "matrix MTTB(", MTTNx, ",", MTTNu, ");";
  FOR i := 1:MTTNx DO
   FOR j := 1:MTTNu DO IF MTTB(i,j) NEQ 0 THEN
      write "MTTB(", i, ",", j, ") := ", MTTB(i,j);
END;

%Write it out
IF MTTNy>0 THEN
IF MTTNx>0 THEN
BEGIN
  write "matrix MTTC(", MTTNy, ",", MTTNx, ");";
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNx DO IF MTTC(i,j) NEQ 0 THEN
      write "MTTC(", i, ",", j, ") := ", MTTC(i,j);
END;

IF MTTNy>0 THEN IF MTTNu>0 THEN 
BEGIN
  write "matrix MTTD(", MTTNy, ",", MTTNu, ");";
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNu DO IF MTTD(i,j) NEQ 0 THEN
      write "MTTD(", i, ",", j, ") := ", MTTD(i,j);
END;

write "END;";

SHUT "$1_$2.r";

EOF

# Now invoke the standard error handling.
mtt_error_r cse2csm_r.log



Deleted mttroot/mtt/bin/trans/cse2ode_r version [945a7d1a16].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141













































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse2ode_r
# Reduce constrained-state equations to ode.
# P.J.Gawthrop 10th May 199, 8th August 1991, April 1994, Dec 1994
# Copyright (c) P.J.Gawthrop, 1991, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.1.4.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
##
## Revision 1.1  2000/12/28 12:21:31  peterg
## Put under RCS
##
## Revision 1.2  1997/01/06 21:17:10  peterg
## Removed:  OFF Exp; OFF GCD;
##
## Revision 1.1  1996/08/25 10:05:45  peter
## Initial revision
##
###############################################################

optimise=''; optimise_msg=''
while [ -n "`echo $1 | grep '^-'`" ]; do
    case $1 in
	-optimise)
	    optimise='-optimise'
	    optimise_msg=' with optimisation' ;;
	*)
	    echo "$1 is an invalid argument - ignoring" ;;
    esac
    shift
done

# Create the reduce output code
def2write_r $optimise $1 ode
def2write_r $optimise $1 odeo

#Inform user
echo Creating $1_ode.r $optimise_msg
echo Creating $1_odeo.r $optimise_msg

# Remove the old log file
rm -f cse2ode_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC >cse2ode_r.log << EOF

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

%Read the definitions file
in "$1_def.r";

%Read the substitution file
in "$1_subs.r";

%Read the constrained-state equations file
in "$1_cse.r";

%Read the algebraic equations file
in "$1_ae.r";

IF MTTNx>0 THEN
 IF MTTNz>0 THEN
   MTTdXX := MTTE^(-1)*MTTEdX
 ELSE
   MTTdXX := MTTEdX;

%Remove all dX terms from y - a rather nasty method, sorry!
  MTTdX1 := 0;
  MTTdX2 := 0;
  MTTdX3 := 0;
  MTTdX4 := 0;
  MTTdX5 := 0;
  MTTdX6 := 0;
  MTTdX7 := 0;
  MTTdX8 := 0;
  MTTdX9 := 0;
  MTTdX10 := 0;
  MTTdX11 := 0;
  MTTdX12 := 0;
  MTTdX13 := 0;
  MTTdX14 := 0;
  MTTdX15 := 0;
  MTTdX16 := 0;
  MTTdX17 := 0;
  MTTdX18 := 0;
  MTTdX19 := 0;
  MTTdX20 := 0;

%Substitute  dX into y;
IF MTTNz>0 THEN
  IF MTTNx>0 THEN
    MTTY := MTTY + MTTEyx*MTTdX;

OFF Echo;
OFF Nat;

MTTdX := MTTdXX;

%Write out the  ordinary differential equations.
OUT "$1_ode.r";
write "%File: $1_ode.r";
in ("$1_ode_write.r");
write "in ""$1_odeo.r"";";
write "END;";
SHUT "$1_ode.r";

%Write out the  output equations
OUT "$1_odeo.r";
write "%File: $1_odeo.r";
in ("$1_odeo_write.r");
write "END;";
SHUT "$1_odeo.r";
quit;
EOF

# Now invoke the standard error handling.
mtt_error_r cse2ode_r.log








Deleted mttroot/mtt/bin/trans/cse2rfe_r version [5e4feb17e7].

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
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
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
173
174
175
176
177
178
179
180
181





















































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse2rfe_r
# Reduce  constrained-state equations to robot matrices
# Experimental version!
# State vector should have momenta in odd rows,angles in even;
# the last row should have the gravity velocity term.
# There should be one output (only) for each joint velocity.
# P.J.Gawthrop, Nov 92, Dec 93, May 1994
# Copyright (c) P.J.Gawthrop, 1992, May 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1996/12/05 12:10:00  peterg
## Version history added.
##
###############################################################

# Inform user
echo Creating $1_rfe.r

# Remove the old log file
rm -f cse2rfe_r.log

# Use reduce to accomplish the transformation
reduce >cse2rfe_r.log << EOF

IN "$1_def.r";
IN "$1_sympar.r";
IN "$1_csm.r";
IN "$1_cse.r";

MTTN2 := MTTNy;


%Find E11 and E12 matrices
MATRIX MTTE11(MTTN2,MTTN2), MTTE12(MTTN2,MTTN2);
FOR i := 1:MTTN2 DO
  FOR j := 1:MTTN2 DO
  BEGIN
    MTTE11(i,j) := MTTE(2*i-1,2*j-1);
    MTTE12(i,j) := MTTE(2*i-1,2*j);
  END;

%Find inertia matrix
MATRIX MTTImi(MTTN2,MTTN2);
FOR i := 1:MTTN2 DO
  BEGIN
    MTTImi(i,i) := MTTC(i,2*i-1);
   END;

MTTIm := MTTImi^-1;

%Find gravity matrix if there is an extra gravity state
MATRIX MTTG(MTTN2,1);
MTTNy2 := 2*MTTNy;
IF ( (MTTNx-1)/MTTNy2 = 1) THEN
FOR i := 1:MTTN2 DO
  BEGIN
    MTTG(i,1) := MTTE(2*i-1,MTTNx);
   END;



%Find V matrix from RHS of equation
MTTu1 := 0;
MTTu2 := 0;
MTTu3 := 0;
MTTu4 := 0;
MTTu5 := 0;
MTTu6 := 0;

MTTx2 := theta_1;
MTTx4 := theta_2;
MTTx6 := theta_3;
MTTx8 := theta_4;
MTTx10 := theta_5;
MTTx12 := theta_6;

MTTx1 := dot_theta_1*MTTIm(1,1);
MTTx3 := dot_theta_2*MTTIm(2,2);
MTTx5 := dot_theta_3*MTTIm(2,3);

MATRIX MTTdt(6,1);
MTTdt(1,1) := dot_theta_1;
MTTdt(2,1) := dot_theta_2;
MTTdt(3,1) := dot_theta_3;
MTTdt(4,1) := dot_theta_4;
MTTdt(5,1) := dot_theta_5;
MTTdt(6,1) := dot_theta_6;

MATRIX dtheta(MTTN2,1);
FOR i := 1:MTTN2 DO
  BEGIN
    dtheta(i,1) := MTTdt(i,1);
   END;

MATRIX MTTVrhs(MTTN2,1);
MATRIX MTTV(MTTN2,1);
FOR i := 1:MTTN2 DO
  BEGIN
    MTTVrhs(i,1) := MTTEdX(2*i-1,1);
   END;

%Find V matrix 
MTTV := MTTE12*dtheta - MTTVrhs;

%Find C matrix
MATRIX MTTC(MTTN2,MTTN2);
k := 0;
FOR i := 1:MTTN2 DO
  FOR j := 1:MTTN2 DO
  BEGIN
  coeffs := coeff(MTTV(i,1),MTTdt(j,1));
  IF length(coeffs)>2 THEN co := part(coeffs,3) ELSE co := 0;
  MTTC(i,j) := co;
  END;

%Find B matrix
MTTN3 := MTTN2*(MTTN2-1)/2;

IF MTTN3>0 THEN
BEGIN
MATRIX MTTB(MTTN2,MTTN3);
FOR i := 1:MTTN2 DO
BEGIN
  counter := 0;
  FOR j := 1:MTTN2-1 DO
  BEGIN
  coeffs := coeff(MTTV(i,1),MTTdt(j,1));
  IF length(coeffs)>1 THEN co := part(coeffs,2) ELSE co := 0;
    FOR k := j+1:MTTN2 DO
    BEGIN 
    counter := counter+1;
    coeffs2 := coeff(co,MTTdt(k,1));
    IF length(coeffs2)>1 THEN co2 := part(coeffs2,2) ELSE co2 := 0;
     MTTB(i,counter) := co2;
    END;
  END;
END;
END;

OFF Echo;
OFF Nat;
ON NERO;

OUT "$1_rfe.r";

%% M
write "MATRIX MTTM(", MTTN2, ",", MTTN2, ")";
MTTM := MTTE11*MTTIm;

%% V
write "MATRIX MTTRV(", MTTN2, ",1)";
MTTRV := MTTV;

%% 

write "MATRIX MTTRC(", MTTN2, ",", MTTN2, ")";
MTTRC := MTTC;

IF MTTN3>0 THEN
  BEGIN
  write "MATRIX MTTRB(", MTTN2, ",", MTTN3, ")";
  MTTRB := MTTRB;
END;

write "MATRIX MTTRG(", MTTN2, ", 1)";
MTTRG := MTTG;

write ";END;"$
SHUT "$1_rfe.r";
quit;
EOF

Deleted mttroot/mtt/bin/trans/cse2scse_r version [f23aba8df6].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258


































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse2scse_r
# Reduce constrained-state equations to sensitivity version
# P.J.Gawthrop 10th May 199, 8th August 1991, April 1994, Dec 1994
# Copyright (c) P.J.Gawthrop, 1999

# 	$Id$	

# Arguments
system=$1; 
system_def=$1_def.r
system_cse=$1_cse.r
system_scse=$1_scse.r

# Parameters
n=`echo $2 | sed 's/,/ /g' |wc -w` ## Number of parameters

## Parameter information for reduce.
parameters=`echo $2 | sed 's/,/ /g' |\
 awk '{
   for (i=1; i<=NF; i++) {
      printf("mttpar(%i,1) := %s;\n", i, $i);
      printf("mttcoef(%i,1) := %ss;\n", i, $i);
   }
  }'`

## Update sympar list.
echo Recreating $1_sympar.txt
# Zap any sensitivity coeficients
mv $1_sympar.txt mtt_junk
grep -v MTT_Sensitivity_Coefficients mtt_junk > $1_sympar.txt

# Create the new sens coeffs at end of list.
echo $2 | sed 's/,/ /g' |\
awk '{
   for (i=1; i<=NF; i++) {
      printf("%ss\tMTT_Sensitivity_Coefficients\n",$i);
   }
  }' >> $1_sympar.txt

touch $1_sympar.txt

matrix="matrix mttpar("$n",1); matrix mttcoef("$n",1);"

# Number of states
Nx=`grep "MTTNx " <$system_def | awk '{print $3}' | sed 's/;//'`

#Inform user
echo Creating $system_scse "(for parameters $2, $Nx states)"

# Remove the old log file
rm -f cse2scse_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC  << EOF >cse2scse_r.log

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

%Read the definitions file
in "$system_def";

%Read the constrained-state equations file
in "$system_cse";

% Declare the parameter matrix and fill it
$matrix
$parameters
mtt_n_par := $n;

MTTNx2 := 2*MTTNx;
MTTNy2 := 2*MTTNy;

% Compute the sensitivity E matrix
matrix MTTssE(MTTNx,MTTNx);
clear MTTx; % Dont use - mkid is better

FOR ii := 1:MTTNx DO
  FOR jj := 1:MTTNx DO
  IF MTTE(ii,jj) NEQ 0 THEN IF MTTE(ii,jj) NEQ 1 THEN
  BEGIN
    % First with respect to theta...
    FOR kk := 1:mtt_n_par DO
    BEGIN
      mttpar_k := mttpar(kk,1);
      mttcoef_k := mttcoef(kk,1);
      MTTssE(ii,jj) := MTTssE(ii,jj) + df(MTTE(ii,jj), mttpar_k)*mttcoef_k;
    END;
    % then with respect to x
    FOR i := 1:MTTNx DO
    BEGIN
      xi := mkid(MTTx,i);
      sxi := mkid(MTTsx,i);
      MTTssE(ii,jj) := MTTssE(ii,jj) + df(MTTE(ii,jj), xi)*sxi;
    END;
  END;

% Compute the sensitivity of the RHS of the cse
matrix MTTssEdx(MTTNx,1);
FOR ii := 1:MTTNx DO
BEGIN 
  % First with respect to theta
    FOR kk := 1:mtt_n_par DO
    BEGIN
      mttpar_k := mttpar(kk,1);
      mttcoef_k := mttcoef(kk,1);
      MTTssEdx(ii,1) := MTTssEdx(ii,1) + df(MTTEdx(ii,1), mttpar_k)*mttcoef_k;
    END;
% Then with respect to x
  FOR i := 1:MTTNx DO
  BEGIN
    xi := mkid(MTTx,i);
    sxi := mkid(MTTsx,i);
    MTTssEdx(ii,1) := MTTssEdx(ii,1) + df(MTTEdx(ii,1), xi)*sxi;
  END; 
END; 

% Sensitivity output function
matrix MTTssY(MTTNy,1);
FOR ii := 1:MTTNy DO
BEGIN 
  % First with respect to theta
    FOR kk := 1:mtt_n_par DO
    BEGIN
      mttpar_k := mttpar(kk,1);
      mttcoef_k := mttcoef(kk,1);
      MTTssY(ii,1) := MTTssY(ii,1) + df(MTTY(ii,1), mttpar_k)*mttcoef_k;
    END;
% Then with respect to x
  FOR i := 1:MTTNx DO
  BEGIN
    xi := mkid(MTTx,i);
    sxi := mkid(MTTsx,i);
    MTTssY(ii,1) := MTTssY(ii,1) + df(MTTY(ii,1), xi)*sxi;
  END; 
END; 


% Now reorganise everything into composite system
%  - odd rows are the system 
%  - even rows are the sensitivity system
% NB at this stage, the states are numbered incorrectly - sorted out below.

%E matrix 
matrix MTTsE(MTTNx2,MTTNx2);
FOR i := 1:MTTNx DO
  FOR j := 1:MTTNx DO
  BEGIN
    MTTsE(2*i-1,2*j-1) := MTTE(i,j);  % System
    MTTsE(2*i,2*j)     := MTTE(i,j);  % Sensitivity system
    MTTsE(2*i,2*j-1)   := MTTssE(i,j);  % Sensitivity system
  END; 

%dX matrix
matrix MTTsEdX(MTTNx2,1);

FOR i := 1:MTTNx DO
BEGIN
  MTTsEdX(2*i-1,1) := MTTEdx(i,1);
  MTTsEdX(2*i,1)   := MTTssEdx(i,1);
END; 

%Y matrix
matrix MTTsY(MTTNy2,1);%dX matrix
matrix MTTsEdX(MTTNx2,1);

FOR i := 1:MTTNx DO
BEGIN
  MTTsEdX(2*i-1,1) := MTTEdx(i,1);
  MTTsEdX(2*i,1)   := MTTssEdx(i,1);
END; 


FOR i := 1:MTTNy DO
BEGIN
  MTTsY(2*i-1,1) := MTTY(i,1);
  MTTsY(2*i,1)   := MTTssY(i,1);
END; 




OFF nat;

OUT "$system_scse";

write "%File: $system_scse";

% Constants

write "% New constants";
write "MTTNx := ", MTTNx2, ";";
write "MTTNy := ", MTTNy2, ";";

% E matrix
MTT_Matrix := MTTsE$ 
MTT_Matrix_name := "MTTE"$
MTT_Matrix_n := MTTNx2$
MTT_Matrix_m := MTTNx2$
Reduce_Matrix()$

% State derivative
MTT_Matrix := MTTsEdX$ 
MTT_Matrix_name := "MTTEdX"$
MTT_Matrix_n := MTTNx2$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Output
MTT_Matrix := MTTsY$ 
MTT_Matrix_name := "MTTY"$
MTT_Matrix_n := MTTNy2$
MTT_Matrix_m := 1$
Reduce_Matrix()$

write "END;";

SHUT "$system_scse";
quit;
EOF

# Now invoke the standard error handling.
mtt_error_r cse2scse_r.log


## Now reorganise the  states
mv -f $system_scse mtt_junk


##echo "Nx = $Nx"
awk '{
  ## Make sure all MTTn variables are followed by a space
  gsub(/mttx[0-9]*/, "& ");

  for (i=Nx;i>0;i--) {

    state = sprintf("mttx%i ",i);
    newstate = sprintf("mttx%i ",2*i-1);
    sstate = sprintf("mttsx%i",i);
    newsstate = sprintf("mttx%i",2*i);

    gsub(state,newstate);
    gsub(sstate,newsstate);

  }
  print $0
}' Nx=$Nx <mtt_junk > $system_scse






Deleted mttroot/mtt/bin/trans/cse2smx_lang version [840ce4dc3c].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228




































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse2smx_r
# Constrained-state equation to state matrices with x vector
# Used for implicit integration
# Copyright (C) 2000 by Peter J. Gawthrop
## Modified from eailier version


# Args
## Now default to matrix form
matrix='yes'
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
    -noglobals)
	noglobals='-noglobals';
	;;
    -parameters)
	parameters='-parameters';
	;;
    -matrix)
	matrix='yes';
	;;
    -optimise)
	optimise='LOAD SCOPE; ON GENTRANOPT;';
        iname='INAME mtt_o;';
	;;
    -fixcc )
        fix_pow='FOR ALL x,y LET x^y = pow(x,y);'
        blurb2='fixing c and cc code';
        unfix_pow='FOR ALL x,y CLEAR x^y;'
		;;
    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done

## Representation
if [ -z $1 ]; then
    echo 'usage [options] cse2smx_lang system [smx|smxa|smxax]'
    exit
fi


# Language
if [ -n "$3" ]; then
    lang=$3
else
    lang="m"
fi

## Representation
if [ -z $2 ]; then
    rep=smx;
else
    rep=$2
fi

case $rep in
    smx)
	nrep=0;
        out='[mtta,mttax]';
        nmatrix=1;
	;;
    smxa)
        nrep=1;
	if [ -n "$matrix" ]; then
          blurb="in matrix form";
          nmatrix=1;
	else
          blurb="in vector form";
          nmatrix=0;
	fi
        out='mtta';
	;;
    smxax)
	nrep=2
        out='mttax';
        nmatrix=0;
	;;
    *) echo Representation $2 not recognised;
       exit;;
esac


# Inform user
if [ -n "$optimise" ]; then
    blurbopt=' using code optimisation'
fi

echo Creating $1_$rep.$lang $blurb $blurbopt $blurb2
#echo Creating $1_smxx.$lang
#echo Creating $1_smxtx.$lang

# Remove the old log file
rm -f cse2smx_r.log
rm -f $1_smx.$lang
rm -f $1_smxx.$lang
rm -f $1_smxtx.$lang
rm -f $1_$rep.body

# Use reduce to accomplish the transformation
$SYMBOLIC << EOF  >cse2smx_lang.log

lang := $lang;

in "$1_subs.r";
in "$1_def.r";
in "$1_cse.r";
in "$1_cr.r";


clear mttx; % Dont need this now - use mkid instead

OFF Echo;

% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := 'Pascal;
ON GENTRANSEG; % Segmentation

OFF GENDECS;  % No declarations
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_tmp;
%% '
% Optimise
$optimise


ON GETDECS;    % Create decrarations automatically
DEFTYPE!* := 'REAL; % and default to real

%%% The following is a bug fix  from ZIB to fix 
%%% segmentation violation problem
symbolic procedure maxtype type;
% ------------------------------------------------------------------- ;
% A type may be a pair (l u) wher l is the minimum type for a variable;
% and  u is the maximum type. This procedure returns the maximum type.;
% ------------------------------------------------------------------- ;
   if atom type
   then type
   else if pairp cdr type then cadr type else car type;

% This fix handles the case that the type is a list with ONE entry.
% Should never happen ?? W.N.
%%%%%% End of bug fix

%Set up output according to the language.
 OFF NAT;
 GENTRANOUT "$1_$rep.body";

% Set up output according to the language.
    IF (lang = r) THEN 
    BEGIN
      write "matrix mtta(", mttnx, ",", mttnx, ");";    
      write "matrix mttb(", mttnx, ",", mttnu, ");";    
      write "matrix mttc(", mttny, ",", mttnx, ");";    
      write "matrix mttd(", mttny, ",", mttnu, ");";    
    END;

  ${fix_pow} %% set x^y to pow(x,y)

% find MTTA : the A matrix
  FOR i := 1:MTTNx DO
  BEGIN
    mttAAx_i := 0;
    FOR j := 1:MTTNx DO
    BEGIN
      ${unfix_pow} %% Revert to x^y form
      ij := i + MTTNx*(j-1);
      xj := mkid(mttx,j);
      a_ij := df(MTTEdx(i,1), xj, 1);
      aa_ij := MTTE(i,j) - mttt*a_ij;
      ${fix_pow} %% set x^y to pow(x,y)
      IF (aa_ij NEQ 0) THEN
        IF ($nmatrix EQ 1) THEN
        BEGIN
          %% Write a  with full indexing
          $iname
          GENTRAN mtta(i,j) ::=: aa_ij;
        END;
        IF (($nmatrix EQ 0) AND ($nrep EQ 1)) THEN
        BEGIN
          %% Write a  with vector indexing
          $iname
          GENTRAN mtta(ij) ::=: aa_ij;
        END;
        mttAAx_i := mttAAx_i + aa_ij*xj;
      END;
      IF (mttAAx_i NEQ 0) THEN
        IF (($nrep EQ 0) OR ($nrep EQ 2)) THEN
        BEGIN
          $iname
          GENTRAN mttax(i) ::=: mttAAx_i;
        END;


  END;

%Shut the  output according to the language.
 GENTRANSHUT "$1_$rep.body";
EOF

fix_broken_numbers ( ) {
    sed -e "/[0-9.]$/ N" -e "s/\([0-9.]\)[\n\t\ ]*\([0-9]\)/\1\2/g"
}

if [ "$lang" = "m" ]; then
#  lang_header $noglobals $parameters $1 $rep m 'mttx,mttu,mttt,mttpar' $out > $1_$rep.m
  mtt_header $1 $rep m > $1_$rep.m
  cat $1_$rep.body | fix_broken_numbers | mtt_p2m >> $1_$rep.m
  echo "## END Code" >> $1_$rep.m
  echo "endfunction" >> $1_$rep.m
fi
 
# Now invoke the standard error handling.
mtt_error_r cse2smx_lang.log




Deleted mttroot/mtt/bin/trans/cse_r2m version [4aef2899f0].

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
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













































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse_r2m
# Reduce constrained-state to simulab  constrained-state equations  
# P.J.Gawthrop 14 June 1991, 12 Jan 1994, April 1994.
# Copyright (c) P.J.Gawthrop 1991, 1994.

# Output must be filtered by matlab_tidy.

#Inform user
echo Creating $1_cse.m

# Remove the old log file
rm -f cse_r2m.log

# Use reduce to accomplish the transformation
reduce >cse_r2m.log << EOF

%Read the reduce definitions file
in "$1_def.r";

%Read the reduce  constrained-state equations   file
in "$1_cse.r";

%Read the reduce  substitution file
in "$1_subs.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the parameter file
%%in "$1_sympar.r";


ON BigFloat, NumVal;
PRECISION 16; %Compatible with Matlab
OFF Nat;

ON NERO;        % Suppress zero elements

OUT "$1_cse.m";

%Headings - Simulab style
%(Note. The ;; are deleted by for2mat)

write "function [sys,x0] = $1_cse(t,x,u,flag,xInitial);";

IF MTTNvar>0 THEN
BEGIN
  write "% Read in the parameters";
  write "global ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), " ..."
                  ELSE write MTTVar(i,1), ";"
  END;
END;


write "%Constrained-state eqns in Simulab form for system $1;;";
write "%File $1_cse.m;;";
write "%Generated by MTT;;";


write "if nargin<4; flag=0; end;";	
write "if (abs(flag) == 1) | (abs(flag) == 3)";	
write "% Set up the State variables";
FOR i := 1:MTTNx DO
BEGIN
  write "MTTx", i, " = x(", i, ");";
END;

write "% Set up the Input variables";
IF MTTNu>0 THEN
FOR i := 1:MTTNu DO
BEGIN
  write "MTTu", i, " = u(", i, ");";
END;
write "end;";

%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
OFF period$

write "if abs(flag) == 1	%State derivative";

write "MTTE = zeros(", MTTNx, ",", MTTNx, ");";
MTTE := MTTE;
MTTEdx := MTTEdx;
write "sys = MTTE\MTTEdx;";

write "elseif abs(flag) == 3	%Outputs";
MTTy := MTTy;
write "sys = MTTy;";

write "elseif abs(flag) == 0	%Structure";
write "	sys = [", MTTNx, ",0,", MTTNy, ",", MTTNu, ",0,0]";
write "	if nargin<5; xInitial = zeros(", MTTNx, ",1); end;";
write "	x0  = xInitial;";
write "end;";
SHUT "$1_cse.m";

Deleted mttroot/mtt/bin/trans/cse_r2tex version [a671e2cc38].

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
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
123
124
125
126
127
128
129
130
131
132




































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse_r2tex
# Reduce constrained-state to LaTex constrained-state equations.
# P.J.Gawthrop 10th May 199, 8th August 1991, April 1994, Jan 1995
# Copyright (c) P.J.Gawthrop, 1991, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  2000/08/24 11:48:55  peterg
## Include _subs file
##
## Revision 1.5  1999/11/22 23:44:47  peterg
## Now does scse as well
##
## Revision 1.4  1999/11/22 23:04:08  peterg
## *** empty log message ***
##
# Revision 1.3  1996/11/12  09:53:59  peterg
# Reads in the params.r file now.
#
# Revision 1.2  1996/11/12  09:11:20  peterg
# Removed all the hoorrible name changes
#
# Revision 1.1  1996/11/05  09:19:28  peterg
# Initial revision
#
###############################################################

#Inform user
echo Creating $1_$2.tex

# Remove the old log file
rm -f cse_r2tex.log

# Use reduce to accomplish the transformation
reduce >cse_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the parameter file
%%in "$1_params.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the constrained-state equations file
in "$1_$2.r";

OFF Echo;
OFF Nat;

OUT "$1_$2.tex";

%Write out the  constrained-state equations.

write "%File: $1_$2.tex";

write "%constrained-state equations";
	IF MTTNx>0 THEN
	FOR Row := 1:MTTNx DO
	BEGIN
	        write"\begin{equation}";
		write "\dot MTTEX", Row, " = ";
		write "{";
		write MTTEdX(Row,1);
		write "}";
		write"\end{equation}";
	END;



	IF MTTNy>0 THEN
	FOR Row := 1:MTTNy DO
	BEGIN
		write"\begin{equation}";
		write "MTTy", Row, " = ";
		write "{";
		write MTTy(Row,1);
		write "}";
		write"\end{equation}";
	END;


IF MTTNx NEQ 0 THEN
BEGIN
write "%  - E matrix";
write "\begin{equation}";
write "MTTE = \begin{pmatrix}";
	FOR Row := 1:MTTNx DO
	BEGIN
		FOR Col := 1:MTTNx DO
		BEGIN
			Write "{", MTTE(Row,Col), "}";
			IF Col<MTTNx THEN Write "&"
		END;

	IF Row<MTTNx THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;



%write "%  - E matrix";
%write "\begin{eqnarray}";
%	FOR Row := 1:MTTNx DO
%	BEGIN
%	  FOR Col := 1:MTTNx DO %IF MTTE(Row,Col) NEQ 0 THEN
%	  BEGIN
%	      Write "MTTE", Row, Col, " &=& {", MTTE(Row,Col), "}";
% 	      IF Row<MTTNx OR Col<MTTNx THEN Write "\cr";
%	  END;   
%	END;
%write "\end{eqnarray}";


SHUT "$1_$2.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/csm2sm_r version [d62d77923d].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142














































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: csm2sm_r
# Constrained-state equation to linear constrained-state matrices conversion
# P.J.Gawthrop  6th September 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 12:24:03  peterg
## Put under RCS
##
## Revision 1.2  1996/08/25 10:11:32  peter
## Added END in output file.
## Error handling.
##
## Revision 1.1  1996/08/19 15:06:16  peter
## Initial revision
##
###############################################################

optimise=''; optimise_msg=''
while [ -n "`echo $1 | grep '^-'`" ]; do
    case $1 in
	-optimise)
	    optimise='-optimise'
	    optimise_msg=' with optimisation' ;;
	*)
	    echo "$1 is an invalid argument - ignoring" ;;
    esac
    shift
done

# Create the reduce output code
def2write_r $optimise $1 $2

# Inform user
echo Creating $1_$2.r $optimise_msg

case $2 in
    sm)
        rep=csm;
        ;;
    ssm)
        rep=scsm
        ;;
    *)
        echo Representation must be sm or ssm
esac

# Remove the old log file
rm -f csm2sm_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC >csm2sm_r.log << EOF

in "$1_def.r";
in "$1_$rep.r";
in "$1_cr.r";
%%in "$1_sympar.r";

OFF Echo;
OFF Nat;

% Find MTTA and MTTB : the A and B matrices

MTTinvE := MTTE^(-1);
MTTA := MTTinvE*MTTA;
MTTB := MTTinvE*MTTB;

% Create the matrix declarations
OUT "$1_$2.r1";
write "MATRIX MTTA(", MTTNx, ",", MTTNx, ")$"; 
write "MATRIX MTTB(", MTTNx, ",", MTTNu, ")$"; 
write "MATRIX MTTC(", MTTNy, ",", MTTNx, ")$"; 
write "MATRIX MTTD(", MTTNy, ",", MTTNu, ")$"; 
SHUT "$1_$2.r1";

%Create the output file
OUT "$1_$2.r2";
write "%File: $1_ode.r";

write "% New constants";
write "MTTNx := ", MTTNx, ";";
write "MTTNy := ", MTTNy, ";";

in ("$1_sm_write.r");

%Write out the matrices.
% IF MTTNx>0 THEN
% BEGIN
%   write "matrix MTTA(", MTTNx, ",", MTTNx, ");";
%   FOR i := 1:MTTNx DO
%    FOR j := 1:MTTNx DO IF MTTA(i,j) NEQ 0 THEN
%       write "MTTA(", i, ",", j, ") := ", MTTA(i,j);
% END;

% IF MTTNx>0 THEN
% IF MTTNu>0 THEN
% BEGIN
%   write "matrix MTTB(", MTTNx, ",", MTTNu, ");";
%   FOR i := 1:MTTNx DO
%    FOR j := 1:MTTNu DO IF MTTB(i,j) NEQ 0 THEN
%       write "MTTB(", i, ",", j, ") := ", MTTB(i,j);
% END;

% %Write it out
% IF MTTNy>0 THEN
% IF MTTNx>0 THEN
% BEGIN
%   write "matrix MTTC(", MTTNy, ",", MTTNx, ");";
%   FOR i := 1:MTTNy DO
%     FOR j := 1:MTTNx DO IF MTTC(i,j) NEQ 0 THEN
%       write "MTTC(", i, ",", j, ") := ", MTTC(i,j);
% END;

% IF MTTNy>0 THEN IF MTTNu>0 THEN 
% BEGIN
%   write "matrix MTTD(", MTTNy, ",", MTTNu, ");";
%   FOR i := 1:MTTNy DO
%     FOR j := 1:MTTNu DO IF MTTD(i,j) NEQ 0 THEN
%       write "MTTD(", i, ",", j, ") := ", MTTD(i,j);
% END;

write "END;";

SHUT "$1_$2.r2";
quit;

EOF

cat $1_$2.r1 $1_$2.r2 > $1_$2.r

# Now invoke the standard error handling.
mtt_error_r csm2sm_r.log

Deleted mttroot/mtt/bin/trans/csm_r2m version [79de729926].

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
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


















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: csm_r2m
# Reduce constained state-space A,B,C,D and E matrices to Matlab
# P.J.Gawthrop July 1990, Feb 1991, May 1991, Sep 91, Dec 93, Jan 94, May 94.
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1996/08/19 18:40:02  peter
## read in the nuim_par function etc.
##
## Revision 1.1  1996/08/19 16:27:04  peter
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_$2.m

# Remove the old log file
rm -f csm_r2m.log

# Use reduce to accomplish the transformation
reduce >csm_r2m.log << EOF

%Read in the definitions file
in "$1_def.r";

%Read the reduce state-space A,B,C and D matrices file
in "$1_$2.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read in the parameter file
%%in "$1_sympar.r";


OUT "$1_$2.m";

%Headings - Matlab style
%(Note. The ;; are deleted by for2mat)

IF MTTNvar>0 THEN
BEGIN
  write "function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_$2(...";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                  ELSE write MTTVar(i,1), ");;";
  END;
END
ELSE write "function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_$2;;";


IF MTTNvar>0 THEN
BEGIN
  write "%function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_$2(...";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write "%", MTTVar(i,1), ",..."
                  ELSE write "%", MTTVar(i,1), ");;";
  END;
END
ELSE write "%function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_$2;;";


write "%Linearised constrained-state matrices for system $1";
write "%File $1_$2.m";
write "%Generated by MTT";

IF MTTNvar>0 THEN
BEGIN
  write "% Read in the parameters";
  write "[ ...;;";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                  ELSE write MTTVar(i,1), "] = $1_numpar"
  END;
  write "% Read in the arguments";
  write "$1_args";
END;

%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
OFF period$

write "MTTA = zeros(", MTTNx, ",", MTTNx, ");";
write "MTTB = zeros(", MTTNx, ",", MTTNu, ");";
write "MTTC = zeros(", MTTNy, ",", MTTNx, ");";
write "MTTD = zeros(", MTTNy, ",", MTTNu, ");";
write "MTTE = zeros(", MTTNx, ",", MTTNx, ");";

ON NERO;	% Suppress zero elements.
MTTA := MTTA;
MTTB := MTTB;
MTTC := MTTC;
MTTD := MTTD;
MTTE := MTTE;

SHUT "$1_$2.m";

Deleted mttroot/mtt/bin/trans/csm_r2tex version [c5c521eb67].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83



















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: csm_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  9 Sep 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, May 1994.

# Inform user
echo Creating $1_$2.tex

# Remove the old log file
rm -f csm_r2tex.log

# Use reduce to accomplish the transformation
reduce >csm_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the constrained-state matrices file
in "$1_$2.r";

%Read the symbolic parameters file
%%in "$1_sympar.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;

OUT "$1_$2.tex";

%Write out the constrained-state matrices.
write "%constrained-state  matrices $1";
write "%File: $1_$2.tex";
write"";

write "%constrained-state matrices";

MTT_Matrix := MTTA$ 
MTT_Matrix_name := "MTTA"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB$ 
MTT_Matrix_name := "MTTB"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC$ 
MTT_Matrix_name := "MTTC"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTD$ 
MTT_Matrix_name := "MTTD"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTE$ 
MTT_Matrix_name := "MTTE"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

SHUT "$1_$2.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/ctf_r2tex version [995ac3d6a0].

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



































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ctf_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

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


# Inform user
echo Creating $1_ctf.tex

# Remove the old log file
rm -f ctf_r2tex.log

# Use reduce to accomplish the transformation
reduce >ctf_r2tex.log<< EOF

%Read the definitions file
in "$1_def.r";

%Read the smconical-form matrices file
in "$1_ctf.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;


OUT "$1_ctf.tex";

%Write out the canonical matrices
write "%Controler TF $1";
write "%File: $1_ctf.tex";
write"";

MTT_Matrix := MTTcTF$ 
MTT_Matrix_name := "MTTcTF"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNy$
Latex_Matrix()$


SHUT "$1_ctf.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/dae2cse_r version [95da3f9a38].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474


























































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh


     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dae2cse_r
# Differential-algebraic equations to constrained-state equations
# P.J.Gawthrop 14 June 1991, 8 Aug 1991, 2 April 1992, 14 April 1994, 28 Dec 94
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.18  2001/10/05 23:37:32  geraint
## Fixed assignment statement in ae.r when RHS=0.
##
## Revision 1.17  2001/07/27 23:29:10  geraint
## Optimises only when requested (-opt).
##
## Revision 1.16  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.15.2.4  2001/06/26 00:55:48  geraint
## Writes algebraic equation Jacobian _aej.r (not used yet).
##
## Revision 1.15.2.3  2001/05/09 00:19:22  geraint
## Fixed EOF error when MTTNYZ=0.
##
## Revision 1.15.2.2  2001/05/05 20:50:16  geraint
## Fixed errors when MTTNx=0.
##
## Revision 1.15.2.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
##
## Revision 1.15  2001/03/19 02:28:52  geraint
## Branch merge: merging-ode2odes-exe back to MAIN.
##
## Revision 1.14.2.1  2001/03/19 00:29:08  geraint
## Parse switches (-A) before calling def2write_r.
## Update $1_def.* instead of removing.
##
## Revision 1.14  2000/12/28 12:24:35  peterg
## *** empty log message ***
##
## Revision 1.13  2000/10/11 08:52:46  peterg
## Creates csex (cse with dxe only) rep.
##
## Revision 1.12  2000/10/10 21:00:58  peterg
## New code genration
##
## Revision 1.11  1998/11/26 09:18:55  peterg
## Incluse subs.r
##
## Revision 1.10  1998/11/18 13:50:29  peterg
## Removed writeing of EYz matrix
##
## Revision 1.9  1998/11/18 10:53:38  peterg
## Put in some more "IF MTTNx>0 THEN" to avoid error messages when no
## states.
##
## Revision 1.8  1998/11/10 08:54:34  peterg
## Put in "IF MTTNx>0 THEN" to prevent probs when Nx=0
##  -- still a couple of apparent error messages - but answers now
## correct
##
## Revision 1.7  1998/10/05 10:46:15  peterg
## Commented out redundant MTTY := MTTY + MTTEyx*MTTEdX;
##
## Revision 1.6  1998/07/19 12:44:35  peterg
## Set MTTYz := 0 if the array is empty - avoids irritating error
## message.
##
## Revision 1.5  1998/05/20 15:23:26  peterg
## Put MTTYz := MTTYz outsise the BEGIN/END
##
## Revision 1.4  1998/05/20 15:13:09  peterg
## Writes out algebraic equations (if any).
##
## Revision 1.3  1998/03/03 09:02:46  peterg
## Replaced MTTEyx*MTTEdX + MTTEyu*MTTdu; term
##
## Revision 1.2  1997/08/26 08:22:36  peterg
## Changed
## MTTY := MTTY + MTTEyx*MTTdX + MTTEyu*MTTdu;
## to
## MTTY := MTTY + MTTEyx*MTTEdX + MTTEyu*MTTdu;
##
## This sorts out the problem when dz appears in the output equation.
##
## Revision 1.1  1997/08/26 08:20:18  peterg
## Initial revision
##
## Revision 1.2  1996/08/25 09:57:30  peter
## Sorted out bug when MTTNz=0
##
## Revision 1.1  1996/08/15 16:47:02  peter
## Initial revision
##
###############################################################

#Explicit solution option and optimise option
solve=0; solve_msg=''
optimise=''; optimise_msg=''
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
        -A )
                solve=1
		solve_msg=' with explicit solution of algebraic equations' ;;
	-fixcc )
                fixcc=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'`
                fix_msg='fixing c and cc code';
		;;
	-optimise)
	    optimise='-optimise'
	    optimise_msg=' with optimisation' ;;
        *)
                echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

# Create the reduce output code
def2write_r $optimise $1 cse 
def2write_r $optimise $1 csex # Version without E matrix
def2write_r $optimise $1 cseo

echo "Creating $1_cse.r $solve_msg $optimise_msg $fix_msg"
echo "Creating $1_csex.r $optimise_msg"
echo "Creating $1_cseo.r $optimise_msg"

# Remove the old log file
rm -f dae2cse_r.log

# Remove some files
rm -f $1_cse.r? $1_cseo.r?

# Use reduce to accomplish the transformation
$SYMBOLIC >dae2cse_r.log << EOF

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

OFF Echo;
OFF Nat;
ON NERO;

%Fix c code if required
$fixcc

in "$1_def.r";
MTTdxs := MTTdX;  %Save the symbolic form of dX

in "$1_subs.r";
in "$1_dae.r";


%Create F_x, F_y matrices - assumming equations are 
% linear in dZ
IF MTTNz>0 THEN 
BEGIN

IF MTTNx>0 THEN 
BEGIN

% Find MTTFx;
write "% Find MTTFx;";

matrix MTTFx(MTTNx,MTTNz);
FOR j := 1:MTTNz DO
  BEGIN
  dzj := MTTdZ(j,1);
  FOR i := 1:MTTNx DO
    MTTFx(i,j) := df(MTTdX(i,1), dzj, 1);
  END;

END;

% Find MTTFy;
write "% Find MTTFy;";

matrix MTTFy(MTTNy,MTTNz);
FOR j := 1:MTTNz DO
  BEGIN
  dzj := MTTdZ(j,1);
  FOR i := 1:MTTNy DO
    MTTFy(i,j) := df(MTTy(i,1), dzj, 1);
  END;

%Create G_x, G_u matrices 
write "%Create G_x, G_u matrices ";


% Find MTTGx;
IF MTTNx>0 THEN 
BEGIN
write "% Find MTTGx;";

matrix MTTGx(MTTNz,MTTNx);
FOR j := 1:MTTNx DO
  BEGIN
  xj := MTTX(j,1);
  FOR i := 1:MTTNz DO
    MTTGx(i,j) := df(MTTZ(i,1), xj, 1);
  END;
END;

% Find MTTGu;
write "% Find MTTGu;";

matrix MTTGu(MTTNz,MTTNu);
FOR j := 1:MTTNu DO
  BEGIN
  uj := MTTu(j,1);
  FOR i := 1:MTTNz DO
    MTTGu(i,j) := df(MTTZ(i,1), uj, 1);
  END;

%Create E matrices
write "%Create E matrices";

IF MTTNx>0 THEN 
BEGIN
matrix MTTExx(MTTNx,MTTNx); MTTExx := MTTFx*MTTGx;
matrix MTTExu(MTTNx,MTTNu); MTTExu := MTTFx*MTTGu;
matrix MTTEyx(MTTNy,MTTNx); MTTEyx := MTTFy*MTTGx;
matrix MTTE(MTTNx,MTTNx);   MTTE := MTTI - MTTExx;
END;
matrix MTTEyu(MTTNy,MTTNu); MTTEyu := MTTFy*MTTGu;




  %% The following gets rid of the dZs; there must be a better way.
  MTTdZ1 := 0;
  MTTdZ2 := 0;
  MTTdZ3 := 0;
  MTTdZ4 := 0;
  MTTdZ5 := 0;
  MTTdZ6 := 0;
  MTTdZ7 := 0;
  MTTdZ8 := 0;
  MTTdZ9 := 0;
  MTTdZ10 := 0;
  MTTdZ11 := 0;
  MTTdZ12 := 0;
  MTTdZ13 := 0;
  MTTdZ14 := 0;
  MTTdZ15 := 0;
  MTTdZ16 := 0;
  MTTdZ17 := 0;
  MTTdZ18 := 0;
  MTTdZ19 := 0;

IF MTTNx>0 THEN 
BEGIN
MTTEdX := MTTdX; %Ie MTTEdX is MTTdX with the dz terms deleted ie EdX.
MTTdX := MTTdXs;  %Restore the symbolic dX

%% Add on input derivative terms
MTTEdX := MTTEdX + MTTExu*MTTdu;
END;


%%%%%MTTY := MTTY + MTTEyx*MTTEdX;
%%% This causes the matrix mismatch
%%% MTTdXs and MTTdu need setting in _def.r file
MTTY := MTTY +  MTTEyu*MTTdu;

IF MTTNx>0 THEN 
  MTTY := MTTY + MTTEyx*(MTTE^(-1))*MTTEdX;


END; %%of MTTNz>0

IF MTTNz=0 THEN 
BEGIN
  MTTEdX := MTTdX;
  MTTE   := MTTI;
END;

IF (MTTNyz>0) AND ($solve>0) THEN
BEGIN
  %%%% Try and solve algebraic loops!!

  %Create list of the relevant equations 
  MTT_eqns := {};
  FOR i := 1:MTTNyz DO
    MTT_eqns := append(MTT_eqns,{MTTyz(i,1)});

  %Create list of the relevant unknowns
  MTT_unknowns := {};
  FOR i := 1:MTTNyz DO
    MTT_unknowns := append(MTT_unknowns,{MTTUi(i,1)});

  %Solve the algebraic equations symbolically
    MTT_sol := solve(MTT_eqns,MTT_unknowns);
  %The result seems to be in an extra list - I dont know why
  % So remove the outer list with first.
  % But only if more than one list element!

  if MTTNyz>1 THEN
    MTT_sol := first(MTT_sol);

  %Substitute back into the equations
  FOR i := 1:MTTNyz DO
  BEGIN
    MTT_sol_i := first(MTT_sol); MTT_sol := rest(MTT_sol);
    set(lhs(MTT_sol_i),rhs(MTT_sol_i));
  END;

  % No algebraic variables left!
  MTTNYz := 0;
END; % IF MTTNyz>0 and $solve

OUT "$1_ae.r";
IF (MTTNyz>0) THEN % not $solve (or perhaps solution failed?)
BEGIN
    WRITE "MATRIX MTTyz(",MTTNyz,",1)";
    WRITE "%File: $1_ae.r";
    FOR i := 1:MTTNyz DO
	WRITE "MTTyz(",i,",1) := ",MTTyz(i,1)," +0";
END; % if MTTNyz>0 (and !$solve)
WRITE ";END;";
SHUT "$1_ae.r";

OUT "$1_aej.r";
IF (MTTNyz>0) THEN % as above
BEGIN
    WRITE "MATRIX MTTyzj(",MTTNyz,",",MTTNyz,")";
    WRITE "%File: $1_aej.r";
    FOR i := 1:MTTNyz DO
	FOR j := 1:MTTNyz DO
	BEGIN
	   didj := df(MTTyz(i,1),mkid('mttui,j));
	   IF (didj NEQ 0) THEN
	      WRITE "MTTyzj(",i,",",j,") := ",didj," +0";
	END;
END;
WRITE ";END;";
SHUT "$1_aej.r";

% Create the matrix declarations
OUT "$1_cse.r1";
write "%";
IF (MTTNx > 0) THEN
BEGIN
    write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; 
    write "MATRIX MTTE(", MTTNx, ",", MTTNx, ")$"; 
END;
SHUT "$1_cse.r1";

OUT "$1_csex.r1";
write "%File:$1_csex.r1";
IF (MTTNx > 0) THEN
    write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; 
SHUT "$1_csex.r1";

IF MTTNy>0 THEN
BEGIN
  OUT "$1_cseo.r1";
  write "MATRIX MTTY(", MTTNy, ",", 1, ")$"; 
  SHUT "$1_cseo.r1";
END;

%%Create the _cse.r file
OUT "$1_cse.r2";
write "%File: $1_cse.r";
in ("$1_cse_write.r");
write "in ""$1_cseo.r"";";
write "END;";

% % State derivative
% MTT_Matrix := MTTEdX$ 
% MTT_Matrix_name := "MTTEdX"$
% MTT_Matrix_n := MTTNx$
% MTT_Matrix_m := 1$
% Reduce_Matrix()$

% % Output
% MTT_Matrix := MTTY$ 
% MTT_Matrix_name := "MTTY"$
% MTT_Matrix_n := MTTNy$
% MTT_Matrix_m := 1$
% Reduce_Matrix()$

% % Inputs
% MTT_Matrix := MTTU$ 
% MTT_Matrix_name := "MTTU"$
% MTT_Matrix_n := MTTNu$
% MTT_Matrix_m := 1$
% Reduce_Matrix()$
% MTT_Matrix := MTTdU$ 
% MTT_Matrix_name := "MTTdU"$
% MTT_Matrix_n := MTTNu$
% MTT_Matrix_m := 1$
% Reduce_Matrix()$

% % E matrix
% MTT_Matrix := MTTE$ 
% MTT_Matrix_name := "MTTE"$
% MTT_Matrix_n := MTTNx$
% MTT_Matrix_m := MTTNx$
% Reduce_Matrix()$

% % Eyx matrix
% MTT_Matrix := MTTEyx$ 
% MTT_Matrix_name := "MTTEyx"$
% MTT_Matrix_n := MTTNy$
% MTT_Matrix_m := MTTNx$
% %Reduce_Matrix()$

% % Yz
% MTT_Matrix := MTTYz$ 
% MTT_Matrix_name := "MTTYz"$
% MTT_Matrix_n := MTTNyz$
% MTT_Matrix_m := 1$
% Reduce_Matrix()$

write ";END;";

SHUT "$1_cse.r2";

OUT "$1_csex.r2";
write "%File: $1_cse.r";
in ("$1_csex_write.r");
write "END;";
SHUT "$1_csex.r2";

%Write out the  output equations
IF MTTNy>0 THEN
BEGIN
OUT "$1_cseo.r2";
write "%File: $1_cseo.r";
in ("$1_cseo_write.r");
write "END;";
SHUT "$1_cseo.r2";
END;
quit;
EOF

touch $1_cseo.r1
touch $1_cseo.r2
cat $1_cse.r1 $1_cse.r2  > $1_cse.r
cat $1_csex.r1 $1_csex.r2  > $1_csex.r
cat $1_cseo.r1 $1_cseo.r2  > $1_cseo.r

if [ "$solve" = "1" ]; then
    echo "Setting MTTNyz=0 in $1_def.r and updating other $1_def files"
    awk '{
     if ($1=="MTTNyz") 
       print "MTTNyz := 0;" 
     else print $0
    }' $1_def.r > mtt_junk
  # Make sure it preserves the time stamp!!
  # and remove dependent reps
   touch -r $1_def.r mtt_junk
   mv mtt_junk $1_def.r
   for file in `ls $1_def.*`; do
      if [ $file != $1_def.r ]; then
          ext=`echo $file|awk -F\. '{print $2}'`
          mtt -q $1 def $ext
      fi
   done
fi


# Now invoke the standard error handling.
mtt_error_r dae2cse_r.log

Deleted mttroot/mtt/bin/trans/dae2daes_m version [2d36d30236].

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
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




















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dae2daesol_m

# Transforms descriptor matrix rep to step response

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1998/05/14 08:14:28  peterg
## Now reads in data from the simpar file.
##
## Revision 1.5  1998/05/13 16:42:03  peterg
## Fixed various bugs etc.
##
# Revision 1.4  1996/08/24  14:27:59  peter
# Global parameters.
# Error handling.
#
## Revision 1.3  1996/08/18 12:00:19  peter
## Unified format of responses.
##
## Revision 1.2  1996/08/16 13:17:57  peter
## Changed default args to include nx+nz
## Fixed bug with vector outputs.
##
## Revision 1.1  1996/08/15 16:24:55  peter
## Initial revision
##
###############################################################


echo Creating $1_daes.m
echo Creating $1_daeso.m
rm -f dae2daes_m.log
rm -f $1_daes.m
rm -f $1_daeso.m


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

  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;
  
  % Number of descriptor "states"
  NX = nx+2*nz+nyz;

  %Read in parameters
  $1_numpar; 
 
  %Read in state (needs redoing for descriptor xevtor
  %x = $1_state;


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

  t=0;  %Just in case its in the parameter list

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

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

  if exist('dx0')==0
   dx0 = zeros(NX,1);
  end;

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

if NX>0
  x = dassl("$1_dae", x0, dx0,  T);
  write_matrix([T,x], '$1_daes');
else
  x = zeros(size(T));
end;

if ny>0
  i=0;
  Y = [];
  for tt=T'
    i=i+1;
    y = $1_daeo(x(i,:),tt);
    Y = [Y; y'];
  end;
  write_matrix([T,Y], '$1_daeso');
end;

EOF

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








Deleted mttroot/mtt/bin/trans/dae2daes_m version [27f1864b05].

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
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




















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dae2daesol_m

# Transforms descriptor matrix rep to step response

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1998/05/14 08:14:28  peterg
## Now reads in data from the simpar file.
##
## Revision 1.5  1998/05/13 16:42:03  peterg
## Fixed various bugs etc.
##
# Revision 1.4  1996/08/24  14:27:59  peter
# Global parameters.
# Error handling.
#
## Revision 1.3  1996/08/18 12:00:19  peter
## Unified format of responses.
##
## Revision 1.2  1996/08/16 13:17:57  peter
## Changed default args to include nx+nz
## Fixed bug with vector outputs.
##
## Revision 1.1  1996/08/15 16:24:55  peter
## Initial revision
##
###############################################################


echo Creating $1_daes.m
echo Creating $1_daeso.m
rm -f dae2daes_m.log
rm -f $1_daes.m
rm -f $1_daeso.m


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

  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;
  
  % Number of descriptor "states"
  NX = nx+2*nz+nyz;

  %Read in parameters
  $1_numpar; 
 
  %Read in state (needs redoing for descriptor xevtor
  %x = $1_state;


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

  t=0;  %Just in case its in the parameter list

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

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

  if exist('dx0')==0
   dx0 = zeros(NX,1);
  end;

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

if NX>0
  x = dassl("$1_dae", x0, dx0,  T);
  write_matrix([T,x], '$1_daes');
else
  x = zeros(size(T));
end;

if ny>0
  i=0;
  Y = [];
  for tt=T'
    i=i+1;
    y = $1_daeo(x(i,:),tt)';
    Y = [Y; y'];
  end;
  write_matrix([T,Y], '$1_daeso');
end;

EOF

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








Deleted mttroot/mtt/bin/trans/dae2dm_r version [b03f8606db].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327







































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dae2dm_r
# Differential-algebraic equation to linear descriptor matrices conversion
# P.J.Gawthrop  8th May 1991, 7 June 1991, April 1994.
# Copyright (c) P.J.Gawthrop, 1991, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2  1996/08/25  09:53:35  peter
# Error handling added.
#
## Revision 1.1  1996/08/18 20:03:51  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_dm.r

# Remove the old log file
rm -f dae2dm_r.log

# Use reduce to accomplish the transformation
reduce >dae2dm_r.log << EOF

in "$1_def.r";
in "$1_dae.r";
in "$1_cr.r";
%%in "$1_sympar.r";

OFF Echo;
OFF Nat;


%Total number of descriptor variables
MTTN := MTTNx + 2*MTTNz + MTTNyz;

IF MTTN>0 THEN
BEGIN
% Find MTTE : the E matrix
matrix MTTE(MTTN,MTTN);

% First row partition
IF MTTNx>0 THEN 
    FOR j := 1:MTTNx DO
      MTTE(j,j) := 1;

% Second row partition
  IF MTTNz>0 THEN 
     FOR j := 1:MTTNz DO
      MTTE(j+MTTNx, j+MTTNx) := 1;

% Find MTTA : the A matrix
matrix MTTA(MTTN,MTTN);

% First row partition: x
IF MTTNx>0 THEN 
  BEGIN
  FOR j := 1:MTTNx DO
    BEGIN
    xj := MTTX(j,1);
    FOR i := 1:MTTNx DO
      MTTA(i,j) := df(MTTdX(i,1), xj, 1);
    END;

  IF MTTNz>0 THEN 
     FOR j := 1:MTTNz DO
       BEGIN
       dzj := MTTdz(j,1);
       FOR i := 1:MTTNx DO
         MTTA(i, j + MTTNx + MTTNz) := df(MTTdX(i,1), dzj, 1);
       END;

  IF MTTNyz>0 THEN 
     FOR j := 1:MTTNyz DO
       BEGIN
       uij := MTTUi(j,1);
       FOR i := 1:MTTNx DO
         MTTA(i, j + MTTNx + 2*MTTNz) := df(MTTdX(i,1), uij, 1);
       END;
  END;

% Second row partition: z
IF MTTNz>0 THEN 
  FOR j := 1:MTTNz DO
    MTTA(j + MTTNx, j + MTTNx + MTTNz) := 1;

% Third row partition
IF MTTNz>0 THEN 
  BEGIN
  IF MTTNx>0 THEN 
  FOR j := 1:MTTNx DO
    BEGIN
    xj := MTTX(j,1);
    FOR i := 1:MTTNz DO
      MTTA(i + MTTNx + MTTNz,j) := df(MTTZ(i,1), xj, 1);
    END;

   FOR j := 1:MTTNz DO
	MTTA(j + MTTNx + MTTNz, j + MTTNx) := -1;

   FOR j := 1:MTTNz DO
     BEGIN
     dzj := MTTdz(j,1);
     FOR i := 1:MTTNz DO
       MTTA(i + MTTNx + MTTNz, j + MTTNx + MTTNz) := df(MTTZ(i,1), dzj, 1);
     END;

  IF MTTNyz>0 THEN 
     FOR j := 1:MTTNyz DO
       BEGIN
       uij := MTTUi(j,1);
       FOR i := 1:MTTNz DO
         MTTA(i+MTTNx+MTTNz, j+MTTNx+2*MTTNz) := df(MTTZ(i,1), uij, 1);
       END;
  END;


% Fourth row partition
IF MTTNyz>0 THEN 
  BEGIN
  IF MTTNx>0 THEN 
  FOR j := 1:MTTNx DO
    BEGIN
    xj := MTTX(j,1);
    FOR i := 1:MTTNyz DO
      MTTA(i + MTTNx + 2*MTTNz,j) := df(MTTYz(i,1), xj, 1);
    END;

  IF MTTNz>0 THEN 
  FOR j := 1:MTTNz DO
    BEGIN
     dzj := MTTdz(j,1);
    FOR i := 1:MTTNyz DO
      MTTA(i + MTTNx + 2*MTTNz, j + MTTNx + MTTNz) := df(MTTYz(i,1), dzj, 1);
    END;

  IF MTTNyz>0 THEN 
     FOR j := 1:MTTNyz DO
       BEGIN
       uij := MTTUi(j,1);
       FOR i := 1:MTTNyz DO
         MTTA(i+MTTNx+2*MTTNz, j+MTTNx+2*MTTNz) := df(MTTYz(i,1), uij, 1);
       END;
  END;

% Find MTTB : the B matrix
matrix MTTB(MTTN,MTTNu);

IF MTTNu>0 THEN
BEGIN

% First row partition
IF MTTNx>0 THEN 
  BEGIN
  FOR j := 1:MTTNu DO
    BEGIN
    uj := MTTU(j,1);
    FOR i := 1:MTTNx DO
      MTTB(i,j) := df(MTTdX(i,1), uj, 1);
    END;
  END;

% Third row partition
IF MTTNz>0 THEN 
  BEGIN
  FOR j := 1:MTTNu DO
    BEGIN
    uj := MTTU(j,1);
    FOR i := 1:MTTNz DO
      MTTB(i + MTTNx + MTTNz ,j) := df(MTTZ(i,1), uj, 1);
    END;
  END;

% Fourth row partition
IF MTTNyz>0 THEN 
  BEGIN
  FOR j := 1:MTTNu DO
    BEGIN
    uj := MTTU(j,1);
    FOR i := 1:MTTNyz DO
      MTTB(i + MTTNx + 2*MTTNz,j) := df(MTTYz(i,1), uj, 1);
    END;
  END;

END;

% Find MTTC : the C matrix
matrix MTTC(MTTNy,MTTN);
IF MTTNy>0 THEN
BEGIN

% First column partition
IF MTTNx>0 THEN 
  BEGIN
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNx DO
    BEGIN
      xj := MTTX(j,1);
      MTTC(i,j) := df(MTTY(i,1), xj, 1);
    END;
  END;

% Third column partition
IF MTTNz>0 THEN 
  BEGIN
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNz DO
    BEGIN
      dzj := MTTdZ(j,1);
      MTTC(i, j + MTTNx + MTTNz) := df(MTTY(i,1), dzj, 1);
    END;
  END;

% Fourth column partition
IF MTTNyz>0 THEN 
  BEGIN
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNyz DO
    BEGIN
      uij := MTTUi(j,1);
      MTTC(i, j + MTTNx + 2*MTTNz) := df(MTTY(i,1), uij, 1);
    END;
  END;

END;
END; %of MTTN>0

% Find MTTD : the D matrix
matrix MTTD(MTTNy,MTTNu);
IF MTTNy>0 THEN
IF MTTNu>0 THEN
BEGIN
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNu DO
    BEGIN
      uj := MTTU(j,1);
      MTTD(i,j) := df(MTTY(i,1), uj, 1);
    END;
END;

%Zap the dz terms (not a nice way)
MTTdz1 := 0;
MTTdz2 := 0;
MTTdz3 := 0;
MTTdz4 := 0;
MTTdz5 := 0;
MTTdz6 := 0;
MTTdz7 := 0;
MTTdz8 := 0;
MTTdz9 := 0;
MTTdz10 := 0;
MTTdz11 := 0;
MTTdz12 := 0;
MTTdz13 := 0;
MTTdz14 := 0;
MTTdz15 := 0;
MTTdz16 := 0;
MTTdz17 := 0;
MTTdz18 := 0;
MTTdz19 := 0;


%Substitute the ss values
in "$1_sspar.r";

%Create the output file
OUT "$1_dm.r";

%Write out the matrices.
IF MTTN>0 THEN
BEGIN
  write "matrix MTTE(", MTTN, ",", MTTN, ");";
  FOR i := 1:MTTN DO
   FOR j := 1:MTTN DO IF MTTE(i,j) NEQ 0 THEN
      write "MTTE(", i, ",", j, ") := ", MTTE(i,j);

  write "matrix MTTA(", MTTN, ",", MTTN, ");";
  FOR i := 1:MTTN DO
   FOR j := 1:MTTN DO IF MTTA(i,j) NEQ 0 THEN
      write "MTTA(", i, ",", j, ") := ", MTTA(i,j);
END;

IF MTTN>0 THEN
IF MTTNu>0 THEN
BEGIN
  write "matrix MTTB(", MTTN, ",", MTTNu, ");";
  FOR i := 1:MTTN DO
   FOR j := 1:MTTNu DO IF MTTB(i,j) NEQ 0 THEN
      write "MTTB(", i, ",", j, ") := ", MTTB(i,j);
END;

%Write it out
IF MTTNy>0 THEN
IF MTTN>0 THEN
BEGIN
  write "matrix MTTC(", MTTNy, ",", MTTN, ");";
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTN DO IF MTTC(i,j) NEQ 0 THEN
      write "MTTC(", i, ",", j, ") := ", MTTC(i,j);
END;

IF MTTNy>0 THEN IF MTTNu>0 THEN 
BEGIN
  write "matrix MTTD(", MTTNy, ",", MTTNu, ");";
  FOR i := 1:MTTNy DO
    FOR j := 1:MTTNu DO IF MTTD(i,j) NEQ 0 THEN
      write "MTTD(", i, ",", j, ") := ", MTTD(i,j);
END;

write "END;";

SHUT "$1_dm.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r dae2dm_r.log

Deleted mttroot/mtt/bin/trans/dae2ker_r version [d1d098f9c2].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
## Shell script dae2ker_r
## Converts dae to behavioral kernal rep. 


echo Creating $1_ker.r

$SYMBOLIC > dae2ker.log <<EOF

% Read the files
in "$1_dae.r";

% Substitute for the non-state derivatives
FOR i:=1:MTTNz DO
BEGIN
  set(mkid(mttdz,i),s*mttz(i,1));
END;

% Create a list algebraic equations set to zero
eq_list:={}; v_list:={};
FOR i:=1:MTTNyz DO
BEGIN
  eq_list := append(eq_list, {MTTyz(i,1)=0});
  v_list := append(v_list,{mkid(mttui,i)});
END;

eq_list; v_list;

%Solve for the "unknown" latent variables
sol := solve(eq_list,v_list);

% Substitute into the manifest variables array
FOR i:=1:MTTNy DO
BEGIN
  mtty(i,1) := sub(sol,mtty(i,1));  
END;

% Eliminate the "external" latent variables
eq_list:={}; v_list:={};
FOR i:=1:MTTNy DO
BEGIN
  u_i := mkid(mttu,i);
  w_i := mkid(mttw,i);
  eq_list := append(eq_list, {w_i=MTTy(i,1)});

  IF i>MTTNu THEN
    v_list := append({w_i},v_list)
  ELSE
    v_list := append({u_i},v_list);
END;

eq_list; v_list;
sol := solve(eq_list,v_list);
sol := first(sol);

% Pluck out the manifest variable solutions
behaviour_list:={};
FOR i:=1:(MTTNy-MTTNu) DO
BEGIN
  soli := first(sol);
  sol := rest(sol);
  behaviour := DEN(RHS(soli))*LHS(soli) - NUM(RHS(soli)) = 0;
  behaviour_list := append(behaviour_list, {behaviour});
END;
behaviour_list := behaviour_list;

MATRIX MTTR(MTTNy-MTTNu,MTTNy);
FOR i:=1:(MTTNy-MTTNu) DO
BEGIN
  FOR j:=1:MTTNy DO
  BEGIN
    w_j := mkid(mttw,j);
    coeffs := coeff(lhs(first(behaviour_list)),w_j);
    IF length(coeffs)>1 THEN
      MTTR(i,j) := second(coeff(lhs(first(behaviour_list)),w_j));
  END;
  behaviour_list := rest(behaviour_list);
END;

%% Now do coefficient matrices

OFF NAT;
OUT "$1_ker.r";
write "MATRIX MTTR(", MTTNy-MTTNu, ",", MTTNy, ");";
MTTR := MTTR;
SHUT "$1_ker.r";


EOF

Deleted mttroot/mtt/bin/trans/dae2lde_r version [ec8a1424aa].

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
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
123
124
125
126
127
128
129
130
131



































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lde2ode.r
# Reduce differential-algebraic equations to Lagranges equations
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 12:25:13  peterg
## Initial revision
##
###############################################################

optimise=''; optimise_msg=''
while [ -n "`echo $1 | grep '^-'`" ]; do
    case $1 in
	-optimise)
	    optimise='-optimise'
	    optimise_msg=' with optimisation' ;;
	*)
	    echo "$1 is an invalid argument - ignoring" ;;
    esac
    shift
done

# Create the reduce output code
def2write_r $optimise $1 lde
def2write_r $optimise $1 ldeo

#Inform user
echo Creating $1_lde.r $optimise_msg
echo Creating $1_ldeo.r $optimise_msg

# Remove the old log file
rm -f cse2lde_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC  << EOF >cse2lde_r.log

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

%Read the definitions file
in "$1_def.r";

%Read the substitution file
in "$1_subs.r";

%Read the dae file
in "$1_dae.r";

% Zap bits we dont need
clear mttui, mttu, mttdu, mttx, mttdz;

%% The lagrangian eqns are those set to zero.
MTTL := mttyz;

% Create the second derivative of z
MATRIX mttddz(MTTNz,1);
FOR i := 1:MTTNz DO
BEGIN
  mttuii := mkid(mttui,i);
  mttdduii := mkid(mttddui,i);
  mttddz(i,1) :=  sub(mttuii=mttdduii,mttz(i,1));
END;
mttddz;

% Create Lagranges Equations
FOR j := 1:MTTNyz DO
BEGIN
  %% Create derivative of the equations by substituting:
  %du for u
  mttuj := mkid(mttu,j);
  mttduj := mkid(mttdu,j);
  MTTL :=  sub(mttuj=mttduj,MTTL);

  % dv for v
  mttuij := mkid(mttui,j);
  mttduij := mkid(mttdui,j);
  MTTL :=  sub(mttuij=mttduij,MTTL);

  % dx for x
  mttxj := mkid(mttx,j);
  MTTL :=  sub(mttxj=mttdx(j,1),MTTL);

  % ddz for dz
  mttdzj := mkid(mttdz,j);
  MTTL :=  sub(mttdzj=mttddz(j,1),MTTL);

END;

L = MTTL;

OFF Echo;
OFF Nat;


%Write out the  ordinary differential equations.
OUT "$1_lde.r";
write "%File: $1_lde.r";
in ("$1_lde_write.r");
write "in ""$1_ldeo.r"";";
write "END;";
SHUT "$1_lde.r";

%Write out the  output equations
OUT "$1_ldeo.r";
write "%File: $1_ldeo.r";
in ("$1_ldeo_write.r");
write "END;";
SHUT "$1_ldeo.r";
quit;
EOF

# Now invoke the standard error handling.
mtt_error_r cse2lde_r.log








Deleted mttroot/mtt/bin/trans/dae_r2m version [d91c90bd7e].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309





















































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dae_r2m
# Reduce DAE to OCTAVE (DASSL) DAE  
# P.J.Gawthrop 14 June 1991, 12 Jan 1994, April 1994, Jan 95, Aug 97.
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/05/13 16:43:03  peterg
## Now uses matlab_matrix to write the matrices
## Various bug fixes
## New global generation method
##
# Revision 1.6  1997/08/28  14:07:16  peterg
# Changed MTTDx to MTTDeriv
#
# Revision 1.5  1996/08/24  14:27:29  peter
# Global parameters.
#
## Revision 1.4  1996/08/18 20:02:21  peter
## Include zero outputs.
##
## Revision 1.3  1996/08/16 13:10:53  peter
## Fixed bug Ny changed to Nx in redidual loop.
##
## Revision 1.2  1996/08/16 08:57:34  peter
## Reads $1_input.
##
## Revision 1.1  1996/08/15 16:46:06  peter
## Initial revision
##
###############################################################


# WARNING this is experimental!!
# It asumes that the output y is NOT dependent on derivatives of
#  z or u.


#Inform user
echo Creating $1_dae.m
echo Creating $1_daeo.m


# Remove the old log file
rm -f dae_r2m.log

# Remove temp. files
rm -f $1_dae.m?
rm -f $1_daeo.m?

# Use reduce to accomplish the transformation
$SYMBOLIC >dae_r2m.log << EOF

%Read the reduce definitions file
in "$1_def.r";

%Read the reduce  DAE   file
in "$1_dae.r";

% Matrix output function
in"$MTTPATH/trans/matlab_matrix.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the parameter file
%%in "$1_sympar.r";


%% ON NERO;        % Suppress zero elements

%Define the common part of the functions.

PROCEDURE common;
BEGIN

  write "% Read in the input";
  write "u = $1_input(x,t)";

 % write "% Read in the arguments";
 % write "$1_args";
  
  write "% Set up the State variables";
  FOR i := 1:MTTNx DO
  BEGIN
    write "mttx", i, " = mttx(", i, ");";
  END;

  write "% Set up the non-state variables";
  FOR i := 1:MTTNz DO
  BEGIN
    write "mttz", i, " = mttx(", MTTNx+ i, ");";
  END;
  write "% Set up the non-state derivatives";
  FOR i := 1:MTTNz DO
  BEGIN
    write "mttdz", i, " = mttx(", MTTNx+MTTNz+ i, ");";
  END;

   write "% Set up the internal inputs";
  FOR i := 1:MTTNyz DO
  BEGIN
    write "mttui", i, " = mttx(", MTTNx+2*MTTNz+i, ");";
  END;
  
  write "% Set up the Input variables";
  IF MTTNu>0 THEN
  FOR i := 1:MTTNu DO
  BEGIN
    write "mttu", i, " = u(", i, ");";
  END;
END;
  
% Firstly do the residual = f(dx,x,t) function.

% MTTGx and u are the derivatives of z wrt x and u respectively

% Find MTTGx;
if MTTNz>0 THEN
BEGIN
matrix MTTGx(MTTNz,MTTNx);
FOR j := 1:MTTNx DO
  BEGIN
  xj := MTTX(j,1);
  FOR i := 1:MTTNz DO
    MTTGx(i,j) := df(MTTZ(i,1), xj, 1);
  END;

% Find MTTGu;
matrix MTTGu(MTTNz,MTTNu);
FOR j := 1:MTTNu DO
  BEGIN
  uj := MTTu(j,1);
  FOR i := 1:MTTNz DO
    MTTGu(i,j) := df(MTTZ(i,1), uj, 1);
  END;
END;

IF MTTNz=0 THEN
BEGIN
  MTTGx := 0;
  MTTGu := 0;
  MTTz := 0;
END;

OUT "$1_dae.m1";
write "function residual = $1_dae(mttx,deriv0,t);";
write "% residuals = $1_dae(dx,x,t);";
write "%DAE in DASSL $1;;";
write "%File $1_dae.m;;";
write "%Generated by MTT;;";


common();
SHUT "$1_dae.m1";

GENTRANOUT "$1_dae.m3";
write "% State derivative";
IF MTTNX>0 THEN
BEGIN
  MTT_Matrix := MTTdX$ 
  MTT_Matrix_name := "deriv"$
  MTT_Matrix_n := MTTNx$
  MTT_Matrix_m := 1$
  matlab_Matrix()$
  GENTRAN deriv := mtt_matrix$
END;

IF MTTNYz>0 THEN
BEGIN
  MTT_Matrix := MTTYz$ 
  MTT_Matrix_name := "MTTYz"$
  MTT_Matrix_n := MTTNYz$
  MTT_Matrix_m := 1$
  matlab_Matrix()$
  GENTRAN MTTYz := mtt_matrix$
END;

if MTTNz>0 THEN
BEGIN
  MTT_Matrix := MTTz$ 
  MTT_Matrix_name := "MTTz"$
  MTT_Matrix_n := MTTNz$
  MTT_Matrix_m := 1$
  matlab_Matrix()$
  GENTRAN MTTz := mtt_matrix$

  MTT_Matrix := MTTGu$ 
  MTT_Matrix_name := "MTTGu"$
  MTT_Matrix_n := MTTNz$
  MTT_Matrix_m := 1$
  matlab_Matrix()$
  GENTRAN MTTGu := mtt_matrix$

  MTT_Matrix := MTTGu$ 
  MTT_Matrix_name := "MTTGx"$
  MTT_Matrix_n := MTTNz$
  MTT_Matrix_m := 1$
  matlab_Matrix()$
  GENTRAN MTTGx := mtt_matrix$

END;


SHUT "$1_dae.m3";

OUT "$1_dae.m4";
%  write "% Set up the non-state derivatives";
%  FOR i := 1:MTTNz DO
%    write "mttdz", i, " = mttderiv0(", MTTNx+ i, ");";
%  END;

write "j = 0;";

%Residual has 3 parts as follows:
%Part 1: dx/dt - dx_0/dt
if MTTNx>0 THEN
BEGIN
  write "for i=1:", MTTNx, ";;";
  write "  j = j+1";
  write "  residual(j) = deriv(i)-deriv0(j);";
  write "end;";
END;

%Part 2: dz/dt - dz_0/dt
IF MTTNz>0 THEN
BEGIN
  if MTTNx>0 THEN
    write "mttdzx = mttgx*mttdx"
  ELSE
    write "mttdzx = zeros(", MTTNz, ",1);";


  if MTTNu>0 THEN
    write "mttdzu = mttgu*mttdu"
  ELSE
    write "mttdzu = zeros(", MTTNz, ",1);";

  write "mttdz = mttdzx + mttdzu";

  write "for i=1:", MTTNz, ";;";
  write "  j = j+1";
  write "  residual(j) = mttdz(i)-mttderiv0(j);";
  write "end;";
END;

%Part 3: v=0 (the algebraic bits)
IF MTTNyz>0 THEN
BEGIN  
  write "for i=1:", MTTNyz, ";;";
  write "  j = j+1";
  write "  residual(j) = mttyz(i)";
  write "end;";
END;

SHUT "$1_dae.m4";


% Now do the y = g(x,t) function.
OUT "$1_daeo.m1";
  
write "function mtty = $1_daeo(mttx,t);";
write "% mtty = $1_daeo(mttx,t);";
write "%DAE in Simulab form for system $1;;";
write "%File $1_daeo.m;;";
write "%Generated by MTT;;";

SHUT "$1_daeo.m1";

OUT "$1_daeo.m3";
common();


%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 500$
OFF period$

MTTy := MTTy;

SHUT "$1_daeo.m3";

EOF

# Create the globals
sympar2global_txt2m $1> $1_dae.m2
sympar2global_txt2m $1> $1_daeo.m2

# Put together the pieces
cat $1_dae.m?>$1_dae.m
cat $1_daeo.m?>$1_daeo.m







Deleted mttroot/mtt/bin/trans/dae_r2tex version [ed25283fdf].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dae_r2tex
# Reduce differential-algebraic to LaTex differential-algebraic equations.
# P.J.Gawthrop 10th May 1991, April 1994
# Copyright (c) P.J.Gawthrop, 1991, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1998/01/23 16:08:09  peterg
## changed eqnarray to equation + aligned
##
## Revision 1.3  1997/06/13 13:30:43  peterg
## Removed eqn labels.
##
# Revision 1.2  1996/12/19  10:25:15  peterg
# Now writes out mtti instead of mtt_{i} -- lets latex_tidy do the
# conversion.
#
# Revision 1.1  1996/10/21  08:50:15  peterg
# Initial revision
#
###############################################################


while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;;
	-partition )
                partition=yes;
                blurb='with partitioning';
		;;
	*)
		echo "$1 is an invalid argument - ignoring";
                exit ;;
  esac
  shift
done

# Inform user
echo Creating $1_dae.tex $blurb

logname=dae_r2tex.log

# Remove the old log file
rm -f dae_r2tex.log

# Use reduce to accomplish the transformation
$SYMBOLIC >$logname << EOF

%Read the definitions file
in "$1_def.r";

%Read the differential-algebraic equations file
in "$1_dae.r";

%Read the symbolic parameter file
%%in "$1_sympar.r";


OFF Echo;
OFF Nat;


%Read the substitution file
in "$1_subs.r";

%Read the simplifying expressions file
IN "$1_simp.r";

% Read the formating function
in "$MTTPATH/trans/latex_equations.r";

OUT "$1_dae.tex";

%Write out the  differential-algebraic equations.

write "%File: $1_dae.tex";

write "%differential-algebraic equations";
%ON Rounded;
%Precision 5;

latex_equations();

SHUT "$1_dae.tex";
quit;
EOF

if [ -n "$partition" ]; then
  rm -f mtt_junk
  # Now for the subsystems
  # Find subsystems
  subsystems=`mtt_get_subsystems $1`

  for subsystem in $subsystems; do
  echo Doing $subsystem
  ucname="MTT_"$subsystem"_uc"
  subsystem_dae=$subsystem"_dae"
  #subname=`echo $subsystem | mtt_remove_underscore`

  Nu=`mtt_getsize -internal $subsystem"_1" u`
  echo Nu $Nu

  # Use symbolic algebra to accomplish the transformation
  $SYMBOLIC >$logname  << EOF


  %Read the definitions file
  in "$1_def.r";
  
  
  %Read the symbolic parameter file
  %%in "$1_sympar.r";
  
  
  % Read the formating function
  in  "$MTTPATH/trans/latex_equations.r";

  OFF Echo;
  OFF Nat;
  
  
  %Read the substitution file
  in "$1_subs.r";
  
  %Read the simplifying expressions file
  IN "$1_simp.r";

  %Read the differential-algebraic equations file
  in "$1_dae.r";

  %Create the output file
  OUT "mtt_junk_1";

  % Connecting inputs
  IF $Nu>0 THEN
  BEGIN
    write "\section{Subsystem $subsystem}";

    write "\subsection{Connections}";
    write"\begin{itemize}";
  FOR Row := 1:$Nu DO
    BEGIN
  	write "\item Input ", Row, " is connected to ";
  	write $ucname(Row,1);
    END;
    write"\end{itemize}";
  END;
  SHUT "mtt_junk_1";

  %Read the differential-algebraic equations file
  in "$subsystem_dae.r";

  %Create the output file
  OUT "mtt_junk_2";
  write "\subsection{Dynamics}";
   latex_equations();
  SHUT "mtt_junk_2";

EOF
  echo >> $1_dae.tex
  echo %Connections for subsystem $subsystem >> $1_dae.tex

  # Sort out underscores and remove mtt to avoide post processor
  cat mtt_junk_1 | mtt_remove_underscore | sed 's/mtt//g'>> $1_dae.tex
  cat mtt_junk_2  >> $1_dae.tex
  rm -rf mtt_junk_?
  done
fi


# Now invoke the standard error handling.
mtt_error_r dae_r2tex.log











Deleted mttroot/mtt/bin/trans/dat22dat version [ba08d67a1d].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dat22dat
# Splits the data file into output and state bits

# Copyright (c) P.J.Gawthrop 1999

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.9  2000/09/27 16:12:50  peterg
## Use expr to evaluate arithmetic - compatible with sh (as opposed to
## bash)
##
## Revision 1.8  2000/09/21 10:07:06  peterg
## Now correctely writes out the state into _odes.dat rep.
##
## Revision 1.7  2000/04/06 09:02:46  peterg
## Removed bash let commands as unsupported by sh
## Do arithmetic within awk - yuk
##
## Revision 1.6  2000/04/06 08:36:15  peterg
## *** empty log message ***
##
## Revision 1.5  1999/03/15 22:42:52  peterg
## Strip comments (put in by Octave save function)
##
## Revision 1.4  1999/03/15 21:55:36  peterg
## Does away with the # symbol in the file - uses _de to get Nx Ny
## instead
##
###############################################################
if [ -z "$1" ]; then
  echo "Usage: dat22dat system ode|odes so|s"
  exit
fi

# Find Nx and Ny
Nx=`mtt_getsize $1 x` # States
Ny=`mtt_getsize $1 y` # Outputs

case $3 in
    so)
	First=1; Last=`expr $First + $Ny`
	;;
    s)
	First=`expr $Ny + 2`; Last=`expr $First + $Nx`
	;;
    *)
	First=1; Last=`expr $Ny + 1`
        ;;
esac

echo Creating $1_$2$3.dat

awk '{
      ## Extract the data
      if (index($1,"#") != 1){
        for (i=First;i<=Last;i++)
	  printf("%s ", $i);
      printf("\n"); 
  }
}' First=$First Last=$Last <$1_$2s.dat2  > $1_$2$3.dat

Deleted mttroot/mtt/bin/trans/dat22sg.sh version [e519db8890].

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
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
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



















































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

# Convert simulation data to SciGraphica (v 0.61) Project file ($sys_odes.sg)

sys=$1

write_project_header ()
{
    cat <<EOF
<?xml version="1.0"?>

<sg:Project xmlns:sg="http://scigraphica.sourceforge.net">
  <sg:Summary>
    <sg:Item>
      <sg:name>application</sg:name>
      <sg:val-string>scigraphica</sg:val-string>
    </sg:Item>
    <sg:Item>
      <sg:name>author</sg:name>
      <sg:val-string>MTT:${USER}</sg:val-string>
    </sg:Item>
  </sg:Summary>

EOF
}

write_project_footer ()
{
    echo ''
    echo '</sg:Project>'
}

write_worksheet_header ()
{
    name=$1 ; ncol=$2 ; nrow=$3
    cat <<EOF

<sgw:Worksheet xmlns:sgw="http://scigraphica.sourceforge.net">
  <sgw:Summary>
    <sgw:Item>
      <sgw:name>application</sgw:name>
      <sgw:val-string>scigraphica</sgw:val-string>
    </sgw:Item>
    <sgw:Item>
      <sgw:name>author</sgw:name>
      <sgw:val-string>MTT:${USER}</sgw:val-string>
    </sgw:Item>
  </sgw:Summary>
  <sgw:Geometry Width="400" Height="350"/>
  <sgw:Name>${name}</sgw:Name>
  <sgw:MaxCol>${ncol}</sgw:MaxCol>
  <sgw:MaxRow>${nrow}</sgw:MaxRow>
  <sgw:Begin>-1</sgw:Begin>
  <sgw:End>-1</sgw:End>
EOF
}

write_worksheet_footer ()
{
    echo ''
    echo '</sgw:Worksheet>'
}

write_column_headings ()
{
    awk '{ printf ("  <sgw:Column No=\"%d\" Width=\"80\" Title=\"%s\" Format=\"0\" Precision=\"3\">\n  </sgw:Column>\n", NR-1,$0) }'
}

write_output_headings ()
{
    sys=$1
    ${MATRIX} -q <<EOF | write_column_headings
	[u_names,y_names,x_names] = ${sys}_struc;
	printf ("Time\n");
	disp (y_names);
EOF
}

write_state_headings ()
{
    sys=$1
    ${MATRIX} -q <<EOF | write_column_headings
	[u_names,y_names,x_names] = ${sys}_struc;
	printf ("Time\n");
	disp (x_names);
EOF
}

write_cell_values ()
{
    sys=$1 ; vec=$2
    ${MATRIX} -q <<EOF
function write_cell (row,col,val)
    printf ("\n");
    printf ("  <sgw:Cell Row=\"%d\" Col=\"%d\">\n", row,col);
    printf ("    <sgw:Content>%f</sgw:Content>\n", val);
    printf ("    <sgw:Formula>%f</sgw:Formula>\n", val);
    printf ("  </sgw:Cell>\n");
endfunction

    [u_names,y_names,x_names] = ${sys}_struc;
    ncol = size(${vec}_names)(1);

    load ("${sys}_odes.dat2");
    nrow = size(mtt_data)(1);

    # write Time
    for r = 1:nrow
	write_cell (r-1,0,mtt_data(r,1));
    endfor

    if ("${vec}" == "y")
	offset = 1;
    elseif ("${vec}" == "x")
	offset = size(y_names)(1);
    endif

    for r = 1:nrow
	for c = 1:ncol
	    write_cell (r-1,c,mtt_data(r,c+offset));
	endfor
    endfor
EOF
}

file=${sys}_odes.sg

NX=`mtt_getsize ${sys} x`
NY=`mtt_getsize ${sys} y`
NTMP=`wc -l ${sys}_odes.dat2 | awk '{print $1}'`
NROW=`expr ${NTMP} - 4`		# 4 comment lines in mtt_data

{
    write_project_header
    # states
    write_worksheet_header	"X_${sys}" ${NX} ${NROW}
    write_state_headings	${sys}
    write_cell_values		${sys} x
    write_worksheet_footer
    # outputs
    write_worksheet_header	"Y_${sys}" ${NY} ${NROW}
    write_output_headings	${sys}
    write_cell_values		${sys} y
    write_worksheet_footer
    write_project_footer
} > ${file}

Deleted mttroot/mtt/bin/trans/dat2gdat version [6a887e71c9].

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
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
123
124
125
126
127
128
129
130
131
132




































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dat2gdat

# Converts a data file in data format to gplot data format

# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 12:26:15  peterg
## Put under RCS
##
## Revision 1.8  1998/09/29 20:01:27  peterg
## 4th argument for nyquist style files - ie differnt x for each y
##
## Revision 1.7  1997/12/04 22:10:32  peterg
## Handles argument list - variable names.
##
## Revision 1.6  1997/05/22 10:34:05  peterg
## Changed argument structure.
##
## Revision 1.5  1997/05/22 10:11:19  peterg
## Fixed parametetr bug
##
# Revision 1.4  1997/05/16  13:03:10  peterg
# Now selects variables to display.
#
# Revision 1.3  1996/08/26  13:02:58  peterg
# Cahged awk to awk.
#
# Revision 1.2  1996/08/15  11:49:11  peter
# Puts a blank line at the end of the file:
#  this allows user to cat files for use in gnuplot.
#
## Revision 1.1  1996/08/14 09:13:52  peter
## Initial revision
##
###############################################################

echo Creating $1_$2.gdat
rm -f $1_$2.gdat

DifferentX=$4;

# Convert multi-columns into gnuplot format -
# ie stack two columns vertically separated by blank lines

#Get the desired data index
which=`name2index $1 "$3"`
echo $1 $3 $which

if [ -z "$DifferentX" ]; then
awk '
BEGIN{
  row=0; col=0;
}
{ 
  if (row==0) {
     N=split(which,Which,",");
    }
  row++;
  j=1;
  if (Which[1]==0) {
    x[row] = $1;
    for (i=1; i<NF; i++) {
      ycol = i+1;
      y[row,j++] = $ycol;
    }
  }
  else {
  xcol = Which[1];
  x[row] = $xcol
  for (i=1; i<N; i++) {
      ycol = Which[i+1];
      y[row,j++] = $ycol;
    }
  }
  cols=j-1;
}
END {
  rows = row;
  for (col = 1; col <= cols; col++) {
    for (row = 1; row <= rows; row++) {
      print x[row], y[row,col]
    };
  if (col<=cols) {
    printf("\n")
  }
  }
}'  which="$which" <$1_$2.dat >   $1_$2.gdat

else
awk '
BEGIN{
  row=0; col=0;
}
{ 
  row++; cols=NF/2
    for (i=1; i<=cols; i++) {
      ycol=2*i;
      xcol=ycol-1;
      x[row,i] = $xcol
      y[row,i] = $ycol;
    }
}
END {
  rows = row;
  for (col = 1; col <= cols; col++) {
    for (row = 1; row <= rows; row++) {
      print x[row,col], y[row,col]
    };
  if (col<=cols) {
    printf("\n")
  }
  }
}'   <$1_$2.dat >   $1_$2.gdat
    
fi






Deleted mttroot/mtt/bin/trans/dat2sdat version [e7c1c34fa1].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dat2sdat

# Structure file - dat to sdat conversion
# P.J.Gawthrop April 1997
# Copyright (c) P.J.Gawthrop, 1997, 1999

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1.4.1  2001/06/26 00:57:21  geraint
## Prints more useful name.
##
## Revision 1.1  2000/12/28 12:26:34  peterg
## Put under RCS
##
## Revision 1.1  1999/03/28 21:29:40  peterg
## Initial revision
##
###############################################################

if [ "$2" = "odes" ]; then
    which="state"
else
    which="output"
fi

awk '
BEGIN{
printf("Time");
}
{ 
  if ($1==which)
    printf(" %s(%s)", $4, $5);
}
END{
printf("\n");
}
'  SYSTEM=$1 which=$which  < $1_struc.txt

cat $1_$2.dat



Deleted mttroot/mtt/bin/trans/dat2siag version [4a36fa9cce].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dat2siag
# Converts data to siag (scheme in a grid) format - ie columns become rows.

# Data file dat to sdat conversion
# P.J.Gawthrop February 1998
# Copyright (c) P.J.Gawthrop, 1998.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1999/03/29 03:35:13  peterg
## Initial revision
##
###############################################################




# This is the main transformation using awk
awk '{
    i++
    for (j=1;j<=NF;j++)
	data[i,j]=$j;
    Cols=NF;
    Rows++;
}
END{
    for (j=1;j<=Cols;j++) {
	for (i=1;i<=Rows;i++){
	    printf("%s ", data[i,j]);
	}
	printf("\n");
    }
}'


Deleted mttroot/mtt/bin/trans/def2write_r version [6639ce8c03].

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
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
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
























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: def2write.r
# Generates r code to write matrices
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.7.2.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
##
## Revision 1.7  2001/04/11 09:44:26  gawthrop
## Fixed cc and c problems to do with pow(x,y) and integers
## mtt/lib/reduce/fix_c.r is included in rdae2dae and cse2smx_lang for
## -c, -cc and -oct options
##
## Revision 1.6  2000/11/29 20:48:53  peterg
## Zapped unnecessary Npar creation
##
## Revision 1.5  2000/11/09 10:12:24  peterg
## Removed debugging line
##
## Revision 1.4  2000/10/14 16:19:54  peterg
## Just optimize one line at a time ...
##
## Revision 1.3  2000/10/11 09:07:17  peterg
## Added csex rep (cse without E)
##
## Revision 1.2  2000/10/10 21:02:17  peterg
## Added cse reps
##
## Revision 1.1  2000/10/10 09:07:32  peterg
## Initial revision
##
###############################################################

optimise=''
while [ -n "`echo $1 | grep '^-'`" ]; do
    case $1 in
	-optimise)
	    opt='-optimise'
	    optimise_msg=' with optimisation' ;;
	*)
	    echo "$1 is an invalid argument - ignoring" ;;
    esac
    shift
done

sys=$1 # System name
rep=$2 # System representation

# Inform User
echo Creating $1_$2_write.r $optimise_msg

# Find system constants
Nx=`mtt_getsize $sys x` # States
Nxx=`mtt_getsize $sys xx` # States x States
Nu=`mtt_getsize $sys u` # Inputs 
Ny=`mtt_getsize $sys y` # Outputs 
Nyz=`mtt_getsize $sys yz` # Zero outputs
#Npar=`wc -l $sys\_sympar.txt | awk '{print $1}'`

# Set up representation-specific stuff
case $rep in
    cse)
        matrices='EdX E'
        ns="$Nx $Nx"
        ms="1 $Nx"
	;;
    csex)
        matrices='EdX'
        ns="$Nx"
        ms="1"
	;;
    cseo)
        matrices='Y'
        ns="$Ny"
        ms="1"
	;;
    lde)
        matrices='L'
        ns="$Nyz"
        ms="1"
	;;
    ldeo)
        matrices='Y Yz'
        ns="$Ny $Nyz"
        ms="1 1"
	;;
    ode)
        matrices='dX'
        ns="$Nx"
        ms="1"
	;;
    odeo)
        matrices='Y'
        ns="$Ny"
        ms="1 1"
	;;
    sm)
        matrices='A B C D'
        ns="$Nx $Nx $Ny $Ny"
        ms="$Nx $Nu $Nx $Nu"
	;;
    *)
        echo def2write_r: representation $rep not recognised
        exit
esac

# Write out the code
echo 'off echo$'                    >$1_$2_write.r

if [ ${opt:-""} = "-optimise" ]; then
    echo 'load scope$'
else
    echo 'load gentran$'
fi >> $1_$2_write.r

for matrix in $matrices; do
    n=`first "$ns"`; ns=`rest "$ns"` 
    m=`first "$ms"`; ms=`rest "$ms"`
    is=`n2m 1 $n`; 
    js=`n2m 1 $m`; 
    for i in $is; do
      for j in $js; do
	if [ ${opt:-""} = "-optimise" ]; then
       	    echo 'optimize'
	    name=`echo MTT$matrix'('$i','$j')'`
	    echo '  '$comma$name ':=:' $name
	    echo 'INAME mtt_tmp$'
	    comma=''
	else
	    echo 'write'
	    name=`echo MTT$matrix'('$i','$j')'`
	    echo '  '$comma$name ':=' $name '$'
	fi >> $1_$2_write.r
      done
    done
done
echo 'END$'                           >>$1_$2_write.r

Deleted mttroot/mtt/bin/trans/def_r2m version [8855e20923].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: def_r2m
# transforms definitions from reduce to m file.
# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/07/25 07:10:41  peterg
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_def.m

# Remove the old log file
rm -f def_r2m.log


# Header
cat <<EOF > $1_def.m
function  [nx,ny,nu,nz,nyz] = $1_def;
% function  [nx,ny,nu,nz,nyz] = $1_def;
% System $1, representation def, language m
% File $1_def.m;
% Generated by MTT on `date`;
%
EOF

# Constants
Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Ny=`grep "MTTNy " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Nu=`grep "MTTNu " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Nz=`grep "MTTNz " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Nyz=`grep "MTTNyz " <$1_def.r | awk '{print $3}' | sed 's/;//'`


cat<<EOF >> $1_def.m 
  nx = $Nx;
  ny = $Ny;
  nu = $Nu;
  nz = $Nz;
  nyz = $Nyz;
EOF

Deleted mttroot/mtt/bin/trans/dir2paths version [98a433273b].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dir2paths
# Finds paths of all valid MTT examples

# P.J.Gawthrop Mar 98
# Copyright (c) P.J.Gawthrop, 1998.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/03/11 10:32:35  peterg
## Initial revision
##
###############################################################


dotdot=$2 # Set to ../ if we are in MTT_work


# Create paths for all valid examples - ie dir name is system name
find $dotdot$1 -name '*_abg.fig' -print |\
  awk '{
   N=split($1,name,"/"); 
   printf("%s", name[1]);
   for (i=2;i<N;i++) printf("/%s", name[i]); 
   printf(" %s %s\n", name[N-1], name[N]);
  }' |\
  awk '{
  correctname=sprintf("%s_abg.fig", $2);
  if ($3==correctname) print  $1,$2
  }'

Deleted mttroot/mtt/bin/trans/dir2rep version [2f10632b5f].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dir2rep
# Creates a rep file for a directory

# P.J.Gawthrop Dec 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/03/11 10:32:11  peterg
## Now uses dir2paths transformation
##
## Revision 1.1  1998/02/05 13:31:25  peterg
## Initial revision
##
###############################################################

dotdot=$2 # Set to ../ if we are in MTT_work

# Inform user
echo "Creating $1_rep.txt (Directory version)"

# Headings
echo "% Verbal description for directory $1 ($1_rep.txt)"> $1_rep.txt
echo "% Generated by MTT on" `date`. >> $1_rep.txt                  	   

# Create paths for all valid examples - ie dir name is system name
dir2paths $1 $2 | sed 's/Introduction/AAAAA/g' | sort | sed 's/AAAAA/Introduction/g' | \
awk '{
     print "mtt -t -d " $1,$2 " rep tex";
  }' >> $1_rep.txt

Deleted mttroot/mtt/bin/trans/dm2fr_m version [a15e80b520].

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
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
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



































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dm2fr_m

# Transformation: descriptor matrix to frequency response

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.13  1998/09/03 09:12:32  peterg
## Removed debugging lines
##
## Revision 1.12  1998/09/02 12:02:14  peterg
## Added mttinput paramater
##
## Revision 1.11  1998/08/11 13:32:42  peterg
## Lowercase mttLAST etc
##
## Revision 1.10  1998/07/27 20:27:25  peterg
## Now get parameters for simpar file.
##
## Revision 1.9  1998/02/26 15:12:26  peterg
## Removed parameter stuff
##
# Revision 1.8  1996/08/30  14:54:36  peter
# Took back lock.
#
## Revision 1.7  1996/08/24  14:23:00  peter
## Global parameter passing.
## Proper error handling.
#
## Revision 1.6  1996/08/16 14:26:07  peter
## Fixed multi-output bug.
## Made sure that u0 is ok.
##
## Revision 1.5  1996/08/15 16:23:02  peter
## Now uses W in place of w for consistancy with time responses.
##
## Revision 1.4  1996/08/15 11:52:42  peter
## Now creats a number of versions:
## fr 	complex frequency response
## lmfr 	log  magnitude of fr
## lpfr  	phase of fr
## nyfr  	real and imag parts - Nyquist style
## nifr 	Nichols style.
##
## Revision 1.3  1996/08/11 19:08:08  peter
## Parameter passing now enabled.
##
## Revision 1.2  1996/08/11 09:32:12  peter
## Now takes the numpar parameters correctly
##
## Revision 1.1  1996/08/10 14:11:11  peter
## Initial revision
##
###############################################################

echo Creating $1_fr.m
echo Creating $1_lmfr.m
echo Creating $1_lpfr.m
echo Creating $1_nyfr.m
echo Creating $1_nifr.m

#if [ "$2" = "" ]; 
#then
#  PARAMS='W=logspace(-1,2,100); u0=zeros(nu,1); u0(1)=1;'
#  echo Using default parameter $PARAMS
#else
#  PARAMS=$2;
#fi

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

# Data
  mttpar=$1_numpar;

# Simulation parameters
  simpar=$1_simpar;

  [nx,ny,nu,nz,nyz] = $1_def

  %Defaults
  
  if exist('simpar.wmin')==0
    simpar.wmin = -1;
  end;

  if exist('simpar.wmax')==0
    simpar.wmax = 2;
  end;

  if exist('simpar.wsteps')==0
    simpar.wsteps = 100;
  end;

  W = logspace(simpar.wmin,simpar.wmax,simpar.wsteps)';
  if exist('mttinput')==0
    mttinput = 1;
  end;
  mttu0 = zeros(nu,1);
  mttu0(mttinput) = 1;

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

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

  [A,B,C,D,E] = $1_dm(mttpar);
  fr = dm2fr(A,B,C,D,E,W,mttu0);
  lw = log10(W);
  lmfr = log10(abs(fr));
  pfr = angle(fr)*180/pi;

% Complex frequency response
  write_matrix([W fr], '$1_fr');

% Log magnitude v log frequency
  write_matrix([lw lmfr], '$1_lmfr');

% Angle v log frequency
  write_matrix([lw pfr], '$1_lpfr');

% Nyquist style
  re = real(fr);
  im = imag(fr);
  nyq = [re(:,1) im(:,1)];
  for i = 2:ny
    nyq = [nyq re(:,i) im(:,i)];
  end;
  write_matrix(nyq, '$1_nyfr');

% Nichols style
  re = lmfr;
  im = pfr;
  nic = [im(:,1) re(:,1)];
  for i = 2:ny
    nic = [nic im(:,i) re(:,i)];
  end;
  write_matrix(nic, '$1_nifr');

EOF

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






Deleted mttroot/mtt/bin/trans/dm2ir_m2dat version [acb379d922].

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



























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dat2ps

# Tramsforms descriptor matrix rep to frequency response dat.


# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1996/08/11 10:40:00  peter
## Now handles e and NaN numbers.
##
## Revision 1.1  1996/08/10 14:15:03  peter
## Initial revision
##
###############################################################

echo Creating $1_ir.dat

if [ "$2" = "" ]; 
then
  PARAMS='t=[0:0.1:10]'
  echo Using default parameter $PARAMS
else
  PARAMS=$2;
fi


$MATRIX << EOF | awk '$1 !~ /[A-MO-Zb-cf-z]/ && NF>0 {print} '  >$1_ir.dat

  $PARAMS;
  [n,m]=size(t);
  if m>n
    t=t';
  end;

  [A,B,C,D,E] = $1_dm($1_numpar);
  y = dm2ir(A,B,C,D,E,t);

  [Ny,Nu]=size(D);
  NN = Ny*Nu;

  xy = [t y(:,1)];
  for i=2:NN
    xy = [xy t y(:,i)];
  end;
xy

EOF

Deleted mttroot/mtt/bin/trans/dm2tf_r version [60f01453cb].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dm2tf_r
# Reduce  descriptor matrices to transfer function
# P.J.Gawthrop 8th May 1991, Dec 1993, April 1994.
# Copyright (c) P.J.Gawthrop, 1991, 1993, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/03/27 15:00:23  peterg
## reduce ---> symbolic
##
## Revision 1.1  1996/08/25 10:09:55  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_tf.r

# Remove the old log file
rm -f dm2tf_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC >dm2tf_r.log << EOF

%ON FLOAT;

IN "$1_def.r";
IN "$1_dm.r";
IN "$1_subs.r";

OFF Echo;
OFF Nat;

%create sE-A
%MTT_SEA := s*MTTE-MTTA;

%Find the denominator of the TF - det(sE-A);
%comden := det(MTT_SEA);

%Find the Adjoint transpose.
%matrix AdjT(MTTNx,MTTNx);
%FOR i := 1:MTTNx DO
%  BEGIN
%  FOR j := 1:MTTNx DO
%    AdjT(i,j) := cofactor(MTT_SEA,i,j);
%  END;

%Adj := TP(AdjT);

%Find the numerator matrix
%Num := MTTC*Adj*MTTB + MTTD*comden;


%Create the transfer function matrix
MTTTF := MTTD;
IF MTTNy>0 THEN MTTTF := MTTTF + (MTTC * ((s*MTTE-MTTA)^-1) * MTTB);

%MTTTF := Num/comden;


OUT "$1_tf.r";

%Declare the transfer function matrix
write "matrix MTTTF(", MTTNy, ",", MTTNu, ")$"$

%And write it.
%MTTTF := MTTTF;
FOR i := 1:MTTNy DO
  BEGIN
  FOR j := 1:MTTNu DO
    IF MTTTF(i,j) NEQ 0 THEN write "MTTTF(", i, ",", j, ") := ", MTTTF(i,j)$
  END;

write ";END;"$
SHUT "$1_tf.r";

EOF

# Now invoke the standard error handling.
mtt_error_r dm2tf_r.log

Deleted mttroot/mtt/bin/trans/dm_r2m version [dc94c23287].

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
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
123
124
125
126
127
128
129
130
131



































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dm_r2m
# Reduce descriptor state-space A,B,C,D and E matrices to Matlab
# P.J.Gawthrop 29th July 1990, 6th Feb 1991, 28 May 1991, Dec 1993, Jan 94
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993,1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/04/13 11:01:55  peterg
## Now uses generic header : matlab_header
##
# Revision 1.6  1997/04/16  13:43:29  peterg
# Added matrix dimenensions
#
# Revision 1.5  1997/02/24  14:44:28  peterg
# Ignores numerical parameters in global list.
#
## Revision 1.4  1996/08/24 14:16:25  peter
## Global parameter passing.
##
## Revision 1.3  1996/08/18 12:02:46  peter
## Fixed bug when some matrices are empty.
##
## Revision 1.2  1996/08/12 20:22:20  peter
## Paramaters passed via an internal call to _numpar.
## _args script can overide these parameters - sneaky.
##
## Revision 1.1  1996/08/12 19:09:13  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_dm.m

# Remove the old log file
rm -f dm_r2m.log

# Use reduce to accomplish the transformation
reduce >dm_r2m.log << EOF

ON BigFloat, NumVal;
PRECISION 16; %Compatible with Matlab

%Read in the definitions file
in "$1_def.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read in the parameter file
%%in "$1_sympar.r";

%Read the reduce state-space A,B,C and D matrices file
in "$1_dm.r";

IF MTTNvar>0 THEN
BEGIN
  write "% Set the parameters";
  write "global ...;;";
  FOR i := 1:MTTNvar DO
    BEGIN
      IF numberp(MTTVar(i,1)) 
      THEN 
      BEGIN
        % Do nowt
      END
      ELSE  
      BEGIN
        write MTTVar(i,1), " ...";
      END;
    END;
    write " ";
END;


%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
OFF period$

MTTN := MTTNx + 2*MTTNz + MTTNyz;
write "MTTA = zeros(", MTTN, ",", MTTN, ");";
write "MTTB = zeros(", MTTN, ",", MTTNu, ");";
write "MTTC = zeros(", MTTNy, ",", MTTN, ");";
write "MTTD = zeros(", MTTNy, ",", MTTNu, ");";
write "MTTE = zeros(", MTTN, ",", MTTN, ");";

OUT "$1_dm.1";

ON NERO;	% Suppress zero elements.
MTTA := MTTA;
MTTB := MTTB;
MTTC := MTTC;
MTTD := MTTD;
MTTE := MTTE;

SHUT "$1_dm.1";


EOF

# Header
matlab_header $1 dm 'A,B,C,D,E'> $1_dm.m

#Define array sizes.
grep -v 'function' $1_def.m | grep -v '%' >>  $1_dm.m
echo 'mtta = zeros(nx+nyz+2*nz,nx+nyz+2*nz);' >>  $1_dm.m
echo 'mttb = zeros(nx+nyz+2*nz,nu);' >>  $1_dm.m
echo 'mttc = zeros(ny,nx+nyz+2*nz);' >>  $1_dm.m
echo 'mttd = zeros(ny,nu);' >>  $1_dm.m
echo 'mtte = zeros(nx+nyz+2*nz,nx+nyz+2*nz);' >>  $1_dm.m


#Code
cat $1_dm.1 >> $1_dm.m


rm -f $1_dm.1


Deleted mttroot/mtt/bin/trans/dm_r2tex version [acd65c348e].

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
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
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



































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dm_r2tex
# Reduce descriptor matrices to LaTex descriptor matrices.
# P.J.Gawthrop 9 June 1990, 8th July 1990, 14 Feb 1991, 10th May 1991, 4th June 1991
# Copyright (c) P.J.Gawthrop, 1990, 1991.

#Inform user
echo Creating $1_dm.tex

# Remove the old log file
rm -f dm_r2tex.log

# Use reduce to accomplish the transformation
reduce >dm_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the symbolic parameters file
%%in "$1_sympar.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Number of descriptor variables
MTTN := MTTNx + 2*MTTNz + MTTNyz;

%Read the descriptor matrices file
in "$1_dm.r";

OFF Echo;
OFF Nat;

OUT "$1_dm.tex";

%Write out the descriptor matrices.
write "%Descriptor matrices $1";
write "%File: $1_dm.tex";
write"";

write "%Descriptor matrices";

%IF (MTTNz+MTTNyz) NEQ 0 THEN
%BEGIN
%  write "%  - E matrix";
%  write "\begin{equation}";
%  write "MTTE = MTTI_0(", MTTNx+MTTNz, ",", MTTNz+MTTNyz, ")";
%  write "\end{equation}";
%END;


IF MTTN NEQ 0 THEN
IF (MTTNz+MTTNyz) > 0 THEN
BEGIN
write "%  - E matrix";
write "\begin{equation}";
write "MTTE = \begin{pmatrix}";
	FOR Row := 1:MTTN DO
	BEGIN
		FOR Col := 1:MTTN DO
		BEGIN
			Write "{", MTTE(Row,Col), "}";
			IF Col<MTTN THEN Write "&"
		END;

	IF Row<MTTN THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;



IF MTTN NEQ 0 THEN
BEGIN
write "%  - A matrix";
write "\begin{equation}";
write "MTTA = \begin{pmatrix}";
	FOR Row := 1:MTTN DO
	BEGIN
		FOR Col := 1:MTTN DO
		BEGIN
			Write "{", MTTA(Row,Col), "}";
			IF Col<MTTN THEN Write "&"
		END;

	IF Row<MTTN THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;

IF MTTN NEQ 0 THEN IF MTTNu NEQ 0 THEN
BEGIN
write "%  - B matrix";
write "\begin{equation}";
write "MTTB = \begin{pmatrix}";
	FOR Row := 1:MTTN DO
	BEGIN
		FOR Col := 1:MTTNu DO
		BEGIN
			Write "{", MTTB(Row,Col), "}";
			IF Col<MTTNu THEN Write "&"
		END;

	IF Row<MTTN THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;

IF MTTN NEQ 0 THEN IF MTTNy NEQ 0 THEN
BEGIN
write "%  - C matrix";
write "\begin{equation}";
write "MTTC = \begin{pmatrix}";
	FOR Row := 1:MTTNy DO
	BEGIN
		FOR Col := 1:MTTN DO
		BEGIN
			Write "{", MTTC(Row,Col), "}";
			IF Col<MTTN THEN Write "&"
		END;

	IF Row<MTTNy THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;

IF MTTNy NEQ 0 THEN IF MTTNu NEQ 0 THEN
BEGIN
write "%  - D matrix";
write "\begin{equation}";
write "MTTD = \begin{pmatrix}";
	FOR Row := 1:MTTNy DO
	BEGIN
		FOR Col := 1:MTTNu DO
		BEGIN
			Write "{", MTTD(Row,Col), "}";
			IF Col<MTTNu THEN Write "&"
		END;

	IF Row<MTTNy THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;




SHUT "$1_dm.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/doc2dvi version [e8e1f97833].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: doc2dvi
# Converts doc file to dvi file

# Copyright (c) P.J.Gawthrop 1998


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/11/24 12:03:27  peterg
## Indexing of book docs.
##
## Revision 1.2  1998/04/15 18:40:43  peterg
## Run LateX three times
##
## Revision 1.1  1998/03/03 08:35:50  peterg
## Initial revision
##
###############################################################

system=$1
documenttype=$2

# Inform user
echo "Creating $system.dvi"

#Run latex , bibtex and makeindex
latex $system.doc > doc2dvi.log
bibtex $system    >> doc2dvi.log
latex $system.doc >> doc2dvi.log
latex $system.doc >> doc2dvi.log

if [ "$documenttype" = "book" ]; then
    makeindex $system >> doc2dvi.log
else
    touch $system.ind
fi

latex $system.doc >> doc2dvi.log
latex $system.doc >> doc2dvi.log

# Make sure transformation succeeeds
exit 0

Deleted mttroot/mtt/bin/trans/doc2pdf version [17899ec521].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: doc2pdf
# Converts doc file to pdf file

# Copyright (c) P.J.Gawthrop 1998


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

system=$1
documenttype=$2

# Inform user
echo "Creating $system.pdf"

#Run pdflatex , bibtex and makeindex
pdflatex $system.doc > doc2pdf.log
bibtex $system    >> doc2pdf.log
pdflatex $system.doc >> doc2pdf.log
pdflatex $system.doc >> doc2pdf.log

if [ "$documenttype" = "book" ]; then
    makeindex $system >> doc2pdf.log
else
    touch $system.ind
fi

pdflatex $system.doc >> doc2pdf.log
pdflatex $system.doc >> doc2pdf.log

# Make sure transformation succeeeds
exit 0

Deleted mttroot/mtt/bin/trans/doc2ps version [d08f5c88d0].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: doc2dvi
# Converts doc file to dvi file

# Copyright (c) P.J.Gawthrop 1998


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1999/11/02 07:56:46  peterg
## Removed documenttype in blurb
##
## Revision 1.3  1998/11/24 12:03:27  peterg
## Indexing of book docs.
##
## Revision 1.2  1998/04/15 18:40:43  peterg
## Run LateX three times
##
## Revision 1.1  1998/03/03 08:35:50  peterg
## Initial revision
##
###############################################################

system=$1
documenttype=$2

# Inform user
echo "Creating $system.ps"

doc2dvi $system $documenttype

dvips -o $system.ps $1 

# Make sure transformation succeeeds
exit 0

Deleted mttroot/mtt/bin/trans/ese2rdae_r version [713fa3d927].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254






























































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ese2rdae_r
# Reduce equations to raw differential-algebraic equation conversion
# P.J.Gawthrop  8th May 1991, May 1994, June 1996
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11  2001/07/06 00:46:50  gawthrop
## Added -cr option -- forces cr to be loaded before the ese.r file
## This avoids causality problems when using multi-port Rs to represent
## arbitary equations
##
## Revision 1.10  2000/11/30 15:23:16  peterg
## Taken out all subsystem stuff - now done in mtt using
## mtt_make_subsystems
##
## Revision 1.9  2000/09/07 12:18:31  peterg
## Prettified layout of this file
##
## Revision 1.8  2000/09/07 12:07:26  peterg
## *** empty log message ***
##
## Revision 1.7  2000/09/01 13:34:15  peterg
## Exit on option error
##
## Revision 1.6  2000/09/01 13:30:32  peterg
## Added -partition switch
##
## Revision 1.5  2000/09/01 12:14:57  peterg
## Added connecti9ng inputs
##
## Revision 1.4  1998/04/07 15:06:46  peterg
## Correct log file name
##
## Revision 1.3  1998/03/07 12:57:19  peterg
## Fixed logname bug
##
## Revision 1.2  1998/03/07 12:51:20  peterg
## This is the new version of ese2dae - it does not do the CRs at this
## stage to give reduce an easier time.
##
## rese2ese_r does the constitutive relationship bit
##
## Revision 1.1  1998/03/07 12:49:31  peterg
## Initial revision
##
## Revision 1.12  1998/01/31 16:22:59  peterg
## Added IF MTTNx>0 THEN and IF MTTNy>0 THEN before the relevant
## assignements of MTTdX and MTTY to themselves.
##
## Revision 1.11  1997/09/18 09:45:08  peterg
## Canged the comment about linux reduce -- reduce reads this for some
## reason.
##
## Revision 1.10  1997/09/15 14:21:18  peterg
## Reads ese file twice to avoid a bug in Linux reduce !!!???
##
## Revision 1.9  1997/08/30 09:59:31  peterg
## Changed mehtod of writing out mtty to avoid a strange segmentation violation.
## Now uses MTTY := MTTY; approach.
##
## Revision 1.8  1997/04/23 09:31:20  peterg
## Now reads in the (top level) def file in the generated reduce code.
##
# Revision 1.7  1997/04/23  09:23:15  peterg
# Two argument version in preparation for heirarchical version
#
# Revision 1.6  1996/11/21  15:47:48  peterg
# Now inputs _params.r not _sympar.r
#
## Revision 1.5  1996/11/02 10:17:35  peterg
## Removed default constitutive relationship input.
##
# Revision 1.4  1996/09/12  12:10:05  peter
# Now reads the default constitutive relationship file.
#
## Revision 1.3  1996/08/25 09:43:26  peter
## General error handling.
##
## Revision 1.2  1996/08/25 08:31:28  peter
## Error handling added.
##
###############################################################


while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;;
	-cr )
                load_cr=yes;
                blurb2=' using cr and subs first';
                ;;
	-partition )
                partition=yes;
                blurb='with partitioning';
		;;
	*)
		echo "$1 is an invalid argument - ignoring";
                exit ;;
  esac
  shift
done

#Create the top-level system name
topname=$1

#Create the system names
if [ -z "$2" ]; 
    then
	sysname=$topname;
    else
	sysname=$1_$2;
fi

defname=$topname"_def.r"
crname=$topname"_cr.r"
subsname=$topname"_subs.r"
paramname=$topname"_params.r"
daename=$sysname"_rdae.r"
esename=$sysname"_ese.r"
logname=ese2rdae.log

if [ -n "${load_cr}" ]; then
    load_cr_comm="in \"${crname}\";"
    load_subs_comm="in \"${subsname}\";"
fi

# Inform user
echo Creating $daename $blurb $blurb2

# Remove the old log file
rm -f $logname

# Use symbolic algebra to accomplish the transformation
$SYMBOLIC >$logname  << EOF

%Read in the cr and sub when  -cr is set
$load_cr_comm
$load_subs_comm

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

% Definitions
in "$defname";

% Elementary system equations
in "$esename";

OFF Echo;
OFF Nat;

%Create the output file
OUT "$daename";

write "in ""$defname""";

% State
MTT_Matrix := MTTdX$ 
MTT_Matrix_name := "MTTdX"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Nonstate
MTT_Matrix := MTTZ$ 
MTT_Matrix_name := "MTTZ"$
MTT_Matrix_n := MTTNz$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Output
MTT_Matrix := MTTy$ 
MTT_Matrix_name := "MTTy"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Zero outputs
MTT_Matrix := MTTYz$ 
MTT_Matrix_name := "MTTYz"$
MTT_Matrix_n := MTTNyz$
MTT_Matrix_m := 1$
Reduce_Matrix()$


SHUT "$daename";
quit;

EOF

#if [ -n "$partition" ]; then
#  rm -f mtt_junk
#  # Now for the subsystems
#  # Find subsystems
#  subsystems=`mtt_get_subsystems $1`
#
#  for subsystem in $subsystems; do
#    echo Doing $subsystem
#    ucname="MTT_"$subsystem"_uc"
#  
#    Nu=`mtt_getsize -internal $subsystem u`
#    echo Nu $Nu
#  
#    # Use symbolic algebra to accomplish the transformation
#    $SYMBOLIC >$logname  << EOF
#  
#    %Read the formatting function
#    in "$MTTPATH/trans/reduce_matrix.r";
#  
#    % Definitions
#    in "$defname";
#  
#    % Elementary system equations
#    in "$esename";
#  
#    OFF Echo;
#    OFF Nat;
#   
#    %Create the output file
#    OUT "mtt_junk";
#    % Connecting inputs
#    MTT_Matrix := $ucname $
#    MTT_Matrix_name := "$ucname" $
#    MTT_Matrix_n := $Nu $
#    MTT_Matrix_m := 1$
#    Reduce_Matrix()$
#  
#    shut "mtt_junk";
#EOF
#    echo >> $1_rdae.r
#    echo %Connections for subsystem $subsystem  >> $1_rdae.r
#    echo >> $1_rdae.r
#  
#    cat mtt_junk >> $1_rdae.r
#    rm -rf mtt_junk
#  done
#fi

echo "END;" >> $1_rdae.r

# Now invoke the standard error handling.
mtt_error_r $logname

Deleted mttroot/mtt/bin/trans/ese_tidy version [351111a9a5].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

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


# Bourne shell script: ese_tidy
# Tidies up Matlab format files
# P.J.Gawthrop May 1998
# Copyright (c) P.J.Gawthrop, 1990, 1994, 1995.

#Puts the state & output equations at the end of the file

grep -v '^MTT' $1_ese.r>junk1
grep '^MTT' $1_ese.r>junk2
echo 'END;' >junk3
cat junk1 junk2 junk3> $1_ese.r




Deleted mttroot/mtt/bin/trans/examples_txt2tk version [db2fcef527].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: examples_txt2tk
# Creates tk/tcl file for xmtt.
# Copyright (c) P.J.Gawthrop, 1998,1999


# Examples menu
awk 'BEGIN{
    basemenu=".exam.exam"
    oldmenu=basemenu
    OLDPATH="";
    }
    {
    if (NF>1){
    PATH=$1;
    N=split(PATH,path,"/"); # Find current example path
    oldN=split(OLDPATH,oldpath,"/"); # Find last example path
    same=1; menu=basemenu;
    while ((path[same]==oldpath[same])&&(same<=N)){
       menu=menu"."tolower(path[same])
       same++
    }
      oldmenu=menu
      for (i=same;i<N;i++){
        menu=tolower(menu"."path[i])
        category=path[i];
	printf("\n# Example category %s (%i)\n", category, N)
        printf("%s  add  cascade -label \"%s\" -menu %s \n", oldmenu, category, menu);
        printf("menu %s\n", menu)
	oldmenu=menu
      }
    oldN=N
    OLDPATH=PATH
    oldcategory=category
    split($2,EXAMPLE,"_");
    example = EXAMPLE[1];
    printf(" set mtt \"xmtt --example %s\" \n", example); 
    printf("%s add command -label %s -command \" exec $mtt &\"\n", menu, example);
 }
}' 

Deleted mttroot/mtt/bin/trans/first version [6060a423fe].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: first
# Gives first of space seperated string
# Copyright (C) 2000 by Peter J. Gawthrop

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

echo $1 | cut -d ' ' -f 1 

Deleted mttroot/mtt/bin/trans/gdat2fig version [b25999b04d].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: gdat2ps

# Converts a data file in gplot format to a ps file

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  1997/12/07 18:45:44  peterg
## Set to monochrome (not colour). This gives clearer plots.
##
## Revision 1.7  1996/08/26 13:04:43  peterg
## Changed $() to ``.
##
# Revision 1.6  1996/08/16  14:51:21  peter
# Put in some cosmetic postscript options.
#
## Revision 1.5  1996/08/15 09:37:58  peter
## Parameters in title.
##
## Revision 1.4  1996/08/14 09:21:17  peter
## Gnu plot conversion now done externally in dat2gdat
##
## Revision 1.3  1996/08/10 14:12:48  peter
## Revised to new dat format: [x y x y x y] in place of [x y y y].
##
## Revision 1.2  1996/08/10 12:54:56  peter
## Reorganised data file for gnuplot input.
##
## Revision 1.1  1996/08/10 09:52:39  peter
## Initial revision
##
###############################################################

echo Creating $1.fig

gnuplot << EOF
  set terminal fig color portrait fontsize 16 size 20 10 metric
  set output '$1.fig'
  set grid
  set title "MTT simulation on `date` "
  plot '$1.gdat' with lines
  exit

EOF

## Add a gold box to give a nice picture
cat >> $1.fig <<EOF
2 4 0 2 31 7 50 0 -1 0.000 0 0 7 0 0 5
	 9675 5310 9675 270 225 270 225 5310 9675 5310
EOF

Deleted mttroot/mtt/bin/trans/gdat2ps version [de49bc31ff].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: gdat2ps

# Converts a data file in gplot format to a ps file

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1996/08/26 13:04:43  peterg
## Changed $() to ``.
##
# Revision 1.6  1996/08/16  14:51:21  peter
# Put in some cosmetic postscript options.
#
## Revision 1.5  1996/08/15 09:37:58  peter
## Parameters in title.
##
## Revision 1.4  1996/08/14 09:21:17  peter
## Gnu plot conversion now done externally in dat2gdat
##
## Revision 1.3  1996/08/10 14:12:48  peter
## Revised to new dat format: [x y x y x y] in place of [x y y y].
##
## Revision 1.2  1996/08/10 12:54:56  peter
## Reorganised data file for gnuplot input.
##
## Revision 1.1  1996/08/10 09:52:39  peter
## Initial revision
##
###############################################################

echo Creating $1.ps

gnuplot << EOF
  set terminal postscript eps monochrome "Times-Roman" 24
  set size 1.5,1.5
  set output '$1.ps'
  set grid
  set title "`date` $2 "
  plot '$1.gdat' with lines
  exit
EOF

Deleted mttroot/mtt/bin/trans/gdat2view version [5424332042].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: gdat2view

# Converts a data file in gplot format to  view 

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2  1996/08/15  09:36:00  peter
# Parameters in title.
#
## Revision 1.1  1996/08/15 08:50:20  peter
## Initial revision
##
###############################################################


# echo Creating view of $1

gnuplot << EOF
  set grid
#  set title "$1. Generated by MTT on $(date)"
  set title "`date` $2 "
  plot '$1.gdat' with lines
  pause 100000
EOF

Deleted mttroot/mtt/bin/trans/icd2ICD_txt22txt.sh version [2134e4a645].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

sys=$1
icd=${sys}_*_icd.txt2
ICD=${sys}_ICD.txt

echo Creating ${ICD}

# lbl.txt ICD Format:
# [#|%]ICD PortName EffortName,EffortUnit;FlowName,FlowUnit
# $1       $2       $3
# Comma / Semi-colon distinction unenforced

# icd.txt Format
# PortName EffortName,EffortUnit;FlowName,FlowUnit input|output,input|output
# $1       $2         $3         $4       $5       $6           $7

cat <<EOF > ${ICD}
## Interface Control Definition for System ${sys}
## ${ICD}: Generated by MTT `date`

EOF

cat ${icd}		|\
    sed 's/[\,\;]/\ /g'	|\
    awk '
    ($2 != "null" && $6 == "input")  { printf ("Input:  %-30s %-30s Causality: Effort   Units: %s\n", $2, $1, $3) }
    ($4 != "null" && $7 == "input")  { printf ("Input:  %-30s %-30s Causality: Flow     Units: %s\n", $4, $1, $5) }
    ($2 != "null" && $6 == "output") { printf ("Output: %-30s %-30s Causality: Effort   Units: %s\n", $2, $1, $3) }
    ($4 != "null" && $7 == "output") { printf ("Output: %-30s %-30s Causality: Flow     Units: %s\n", $4, $1, $5) }
    ' | sort >> ${ICD}

Deleted mttroot/mtt/bin/trans/icd_txt2m.sh version [cb0a719b07].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

# Inform user
echo Creating $1_icd.m

#Create the component ICD file complete with headers.
echo "function icd = $1_icd" > $1_icd.m
echo "%% Component icd file ($1_icd.m)" >> $1_icd.m
echo "%% Generated by MTT at `date`" >> $1_icd.m

#Write out the variables 
awk '{
       if (NF==2) {i++; print "icd."$1 "\t = \""$2"\";"}
     
     }
     END{
       if (i==0) print "icd = 0;"
        }' $1_icd.txt >> $1_icd.m

Deleted mttroot/mtt/bin/trans/ker_r2tex version [efd3e610b9].

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





























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ker_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  9 Sep 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996.
# Copyright (C) 2001 by Peter J. Gawthrop


# Inform user
echo Creating $1_ker.tex

# Remove the old log file
rm -f ker_r2tex.log

# Use reduce to accomplish the transformation
reduce >ker_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the constrained-state matrices file
in "$1_ker.r";

%Read the symbolic parameters file
%%in "$1_sympar.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;

MATRIX MTT_Matrix(MTTNy-MTTNu,MTTNy);

OUT "$1_ker.tex";

%Write out the kernel matrix
write "%Kernel  matrices $1";
write "%File: $1_ker.tex";
write"";

MTT_Matrix := MTTR$ 
MTT_Matrix_name := "MTTR"$
MTT_Matrix_n := MTTNy-MTTNu$
MTT_Matrix_m := MTTNy$
LaTeX_Matrix()$

SHUT "$1_ker.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/landscape2portrait.sh version [2711c6c9b6].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: landscape2portrait.sh
# Converts one or more figure files from landscape mode to portrait mode

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

# Copyright (C) 2001 by Peter J. Gawthrop

figfiles=$*

for figfile in $figfiles; do
    count=`grep -c Landscape $figfile`
    if [ "$count" = "1" ]; then
       echo Converting $figfile
       mv $figfile ${figfile}.bak
       sed 's/Landscape/Portrait/'< ${figfile}.bak > $figfile
    fi
done

Deleted mttroot/mtt/bin/trans/lang_header version [63caba35a0].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243



















































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

# Generates function header for a computer language
# PJ Gawthrop May 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11  2000/05/11 08:03:02  peterg
## Remove the mtt no global stuff
##
## Revision 1.10  2000/04/18 11:14:32  peterg
## - parameters option
##
## Revision 1.9  2000/04/08 10:23:38  peterg
## Added -noglobal option
##
## Revision 1.8  1999/02/16 04:14:53  peterg
## Small change to modeline generation
##
## Revision 1.7  1999/01/20 22:19:21  peterg
## Puts emacs mode line at top of .m files
##
## Revision 1.6  1998/07/27 20:30:39  peterg
## Mods for dm rep - no globals ...
##
## Revision 1.5  1998/07/25 20:42:30  peterg
## No assignements for switch either
##
## Revision 1.4  1998/07/25 10:43:10  peterg
## No assignments of x or u if sm rep.
##
## Revision 1.3  1998/07/19 15:52:15  peterg
## Don't call the _input function - make it external from now on ...
##
## Revision 1.2  1998/05/24 12:47:39  peterg
## This still needs worjk doing for c generation!!
##
## Revision 1.1  1998/05/23 16:17:40  peterg
## Initial revision
##
###############################################################

# Args
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
    -noglobals)
	noglobals=noglobals;
	;;
    -parameters)
	parameters=parameters;
	;;
    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done

# Set up the language specific stuff
system=$1
rep=$2
language=$3
args=$4
output=$5
extras=$6

case $language in
    m)
	modeline='% -*-octave-*- Put Emacs into octave-mode%';
	ext='m';
	Lc='#';
	Rc='#';
	Lb='(';
	Rb=')';
	;;
    p)
	modeline='% -*-octave-*- Put Emacs into octave-mode%';
	ext='m';
	Lc='#';
	Rc='#';
	Lb='[';
	Rb=']';
	;;
    c)
	ext='c';
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    java)
	ext='java';
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    *)
	echo Language $language not supported - sorry; exit 1
esac


######### Octave (matlab) code
if [ "$language" = m ]; then
cat <<EOF
function $output = $1_$rep($args);
% $output = $1_$rep($args);
%System $system, representation $rep, language $language;
%File $1_$rep.$ext;
%Generated by MTT on `date`;
%
EOF
fi


######### c code
if [ "$language" = c ]; then
cat <<EOF
void $1_$rep() {
/*
System $system, representation $rep, language $language;
File $1_$rep.$ext;
Generated by MTT on `date`;

NB Arrays are be defined to be one larger than expected
 - the 0 element is not used.
*/

EOF

# Appropriate emacs mode line
cat <<EOF
$modeline
EOF

# Declarations
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;

  printf("$Lc Declare standard arrays $Rc\n");
  printf("  extern double mtty[%i]; \t $Lc $1_ode output $Rc\n", ny+1);
  printf("  extern double mttdx[%i]; \t $Lc $1_ode state derivative $Rc\n", nx+1);
  printf("  extern double mttx[%i]; \t $Lc $1_ode state $Rc\n", nx+1);
  printf("  extern double mttu[%i]; \t $Lc $1_ode input $Rc\n\n", nu+1);

  printf("$Lc Dummy variable list $Rc\n");
  printf("  double t0;\n\n");


  printf("$Lc State variable list $Rc\n");
  for i = 1:nx
    printf("  double mttx%i;\n",i);
  end;
printf("\n");

printf("$Lc State variable input list $Rc\n");
for i = 1:nu
  printf("  double mttu%i;\n",i);
end;
printf("\n");

printf("$Lc Counter $Rc\n");
printf("  int i;\n");
printf("\n");

printf("$Lc Time $Rc\n");
printf("  double t;\n");
printf("\n");

EOF

fi

if [ "$language" = "java" ]; then
cat <<EOF
public class $1_ode{
/*
System $system, representation $rep, language $language;
File $1_$rep.$ext;
Generated by MTT on `date`;
*/

EOF
fi

# Any extra bits ..
if [ -n "$extras" ]; then
cat <<EOF
$Lc Extra bits here $Rc
$extras
EOF
fi

# Globals
if [ -z "$noglobals" ]; then
    sympar2global_txt2lang $1 $language
else
cat<<EOF
global ...
mtt_no_globals ;
EOF
fi

# Explicit parameters
if [ -n "$parameters" ]; then
    sympar2par_txt2m $1 
fi

## if [ "$language" = "c" ] || [ "$language" = "m" ]; then
##   if [ "$rep" != "sm" ]&&[ "$rep" != "dm" ]&&[ "$rep" != "switch" ]; then
##   # Common part - ode (c and m)
##   # Use octave for this bit - needs the definition file
##   $MATRIX -q  <<EOF 
##     %System structure
##     [nx,ny,nu,nz,nyz] = $1_def;
## 
##   printf("$Lc====== Set up the state variables ======$Rc\n");
##   for i = 1:nx
##     printf("  mttx%i = mttx$Lb%i$Rb;\n",i,i);
##   end;
##   printf("\n");
## 
##   printf("$Lc====== Set up the input variables ======$Rc\n");
##   for i = 1:nu
##   printf("  mttu%i = mttu$Lb%i$Rb;\n",i,i);
##   end;
##   printf("\n");
## 
## EOF
##  fi
## fi
## #if [ "$language" = "java" ]; then

#$MATRIX -q <<EOF   
#    printf("JAVA\n");
#EOF

#fi

Deleted mttroot/mtt/bin/trans/lang_matrix.r version [f4b204b20b].

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
68
69
70
71
72
73
74
75
76












































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     %%%%% Model Transformation Tools %%%%%
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Reduce function to write matrices in computer - language form
% P.J.Gawthrop  March 1998, May 1988
% Copyright (c) P.J.Gawthrop, 1998



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.7  2000/08/29 17:33:59  peterg
% % After much fiddling about ..
% %  now does global optimisation (over all elements of matrix / vector)
% %  still fails for _sm.m
% %
% % Revision 1.6  2000/08/25 09:23:40  peterg
% % Made both names the same!
% %
% % Revision 1.5  2000/08/24 17:12:01  peterg
% % Now optimises using SCOPE
% %
% % Revision 1.4  1998/07/27 17:34:59  peterg
% % Sorted syntax errors
% %
% % Revision 1.3  1998/07/27 16:31:10  peterg
% % Sorted out to work with mtt_r2m
% %
% % Revision 1.2  1998/05/23 15:00:27  peterg
% % Removed the name = matrix statement - now done by sed.
% %
% % Revision 1.1  1998/05/23 10:49:25  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



PROCEDURE Lang_Matrix();
BEGIN
%INAME(mtt_o); % Set temp name
GENTRAN mtt_matrix :=: mtt_matrix;

%     FOR row := 1:MTT_Matrix_n DO
%     BEGIN
%       IF MTT_Matrix_m>1 THEN
%       BEGIN
%         FOR col := 1:MTT_Matrix_m DO
%         BEGIN
%               IF (row EQ 1) AND (col EQ 1) THEN DELAYOPTS;
%               INAME(mtt_o); % Set temp name
%               %SETLENGTH(2); % Adjust optimisation
%               gentran declare mtt_matrix_element:REAL;
%               gentran declare mtt_matrix:REAL;
%               mtt_matrix_element := mtt_matrix(row,col);
%               GENTRAN mtt_matrix(row,col) ::=: mtt_matrix_element;
%               IF (row EQ MTT_matrix_n) AND (col EQ MTT_Matrix_m) THEN MAKEOPTS;
%             END;
%       END
%       ELSE
%         BEGIN
%           IF (row EQ 1) THEN DELAYOPTS;
%           INAME(mtt_o); % Set temp name
%           GENTRAN mtt_matrix(row) ::=: mtt_matrix(row,1);
%           IF (row EQ MTT_matrix_n) THEN MAKEOPTS;
%         END;
%     END
END;

END;;


Deleted mttroot/mtt/bin/trans/latex_equations.r version [25e7283cc5].

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
68
69
70
71
72
73
74
75











































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Reduce file to generate equations
% Copyright (C) 2000 by Peter J. Gawthrop

PROCEDURE latex_equations;
BEGIN
IF MTTNx>0 THEN
BEGIN
  write"\begin{equation}"$
  write"\begin{aligned}"$
  FOR Row := 1:MTTNx DO
  BEGIN
	write "\dot MTTX", Row, " &= "$
	write "{"$
	write MTTdx(Row,1)$
	write "}"$
        IF Row<MTTNx THEN write "\cr"$
  END$
  write"\end{aligned}"$
  write"\end{equation}"$
END$

IF MTTNz>0 THEN
BEGIN
  write"\begin{equation}"$
  write"\begin{aligned}"$
FOR Row := 1:MTTNz DO
  BEGIN
	write "MTTz", Row, " &= "$
	write "{"$
	write MTTz(Row,1)$
	write "}"$
        IF Row<MTTNz THEN write "\cr"$
  END$
  write"\end{aligned}"$
  write"\end{equation}"$

END$

IF MTTNyz>0 THEN
BEGIN
  write"\begin{equation}"$
  write"\begin{aligned}"$
FOR Row := 1:MTTNyz DO
  BEGIN
	write "0 &= "$
	write "{"$
	write MTTyz(Row,1)$
	write "}"$
        IF Row<MTTNyz THEN write "\cr"$
  END$
  write"\end{aligned}"$
  write"\end{equation}"$

END$

IF MTTNy>0 THEN
BEGIN
  write"\begin{equation}"$
  write"\begin{aligned}"$
FOR Row := 1:MTTNy DO
  BEGIN
	write "MTTy", Row, " &= "$
	write "{"$
	write MTTy(Row,1)$
	write "}"$
        IF Row<MTTNy THEN write "\cr"$
  END$
  write"\end{aligned}"$
  write"\end{equation}"$

END$

END$

END$

Deleted mttroot/mtt/bin/trans/latex_matrix.r version [a9950295a9].

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
68
69
70
71
72
73
74
75
76
77
78
79















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     %%%%% Model Transformation Tools %%%%%
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Reduce function to write matrices in latex form
% P.J.Gawthrop  January 22 1998
% Copyright (c) P.J.Gawthrop, 1998

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Version control history
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $Id$
%% $Log$
%% Revision 1.6  2000/10/10 21:02:42  peterg
%% *** empty log message ***
%%
%% Revision 1.5  2000/08/09 10:41:39  peterg
%% Changed criterion form 3 to 5
%%
%% Revision 1.4  1998/11/10 14:15:36  peterg
%% Now does matrix style for m<3
%%
%% Revision 1.3  1998/03/14 11:07:09  peterg
%% Removed comma from array subscript
%%
%% Revision 1.2  1998/02/25 22:11:28  peterg
%% Added big matrix version
%%
%% Revision 1.1  1998/01/22 09:59:36  peterg
%% Initial revision
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


PROCEDURE Latex_Matrix;
BEGIN
IF MTT_Matrix_m<10 THEN %% Do matrix style version
BEGIN
  IF MTT_Matrix_n>0 THEN
    IF MTT_Matrix_m>0 THEN
    BEGIN
      write "\begin{equation}";
      write MTT_Matrix_name, " = \begin{pmatrix}";
      FOR Row := 1:MTT_Matrix_n DO
      BEGIN
        FOR Col := 1:MTT_Matrix_m DO
        BEGIN
          write "{", MTT_Matrix(Row,Col), "}";
          IF Col<MTT_Matrix_m THEN Write "&"
        END;

	IF Row<MTT_Matrix_n THEN Write "\cr";
      END;
      write "\end{pmatrix}";
      write "\end{equation}";
    END;
END
ELSE  %% write out the elements one-by-one.
  IF MTT_Matrix_n>0 THEN
    IF MTT_Matrix_m>0 THEN
    BEGIN
      FOR Row := 1:MTT_Matrix_n DO
      BEGIN
        FOR Col := 1:MTT_Matrix_m DO
        BEGIN
          MTT_element := MTT_Matrix(Row,Col);
          IF MTT_element NEQ 0 THEN
          BEGIN
            write "\begin{equation}";
            write MTT_Matrix_name, "_", Row, Col, " = {", MTT_element, "}\cr";
            write "\end{equation}";
          END;
        END;
      END;
    END;
END;
END;

END;;

Deleted mttroot/mtt/bin/trans/latex_tidy version [75212ba689].

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
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
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






























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: latex_tidy
# Tidies up LaTex format files
# P.J.Gawthrop 12 June 1990, Dec 1994
# Copyright (c) P.J.Gawthrop, 1990, 1994

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.17  2000/12/28 12:31:15  peterg
## *** empty log message ***
##
## Revision 1.16  2000/10/10 21:03:20  peterg
## *** empty log message ***
##
## Revision 1.15  1998/04/07 08:44:11  peterg
## zapped eta - it messes up theta
##
## Revision 1.14  1998/02/25 22:12:07  peterg
## Added , to regexp for subscripts
##
## Revision 1.13  1998/02/18 09:06:07  peterg
## Added dX0
##
## Revision 1.12  1998/02/09 14:11:08  peterg
## Added ctf --> D(s)
##
## Revision 1.11  1998/01/30 15:15:14  peterg
## Sorted out superscript problem
##
# Revision 1.10  1997/08/19  10:38:26  peterg
# Added pi to the list
#
## Revision 1.9  1997/02/24 13:02:17  peterg
## Added gamma and delta transformations
##
## Revision 1.8  1996/12/31 16:14:53  peterg
## Now handles multi-character subscripts.
##
## Revision 1.7  1996/12/19 10:24:29  peterg
## Uniform conversion of mttxi --> x_{i} for x,u,y and z
## Convert ???mttx to mtt x for  x,u,y and z
##
## Revision 1.6  1996/12/12 16:03:19  peterg
## Removed global argument stuff for y - its already done in the
## translation.
##
## Revision 1.5  1996/12/12 15:59:06  peterg
## Generic handling of subscript for y,u,ui
##
## Revision 1.4  1996/12/12 15:54:20  peterg
## Saved it.
##
## Revision 1.3  1996/08/30 14:36:46  peter
## Added some more subscripts.
## -- its high time this was rewritten in awk or perl!!!
##
## Revision 1.2  1996/08/19 14:35:51  peter
## Prettyfied z dot.
##
## Revision 1.1  1996/08/18 20:03:12  peter
## Initial revision
##
###############################################################
 
cat $1 | \
tr "[A-Z]" "[a-z]" | \
sed \
    -e "s/_\([a-z0-9,]*\)/_{\1}/g" \
    -e "s/\// \\\over /g" \
    -e "s/[0-9a-z_]*mtty/mtty/g" \
    -e "s/[0-9a-z_]*mttu/mttu/g" \
    -e "s/mttx\([0-9]*\)/x_{\1}/g" \
    -e "s/mttex\([0-9]*\)/\\\chi_{\1}/g" \
    -e "s/mttddui\([0-9]*\)/\\\ddot{v}_{\1}/g" \
    -e "s/mttdui\([0-9]*\)/\\\dot{v}_{\1}/g" \
    -e "s/mttui\([0-9]*\)/v_{\1}/g" \
    -e "s/mttu\([0-9]*\)/u_{\1}/g" \
    -e "s/mtty\([0-9]*\)/y_{\1}/g" \
    -e "s/mttz\([0-9]*\)/z_{\1}/g" \
    -e "s/mttdx0/\\\dot x_0/g" \
    -e "s/mttdx/\\\dot x/g" \
    -e "s/mttdz/\\\dot z_/g" \
    -e "s/mttdu/\\\dot u_/g" \
    -e "s/dot_/ \\\dot /g" \
    -e "s/mtttf/G(s)/g" \
    -e "s/mttctf/D(s)/g" \
    -e "s/mtta/A/g" \
    -e "s/mttb/B/g" \
    -e "s/mttc/C/g" \
    -e "s/mttd/D/g" \
    -e "s/mtte/E/g" \
    -e "s/mttg/G/g" \
    -e "s/mtti/I/g" \
    -e "s/mttk/K/g" \
    -e "s/mttl/L/g" \
    -e "s/mttm/M/g" \
    -e "s/mtttheta/\\\Theta/g" \
    -e "s/mtto/O/g" \
    -e "s/mttv/V/g" \
    -e "s/mtty0/y_0/g" \
    -e "s/mttu0/u_0/g" \
    -e "s/mttx/x/g" \
    -e "s/mttz/z/g" \
    -e "s/mttyy/Y/g" \
    -e "s/mttw/w/g" \
    -e "s/mttt/T/g" \
    -e "s/mttpar//g" \
    -e "s/!/\\\/g" \
    -e "s/\\$//g" \
    -e "s/(/{(/g" \
    -e "s/\*\*/^/g" \
    -e "s/\*/ /g" \
    -e "s/)/)}/g" \
    -e "s/\left/\left (/g" \
    -e "s/\right/\right )/g" \
    -e "s/sqrt/\\\sqrt/g" \
    -e "s/theta/\\\theta/g" \
    -e "s/tau/\\\tau/g" \
    -e "s/alpha/\\\alpha/g" \
    -e "s/beta/\\\beta/g" \
    -e "s/gamma/\\\gamma/g" \
    -e "s/delta/\\\delta/g" \
    -e "s/epsilon/\\\epsilon/g" \
    -e "s/eta/\\\eta/g" \
    -e "s/kappa/\\\kappa/g" \
    -e "s/lambd/\\lambda/g" \
    -e "s/lambda/\\\lambda/g" \
    -e "s/mu/\\\mu/g" \
    -e "s/phi/\\\phi/g" \
    -e "s/pi/\\\pi/g" \
    -e "s/rho/\\\rho/g" \
    -e "s/sigma/\\\sigma/g" \
    -e "s/omega/\\\omega/g" \
    -e "s/zeta/\\\zeta/g" \
    -e "s/infty/\\\infty/g" \
    -e "s/sin/\\\sin/g" \
    -e "s/cos/\\\cos/g" \
    -e "s/23/{23}/g" \
    -e "s/+-/ -/g" \
 | cat -s  | \
sed -e "s/ $//g" | \
tr  -s '\012' '\012' \
>junk

mv junk $1





Deleted mttroot/mtt/bin/trans/lbl2alias_txt version [19255cbb75].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2alias_txt2txt
# Creates the component aliases in text form

# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/07/02 08:14:07  peterg
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_alias.txt

#Create the alias file complete with headers.
echo "# Alias file ($1_alias.txt)" > $1_alias.txt
echo "# Generated by MTT at `date`" >> $1_alias.txt

#Write out the variables 
grep '[%|#]ALIAS' $1_lbl.txt |\
awk '{print $2,$3}' >> $1_alias.txt









Deleted mttroot/mtt/bin/trans/lbl2alias_txt2txt version [a972903b94].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2alias_txt2txt
# Creates the component aliases in text form

# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/07/17 16:31:37  peterg
## Ignore component aliases (with /)
##
## Revision 1.4  1998/07/03 15:21:26  peterg
## Replace sub by gsub -- need to replace ALL ,
##
## Revision 1.3  1998/07/03 13:49:03  peterg
## Flips the order of alias and name when $ is involved.
##
## Revision 1.2  1998/07/03 07:54:39  peterg
## Tidied
##
## Revision 1.1  1998/07/02 09:22:10  peterg
## Initial revision
##
## Revision 1.2  1998/07/02 08:34:00  peterg
## Renamed to lbl2alias_txt2txt
##
## Revision 1.1  1998/07/02 08:14:07  peterg
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_alias.txt

#Create the alias file complete with headers.
echo "# Alias file ($1_alias.txt)" > $1_alias.txt
echo "# Generated by MTT at `date`" >> $1_alias.txt

#Write out the variables 
    grep '[%|#]ALIAS' $1_lbl.txt |\
    awk '{
      if (match($3,"/")==0){
        if (match($2,"\\$")==0){
          alias=$2; name =$3
        }
        else{
          alias=$3; name =$2
        }
        gsub(",","__",alias); #Replace ,
        n=split(alias,a,"|");
        for (i=1; i<=n; i++)
          print a[i] "\t" name;
	   }
      }
      END{
      print "###_END_OF_ALIAS_###"
     }' >> $1_alias.txt









Deleted mttroot/mtt/bin/trans/lbl2args_txt2out version [05b9541fdd].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
# Writes argument list to standard output ready for use in calling lbl file

  ###################################### 
  ##### Model Transformation Tools #####
  ######################################
  
  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.1  2001/06/11 15:06:58  gawthrop
  ## Now handles user-defined components
  ##
  ###############################################################

# Copyright (C) 2001 by Peter J. Gawthrop

if [ -f "$1_lbl.txt" ]; then
grep '[#%]ALIAS' $1_lbl.txt |\

awk '{
  if (match($2,"\\$[0-9]")==1) ## Test if its a argument alias
  {
    i = substr($2,2);
    arg[i] = $3
    N++
  }
}
END{
    for (j=1;j<=N;j++){
      if (length(arg[j])==0)
        arg[j] = "??";
    }
    for (j=1;j<N;j++){
      if (length(arg[j])==0)
        arg[j] = "??";
      printf("%s;", arg[j]);
    }
    printf("%s\n",arg[N]);
}'
fi

Deleted mttroot/mtt/bin/trans/lbl2component version [6d85c8fe68].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2component
# Creates the commands to pull down components from libraries

# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/07/27 08:38:11  peterg
## Just look for / in the relevant field.
##
## Revision 1.1  1998/07/17 17:04:50  peterg
## Initial revision
##
###############################################################


# Regexp for an alias
alias='^[#%]ALIAS'

grep $alias $1_lbl.txt | awk '{if (match($3,"/")>0) print "mtt -q compcopy " $3}'










Deleted mttroot/mtt/bin/trans/lbl2cr_txt2r version [52afa16970].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2cr_txt2r

# Label file to constitutive relationship conversion
# P.J.GawthropNovemebr 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.3  1996/11/03  21:11:44  peterg
# Removed END; statement
#
## Revision 1.2  1996/11/02 10:20:53  peterg
## Created from lbl2sympar
##
###############################################################


# Inform user
echo "Creating $1_cr.r"

rm -f mtt_error

#Write some file headers
echo "%% constitutive relationship  file ($1_cr.r)" > $1_cr.r
echo "%% Generated by MTT at `date`" >> $1_cr.r

# This is the main transformation using awk
awk -f $MTTPATH/trans/awk/lbl2cr.awk <$1_lbl.txt  2>mtt_error.txt | \
	sh >> $1_cr.r

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


Deleted mttroot/mtt/bin/trans/lbl2icd_txt2txt.sh version [90cc5ce192].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2icd_txt2txt
# Creates the component ICDs in text form

# Adapted from lbl2alias_txt2txt

sys=$1
icd=${sys}_icd.txt
lbl=${sys}_lbl.txt

# Inform user
echo Creating ${icd}

#Create the ICD file complete with headers.
echo "# Component ICD file ($1_icd.txt)" > ${icd}
echo "# Generated by MTT at `date`" >> ${icd}

#Write out the variables 
    grep '[%|#]ICD' ${lbl} |\
    awk '{
      if (match($3,"/")==0){
        if (match($2,"\\$")==0){
          icd=$2; name =$3
        }
        else{
          icd=$3; name =$2
        }
        n=split(icd,a,"|");
        for (i=1; i<=n; i++)
          print a[i] "\t" name;
	   }
      }
      END{
      print "###_END_OF_ICD_###"
     }' >> ${icd}

Deleted mttroot/mtt/bin/trans/lbl2modpar_txt version [ccd703b3b8].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2modpar_txt2txt
# Creates the component modpares in text form

# Copyright (C) 2001 by Peter J. Gawthrop

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

# Inform user
echo Creating $1_modpar.txt

#Create the modpar file complete with headers.
echo "# Modpar file ($1_modpar.txt)" > $1_modpar.txt
echo "# Generated by MTT at `date`" >> $1_modpar.txt

#Write out the variables 
grep '[%|#]MODPAR' $1_lbl.txt |\
awk '{printf("%s\t%s\n", $2,$3)}' >> $1_modpar.txt

echo "# End of $1_modpar.txt" >> $1_modpar.txt








Deleted mttroot/mtt/bin/trans/lbl2sympar_txt2r version [7f7d56852b].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2sympar_txt2r

# Label file to symbolic parameters conversion
# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.6  1996/12/07  19:39:51  peterg
# Minor debugging.
#
## Revision 1.5  1996/09/12 17:18:44  peter
## Don't add an RCS header ..
##
## Revision 1.4  1996/08/30 19:01:21  peter
## Added headers to sympar file.
##
## Revision 1.3  1996/08/30 10:18:33  peter
## New path for awk script.
##
## Revision 1.2  1996/08/30 10:04:20  peter
## Included `;' in demimiter list.
##
# Revision 1.1  1996/08/24  13:34:09  peter
# Initial revision
#
###############################################################


# Inform user
echo "Creating $1_sympar.r"

rm -f mtt_error

#Write some file headers
echo "%% Symbolic parameter file ($1_sympar.r)" > $1_sympar.r
echo "%% Generated by MTT at `date`" >> $1_sympar.r

# This is the main transformation using awk
tr ';' ',' <  $1_lbl.txt | \
awk -f $MTTPATH/trans/awk/lbl2sympar.awk | sort >> $1_sympar.r 2>mtt_error.txt

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


Deleted mttroot/mtt/bin/trans/lbl_txt2tex version [0f96c4023e].

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
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
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





















































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl_txt2tex
# Latex summary of the lbl file

# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.10  2000/12/28 12:32:06  peterg
## Put under RCS
##
## Revision 1.9  2000/11/16 13:11:06  peterg
## Included PAR and UNITS declarations
##
## Revision 1.8  1999/02/17 21:42:19  peterg
## Replaced print by printf to avoid extra nl in paragraph command.
##
## Revision 1.7  1998/07/27 12:56:26  peterg
## Splits up | separated expressions.
##
## Revision 1.6  1998/07/27 10:56:31  peterg
## Cosmetics.
##
## Revision 1.5  1998/07/27 08:29:44  peterg
## Include a comment field in the aliases
##
## Revision 1.4  1998/07/17 19:46:44  peterg
## Included component alias.
##
## Revision 1.3  1998/07/16 20:39:52  peterg
## More cosmetic changes
##
## Revision 1.2  1998/07/16 16:34:09  peterg
## Cosmetic changes
##
## Revision 1.1  1998/07/16 16:31:47  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_lbl.tex

#Create the alias file complete with headers.
echo "% Label summary file ($1_lbl.tex)" > $1_lbl.tex
echo "% Generated by MTT at `date`" >> $1_lbl.tex

#Write out the Description
    grep '[%|#]SUMMARY' $1_lbl.txt | sed 's/_/\\_/g'  |\
    awk '{
           printf("\\paragraph{System %s:",$2);
           for (i=3;i<=NF;i++) printf("%s ",$i); print ""
           print  "}"
         }' >> $1_lbl.tex
    grep '[%|#]DESCRIPTION' $1_lbl.txt | sed 's/_/\\_/g'  |\
    awk '{
           for (i=2;i<=NF;i++) printf("%s ",$i); print ""
         }' >> $1_lbl.tex

#Write out the aliases
cat <<EOF >> $1_lbl.tex
\paragraph{Interface information:}
\begin{description}
EOF
    grep '[%|#]ALIAS' $1_lbl.txt | sed 's/_/\\_/g' |\
    awk '{
      N=split($2,a,"|");
      for (i=1;i<=N;i++){
        if (match(a[i],"\\$")>0){
          printf("\\item [Parameter \\%s] represents actual parameter ",a[i])
        }
        else if (match($3,"/")>0){
          printf("\\item [Component %s]  is in library ",a[i])
        }
        else{
          printf("\\item [Port %s] represents actual port ",a[i])
        }
        printf("\\textbf{%s}",$3)
        if (match($4,"[#%]")==1) printf(" -- ");
        for (j=5;j<=NF;j++) printf(" %s", $j)
        printf("\n");
        }
      }
    END{if (NR==0) print "\\item This component has no ALIAS declarations"
}'  | sort >> $1_lbl.tex
cat <<EOF >> $1_lbl.tex
\end{description}
EOF

#Write out the VARS
cat <<EOF >> $1_lbl.tex
\paragraph{Variable declarations:}
\begin{description}
EOF
    grep '[%|#][V|P]AR' $1_lbl.txt | sed 's/_/\\_/g' |\
    awk '{
        printf("\\item %s\n",$2)
      }
    END{if (NR==0) print "\\item This component has no PAR declarations"
}'  | sort >> $1_lbl.tex
cat <<EOF >> $1_lbl.tex
\end{description}
EOF


#Write out the UNITS
cat <<EOF >> $1_lbl.tex
\paragraph{Units declarations:}
\begin{description}
EOF
    grep '[%|#]UNITS' $1_lbl.txt | sed 's/_/\\_/g' |\
    awk '{
        printf("\\item [Port %s] has domain %s\n",$2, $3)
	printf("\\begin{description}\n")
        printf("\\item [Effort units] %s\n",$4)
        printf("\\item [Flow units] %s\n",$5)
	printf("\\end{description}\n")
      }
    END{if (NR==0) print "\\item This component has no UNITs declarations"
}' >> $1_lbl.tex
cat <<EOF >> $1_lbl.tex
\end{description}
EOF

# Write the actual lbl file
cat >> $1_lbl.tex <<EOF
\subsubsection*{The label file: $1\_lbl.txt}
\begin{verbatim}
EOF
cat $1_lbl.txt >> $1_lbl.tex
cat >> $1_lbl.tex <<EOF
\end{verbatim}
EOF







Deleted mttroot/mtt/bin/trans/lde_r2tex version [d2cd6c0a98].

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
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










































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lde_r2tex
# Reduce differential-algebraic to LaTex differential-algebraic equations.
# P.J.Gawthrop 10th May 1991, April 1994
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/01/23 15:51:01  peterg
## Repleace eqnarray by equation + aligned -- this works with Latex2html
##
## Revision 1.2  1996/12/20 08:59:10  peterg
## Now writes out mtti instead of mtt_{i} -- lets latex_tidy do the
## conversion.
##
## Revision 1.1  1996/12/20 08:53:57  peterg
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_lde.tex

# Remove the old log file
rm -f lde_r2tex.log

# Use reduce to accomplish the transformation
reduce >lde_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the differential-algebraic equations file
in "$1_lde.r";

%Read the symbolic parameter file
%%in "$1_sympar.r";



OFF Echo;
OFF Nat;

%Read the substitution file
IN "$1_subs.r";

%Read the simplifying expressions file
IN "$1_simp.r";

OUT "$1_lde.tex";

%Write out the  differential-algebraic equations.

write "%File: $1_lde.tex";

write "%ordinary differential equations";
write "% Generated by MTT";

IF MTTNyz>0 THEN
BEGIN
  write"\begin{equation} \label{eq_$1_lde_x}";
  write"\begin{aligned}";
  FOR Row := 1:MTTNx DO
  BEGIN
	write "{";
	write MTTl(Row,1);
	write "}";
	write " &= 0";
        IF Row<MTTNx THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;


IF MTTNy>0 THEN
BEGIN
  write"\begin{equation} \label{eq_$1_lde_y}";
  write"\begin{aligned}";
  FOR Row := 1:MTTNy DO
  BEGIN
	write "MTTy", Row, " &= ";
	write "{";
	write MTTy(Row,1);
	write "}";
        IF Row<MTTNy THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;





SHUT "$1_lde.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/m/abg2cbg.m version [5a064c61a6].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525













































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [port_bonds, status] = abg2cbg(system_name, system_type, full_name,
					port_bonds,
					port_bond_direction,
					port_status,
					derivative_causality,
					typefile, infofile, errorfile)

  ## abg2cbg - acausal to causal bg conversion
  ##
  ##     ###################################### 
  ##     ##### Model Transformation Tools #####
  ##     ######################################
  ## 
  ## Matlab function  abg2cbg.m
  ## Acausal bond graph to causal bond graph: mfile format
  ## [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

  ## ###############################################################
  ## ## Version control history
  ## ###############################################################
  ## ## $Id$
  ## ## $Log$
  ## ## Revision 1.48  2001/07/23 23:20:27  gawthrop
  ## ## Now only writes to type.sh and cbg.m when causality is completed.
  ## ##
  ## ## Revision 1.47  2000/03/20 16:45:26  peterg
  ## ## *** empty log message ***
  ## ##
  ## ## Revision 1.46  2000/02/17 16:14:49  peterg
  ## ## *** empty log message ***
  ## ##
  ## ## Revision 1.45  1999/11/01 03:17:45  peterg
  ## ## Added extra info - current subsystem
  ## ##
  ## ## Revision 1.44  1999/03/11 23:54:11  peterg
  ## ## Include possibility of vector SS when finding port_bond_index
  ## ##
  ## ## Revision 1.43  1998/12/14 15:19:36  peterg
  ## ## Added missing "derivative_causality," argument to recursive call of
  ## ## this function
  ## ##
  ## ## Revision 1.42  1998/12/03 14:55:40  peterg
  ## ## Now uses number of components with complete causality to measure
  ## ## progress of algorithm -- Done.
  ## ## This replaces bond count -- done.
  ## ##
  ## ## Revision 1.41  1998/11/20 10:52:28  peterg
  ## ## Copies port bonds if the port bonds ARE set
  ## ## -- replaces Copies port bonds if the component bonds are NOT set
  ## ##
  ## ## Revision 1.40  1998/09/02 11:47:09  peterg
  ## ## Now uses explicit ordered list of ports instead of port.index.
  ## ## Note that subsystems are still treated in arbitrary order.
  ## ##
  ## ## Revision 1.39  1998/08/25 20:06:16  peterg
  ## ## Writes flipped port info
  ## ##
  ## ## Revision 1.38  1998/08/25 09:15:28  peterg
  ## ## Fixed couple of problems with using two copies of the one data
  ## ## stucture:
  ## ##
  ## ## ABG_field and ABG.field
  ## ##
  ## ## Maybe this is conceptually wrong?
  ## ##
  ## ## Revision 1.37  1998/08/25 08:33:29  peterg
  ## ## Now does ports as well - fixed string prob by using deblank
  ## ##
  ## ## Revision 1.36  1998/08/25 06:44:40  peterg
  ## ## Furhter revisions
  ## ##
  ## ## Revision 1.35  1998/08/24 10:16:32  peterg
  ## ## Coverted to new structure - still needs status sorting.
  ## ##
  ## ## Revision 1.34  1998/08/24 07:35:03  peterg
  ## ## About to go to new abg format.
  ## ##
  ## ## Revision 1.33  1998/07/29 13:36:37  peterg
  ## ## Don't set port status if there aren't any ports.
  ## ##
  ## ## Revision 1.32  1998/07/28 19:06:11  peterg
  ## ## *** empty log message ***
  ## ##
  ## ## Revision 1.31  1998/07/28 13:15:10  peterg
  ## ## Vector SS ports included.
  ## ##
  ## ## Revision 1.30  1998/07/27 20:29:49  peterg
  ## ## Had another go at causality ....
  ## ##   1. Impose external causality onto all port bonds
  ## ##   2. Set C_cause.m so that it DOESN'T set causality
  ## ##       -- I_cause is already ok !
  ## ##
  ## ## Revision 1.29  1998/07/10 09:01:42  peterg
  ## ## Added error + info file in new form
  ## ##
  ## ## Revision 1.28  1998/07/08 09:23:42  peterg
  ## ## Undid the previous change -- needs more thought.
  ## ##
  ## ## Revision 1.27  1998/07/03 19:03:31  peterg
  ## ## Always override the causality of port bonds!
  ## ##
  ## ## Revision 1.26  1998/06/27 13:24:04  peterg
  ## ## Causality now set correctly for:
  ## ## 	multi-port C and I
  ## ## 	C and I with arrows pointing in
  ## ##
  ## ## Revision 1.25  1998/06/25 18:53:30  peterg
  ## ## Actually, the previous comment was optimistic.
  ## ## The port causalities on a compound are now forced to be the same as
  ## ## that specified by a a _cuase.m file (if it exists)
  ## ##
  ## ## Revision 1.24  1998/06/25 17:45:03  peterg
  ## ## No change -- but checked that explicit causality works!
  ## ##
  ## ## Revision 1.23  1998/04/04 10:46:37  peterg
  ## ## Coerces port bonds to have smae direction as the imposing bonds
  ## ## _cbg now generates the (coerced) components as welll as the (coerced)
  ## ## causality.
  ## ##
  ## ## Revision 1.22  1997/08/19 10:21:09  peterg
  ## ## Only copy port cuaslity info if not already set within the
  ## ## subsystem. I thought I'd done this already ....
  ## ##
  ## ## Revision 1.21  1997/08/18 16:25:25  peterg
  ## ## Minor bug fixes
  ## ##
  ## ## Revision 1.20  1997/08/18 12:45:24  peterg
  ## ## Replaced: comp_bonds = bonds(bond_list,:)
  ## ## by: 	for kk = 1:n_comp
  ## ## 	  comp_bonds(kk,:) = bonds(comp(kk),:);
  ## ## 	end;
  ## ##
  ## ## to avoid an octave bug in 1.92.
  ## ##
  ## ## Revision 1.19  1997/08/18 11:23:59  peterg
  ## ## Main component loop now misses out the ports (SS:[]) -- the causality
  ## ## is merely passed through these components.
  ## ##
  ## ## Revision 1.18  1997/08/08 08:11:04  peterg
  ## ## Suppress compoment trace.
  ## ##
  ## ## Revision 1.17  1997/08/07 16:10:13  peterg
  ## ## Move the if status ..  to the beginning of the main loop.
  ## ##
  ## ## Revision 1.16  1997/08/04 13:11:19  peterg
  ## ## Only change to component-orientated causality for simple components
  ## ## NOT for compound components.
  ## ##
  ## ## Revision 1.15  1997/01/05 12:25:59  peterg
  ## ## More informative message about port bonds incompatible with  ports
  ## ##
  ## ## Revision 1.14  1996/12/31 16:20:42  peterg
  ## ## Just write causality information at top level -- it gets a bit
  ## ## voluminous if written at deeper levels.
  ## ##
  ## ## Revision 1.13  1996/12/31 11:49:09  peterg
  ## ## Don't copy port bond causality if already set -- allows subsystem
  ## ## causality to be preset directely on named SS.
  ## ##
  ## ## Revision 1.12  1996/12/31 11:42:36  peterg
  ## ## *** empty log message ***
  ## ##
  ## ## Revision 1.11  1996/12/07  17:10:48  peterg
  ## ## Allows port SS at top level - ie takes it to be an ardianry SS at top
  ## ## level.
  ## ##
  ## ## Revision 1.10  1996/12/04 21:48:55  peterg
  ## ## Compares full-name with empty string (instead of testing for zero
  ## ## length.
  ## ##
  ## ## Revision 1.9  1996/08/30  12:55:40  peter
  ## ## More heirachical stuff added.
  ## ##
  ## ## Revision 1.8  1996/08/26  10:04:25  peterg
  ## ## Fixed error due to a line wrap.
  ## ##
  ## ##Revision 1.7  1996/08/16  12:58:58  peter
  ## ## Now does preferred causality of I and C.
  ## ## Revision 1.6  1996/08/09 08:27:29  peter
  ## ## Added a few deguging lines
  ## ##
  ## ## Revision 1.5  1996/08/08 18:06:18  peter
  ## ## Unified file naming scheme
  ## ##
  ## ## Revision 1.4  1996/08/08 08:30:06  peter
  ## ## The cbg filename contains the system name - this makes things easier
  ## ## when setting up the m to fig translation and m to ese translation
  ## ##
  ## ## Revision 1.3  1996/08/05 18:53:21  peter
  ## ## Fixed bug passing causality from subsystems.
  ## ##
  ## ## Revision 1.2  1996/08/05 15:41:41  peter
  ## ## Now recursively does causality on subsystems.
  ## ##
  ## ## Revision 1.1  1996/08/04 17:55:55  peter
  ## ## Initial revision
  ## ##
  ## ###############################################################

  mtt_info(sprintf("Completing causality for subsystem %s", system_name), infofile);

  pc = '%';
  if nargin<1
    system_name = 'no_name';
  end;

  if nargin<4
    port_bonds = [];
  end;

  if nargin<5
    infofile = 'stdout';
  end;

  ## Are we at the top level of the heirarchy?
  at_top_level = strcmp(full_name, '');

  ## Create a file to contain shell commands which map subsystem types 
  ## onto components
#   if at_top_level # Then at top level
#     fprintf(typefile, "# Commands to map types onto subsystems\n");
#     fprintf(typefile, "# File %s_type.sh\n", system_name);
#     fprintf(typefile, "# Generated by MTT at %s\n\n", ctime(time));
#   end;

  ## Create the (full) system name
  if at_top_level
    full_name = system_name;
    system_type = system_name;
  else
    full_name = [full_name, "_", system_name];
  end;
  
  fun_name = [system_type, "_abg"];

  disp("====================================");
  disp(["BEGIN: ", full_name, " (", fun_name, ")"]);
  disp("====================================");

  ## If no such function - then there is nothing to be done.
  if exist(fun_name)~=2
    mtt_error(["m-file ", fun_name, " does not exist"], errorfile);
    bonds = [];
    status = [];
    return
  end;

  ## Evaluate the system function to get the bonds and number of ports
  ##eval(["[bonds,components,n_ports,N_ports]=", fun_name, ";"]);
  eval(["[ABG]=", fun_name, ";"]);
  !struct_contains(ABG,"subsystems")
  if !struct_contains(ABG,"subsystems")# Are there any subsystems?
    return;			# Nothing to do
  else
    [n_subsystems,junk] = size(struct_elements(ABG.subsystems))
  endif
  
  if struct_contains(ABG,"portlist")# Are there any ports?
    [n_ports,junk] = size(ABG.portlist);
    ##     port_bond_index=zeros(n_ports,1);
    i_port = 0;
    for i=1:n_ports		# Find indices of the internal ports
      name = deblank(ABG.portlist(i,:)); # Name of this port
      eval(["port = ABG.ports.",name,";"]); # Extract port info
      for j=1:length(port.connections) # Maybe vector SS
	port_bond_index(++i_port) = abs(port.connections(j));
      endfor;
    endfor
  else
    n_ports = 0;
  endif				   

  
  [n_bonds,columns] = size(ABG.bonds);# Find number of bonds
  if (columns ~= 2)&(n_bonds>0)
    error("Incorrect bonds matrix: must have 2 columns");
  end;

  
  ## Find number of components
  ##  [n_components,m_components] = size(components);
  ##  if n_components==0 # there is nothing to be done
  ##    return
  ##  end;


  
  ## Coerce the port (SS:[]) component bonds to have the same direction as
  ## of the bonds in the encapsulating system -- but not at top level
  Flipped.ports="";Flipped.subs="";Flipped.cons="";
  
  if (n_ports>0)&&(!at_top_level) # Coerce directions
    for i=1:n_ports
      name = deblank(ABG.portlist(i,:)); # Name of this port
      eval(["port = ABG.ports.",name,";"]); # Extract port info
      disp ("----");
      i
      name
      port
      port_bond_direction
      port.connections

      if (sign(port.connections)!=port_bond_direction(i)) # Direction different?
      	eval(["ABG.ports.",name,".connections = - port.connections;"]); # Flip direction at port
	Flipped.ports=[Flipped.ports;name];	# Remember which port has been flipped
        bond_index=abs(port.connections); # Index of bond on port
      	mtt_info(sprintf("Flip port %s on %s"\
			 ,name,full_name),infofile); # And report
      	for [subsystem,name] = ABG.subsystems # and at the other end
	  for k=1:length(subsystem.connections)
	    if (abs(subsystem.connections(k))==bond_index) # Then flip the connection
	      eval(["ABG.subsystems.",name,".connections(k)   = -subsystem.connections(k);"]);
	      Flipped.subs=[Flipped.subs;name];	# Remember which subsystem has been flipped
	      Flipped.cons=[Flipped.cons;k];	# Remember which connection has been flipped
      	      mtt_info(sprintf("Flip subsystem %s on %s"\
			       ,name,full_name),infofile); # And report
	    endif
	  endfor
      	endfor			# subsystem = ABG.subsystems

      	ABG.bonds(bond_index,:) = -ABG.bonds(bond_index,:);	# Flip the bond causalities 
	##(these are arrow-orientated)
      endif			# Is the direction different?
    endfor			# port = ABG.ports
  endif				# (n_ports>0)&&(!at_top_level)

  ## If not at top level, then copy the port bonds.
  if !at_top_level		# Find number of port bonds

    for j=1:n_ports
      jj = port_bond_index(j); # The index of the bond
      for k = 1:2
	##	if ABG.bonds(jj,k)==0 # only copy if not already set
	##	  ABG.bonds(jj,k) = port_bonds(j,k);
	##	endif
	if port_bonds(j,k)!=0	# only copy if port bonds are set
	  ABG.bonds(jj,k) = port_bonds(j,k);
	endif
      endfor
    endfor
  else
    n_port_bonds=0;
  endif
  
  ## Causality indicator
  total = 2*n_bonds;
  done = sum(sum(abs(ABG.bonds)))/total*100;

  fields=["ports";"subsystems"];	# Do for both ports and subsystems -
  ## ports first
  for i=1:2
    field=deblank(fields(i,:));
    if struct_contains(ABG,field);
      eval(["ABG_field = ABG.",field, ";"]);
      field,ABG_field
      
      sum_ok = 0; n_comp = 0;
      for [subsystem,name] = ABG_field# Find % status = 0 (causally complete)
    	eval(["ok = (ABG_field.",name,".status==0);"]);
	sum_ok = sum_ok + ok; n_comp ++;
      endfor;
      Done = sum_ok/n_comp*100
      
      ## Outer while loop sets preferred causality
      ci_index=1;

      ##      for [subsystem,name] = ABG_field# Set new status field to -1
      ##    	eval(["ABG_field.",name,".status=-1;"]);
      ##      endfor;
      
      while( ci_index>0)
    	old_done = inf;
    	old_Done = inf;
	
    	while Done!=old_Done	# Inner loop propagates causality
	  old_Done = Done;
	  for [subsystem,name] = ABG_field
	    name,subsystem
      	    if subsystem.status != 0 # only do this if causality not yet complete
	      comp = subsystem.connections; # Get the bonds on this component
	      bond_list = abs(comp);
	      direction = sign(comp)'*[1 1];
              n_bonds = length(bond_list);

	      if strcmp(subsystem.type,"0") # Change names
	    	subsystem.type = "zero";
	      end;
	      if strcmp(subsystem.type,"1")
	    	subsystem.type = "one";
	      end;
	      
	      cause_name = [subsystem.type, "_cause"];# Component causality procedure name
	      eqn_name = [subsystem.type, "_eqn"]; #Component equation procedure name
	      
	      comp_bonds=[];	# Bonds on this component (arrow-orientated) -- these become the
	      for kk = 1:n_bonds # port bonds on the ith component of this subsystem.
	    	comp_bonds(kk,:) = ABG.bonds(bond_list(kk),:);
	      end;

	      if exist(eqn_name)!=2 # Try a compound component
		## Port status depends on whether the corresponding bonds are
		##  fully causal at this stage.
            	one = ones(n_bonds,1);
            	port_status = (sum(abs(comp_bonds'))'==2*one) - one;
		
	    	port_bond_direction = -sign(subsystem.connections)'; # Direction of bonds

            	if exist(cause_name)==2	# If there is a predefined causality function; use it
		  comp_bonds = comp_bonds.*(port_bond_direction*[1 1]);	# Convert from arrow orientated to component orientated causality
		  eval([ "[comp_bonds] = ", cause_name, "(comp_bonds);" ]); # Evaluate the built-in causality procedure

		  comp_bonds = comp_bonds.*(port_bond_direction*[1 1]);	# and convert from component orientated to arrow orientated causality
            	end;
		
		port_bond_direction,comp_bonds
	    	[comp_bonds,subsystem.status] = abg2cbg(name, subsystem.type, full_name, 
							comp_bonds, port_bond_direction, port_status, ...
							derivative_causality, ...
						    	typefile, infofile, errorfile);

		
	      else # its a simple component -- or explicit causality defined
		mtt_info(sprintf("Completing causality for component %s (%s)",
				 name, subsystem.type), infofile);
	    	disp(["---", name, " (", cause_name, ") ---"]);
	    	comp_bonds_in = comp_bonds
	    	
		## Convert from arrow orientated to component orientated causality
	    	comp_bonds = comp_bonds.*direction;
	    	
		## Evaluate the built-in causality procedure
		##eval([ "[comp_bonds,status(i)] = ", cause_name, "(comp_bonds);" ]);
	    	eval([ "[comp_bonds,subsystem.status] = ", cause_name, "(comp_bonds)" ]);
		## and convert from component orientated to arrow orientated causality
            	comp_bonds = comp_bonds.*direction; 
		
	    	comp_bonds_out = comp_bonds
	      end;
	      
	      ABG.bonds(bond_list,:) = comp_bonds;# Update the full bonds list
	      eval(["ABG_field.",name,".status = subsystem.status;"]);
    	    end;
	  end;

	  sum_ok = 0; n_comp = 0;
	  for [subsystem,name] = ABG_field# Find % status = 0 (causally complete)
    	    eval(["ok = (ABG_field.",name,".status==0);"]);
	    sum_ok = sum_ok + ok; n_comp ++;
	  endfor;

	  Done = sum_ok/n_comp*100
	  done = sum(sum(abs(ABG.bonds)))/total*100
	  ##disp(sprintf("Causality is #3.0f#s complete.", done, pc), infofile));
	  
    	endwhile			# done!=old_done
  	
    	[name,prefered] = getdynamic(ABG_field) # Set causality of a C or I which is not already set
    	if prefered==0
	  ci_index=0;
    	else
	  disp("Set causality of a C or I which is not already set")
	  eval(["ci_bond_index = ABG.",field,".",name,".connections;"]); # Get bonds
	  ci_direction = sign(ci_bond_index);
	  ci_bond_index = abs(ci_bond_index);
	  if derivative_causality
	    prefered = -prefered;
	  end;
	  ABG.bonds(ci_bond_index,1:2) = prefered*ci_direction'*[1 1]
	  eval(["ABG.subsystems.",name,".status=0"]); #set status of the C or I
    	endif
      endwhile			# ( ci_index>0)
      eval(["ABG.",field," = ABG_field;"]); # Copy back to actual structure
    endif			# struct_contains(CBG,field(i,:));
  endfor
  ##  if n_ports>0
  ##    status(1:n_ports) = zeros(n_ports,1); # Port status not relevant
  ##  endif;
  
  ## Print final causality
  ##  final_done =  (sum(status==zeros(n_components,1))/n_components)*100;
  
  if at_top_level
    mtt_info(sprintf("Final causality of %s is %3.0f%s complete.", ...
		     full_name, Done, pc), infofile);
    
    if Done<100
      mtt_error(sprintf("Unable to complete causality"),errorfile);
    end;
  endif				# at_top_level
  


  
  ## Return the port bonds - arrow orientated causality - and the direction 
  status=0;
  if !at_top_level # Not at top level
    port_bonds = ABG.bonds(port_bond_index,:); # Return port bonds
  endif;				# at top level

  for [subsystem,name] = ABG.subsystems
    if subsystem.status==-1	# Under causal
      status=-1;
      mtt_info(sprintf("Component %s (%s) is undercausal", name, subsystem.type), ...
	       infofile);
    elseif subsystem.status==1;	# Over causal
      status=-1;
      mtt_info(sprintf("Component %s (%s) is overcausal", name, subsystem.type), ...
	       infofile);
    endif;
  endfor;			# [subsystem,name] = ABG.subsystems

  ## write out the component .cbg file
    disp(["Writing ", full_name]);
    write_cbg(full_name,system_type,ABG,Flipped);
    fprintf(typefile, "$1%s$2%s$3\n", system_type, full_name);
  


  status, port_bonds
  disp("====================================");
  disp(["END: ", full_name, " (", fun_name, ")"]);
  disp("====================================");


endfunction;

Deleted mttroot/mtt/bin/trans/m/add_bond.m version [575ba3aab9].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function comp_list = add_bond(comp_list,bond_number,comp_number);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Adds a new bond entry to a list of components -- pads the list appropriately.

[N,M] = size(comp_list);
if M==0
  M=1;
end;

if comp_number>N % Pad with zeros
  comp_list = [comp_list;zeros(comp_number-N,M)];
end;

this_comp = [nozeros(comp_list(comp_number,:)), bond_number];

L = length(this_comp);

[N,M] = size(comp_list);

if L<M %pad new row with zeros
  comp_list(comp_number,:) = [this_comp, zeros(1,M-L)];
elseif L>M %pad matrix with zeros and insert new row
  comp_list = [comp_list zeros(N,L-M)];
  comp_list(comp_number,:) = this_comp;
else %Sizes match so just insert
  comp_list(comp_number,:) = this_comp;
end;

Deleted mttroot/mtt/bin/trans/m/add_row.m version [8618dcbf0d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function New=add_row(Old,Row); # Adds a row to end of matrix

  [N,M]=size(Old);
  [n,m] = size(Row);

  if m>M
    Old = [Old, zeros(N,m-M)];	# Pad with zeros
  elseif M>m
    Row = [Row, zeros(n,M-m)];
  endif

  New = [Old;Row];

endfunction

	   

Deleted mttroot/mtt/bin/trans/m/adjbond.m version [266020f198].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [index,distance] = adjbond(point,arrow_end,other_end);
% adjbond:  Determines the bond closest to the point 
%  [index,distance] = adjbond(point,arrow_end,other_end);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[n,m] = size(other_end);
one = ones(n,1);
arrow_distance = length2d(one*point - arrow_end);
min_arrow_distance = min(arrow_distance);

other_distance = length2d(one*point - other_end);
min_other_distance = min(other_distance);

min_distance = min([arrow_distance; other_distance]);

adjacent = [arrow_distance, other_distance] == min_distance*[one one];
[index,n] = getindex(adjacent,1);
distance = min_distance;

Deleted mttroot/mtt/bin/trans/m/adjcomp.m version [142766d077].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function indices = adjcomp(arrow_end,other_end,components);
% adjcomp: Determines the two components at each end of the bond



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[n,m] = size(components);
one = ones(n,1);

arrow_distance = length2d(one*arrow_end - components(:,1:2));
min_arrow_distance = min(arrow_distance);

other_distance = length2d(one*other_end - components(:,1:2));
min_other_distance = min(other_distance);

arrow_adjacent = arrow_distance==min_arrow_distance*one;
other_adjacent = other_distance==min_other_distance*one;
[index,n] = getindex([arrow_adjacent,other_adjacent],1);

if index(1,2)==1
  indices = index(1:2,1)';
else
  indices = index(2:-1:1,1)';
end;


Deleted mttroot/mtt/bin/trans/m/alias_args.m version [33aaf8ec7f].

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
68
69
70
71
72
73









































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function args = alias_args(args,alias,delim,message,FileID,sys_name)

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  2001/06/13 14:50:15  gawthrop
## Operator ^ now ok in args in abg and/or lbl
##
## Revision 1.6  2001/04/23 16:23:30  gawthrop
## Now stips ; from bottlom level argument list - allows aliasing of
## parts of a,b,c (eg a,b by using a,b;c
##
## Revision 1.5  2000/10/12 19:27:20  peterg
## Now writes out the aliased args ...
##
## Revision 1.4  2000/09/14 13:35:43  peterg
## appended '(' and ')' to SEPS
##   -- otherwise first argument after '(' doesn't get substituted
## (Fixed by Geraint)
##
## Revision 1.3  1998/08/11 14:09:05  peterg
## Replaced incorrect length(args>0) with !isempty(args)
##
## Revision 1.2  1998/07/27 10:24:20  peterg
## Included , in the the list of seperators (SEPS)
## This makes it substitute for bits of args separated by commas.
##
## Revision 1.1  1998/07/03 18:29:40  peterg
## Initial revision
##
###############################################################

  if is_struct(alias)
    if !isempty(args)
      Args = split(args,delim); args="";
      [N,M]= size(Args);
      for i=1:N
        arg = deblank(Args(i,:));
        arg_ = strrep(arg,",","__");
        if struct_contains(alias,arg_)
          eval(["new_arg = alias.", arg_,";"]);
  	  mtt_info(["Replacing ", arg, "\t by ",\
		    new_arg, message],FileID);
  	  mtt_save_alias(arg,sys_name);
##	  printf("%s --> %s\n",arg,new_arg);
          arg = new_arg;
## 	else
## 	  mtt_info(["NOT replacing ", arg, message],FileID);
        end
        SEPS = ",+-*/()^";
        for j = 1:length(SEPS)
	  if (length(arg)>1)&&(length(findstr(arg,SEPS(j)))>0)
	    arg = alias_args(arg,alias,SEPS(j),message,FileID,sys_name);
	  end 
	end;
        args = sprintf("%s%s%s", args, delim, arg);
      end
      if (length(args)>1)
	if (substr(args,1,1)==delim)
	  args = substr(args,2); # loose leading delimiter
	endif
      endif
      
    end
  end;
endfunction;





Deleted mttroot/mtt/bin/trans/m/args2arg.m version [88e206959b].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function arg = args2arg(args,n,FS)
% args2arg - pulls the nth argument from a FS-separated list.
% FS defaults to `;'.
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  args2arg.m
% arg = args2arg(args,n,FS) 
% Copyright (c) P.J. Gawthrop, 1996.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/08/30 09:58:55  peter
% %% Uses str2ch to exteact a char from a string.
% %%
% %% Revision 1.1  1996/08/27  12:50:43  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Field separator
if nargin<3
  FS = ';';
end;

Deleted mttroot/mtt/bin/trans/m/cause2name.m version [1ae26e00bb].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = cause2name(causality)
% cause2name - converts causality to a string
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  cause2name
% name = cause2name(causality)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

if causality==1
  name = 'effort';
elseif causality ==-1
  name = 'flow';
else
  name = 'state';
end;

Deleted mttroot/mtt/bin/trans/m/cause2num.m version [596056c3f2].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function num = cause2num(causality)
% cause2num - converts causality to a string
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  cause2num
% num = cause2num(causality)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

if causality==1
  num = 1;
elseif causality ==-1
  num = 2;
else
  num = 3;
end;

Deleted mttroot/mtt/bin/trans/m/cbg2ese.m version [31625fa4e2].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553









































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function structure = cbg2ese(system_name, system_type, system_cr, ...
			     system_args, full_name, full_name_repetition, ...
			     repetition,...
			     structure, structure_file,infofilenum)
  ## Set up globals to count the component inputs and outputs. This relies on
  ## the named SS (the ports) being in the correct order. Using globals here
  ## avoids changing the common argument list for all _eqn files for something
  ## which is only used for named SS components.
  global local_u_index
  global local_y_index
  global at_top_level
  ## 
  ##     ###################################### 
  ##     ##### Model Transformation Tools #####
  ##     ######################################
  ## 
  ## Matlab function  cbg2ese.m
  ## Acausal bond graph to causal bond graph: mfile format
  ## Structure matrix [states,nonstates,inputs,outputs,zero_outputs]
  
  ## ###############################################################
  ## ## Version control history
  ## ###############################################################
  ## ## $Id$
  ## ## $Log$
  ## ## Revision 1.43  2001/11/11 08:32:00  geraint
  ## ## fflush (structure_file).
  ## ##
  ## ## Revision 1.42  2001/04/23 16:23:30  gawthrop
  ## ## Now stips ; from bottlom level argument list - allows aliasing of
  ## ## parts of a,b,c (eg a,b by using a,b;c
  ## ##
  ## ## Revision 1.41  2001/04/15 21:15:41  geraint
  ## ## Added interface definition rep: _ICD.(txt|c|cc|m).
  ## ##
  ## ## Revision 1.40  2001/02/05 01:50:29  geraint
  ## ## No unit type comparison at ports if either is "none".
  ## ##
  ## ## Revision 1.40  2000/12/16 08:10:55  geraint
  ## ## No unit type comparison at ports if either is "none".
  ## ##
  ## ## Revision 1.39  2000/11/16 12:54:14  peterg
  ## ## Added checking of unit consistency at ports
  ## ##
  ## ## Revision 1.38  2000/11/16 10:00:57  peterg
  ## ## *** empty log message ***
  ## ##
  ## ## Revision 1.37  2000/11/12 16:45:57  peterg
  ## ## Close ese file before recursive call of cbg2ese -- reopen when
  ## ## finished.
  ## ## THis prevents a new file being opened for each subsystem which fails
  ## ## when > 1K files opened
  ## ##
  ## ## Revision 1.36  2000/10/13 10:54:47  peterg
  ## ## Now writes out a unique name for each state etc
  ## ##
  ## ## Revision 1.35  2000/10/12 19:27:47  peterg
  ## ## Now writes the aliased args
  ## ##
  ## ## Revision 1.34  2000/09/01 08:42:44  peterg
  ## ## Cahged somes ends to end for etc for clarity
  ## ##
  ## ## Revision 1.33  2000/09/01 08:05:32  peterg
  ## ## Reformatted with out changing function
  ## ##
  ## ## Revision 1.32  1998/11/16 13:01:19  peterg
  ## ## Fixed problem with repetitions>1 due to new data structures -- now
  ## ## computes initial next_bond correctly
  ## ##
  ## ## Revision 1.31  1998/09/24 12:57:44  peterg
  ## ## Now ignores aliasing if no arguments given.
  ## ##
  ## ## Revision 1.30  1998/09/02 11:14:23  peterg
  ## ## Revised to use ordered lists of subsystems and ports
  ## ##
  ## ## Revision 1.29  1998/08/25 09:22:34  peterg
  ## ## Correctely recognises port SSs its now easy -- they are in there own
  ## ## field
  ## ##
  ## ## Revision 1.28  1998/08/25 08:31:42  peterg
  ## ## Fixed bug - didn't find the ports - use deblank
  ## ##
  ## ## Revision 1.27  1998/08/25 07:16:49  peterg
  ## ## Modified to data struture representation
  ## ##
  ## ## Revision 1.26  1998/08/24 14:53:55  peterg
  ## ## Uses new _cbg structure.
  ## ##
  ## ## Revision 1.25  1998/07/28 19:05:12  peterg
  ## ## Sttill has vector SS port bug?
  ## ##
  ## ## Revision 1.24  1998/07/27 10:26:02  peterg
  ## ## No change - but fixed bug in alias_args
  ## ##
  ## ## Revision 1.23  1998/07/08 12:33:51  peterg
  ## ## Reinstated the infofilenum parameter.
  ## ##
  ## ## Revision 1.22  1998/07/04 07:10:27  peterg
  ## ## Don't evaluate alias if no constitutive relationship or args and write
  ## ## message.
  ## ##
  ## ## Revision 1.21  1998/07/03 18:58:58  peterg
  ## ## Put arg alias stuff within function alias_args
  ## ## Called recursively to handle arithmetic expressions
  ## ##
  ## ## Revision 1.20  1998/07/03 14:39:09  peterg
  ## ## Added info messages a bit busy now!
  ## ##
  ## ## Revision 1.19  1998/04/12 11:58:19  peterg
  ## ## Rename port components by changing name_r to [name_r
  ## ##
  ## ## Revision 1.18  1998/04/11 18:59:16  peterg
  ## ## at_top_level now global - passed to SS components
  ## ##
  ## ## Revision 1.17  1998/04/04 10:47:31  peterg
  ## ## Uses (coerced) components from _cbg file - _abg not now used here.
  ## ##
  ## ## Revision 1.16  1998/03/06 09:38:58  peterg
  ## ## Now writes correct structure file for multiport C & I
  ## ##
  ## ## Revision 1.15  1997/12/16 18:24:33  peterg
  ## ## Added unknown_input to structure list
  ## ##
  ## ## Revision 1.14  1997/08/26 07:51:10  peterg
  ## ## Now counts the local input and outputs by order of appearence rather
  ## ## than by port number - it therfore handles ports with bicausality correctely.
  ## ##
  ## ## Revision 1.13  1997/05/19 16:45:56  peterg
  ## ## Fixed ISW bug -- deleted spurious ISW_eqn.m file
  ## ##
  ## ## Revision 1.12  1997/04/15  09:17:26  peterg
  ## ## Added the structure file - contains details of states etc.
  ## ## 
  ## ## Revision 1.11  1996/12/07 18:20:11  peterg
  ## ## Replaces null argument by a default and tells user.
  ## ##
  ## ## Revision 1.10  1996/12/07 17:37:07  peterg
  ## ## Now handles numbered SS ports appearing at top level.
  ## ##
  ## ## Revision 1.9  1996/12/04 21:49:47  peterg
  ## ## Compares full-name with empty string (instead of testing for zero
  ## ## length)
  ## ##
  ## ## Revision 1.8  1996/08/30  16:36:08  peter
  ## ## More info written to ese files.
  ## ##
  ## ## Revision 1.7  1996/08/30 11:23:13  peter
  ## ## Argument substitution implemented.
  ## ##
  ## ## Revision 1.6  1996/08/27  08:04:52  peterg
  ## ## Handles complex components and repetative components.
  ## ##
  ## ## Revision 1.5  1996/08/24  15:02:23  peter
  ## ## Writes `END;' to keep reduce happy.
  ## ##
  ## ## Revision 1.4  1996/08/19 09:03:41  peter
  ## ## Handles repeating components.
  ## ##
  ## ## Revision 1.3  1996/08/18 20:08:02  peter
  ## ## Included additional structure: structure(5) = zero_outputs.
  ## ##
  ## ## Revision 1.2  1996/08/08 18:08:11  peter
  ## ## Sorted out file naming sceme
  ## ##
  ## ## Revision 1.1  1996/08/08 15:53:23  peter
  ## ## Initial revision
  ## ##
  ## #############################################################
  
  ## disp("cbg2ese");
  ## system_name, system_type, full_name, repetition
  
  pc = "%";
  unit_error = "Component %s connects inconsistent ports with units %s and %s"  
  unit_info = "Component %s connects ports with units %s and %s"  

  ## Set up the names corresponding to the structure matrix.
  structure_name = [
		    "state        ",
		    "nonstate     ",
		    "input        ",
		    "output       ",
		    "zero_output  ",
		    "unknown_input"];
  
  
  ## Are we at the top level of the heirarchy?
  at_top_level = strcmp(full_name, "");
  
  ## Create the (full) system name
  if at_top_level
    full_name = system_name;
    full_name_repetition = system_name;
    system_type = system_name;
  else
    full_name = [full_name, "_", system_name];
    full_name_repetition = [full_name_repetition, ...
			    "_", system_name, "_", num2str(repetition)];
  end;
  
  
  
  cbg_name = [full_name, "_cbg"];
  if exist(cbg_name)~=2		# Return if cbg file doesn't exist
    disp([cbg_name, " does not exist"]);
    return
  end;
  
  ## Setup files
  ese_name = [full_name_repetition, "_ese.r"];
  ese_file = fopen(ese_name, "w") # open file (first time)
  icd_file = fopen([full_name_repetition,"_icd.txt2"],"w")

  fprintf(ese_file, "\n%s%s Equation file for system %s (file %s)\n", ...
	  pc, pc, full_name_repetition, ese_name);
  fprintf(ese_file, "%s%s Generated by MTT\n\n", pc, pc);
  
  ## Evaluate the system function to get the bonds
  eval(["CBG = ", cbg_name, ";"]);
  ##eval(["[bonds,status,system_type,components] = ", cbg_name, ";"]);
  ##  abg_name = [system_type, "_abg"];
  ##  cmp_name = [system_type, "_cmp"];
  ##  alias_name = [system_type, "_alias"];
  
  ## No longer needed - cbg now has components:  
  ##  eval(["[junk,components]=", abg_name, ";"]);
  
  ## Find number of bonds
  [n_bonds,columns] = size(CBG.bonds);
  if (columns ~= 2)&(n_bonds>0)
    error("Incorrect bonds matrix: must have 2 columns");
  endif;

  ## Set up initial bond units
  for i=1:n_bonds
    bond_effort_unit(i,:)="null";
    bond_flow_unit(i,:)="null";
  endfor

  ##  ## Find number of components
  ##  [n_components,columns] = size(components);
  ##  n_components = n_components
  
  ## Set up the first dummy bond number - needed for repetative components
  ##  next_bond = max(max(abs(components)))+1;
  next_bond = n_bonds+1;
  
  ## Set up the counters for the labelled SS. These are, by definition,
  ## encountered first and so the counters will not be messed up by subsystems.
  local_u_index = 0;
  local_y_index = 0;
  
  if (length(system_args)==0)
    mtt_info(sprintf("No arguments given so no argument aliasing done for system %s(%s)",\
		     system_name,system_type), infofilenum);
    AliasingArguments=0;
  else
    AliasingArguments=1;
  endif;
  
  if (length(system_cr)==0)
    mtt_info(sprintf("No cr given so no cr aliasing done for system %s(%s)",\
		     system_name,system_type), infofilenum);
    AliasingCRs=0;
  else
    AliasingCRs=1;  endif;
  
  
  fields=["ports";"subsystems"]; # Do for both ports and subsystems -
  ## ports first
  lists=["portlist";"subsystemlist"];
  for i=1:2
    field=deblank(fields(i,:));
    list=deblank(lists(i,:));
    if struct_contains(CBG,list);
      eval(["namelist=CBG.",list,";"]); # List of ports/subsystems
      [N,M]=size(namelist);	# Number of ports/subsystems
      for j=1:N
      	comp_name = deblank(namelist(j,:)); # Name of this component
	eval(["subsystem=CBG.",field,".",comp_name,";"]); # Pluck out the details
    	comp = subsystem.connections; # Connections
    	bond_list = abs(comp);
    	direction = sign(comp)'*[1 1];
				# Convert from arrow orientated to component orientated causality
    	comp_bonds = CBG.bonds(bond_list,:).*direction;
	
    	## disp(["---- ", field, " ---"]);    
    	
	if AliasingArguments	# Alias the args list if appropriate
    	  message = sprintf("\tfor component  %s (%s) within %s",\
			    comp_name,subsystem.type,full_name);    
    	  if struct_contains(CBG,"alias")
	    subsystem.arg = alias_args(subsystem.arg,CBG.alias,";",message,infofilenum,full_name);
    	  endif;
	endif;
	
	if AliasingCRs	# Alias the CR list if appropriate
    	  message = sprintf("\tfor component  %s (%s) within %s",\
			    comp_name,subsystem.type,full_name);    
    	  if struct_contains(CBG,"alias")
	    subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum,full_name);
    	  endif;
	endif;

	## Substitute positional ($1 etc) arguments
    	subsystem.cr = subs_arg(subsystem.cr,system_cr, ...
				"lin",full_name,subsystem.type,comp_name,infofilenum);
    	subsystem.arg = subs_arg(subsystem.arg,system_args, ...
				 "1",full_name,subsystem.type,comp_name,infofilenum);
    	
	## change name of 0 and 1 components -- matlab doesn't like numbers here
    	if strcmp(subsystem.type,"0")
	  subsystem.type = "zero";
    	endif;
    	if strcmp(subsystem.type,"1")
	  subsystem.type = "one";
    	endif;
    	
    	ports = length(bond_list);
    	
    	if subsystem.repetitions>1
	  port_pairs = ports/2;
	  if round(port_pairs)~=port_pairs;
	    mtt_info(["Repeated component ", comp_name, ...
		      " has an odd number of ports - ignoring repetitions"], infofilenum);
	    subsystem.repetitions = 1;
	  endif;
    	endif;
    	
    	if subsystem.repetitions>1
	  odd_bonds = bond_list(1:2:ports-1);
	  even_bonds = bond_list(2:2:ports);
    	endif;
    	
    	for k = 1:subsystem.repetitions
	  
	  if subsystem.repetitions>1
	    
	    if k==1
	      bond_list(1:2:ports-1) = odd_bonds;
	    else
	      bond_list(1:2:ports-1) = bond_list(2:2:ports);
	    endif;
	    
	    if k==subsystem.repetitions
	      bond_list(2:2:ports) = even_bonds;
	    else
	      new_bonds = [next_bond:next_bond+port_pairs-1];
	      next_bond = next_bond+port_pairs;
	      bond_list(2:2:ports) = new_bonds;
	    endif;
	    
	  endif;
	  
	  ## Invoke the appropriate equation-generating procedure
	  name_r = full_name_repetition;
	  eqn_name = [subsystem.type, "_eqn"];
	  
	  if exist(eqn_name)~=2 ## Try a compound component
            fclose(ese_file);	# Close but reopen later

	    disp("---PUSH---"); bond_list, comp_name, subsystem.type
	    structure = cbg2ese(comp_name, subsystem.type, subsystem.cr, subsystem.arg, ...
				full_name, full_name_repetition, ...
				k, structure,  structure_file, infofilenum);
	    
	    disp("---POP---");
	    ese_file = fopen(ese_name, "a") # open file (again)

	    eval(["subABG = ",subsystem.type , "_abg;"]); # Get the information

	    ## Link up the bonds for this compound component
	    fprintf(ese_file, ...
		    "\n\t%s Equations linking up subsystem %s (%s)\n\n", ...
		    pc, comp_name, subsystem.type);
	    name_comp_name = sprintf("%s_%s_%d", ...
				     full_name_repetition, comp_name, k);
	    
	    printf("\n\t%s Equations linking up subsystem %s (%s)\n\n",\
		   pc, comp_name, subsystem.type);
	    
	    u_index = 0; y_index = 0; ## Count the inputs and outputs
	    for port_number=1:length(bond_list)
              port_bond_number = bond_list(port_number);
	      this_bond_effort_unit = \
		  deblank(bond_effort_unit(port_bond_number,:));
	      this_bond_flow_unit = \
		  deblank(bond_flow_unit(port_bond_number,:));

	      ## Extract the unit/domain stuff
              this_port_name = subABG.portlist(port_number,:);
              
              eval(sprintf("this_port = subABG.ports.%s;", \
			   this_port_name));
	      if struct_contains(this_port,"units")
                eval(["effort_unit = \
		    subABG.ports.",this_port_name,".units.effort;"]);
                eval(["flow_unit = \
		    subABG.ports.",this_port_name,".units.flow;"]);
	      else
		effort_unit = "none";
		flow_unit = "none";
	      endif

	      ## and check consistency
              ## Efforts
	      if strcmp(this_bond_effort_unit,"null") # set
		bond_effort_unit = \
		    [bond_effort_unit(1:port_bond_number-1,:)
		     effort_unit
		     bond_effort_unit(port_bond_number+1:n_bonds,:)
		     ]
	      elseif (!strcmp(this_bond_effort_unit,"none") && !strcmp(effort_unit,"none")) # check
		mtt_info(sprintf(unit_info,full_name, effort_unit, \
				 this_bond_effort_unit), infofilenum);
		if !strcmp(this_bond_effort_unit,effort_unit)
		  error_string = sprintf(unit_error, full_name,\
					 effort_unit, \
					 this_bond_effort_unit);
		  mtt_error(error_string);
		endif
	      endif
	      ## Flows
	      if strcmp(this_bond_flow_unit,"null") # set
		bond_flow_unit = \
		    [bond_flow_unit(1:port_bond_number-1,:)
		     flow_unit
		     bond_flow_unit(port_bond_number+1:n_bonds,:)
		     ]
	      elseif (!strcmp(this_bond_flow_unit,"none") && !strcmp(flow_unit,"none")) # check
		mtt_info(sprintf(unit_info,full_name, flow_unit, \
				 this_bond_flow_unit), infofilenum);
		if !strcmp(this_bond_flow_unit,flow_unit)
		  error_string = sprintf(unit_error, full_name,\
					 flow_unit, \
					 this_bond_flow_unit);
		  mtt_error(error_string);
		endif
	      endif
	      

	      ## Effort
	      if comp_bonds(port_number,1)==1 # Source
	     	u_index = u_index + 1;
	     	fprintf(ese_file, "%s_MTTu%d := %s;\n", ...
		 	name_comp_name, u_index, varname(name_r, ...
							 bond_list(port_number),1));
	      else # Sensor
	     	y_index = y_index + 1;
	     	fprintf(ese_file, "%s := %s_MTTy%d;\n", ...
		 	varname(name_r, ...
				bond_list(port_number),1), name_comp_name, y_index);
	      end;
	      ## Flow
	      if comp_bonds(port_number,2)==-1 # Source
	     	u_index = u_index + 1;
	     	fprintf(ese_file, "%s_MTTu%d := %s;\n", ...
		 	name_comp_name, u_index, varname(name_r, ...
							 bond_list(port_number),-1));
	      else # Sensor
	     	y_index = y_index + 1;
	     	fprintf(ese_file, "%s := %s_MTTy%d;\n", ...
		 	varname(name_r, ...
				bond_list(port_number),-1), name_comp_name, y_index);
	      end;	
	    end;
	    
	  else # its a simple component
	    fprintf(ese_file, "\n\t%s Equations for component %s (%s), repetition %d\n\n", ...
		    pc, comp_name, subsystem.type,k);
	    
	    
	    ##				# Is it a named port? (Name begins with [)
	    ##            Named_Port = (comp_name(1)=="[");
	    
	    if strcmp(field,"ports") #Add [ to start of name
	      name_r = ["[" name_r];
	    endif;
	    
	    ## Save the current structure
	    old_structure = structure;
	    
	    ## Generate the simple component equations
	    ## .. firstly replacing ; by , in argument list
	    subsystem_arg = strrep(subsystem.arg,";",",");

	    eval(["structure = ", ...
		  eqn_name, ...
		  "(name_r,bond_list,comp_bonds, ...
		    direction,subsystem.cr,subsystem_arg,structure,ese_file);" ]);
	    
	    ## If structure has changed, write info to structure file.
	    structure_change = structure-old_structure;
	    
	    ## The following line is to avoid probs with multiport C or I
	    ## it needs changing to handle multi ports correctly
	    structure_changes = sum(structure_change);
	    
	    structure_change = structure_change>zeros(size(structure_change));
 	    if structure_changes>0
 	      which_indices = getindex(structure_change,1);
 	      which_indices = which_indices(:,2)';
 	      for which_index=which_indices
 	    	value = structure(which_index);
	    	value_change=value-old_structure(which_index);
	    	for k=1:value_change
		  fprintf(structure_file, ...
			  "%s\t%i\t%s\t%s_%s\t%i\n", ...
			  structure_name(which_index,:), value-k+1, ...
			  comp_name, full_name_repetition, comp_name, repetition);
	    	endfor;
 	      endfor;
 	    endif;
	  endif
	endfor
	fflush (structure_file);

	## component interface definition
	if struct_contains(CBG,"icd")
	  if struct_contains(CBG.icd,comp_name)
	    if AliasingArguments
	      subsystem.icd = alias_args(eval(["CBG.icd.",comp_name]),CBG.alias,";",message,infofilenum,full_name);
	    endif
	  endif
	  if (struct_contains(subsystem,"icd"))
	    subsystem.icd = subs_arg(subsystem.icd,system_args, ...
				     "null",full_name,subsystem.type,comp_name,infofilenum);
	    
	    fprintf(icd_file,"%s_%s\t%s\t",full_name_repetition,comp_name,subsystem.icd);
	    if (comp_bonds(1) == 1)
	      fprintf(icd_file,"output,");
	    elseif (comp_bonds(1) == -1)
	      fprintf(icd_file,"input,");
	    endif
	    if (comp_bonds(2) == 1)
	      fprintf(icd_file,"input\n");
	    elseif (comp_bonds(2) == -1)
	      fprintf(icd_file,"output\n");
	    endif
	  endif
	endif			# End of component interface definition

      endfor			# [subsystem,comp_name] = CBG_field
    endif			# struct_contains(CBG,field)
  endfor			# i=1:2

  fclose(icd_file);
  fclose(ese_file);		# Close
  
endfunction



Deleted mttroot/mtt/bin/trans/m/cbg2fig.m version [040a608b2a].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
























































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function cbg2fig(system_name, system_type, full_name, ...
                 stroke_length, stroke_thickness, stroke_colour, ...
                 comp_font, comp_colour_u, comp_colour_o)

  ## cbg2fig - converts causal bg to figure
  ##
  ##     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% Model
  ##     Transformation Tools %%%%%
  ##     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ##
  ## Matlab function  cbg_m2fig Causal bond graph:  mfile format to fig
  ## file format The resultant fig file is the original _abg.fig with
  ## additional causal strokes superimposed. cbg2fig(system_name, ...
  ## system_type, full_name, ... stroke_length, stroke_thickness,
  ## stroke_colour, ... comp_font, comp_colour_u, comp_colour_o)
  ## Note this uses geometric info from _rbg.fig - so don't use with
  ## -abg switch.  

  ## P.J.Gawthrop May 1996
  ## Copyright (c) P.J.Gawthrop, 1996.

  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% Version control history
  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% $Id$
  ## %% $Log$
  ## %% Revision 1.15  2001/03/23 11:20:20  gawthrop
  ## %% Fixed bug with vector components --NB takes geometric info from _rbg.fig
  ## %%
  ## %% Revision 1.14  2000/09/14 12:07:15  peterg
  ## %% Fixed overwriting of ports.
  ## %%
  ## %% Revision 1.13  2000/09/14 09:12:19  peterg
  ## %% Fixed stroke orientation bug with bent bonds
  ## %% Uses new info from the _rbg.m file - 4 new cols in rbonds
  ## %%
  ## %% Revision 1.12  2000/09/14 08:07:00  peterg
  ## %% Reformated as an Octave function
  ## %%
  ## %% Revision 1.11  2000/01/18 14:52:02  peterg
  ## %% Removed recursion --- maybe put back via a flag later
  ## %%
  ## %% Revision 1.10  1998/12/14 15:27:32  peterg
  ## %% Added separate handling of ports ( poss zero)
  ## %%
  ## %% Revision 1.9  1998/08/25 06:43:02  peterg
  ## %% Revised (partially) for data strucures - needs to include graphic info
  ## %% in abg file.
  ## %%
  ## %% Revision 1.8  1998/04/04 10:45:01  peterg
  ## %% Don't do strokes on port bonds
  ## %%
  ## %% Revision 1.7  1997/08/19 09:49:19  peterg
  ## %% Modified to take account of the expanded vector bonds. Only displays
  ## %% causality corresponding to the bond connecting the first element of
  ## %% the vector ports.
  ## %%
  ## %% Revision 1.6  1997/08/19 09:41:47  peterg
  ## %% Some debugging lines added.
  ## %%
  ## %% Revision 1.5  1997/05/16  07:33:45  peterg
  ## %% Now checks to see if sub system is a simple component before
  ## %% recursion.
  ## %% 0 --> zero
  ## %% 1 --> one
  ## %%
  ## %% Revision 1.4  1996/12/07  21:34:52  peterg
  ## %% Tests for null string with strcmp
  ## %% 
  ## %% Revision 1.3  1996/08/08  15:52:28  peter
  ## %% Recursive version.
  ## %% Fails due to octave bug - reported.
  ## %%
  ## %% Revision 1.2  1996/08/05 20:15:39  peter
  ## %% Prepared for recursive version.
  ## %%
  ## %% Revision 1.1  1996/08/05 18:12:25  peter
  ## %% Initial revision
  ## %%
  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


  if nargin<4
    stroke_length = 20;
  end;

  if nargin<5
    stroke_thickness = 2;
  end;

  if nargin<6
    stroke_colour = 1; %Blue
  end;

  if nargin<7
    comp_font = 18; %Helvetica bold
  end;

  if nargin<8
    comp_colour_u = 12; %Green
  end;

  if nargin<9
    comp_colour_o = 4; %Red
  end;

  ## Create a back slash '\' character.
  bs = setstr(92);

  ## Create the (full) system name
  if strcmp(full_name,'')
    full_name = system_name;
  else
    full_name = [full_name, '_', system_name];
  end;

  full_name_type = [full_name, '_', system_type];
  ## $$$ fig_name = [full_name_type, '_cbg.fig'];
  fig_name = [full_name, '_cbg.fig']
  
  ## Return if initial fig file doesn't exist
  if exist(fig_name)~=2
    return
  end;

  ## Setup file - append to the fig file
  filenum = fopen(fig_name, 'a');

  ## Get the raw and the processed bonds
  eval(['[rbonds,rstrokes,rcomponents,port_coord,port_name,port_list] = ', system_type, '_rbg;']);
  eval(["ABG = ", system_type, "_abg;"]);
  bonds=ABG.bonds;

  ## Original number of bonds
  [n_bonds,junk] = size(rbonds);

  ## Get the causal bonds
  #eval(['[cbonds,status]=', full_name, '_cbg;']);
  eval(["CBG = ", full_name, "_cbg;"]);
  cbonds=CBG.bonds;

  ## Check sizes
  [Rows,Columns] = size(rcomponents);
  if (Columns ~= 13)
    error('Incorrect rcomponents matrix: must have 13 columns');
  end;
  M_components = Columns;
  N_rcomponents = Rows;		# Number of raw components

  [N_rports,junk] = size(port_list);
  [N_components, Columns] = size(CBG.subsystemlist); # Number of derived
						     # components

  if struct_contains(CBG,'portlist')
    [N_ports, Columns] = size(CBG.portlist);
  else
    N_ports = 0;
  end


  ## Rotation matrix
  rot = [0 -1; 1 0];


  ## Determine coordinates of the arrow end of the bond and the other end
  ## and other geometry
  other_end_1 = rbonds(:,1:2);
  arrow_end = rbonds(:,3:4);
  other_end_2 = rbonds(:,5:6);

  distance_1 = length2d(other_end_1 - arrow_end);
  distance_2 = length2d(other_end_2 - arrow_end);
  which_end = (distance_1>distance_2)*[1 1];
  one = ones(size(which_end));
  other_end = which_end.*other_end_1 + (one-which_end).*other_end_2;
  arrow_barb = which_end.*other_end_2 + (one-which_end).*other_end_1;
  arrow_vector =  arrow_barb-arrow_end;
  unit_arrow_vector = arrow_vector./(length2d(arrow_vector)*[1 1]);
  
  ## Extract directional information
  arrow_end_direction = [rbonds(:,7), rbonds(:,8)];
  other_end_direction = [rbonds(:,9), rbonds(:,10)];


  ## Get indices of bonds with changed causality -- but ignore the extra bonds
  ## due to vector bond expansion
  changed_e = bonds(1:n_bonds,1)~=cbonds(1:n_bonds,1);
  changed_f = bonds(1:n_bonds,2)~=cbonds(1:n_bonds,2);
  changed = changed_e|changed_f;

  index_e  = getindex(changed_e,1)';
  index_f  = getindex(changed_f,1)';
  index_ef  = getindex(changed,1)';

  ## Print the new strokes in fig format
  if index_ef(1,1)>0
    for i = index_e		# Do the effort stroke - opp. side to arrow
      if cbonds(i,1)==1		# Stroke at arrow end
	bond_vector = arrow_end_direction(i,:); # Directional vector
	stroke_end_1 = arrow_end(i,:);
      else
	bond_vector = other_end_direction(i,:); # Directional vector
	stroke_end_1 = other_end(i,:);
      end;

      ## Work out the direction for the stroke (right angles to bond)
      unit_bond_vector = bond_vector./(length2d(bond_vector)*[1 1]);
      unit_stroke_vector = (rot*unit_bond_vector')';
      
      sig = sign(unit_arrow_vector(i,:)*unit_stroke_vector');
      stroke_end_2 = stroke_end_1 - stroke_length*sig*unit_stroke_vector;
      

      ## print the fig3 format firstline spec.
      polyline = 2; 
      firstline = fig3(polyline,stroke_thickness,stroke_colour);
      fprintf(filenum, '%s\n', firstline);

      fprintf(filenum, '	%4.0f %4.0f %4.0f %4.0f \n', ...
	      stroke_end_1(1), stroke_end_1(2), ...
	      stroke_end_2(1), stroke_end_2(2) );
    end;

    for i = index_f		# Do the flow stroke - same side as arrow
      if cbonds(i,2)==1		# Stroke at arrow end
	bond_vector = arrow_end_direction(i,:); # Directional vector
	stroke_end_1 = arrow_end(i,:);
      else
	bond_vector = other_end_direction(i,:); # Directional vector
	stroke_end_1 = other_end(i,:);
      end;
      
      ## Work out the direction for the stroke (right angles to bond)
      unit_bond_vector = bond_vector./(length2d(bond_vector)*[1 1]);
      unit_stroke_vector = (rot*unit_bond_vector')';
      
      sig = sign(unit_arrow_vector(i,:)*unit_stroke_vector');
      stroke_end_2 = stroke_end_1 + stroke_length*sig*unit_stroke_vector;

      ## print the fig3 format firstline spec.
      polyline = 2; 
      firstline = fig3(polyline,stroke_thickness,stroke_colour);
      fprintf(filenum, '%s\n', firstline);

      fprintf(filenum, '	%4.0f %4.0f %4.0f %4.0f \n', ...
	      stroke_end_1(1), stroke_end_1(2), ...
	      stroke_end_2(1), stroke_end_2(2) );
    end;
  end;

  ## Print all the components - coloured acording to causality.
  ## Miss out the ports
  
  for i = N_rports+1:N_rcomponents
    eval(['[comp_type,comp_name] = ', system_type, '_cmp(i);']);
    eval(["comp_status = CBG.subsystems.", comp_name, ".status;"]);

#     if i>N_rports			# Subsystem
#       comp_name = CBG.subsystemlist(i-N_rports,:);
#       eval(["comp_status = CBG.subsystems.", comp_name, ".status;"]);
#     else
#       comp_name = CBG.portlist(i,:);
#       eval(["comp_status = CBG.ports.", comp_name, ".status;"]);
#     end

    
    fig_params = rcomponents(i,3:M_components);
    coords = rcomponents(i,1:2);
    
    if comp_status==-1		# Then under causal
      fig_params(3) = comp_colour_u;
      fig_params(6) = comp_font;
    end;

    if comp_status==1		# Then over causal
      fig_params(3) = comp_colour_o;
      fig_params(6) = comp_font;
    end;


    ## Now print the component in fig format
    
    if index(comp_name,"mtt")==1 # Its a dummy name
      typename = comp_type;	# just show type
    else
      typename = [comp_type,":",comp_name];
    endif;

    Terminator = [bs, '001'];  
    real_index = 8;
    for j = 1:length(fig_params)
      if j==real_index
	fprintf(filenum, '%2.4f ', fig_params(j));
      else
	fprintf(filenum, '%i ', fig_params(j));
      endif
      

    endfor
    
    

    fprintf(filenum, '%1.0f %1.0f ', coords(1), coords(2)); 
    fprintf(filenum, '%s%s\n', typename, Terminator);

  endfor

  ## Close the file
  fclose(filenum);
  return

endfunction

Deleted mttroot/mtt/bin/trans/m/cr2name.m version [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);
    
    





Deleted mttroot/mtt/bin/trans/m/csm2sm.m version [82261a8899].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [A,B,C,D] = csm2sm(A,B,C,D,E);
% [A,B,C,D] = csm2sm(A,B,C,D,E);
% Converts constrained-state matrices to state matrices.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


A = E\A;
B = E\B;

Deleted mttroot/mtt/bin/trans/m/dm2fr.m version [55c366535d].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  fr = dm2fr(A,B,C,D,E,W,u0)
# fr = dm2fr(A,B,C,D,E,W,u0)
# Descriptor matrix to frequency response.
# A,B,C,D,E - descriptor matrices
# W vector of frequency points
# u0 input gain vector: u = u0*unit phasor

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.8  1997/06/13 13:05:38  peterg
# ## Replaced 'C*( (E*j*w - A) \ B*u0 ' by  C*( inv(E*j*w - A)*B*u0 ). \
# ## seems to have a bug for complex nos (??)
# ##
# ## Revision 1.7  1996/11/06  16:40:38  peterg
# ## Explicit definition of j
# ##
# ## Revision 1.6  1996/08/24  14:22:23  peter
# ## Put in a ; to avoid excessive log output.
# ##
# ## Revision 1.5  1996/08/16 14:26:37  peter
# ## Check and fix size of u0.
# ##
# ## Revision 1.4  1996/08/15 12:50:51  peter
# ## Put in a conj to undo effect of transpose.
# ##
# ## Revision 1.3  1996/08/15 11:53:44  peter
# ## Now has u0 input vector
# ##
# ## Revision 1.2  1996/08/15 10:24:28  peter
# ## Includes u0 argument.
# ##
# ## Revision 1.1  1996/08/10 14:11:28  peter
# ## Initial revision
# ##
# ###############################################################

[Ny,Nu] = size(D);
[Ny,Nx] = size(C);
N = length(W);

if nargin<7
  U0 = zeros(Nu,1);
  U0(1) = 1;
else
  for i=1:Nu
    U0(i) = u0(i);
  end;
end;

u0 = U0;

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

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

j = sqrt(-1);
fr = zeros(N,Ny);
i = 0;
for w = W'
  i = i+1;
  ##   EjA = E*j*w - A;
  ##   iEjA = conj(EjA)*inv(conj(EjA)*EjA);
  ##   FR = C*iEjA*B*u0 + D*u0;
  FR = C*( (E*j*w - A) \ B*u0 ) + D*u0;
  ## FR = C*( inv(E*j*w - A)*B*u0 ) + D*u0;
  fr(i,:) = conj(FR');
end;













Deleted mttroot/mtt/bin/trans/m/dm2ir.m version [205a34d87e].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function ir = dm2ir(A,B,C,D,E,T);
% ir = dm2ir(A,B,C,D,E,T);
% Descriptor matrix to impulse response.
% NB At the moment - this assumes that E is unity .....
% A,B,C,D,E - descriptor matrices
% T vector of time points

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/08/10 14:16:04  peter
% %% Now has T vector input - it was tmax & tstep
% %%
% %% Revision 1.2  1996/08/10 11:49:39  peter
% %% Fixed multi-input/output problem
% %%
% %% Revision 1.1  1996/08/10 10:26:00  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[N,M] = size(T);
if M>N
  T = T';
  N = M;
end;

[Ny,Nu] = size(D);
NN=Ny*Nu;

ir = zeros(N,NN);
i = 0;
for t = T'
  i=i+1;
  ir(i,:) = reshape(C*expm(A*t)*B, 1,NN);
end;

Deleted mttroot/mtt/bin/trans/m/dm2sr.m version [ef0adb9b22].

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


































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Y,X] = dm2sr(A,B,C,D,E,T,u0,x0);
% [Y,X] = dm2sr(A,B,C,D,E,T,u0,x0);
% Descriptor matrix to impulse response.
% NB At the moment - this assumes that E is unity .....
% A,B,C,D,E - descriptor matrices
% T vector of time points
% u0 input gain vector: u = u0*unit step.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.4  1996/08/15 08:34:08  peter
% %% Added step gain (u0) and initial condition (x0)
% %%
% %% Revision 1.3  1996/08/11 19:33:24  peter
% %% Replaced exp by expm - whoops!
% %%
% %% Revision 1.2  1996/08/11 10:37:40  peter
% %% Corrected mistake in step-response calculation.
% %%
% %% Revision 1.1  1996/08/11 09:42:40  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[Ny,Nu] = size(D);
[Ny,Nx] = size(C);

if nargin<7
  u0 = zeros(Nu,1);
  u0(1) = 1;
end;

if nargin<8
  x0 = zeros(Nx,1);
end;

[N,M] = size(T);
if M>N
  T = T';
  N = M;
end;

one = eye(Nx);

Y = zeros(N,Ny);
X = zeros(N,Nx);
i = 0;
for t = T'
  i=i+1;
  if Nx>0
    expAt = expm(A*t);
    x = ( A\(expAt-one) )*B*u0 + expAt*x0;
    X(i,:) = x';
    if Ny>0
      y = C*x + D*u0;
      Y(i,:) = y';
    end;
  elseif Ny>0
    y = D*u0;
    Y(i,:) = y';
  end;
end;

Deleted mttroot/mtt/bin/trans/m/equation.m version [ebd4d7871d].

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
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











































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                              inbonds,incauses,inports)
% eqn is a string containing the equation
% 
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function equations.m
% eqn =  equation(name,cr,args,outbond,outcause,outport, ...
%                              inbonds,incauses,inports)


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% 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
  error('equation.m: inports inconsistent with inbonds');
end;

% Set up LHS
LHS = varname(name, outbond, outcause);

% Set up various strings to get correct syntax if some strings are empty
if strcmp(cr,'')
  cause_name = '';
  port_name = '';
  lp = '';
  rp = '';
  c_comma = '';
else
  cause_name = cause2name(outcause);
  port_name = sprintf('%1.0f', outport');
  lp = '(';
  rp = ')';
  c_comma = ',';
end

if strcmp(args,'')
  a_comma = '';
else
  a_comma = ',';
end;

% Set up first line of RHS
RHS1 = sprintf('%s%s%s%s%s%s%s%s\n', ...
    cr, lp, args, a_comma, cause_name, c_comma, port_name, c_comma);


% Set up rest of RHS - the input variables, causality and ports.
RHS2 = '';
for i=1:nports
  RHS2 = sprintf('%s\t%s', ...
      RHS2, varname(name, inbonds(i), incauses(i)));
  
  if strcmp(cr,'')==0 % add the causality & port info
    RHS2 = sprintf('%s,%s,%1.0f', ...
	RHS2, cause2name(incauses(i)), inports(i));
  end;
  
  if (i<nports) % Add a comma
    RHS2 = sprintf('%s,\n',RHS2);
  else
    RHS2 = sprintf('%s\n',RHS2);
  end;
end;
 
 
% Set up equation
eqn = sprintf('%s := %s%s\t%s;\n', LHS, RHS1, RHS2, rp);


Deleted mttroot/mtt/bin/trans/m/fig3.m version [482caa1bd5].

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 first_line = fig3(object,thickness,colour)
% first_line = fig3(object,thickness,colour)
%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Matlab function fig3.m
% Provides the "first line" format for polyines and text objects
% See fig 3 documentation for details
%
% P.J.Gawthrop June 1996
% Copyright (c) P.J.Gawthrop, 1996.

red = 4;
blue = 1;

if (object==2)	%Polyline
  sub_type = 1;
  line_style = 0;

  if nargin<2
    thickness = 3;
  end;

  if nargin<3
    colour = red;
  end;
  
  fill_colour = -1;
  depth = 0;
  pen_style = 0;
  area_fill = -1;
  style_val = 0.0;
  join_style = 0;
  cap_style = 0;
  radius = -1;
  f_arrow = 0;
  b_arrow = 0;
  npoints = 2;
  first_line = [... 
    int2str(object), ' ', ... 
    int2str(sub_type), ' ', ... 
    int2str(line_style), ' ', ...
    int2str(thickness), ' ', ...
    int2str(colour), ' ', ...
    int2str(fill_colour), ' ', ...
    int2str(depth), ' ', ...
    int2str(pen_style), ' ', ...
    int2str(area_fill), ' ', ...
    num2str(style_val), ' ' ...
    int2str(join_style), ' ', ...
    int2str(cap_style), ' ', ...
    int2str(radius), ' ', ...
    int2str(f_arrow), ' ', ...
    int2str(b_arrow), ' ', ...
    int2str(npoints)];
 
elseif (object==4) %text


else
  error('Object must be 2 (polyline) or 4(text)');
end;



Deleted mttroot/mtt/bin/trans/m/figfig.m version [834208ffe6].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function figfig(filename,language,boxed,monochrome)
  ## Usage: figfig(filename[,language,boxed,monochrome])
  ## 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");
  ## Boxed=1 gives a box around the figure
  ## Monochrome=1 gives a monchrome plot

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.5  2001/05/10 19:08:35  gawthrop
  ## Cosmetic improvements
  ##
  ## Revision 1.4  2001/05/08 15:18:12  gawthrop
  ## Added trig and hyperbolic functions to argument exclusion list
  ##
  ## Revision 1.3  2001/04/10 12:54:50  gawthrop
  ## Minor fixes for sensitivity versions
  ##
  ## Revision 1.2  2000/12/27 16:06:02  peterg
  ## *** empty log message ***
  ##
  ## Revision 1.1  2000/11/03 10:43:10  peterg
  ## Initial revision
  ###############################################################

  if nargin<3
    boxed=1;
  endif
  
  if nargin<4
    monochrome=0;
  else
    monochrome=1;
  endif
  
  
  figfilename = sprintf("%s.fig",filename);
  
  eval(sprintf("gset output \"%s\" ",figfilename));

  if (monochrome==1)
    gset term fig monochrome portrait fontsize 16 size 20 10 metric
  else
    gset term fig color portrait fontsize 16 size 20 10 metric
  endif
  
  replot;
  gset term x11
  gset output 
  replot;


  if boxed # 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);
  endif
  

  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

Deleted mttroot/mtt/bin/trans/m/getdynamic.m version [96484d5f7e].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,prefered] = getdynamic(subsystems);
# Get the index of a dynamic components which is not set.

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.2  1996/08/16 12:51:22  peter
# ## Removed debugging lines.
# ##
# ## Revision 1.1  1996/08/16 12:50:41  peter
# ## Initial revision
# ##
# ###############################################################

  prefered = 0;			# No prefered causality to start with
  for [subsystem,name] = subsystems
    if subsystem.status==-1 # Undercausal
      if strcmp(subsystem.type,'C')
      	prefered=-1;
      	break;
      endif;
      if strcmp(subsystem.type,'I')
      	prefered=1;
      	break;
      endif;
    endif;
  endfor;

  if prefered==0
    name = "";
  end;
  
endfunction

Deleted mttroot/mtt/bin/trans/m/getindex.m version [b17581b243].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [index, n, otherindex, m] = getindex(array,value);
% Finds the n indices of the elements of array equal to value
% otherindex contains indeces of the the m other  elements.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[N,M] = size(array);
n=0; m=0;
for i=1:N
  for j = 1:M
    if array(i,j)==value
      n=n+1;
      index(n,:) = [i j];
    else
      m=m+1;
      otherindex(m,:) = [i j];
    end;
  end;
end;


if (M==1)&(n>0)
  index = index(:,1);
end;

if (M==1)&(m>0)
  otherindex = otherindex(:,1);
end;

% Octave doesn't like empty matrices
if n==0
  index=0;
end;

if m==0
  otherindex=0;
end;



Deleted mttroot/mtt/bin/trans/m/length2d.m version [ad2755e59c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function len = length2d(vector_array)
% length2d - Finds (geometric) length of row vectors stacked 
% into a column vector
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  length2d
% len = length2d(vector_array)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

% 

len = sqrt(sum(vector_array'.^2)');

Deleted mttroot/mtt/bin/trans/m/makedef.m version [4b8ed092ca].

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
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
123
124
125
126
127
128
129
130
131



































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function makedef(structure,deffilenum);

  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% Version control history
  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% $Id$
  ## %% $Log$
  ## %% Revision 1.8  2000/10/20 13:26:41  peterg
  ## %% Made sure that mttui not declared twice
  ## %%
  ## %% Revision 1.7  2000/10/20 13:16:29  peterg
  ## %% Reformated
  ## %%
  ## %% Revision 1.6  1996/12/07 18:21:57  peterg
  ## %% Now uses fopen + file number
  ## %%
  ## %% Revision 1.5  1996/11/09 21:05:44  peterg
  ## %% Only generates MTTIm when at least 2 states!
  ## %%
  ## %% Revision 1.4  1996/08/30  19:42:36  peter
  ## %% Added newline at end of file.
  ## %%
  ## %% Revision 1.3  1996/08/24 15:06:22  peter
  ## %% Write `END;' at end to please reduce.
  ## %%
  ## %% Revision 1.2  1996/08/18 20:05:20  peter
  ## %% Put unded version control
  ## %%
  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



  states = structure(1);
  nonstates=structure(2);
  inputs=structure(3);
  outputs=structure(4);
  zero_outputs = structure(5);
  internal_inputs = structure(6);
  connecting_inputs = structure(7);

  pc = '%';
  ## Declare reduce constants;
  fprintf(deffilenum, 'MTTNx := %1.0f;\n', states);
  fprintf(deffilenum, 'MTTNz := %1.0f;\n', nonstates);
  fprintf(deffilenum, 'MTTNu := %1.0f;\n', inputs);
  fprintf(deffilenum, 'MTTNy := %1.0f;\n', outputs);
  fprintf(deffilenum, 'MTTNyz := %1.0f;\n', zero_outputs);
  fprintf(deffilenum, 'MTTNui := %1.0f;\n', internal_inputs);
  fprintf(deffilenum, 'MTTNuc := %1.0f;\n', connecting_inputs);

  ## Declare reduce matrices
  fprintf(deffilenum, '%s Declare reduce matrices\n', pc);
  if states>0
    fprintf(deffilenum, 'matrix MTTx(%1.0f,1);\n', states);
    fprintf(deffilenum, 'matrix MTTdx(%1.0f,1);\n', states);
  endif

  if nonstates>0
    fprintf(deffilenum, 'matrix MTTz(%1.0f,1);\n', nonstates);
    fprintf(deffilenum, 'matrix MTTdz(%1.0f,1);\n', nonstates);
  endif

  if inputs>0
    fprintf(deffilenum, 'matrix MTTu(%1.0f,1);\n', inputs);
    fprintf(deffilenum, 'matrix MTTdu(%1.0f,1);\n', inputs);
  endif

  if outputs>0
    fprintf(deffilenum, 'matrix MTTy(%1.0f,1);\n', outputs);
  endif

  if zero_outputs>0
    fprintf(deffilenum, 'matrix MTTyz(%1.0f,1);\n', zero_outputs);
    fprintf(deffilenum, 'matrix MTTui(%1.0f,1);\n', zero_outputs);
  elseif internal_inputs>0
    fprintf(deffilenum, 'matrix MTTui(%1.0f,1);\n', inputs);
  endif

  if connecting_inputs>0
    fprintf(deffilenum, 'matrix MTTuc(%1.0f,1);\n', connecting_inputs);
  endif


  ## Make an Nx x Nx unit matrix
  if states>0
    fprintf(deffilenum, 'matrix MTTI(%1.0f,%1.0f);\n', states,states);
    for i = 1:states
      fprintf(deffilenum, 'MTTI(%1.0f,%1.0f) := 1;\n', i, i);
    end
  endif


  ## Make an Nx/2 x Nx/2 unit matrix
  if states>1
    fprintf(deffilenum, 'matrix MTTIm(%1.0f,%1.0f);\n', states/2,states/2);
    for i = 1:states/2
      fprintf(deffilenum, 'MTTIM(%1.0f,%1.0f) := 1;\n', i, i);
    end
  endif


  ## Set the y, yz, du, u, x and dx matrices
  fprintf(deffilenum, '%s Set the y, yz, u and x matrices\n', pc);
  for i=1:outputs
    fprintf(deffilenum, 'MTTy(%1.0f,1) := MTTy%1.0f;\n', i, i);
  endfor

  for i=1:zero_outputs
    fprintf(deffilenum, 'MTTyz(%1.0f,1) := MTTyz%1.0f;\n', i, i);
    fprintf(deffilenum, 'MTTui(%1.0f,1) := MTTui%1.0f;\n', i, i);
  endfor

  for i=1:inputs
    fprintf(deffilenum, 'MTTu(%1.0f,1) := MTTu%1.0f;\n', i, i);
  endfor

  for i=1:inputs
    fprintf(deffilenum, 'MTTdu(%1.0f,1) := MTTdu%1.0f;\n', i, i);
  endfor

  for i=1:states
    fprintf(deffilenum, 'MTTx(%1.0f,1) := MTTx%1.0f;\n', i, i);
  endfor

  for i=1:nonstates
    fprintf(deffilenum, 'MTTdz(%1.0f,1) := MTTdz%1.0f;\n', i, i);
  endfor

  fflush (deffilenum);

endfunction

Deleted mttroot/mtt/bin/trans/m/mat2mfile.m version [e8cb0dd3b5].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  mat2mfile(matrix, matrix_name, filenum);
% mat2mfile - writes a matrix as part of an  m-file
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  mat2mfile
% mat2mfile(matrix, matrix_name, filenum)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/12/04 21:53:00  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

%Writes out a matrix as a matlab m-file

[N, M] = size(matrix);

empty = (N==1)&(M==1)&(matrix(1,1)==0);

%Write out the matrix
fprintf(filenum, '%s = [\n', matrix_name);

if ~empty
  for i = 1:N,
    for j = 1:M
      fprintf(filenum, '%1.0f ', matrix(i,j));
    end;
    fprintf(filenum, '\n');
  end;
else
  fprintf(filenum,'0');
end;
fprintf(filenum, '];\n');
fprintf(filenum, '\n');

Deleted mttroot/mtt/bin/trans/m/mat2tex.m version [557dae5024].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function tex = mat2tex(mat)
  ## mat2tex: converts matrix into LaTeX form.
  ## tex = mat2tex(mat)
  

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.1  1999/03/25 01:33:51  peterg
  ## Initial revision
  ##
  ###############################################################

  [n,m]=size(mat);

  for i=1:n
    for j=1:m
      if mat(i,j) == 0
	printf("0    ");
	else
	  printf("%5.2f", mat(i,j));
	endif
      if j<m
 	printf("&");
      endif
    endfor
      printf("\\\\\n");
  endfor
  
endfunction



Deleted mttroot/mtt/bin/trans/m/mtt.m version [f788927636].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function mtt (sys,rep,lang)

  ## usage:  mtt (system[,representation,language])
  ##
  ## Invokes mtt from octave to generate system_representation.language
  ## Ie equivalent to "mtt system representation language" at the shell
  ## Representation and language defualt to "sm" and "m" respectively

  if nargin<2
    rep='sm';
  endif
  
  if nargin<3
    lang='m';
  endif

  filename = sprintf("%s_%s.%s", sys, rep, lang);

  command = sprintf("mtt -q %s %s %s", sys, rep, lang);
  system(command);


endfunction

Deleted mttroot/mtt/bin/trans/m/mtt2sys.m version [a36fac3658].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function sys = mtt2sys (Name,par)

  ## usage:  sys = mtt2sys (Name[,par])
  ##
  ## Creates a sys structure for the Octave Control Systems Toolbox
  ## from an MTT system with name "Name"
  ## Optional second argument is system parameter list
  ## Assumes that Name_sm.m, Name_struc.m and Name_numpar.m exist

  ## Copyright (C) 2000 by Peter J Gawthrop


  if nargin<1
    error("missing system name, usage:  sys = mtt2sys (Name)");
  else
    ## Create function names
    numpar_name = sprintf("%s_numpar",Name);
    sm_name = sprintf("%s_sm",Name);
    struc_name = sprintf("%s_struc",Name);
  endif

  if nargin<2			# Use predefined parameters
    mtt(Name,"numpar");
    eval(sprintf("par=%s_numpar;", Name)); # Parameters
    mtt(Name,"sm");		# Create state matrices
    mtt(Name,"struc");		# Create structure info
    mtt(Name,"sympar");		# Create sympar details
  else				# Only create other file if not there
    if  exist(sm_name)!=2
      mtt(Name,"sm");		# Create state matrices
    endif

    if  exist(struc_name)!=2
      mtt(Name,"struc");	# Create state matrices
    endif

  endif
  


  eval(sprintf("[A,B,C,D]=%s_sm(par);", Name)); # State matrices
  sys = ss2sys(A,B,C,D);	# Sys form
  eval(sprintf("[sys.inname,sys.outname,sys.stname]=%s_struc;", Name)); # Setup names
  
endfunction






Deleted mttroot/mtt/bin/trans/m/mtt_error.m version [73f0ddc790].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function mtt_error(message, errorfile);
% mtt_error(message, errorfile);

% function [bonds, status] = abg2cbg(bonds,components,system_name,filename)
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1997/02/11 10:06:42  peterg
% %% Removed a debugging line.
% %%
% %% Revision 1.1  1996/08/18  20:06:57  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Set default file if it isn't there already
if nargin<2
  errorfile = fopen('mtt_error.txt','a');
end;

fprintf(errorfile, '*MTT ERROR : %s\n', message);

#error('MTT exiting this transformation on error');

Deleted mttroot/mtt/bin/trans/m/mtt_euler.m version [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;

Deleted mttroot/mtt/bin/trans/m/mtt_identify.m version [21f7e88261].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [theta,Theta,Error,Y] = mtt_identify (system_name,y_s,theta_0,criterion,max_iterations)

  ## usage:  [theta,Theta,Error] = mtt_identify (system_name,theta_0,criterion,max_iterations)
  ##      y_s   actual system output
  ##      theta_0   initial parameter estimate
  ##      criterion convergence criterion
  ##      max_iterations limit to number of iterations

  if nargin<4
    criterion = 1e-5;
  endif
  
  if nargin <5
    max_iterations = 20;
  endif

  alpha = 1.0;
  e_last = 1e20;
  error=1e10;
  theta = theta_0;
  Theta = [];
  Error = [];
  Y = [];
  iterations = 0;
  while abs(e_last-error)>criterion
    theta
    iterations = iterations + 1;
    e_last = error;
    [t,y,y_theta] = mtt_ssimulate(system_name,theta); # Simulate system
    Theta = [Theta theta];	# Save parameters
    Y = [Y y];			# Save output
    E = (y - y_s);		# Error(t)
    error = (E'*E);			# Sum the error
    Error = [Error error];
    theta = theta - alpha*((y_theta'*y_theta)\(y_theta'*E));
  endwhile

endfunction

Deleted mttroot/mtt/bin/trans/m/mtt_implicit.m version [d63b98c98d].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [x] = mtt_implicit(x,dx,AA,AAx,dt,Nx,open); 
  ## x = mtt_implicit(x,dx,AA,AAx,dt,Nx,open); 
  ## Implicit integration update

  ## ###############################################################
  ## ## Version control history
  ## ###############################################################
  ## ## $Id$
  ## ## $Log$
  ## ## Revision 1.3  1999/04/20 06:14:53  peterg
  ## ## Reorder to make equivalent to .p version
  ## ##
  ## ## Revision 1.2  1999/04/20 00:58:22  peterg
  ## ## Set open-switch states to zero
  ## ##
  ## ## Revision 1.1  1999/04/02 06:23:20  peterg
  ## ## Initial revision
  ## ##
  ## ###############################################################

  ## Copyright (C) 1999 by P.J. Gawthrop

  I = nozeros(!open.*[1:Nx]');	# Indices of states to update
  x(I) = AA(I,I)\(AAx(I) + dx(I)*dt);	# Implicit update (except open switches);
  I_open = nozeros(open.*[1:Nx]'); # Indices of open switches
  x(I_open) = 0.0;		# Open switches have zero state

endfunction

Deleted mttroot/mtt/bin/trans/m/mtt_info.m version [797b0982e0].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function mtt_info(info, infofile);
  ## mtt_info(info, infofile);

  ## function [bonds, status] = abg2cbg(bonds,components,system_name,filename)
  ## 
  ##     ###################################### 
  ##     ##### Model Transformation Tools #####
  ##     ######################################

  ## ###############################################################
  ## ## Version control history
  ## ###############################################################
  ## ## $Id$
  ## ## $Log$
  ## ## Revision 1.2  1997/02/11 10:06:42  peterg
  ## ## Removed a debugging line.
  ## ##
  ## ## Revision 1.1  1996/08/18  20:06:57  peter
  ## ## Initial revision
  ## ##
  ## ###############################################################

  ## Set default file if it isn't there already
  if nargin<2
    infofile = fopen("mtt_info.txt","a");
  end;

  fprintf(infofile, "INFORMATION: %s\n", info);

  if nargin<2
    fclose(infofile);
  end;

endfunction





Deleted mttroot/mtt/bin/trans/m/mtt_optimise.m version [261e38eb89].

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
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
















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [theta,Theta,Error,Y,iterations] = mtt_optimise (system_name,y_s,theta_0,method,free,weight,criterion,max_iterations,alpha,View)
  ## Usage: [theta,Theta,Error,Y,iterations] = mtt_optimise (system_name,y_s,theta_0,method,free,weight,criterion,max_iterations,alpha)
  ##  system_name     String containg system name
  ##  y_s   actual system output
  ##  theta_0   initial parameter estimate
  ##  free  Indices of the free parameters within theta_0
  ##  weight Weighting function - same dimension as y_s
  ##  method "time" or "freq"
  ##  criterion convergence criterion
  ##  max_iterations limit to number of iterations
  ##  alpha  Optimisation gain parameter

  ## Copyright (C) 1999 by Peter J. Gawthrop

  if nargin<4
    method="time";
  endif

  N = length(theta_0);
  if nargin<5
    free = [1:N];
  endif
  
  if nargin<6
    weight = ones(size(y_s));
  endif

  if nargin<7
    criterion = 1e-7;
  endif
  
  if nargin <8
    max_iterations = 25;
  endif

  if nargin<9
    alpha = 0.1;
  endif
  
  if nargin<10
    View = 0;
  endif
  
  if (!strcmp(method,"time"))&&(!strcmp(method,"freq"))
    error("method must be either time or freq")
  endif
  
  [n_data,n_y] = size(y_s);

  n_th = length(free);
  error_old = inf;
  error=1e50;
  theta = theta_0;
  Theta = [];
  Error = [];
  Y = [];
  iterations = 0;
  while (abs(error_old-error)>criterion)&&(abs(error)>criterion)&&(iterations<max_iterations)
    iterations = iterations + 1;
    error_old_old = error_old;
    error_old = error;
    eval(sprintf("[t,y,y_theta] = \
	mtt_s%s(system_name,theta,free);",method)); # Simulate system

    if View
      xlabel("");
      title(sprintf("mtt_optimise: Weighted actual and estimated Interation %i", iterations));
      plot(t,y.*weight,t,y_s.*weight);
    endif
    
    error = 0; 
    J = zeros(n_th,1);
    JJ = zeros(n_th,n_th);
    for i = 1:n_y
      E = weight(:,i).*(y(:,i) - y_s(:,i)); # Weighted error
      error = error + (E'*E);	# Sum the error

      Weight = weight(:,i)*ones(1,n_th); # Sensitivity weight
      y_theta_w = Weight.*y_theta(:,i:n_y:n_y*n_th); # Weighted sensitivity
      J  = J + real(y_theta_w'*E); # Jacobian
      JJ = JJ + real(y_theta_w'*y_theta_w); # Newton Euler approx Hessian
    endfor

    error
 
    if error<(error_old+criterion) # Save some diagnostics
      Error = [Error error];	# Save error
      Theta = [Theta theta];	# Save parameters
      Y = [Y y];		# Save output
    endif

    ## Update the estimate if we are not done yet.
    if (abs(error_old-error)>criterion)&&(abs(error)>criterion)&&(iterations<max_iterations)
      if error>(error_old+criterion) # Reduce step size and try again
        factor = 10;
	disp(sprintf("%2.2f*step",alpha));
	error = error_old;	# Go back to previous error value
	error_old = inf;	# Don't let it think its converged
	theta(free) = theta(free)  + step; # Reverse step
	step = alpha*step;	# new stepsize
      else			# Recompute step size
	tol = 1e-5;
	step =  pinv(JJ,tol)*J;	# Step size
	#step =  pinv(JJ)*J;	# Step size (built in tol)
      endif
      theta(free) = theta(free) - step; # Increment parameters
    endif
 ##   theta
  endwhile
endfunction


Deleted mttroot/mtt/bin/trans/m/mtt_save_alias.m version [85981ff6a1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function mtt_save_alias (arg,system_name)

  ## usage:  mtt_save_alias (arg,system_name,FileID)
  ##
  ##
  ##     ###################################### 
  ##     #### Model  Transformation Tools #####
  ##     ######################################

  ## ############################################################### 
  ## Version
  ## control history
  ## ############################################################### ## $Id:
  ## mtt_info.m,v 1.2 1997/02/11 10:06:42 peterg Exp peterg $ ## $Log:
  ## mtt_info.m,v $ ## Revision 1.2  1997/02/11 10:06:42  peterg ##
  ## ###############################################################

  fileid = fopen('mtt_aliased.txt','a');
  fprintf(fileid, "%s\t%s\n", arg,system_name);
  fclose(fileid);
endfunction

Deleted mttroot/mtt/bin/trans/m/mtt_sfreq.m version [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
60
61





























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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



Deleted mttroot/mtt/bin/trans/m/mtt_simulate.m version [cbe0b154db].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [t,y,y_theta] = mtt_simulate(system_name,theta);
  ## usage: [t,y,y_theta] = mtt_simulate(r);
  ##
  ## Simulate system with name system and parameter vector theta
  ## The order of components in theta is determined in system_numpar.txt:
  ## Copyright (C) 1999 by Peter J. Gawthrop

  ## 	$Id$	

  ## Simulate using mtt-generated function
  y_theta = [];
   for i=1:length(theta)
     args="";
     for j=1:length(theta)
       i_sensitivity=(j==i);
       args = sprintf("%s%i %g ",args, i_sensitivity, theta(j));
     endfor

     command = sprintf("./%s_ode2odes.out %s > mtt_data.dat\n", system_name, args);
     system(command);

     ## Retrieve data
     load -force mtt_data.dat
     t = mtt_data(:,1);
     y = mtt_data(:,2);
     y_theta = [y_theta mtt_data(:,3)];
   endfor

endfunction



Deleted mttroot/mtt/bin/trans/m/mtt_ssimulate.m version [5b7c3603ee].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [t,y,y_theta] = mtt_ssimulate(system_name,theta);
  ## usage: [t,y,y_theta] = mtt_ssimulate(system_name,theta);
  ##
  ## Simulate system 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$	

  ## Simulate using mtt-generated function
  y_theta = [];
   for i=1:length(theta)
     args="";
     for j=1:length(theta)
       i_sensitivity=(j==i);
       args = sprintf("%s%i %g ",args, i_sensitivity, theta(j));
     endfor

     command = sprintf("./%s_ode2odes.out %s > mtt_data.dat\n", system_name, args);
     system(command);

     ## Retrieve data
     load -force mtt_data.dat
     t = mtt_data(:,1);
     y = mtt_data(:,2);
     y_theta = [y_theta mtt_data(:,3)];
   endfor

endfunction



Deleted mttroot/mtt/bin/trans/m/mtt_stime.m version [57b5993ee0].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [t,y,y_theta,x,x_last] = mtt_stime(system_name,theta,free);
  ## usage: [t,y,y_theta,x,x_last] = mtt_stime(system_name,theta);
  ##
  ## Simulate system 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$	

  ## Simulate using mtt-generated function

  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
  
  for i=free
    args=sprintf("%i",i);
    for j=1:length(theta)
      args = sprintf("%s %g",args, theta(j));
    endfor

    ## Run system and replace NaN by 1e30 -- easier to handle
    file_name = sprintf("%s_input.dat", system_name);
    if exist(file_name)==2	# Then use data from this file ...
      command = sprintf("./%s_ode2odes.out %s < %s | sed \'s/NAN/Inf/g\' >mtt_out_data.dat\n", \
			system_name, args, file_name);
    else
      command = sprintf("./%s_ode2odes.out %s | sed \'s/NAN/Inf/g\' >mtt_out_data.dat\n", \
			system_name, args);
    endif
      
   system(command);

    ## Retrieve out_data
    load -force mtt_out_data.dat
    y_theta = [y_theta mtt_out_data(:,3:2:1+ny)];
  endfor

  ## System out_data
  [n,m]=size(mtt_out_data);
  t = mtt_out_data(:,1);
  y = mtt_out_data(:,2:2:ny);
  x = mtt_out_data(:,3+ny:m);
  x_last = mtt_out_data(n,3+ny:m);
endfunction



Deleted mttroot/mtt/bin/trans/m/mtt_strip_name.m version [061a293596].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
function stripped_name = mtt_strip_name (name)

  ## usage:  stripped_name = mtt_strip_name (name)
  ##
  ## Removes blanks and [] from a port name

  stripped_name = deblank(name); # remove blanks
  stripped_name = stripped_name(2:length(stripped_name)-1);
  stripped_name = deblank(stripped_name); # remove blanks

endfunction

Deleted mttroot/mtt/bin/trans/m/mtt_type_name.m version [6cb1565552].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function NewType = mtt_type_name (OldType)

  ## usage:  NewType = mtt_type_name (OldType)
  ##
  ## 

  if OldType=="0";
    NewType = "Zero";
  elseif OldType=="1";
    NewType = "One";
  else
    NewType = OldType;
  endif

endfunction

Deleted mttroot/mtt/bin/trans/m/mtt_update.m version [27453a1721].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
function [x] = mtt_update(dx,x,dt,STEPFACTOR,METHOD,name);

  if (METHOD==1)		#Euler
    ddt = dt/STEPFACTOR;
    x = x + dx*ddt;
  elseif (METHOD==2)		#Linear implicit or Implicit
    eval("[AA,AAx] = ",name,"_smx;");
    x = AA\(AAx + dx*dt);
  else
    error("Method %i is not defined", METHOD);
  endif;

endfunction;

Deleted mttroot/mtt/bin/trans/m/mtt_write.m version [79505da971].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function mtt_write(t,x,y,nx,ny);

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1999/03/15 23:05:29  peterg
## A complete rewrite - now puts into a Global matrix MTT_data
##
## Revision 1.3  1999/03/15 21:57:00  peterg
## Removed the # symbol
##
###############################################################

global MTT_data
  if t==0.0
    MTT_data=[];
  endif

  MTT_data = [MTT_data; t,y',t,x'];
endfunction

Deleted mttroot/mtt/bin/trans/m/name_in_list.m version [d44d5cda78].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function index = name_in_list(name,list)

% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  name_in_list.m
% Finds name in list and returns index -- zero if not found


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/23 09:22:05  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[N,M] = size(list);
if N<1
  error('list must have at least one element');
end;

index = 0;

for i = 1:N
 j = findstr(name,list(i,:));
 if (length(j)==1)
    if j(1)==1
      if index==0
        index = i;
      else 
        index = [index i];
      end
    end
 end;
end;

Deleted mttroot/mtt/bin/trans/m/nozeros.m version [e7ac91823e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function v = nozeros (v0,tol)

  ## usage:  v = nozeros (v0,tol)
  ##
  ## Zaps the zeros in a vector with tolerance tol (defaults to zero)

  ## Copyright (C) 2000 by Peter J. Gawthrop

  if nargin<2
    tol=eps;
  endif
  
  
  v = [];
  j=0;
  for i = 1:length(v0)
    if abs(v0(i))>tol
      j=j+1;
      v(1,j) = v0(i);
    end;
  end;
  

endfunction

Deleted mttroot/mtt/bin/trans/m/pol2root2tex.m version [f78af4d947].

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
68
69
70
71
72
73









































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function tex = pol2root2tex(pol,name,f)
  ## pol2tex: converts polynomial into LaTeX form as (s-z_1)..(s-z_n)
  ## tex = pol2root2tex(pol,[name,f])
  
  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.2  2001/05/10 19:08:35  gawthrop
  ## Cosmetic improvements
  ##
  ## Revision 1.1  2001/05/10 11:44:40  gawthrop
  ## Useful conversion functions
  ##
  ## Revision 1.1  1999/05/24 22:05:53  peterg
  ## Initial revision
  ##
  ###############################################################

  if nargin<2
    name = "s"
  endif
  
  if nargin<3
    f = "%2.2f";
  endif

  n = length(pol)-1;

  if n>0
    r = sort(roots(pol));
  endif
  
  gain = pol(1);

  complex=0;
  if ((gain==1)&&(n>0))
    tex="";
  else
    tex = sprintf("%g", gain);
  endif
  
  for i=1:n
    if real(r(i))<0
      r_plusminus = '+';
    else
      r_plusminus = '-';
    endif
    if imag(r(i))<0
      i_plusminus = '+';
    else
      i_plusminus = '-';
    endif

    if complex
      complex=0;
    else
      if abs(imag(r(i)))<1e-5
	ff = sprintf("%%s (%s %%s %s)",name, f);
	tex = sprintf(ff, tex, r_plusminus, abs(r(i)));
      else
	ff = sprintf("%%s (%s %%s %s \\pm j %s)", name, f, f);
	tex = sprintf(ff, tex, r_plusminus, abs(real(r(i))), imag(r(i)));
	complex=1;
      endif
    endif
  endfor
  
endfunction



Deleted mttroot/mtt/bin/trans/m/pol2tex.m version [20e8117d85].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function tex = pol2tex(pol,name,f)
  ## pol2tex: converts polynomial into LaTeX form.
  ## tex = pol2tex(pol,[name,f])
  
  ## pol  polynomial (row vector)
  ## name name of the variable (eg s or z)
  ## f    format of the coefficients (eg %2.4f)

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.3  2001/07/11 03:58:41  gawthrop
  ## removed {}
  ##
  ## Revision 1.2  2001/05/10 19:08:35  gawthrop
  ## Cosmetic improvements
  ##
  ## Revision 1.1  2001/05/10 11:44:40  gawthrop
  ## Useful conversion functions
  ##
  ## Revision 1.1  1999/03/25 01:33:51  peterg
  ## Initial revision
  ##
  ###############################################################

  if nargin<2
    name = "s";
  endif
  
  if nargin<3
    f = "%2.2f";
  endif
  
  n = length(pol);
  if n<1
    tex = "--";
    return
  endif

  if pol(1) == 1
    if n>1
      tex = '';
    else
      tex = '1';
    endif
  else
    ff = sprintf(" %s",f);
    tex = sprintf(ff, pol(1));
  endif
  
  if n>2
    tex = sprintf("%s%s^%i", tex, name, n-1);
  elseif n==2
    tex = sprintf("%s%s", tex, name);
  else
    tex = sprintf("%s", tex);
  endif

  for i=2:n
    if pol(i)<0
      plusminus = '-';
    else
      plusminus = '+';
    endif
    ff = sprintf("%%s %%s %s",f);
    tex = sprintf(ff, tex, plusminus, abs(pol(i)));
    if i<n-1
      tex = sprintf("%s%s^%i", tex, name, n-i);
    elseif i==n-1
      tex = sprintf("%s%s", tex, name); 
    else
      tex = sprintf("%s", tex);
    endif
  endfor
endfunction



Deleted mttroot/mtt/bin/trans/m/pow.m version [0360ed3c86].

1
2
3
4
5
6
7
8
9









-
-
-
-
-
-
-
-
-
function z = pow (x,y)

  ## usage:  z = pow (x,y)
  ##
  ## Computes z = x^y

  z = x^y;

endfunction

Deleted mttroot/mtt/bin/trans/m/printcr.m version [cc1770a912].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  printcr(name,outport,bond_number,cr,args,RHS_cause,eqnfile)
% printcr - prints cr and arguments
% Assumes that the (multiport) component is unicausal.
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  printcr
% printcr(name,outport,bond_number,cr,args,RHS_cause,eqnfile


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



if nargin<7
  eqnfile = 'stdout';
end;

% Find the number of ports
ports = length(RHS_cause);

% Print the CR
if length(cr) == 0 % No CR given - use unity CR
  fprintf(eqnfile, '%s;\n', varname(name,bond_number(outport), RHS_cause(outport)));
else % CR exists
  fprintf(eqnfile, '%s(', cr); % The CR name
  if ports>1 % Multi ports - port no. is first arg of CR
    fprintf(eqnfile, '%1.0f,', outport);
  end;
  fprintf(eqnfile, '%s', args); % Print the arguments
  for port = 1:ports % Print the input causalities and values
    fprintf(eqnfile, '\n\t\t,%s,%s', cause2name(RHS_cause(port)), ...
    varname(name,bond_number(port), RHS_cause(port)));
  end;
fprintf(eqnfile, '\n\t\t);\n');    
end;

Deleted mttroot/mtt/bin/trans/m/psfig.m version [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
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

Deleted mttroot/mtt/bin/trans/m/rbg2abg.m version [6edafa9130].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691



















































































































































































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,components,n_vector_bonds] = rbg2abg(name,rbonds,rstrokes,rcomponents,\
				      port_coord,port_name,\
				      infofile,errorfile)

  ## ###############################################################
  ## ## Version control history
  ## ###############################################################
  ## ## $Id$
  ## ## $Log$
  ## ## Revision 1.45  1999/10/19 02:13:31  peterg
  ## ## Now assigns correct bonds to the new junction port names
  ## ##
  ## ## Revision 1.44  1999/10/19 00:05:44  peterg
  ## ## Now defaults junction ports when only one specified (for vector junctions)
  ## ##
  ## ## Revision 1.43  1999/10/18 04:08:46  peterg
  ## ## Now computes n_vector_bonds -- number apparent (maybe vector) bonds per component.
  ## ## Neeeded to vectorise junctions.
  ## ##
  ## ## Revision 1.42  1999/08/25 21:45:03  peterg
  ## ## Spurious start to vector 0 and 1
  ## ##
  ## ## Revision 1.41  1999/08/19 21:12:33  peterg
  ## ## Tidied and started implementaation of vector junctions
  ## ##
  ## ## Revision 1.40  1999/08/19 05:39:55  peterg
  ## ## Put into octave format
  ## ##
  ## ## Revision 1.39  1999/08/19 05:22:16  peterg
  ## ## To RCS prior to inplementing vector junctions
  ## ##
  ## ## Revision 1.38  1999/03/12 00:58:06  peterg
  ## ## Now gets portlist from the _abg.m file NOT the _rbg.m file
  ## ## - this allows expansion of vector SS ports.
  ## ##
  ## ## Revision 1.37  1998/07/28 19:06:43  peterg
  ## ## Still some bugs (vector SS ports)??
  ## ##
  ## ## Revision 1.36  1998/07/28 10:30:50  peterg
  ## ## Implemented vector SS ports.
  ## ##
  ## ## Revision 1.35  1998/07/08 15:35:15  peterg
  ## ## Added errorfile argument
  ## ##
  ## ## Revision 1.34  1998/07/02 19:41:29  peterg
  ## ## Fixed empty port string bug - set to null string.
  ## ##
  ## ## Revision 1.33  1998/07/02 17:16:06  peterg
  ## ## Commented out redundent code -- obsolete due to new default mechanism
  ## ##
  ## ## Revision 1.32  1998/07/02 15:12:05  peterg
  ## ## Added hard error reporting
  ## ## Added error when two unlabled bonds point in.
  ## ##
  ## ## Revision 1.31  1998/07/02 14:30:50  peterg
  ## ## Corrected various bugs - including resettting n_ports to correct value
  ## ##
  ## ## Revision 1.30  1998/07/02 13:40:50  peterg
  ## ## Added extra ports names (due to defaults) to relevant lists:
  ## ## 	port_name
  ## ## 	port_bond
  ## ##
  ## ## Revision 1.29  1998/07/02 13:28:31  peterg
  ## ## Added defaults in new form BEFORE alias expansion
  ## ##
  ## ## Revision 1.28  1998/07/02 12:36:05  peterg
  ## ## Removed debugging lines
  ## ##
  ## ## Revision 1.27  1998/07/02 12:24:02  peterg
  ## ## Expand port aliases
  ## ##
  ## ## Revision 1.26  1998/04/16 14:07:51  peterg
  ## ## Sorted out [] problem with vector ports -- new octave function
  ## ## split_port
  ## ##
  ## ## Revision 1.25  1998/04/12 15:01:04  peterg
  ## ## Converted to uniform port notation - always use []
  ## ##
  ## ## Revision 1.24  1998/02/19 08:57:16  peterg
  ## ## Fixed mtt-info bug -- confused filename with number
  ## ##
  ## ## Revision 1.23  1997/12/04 14:24:22  peterg
  ## ## Removed error message about through-pointing arrows
  ## ##
  ## ## Revision 1.22  1997/09/18 19:49:37  peterg
  ## ## Added test for uniquness of bonds on a component -- if non-unique
  ## ## implies same component at both ends of a bond.
  ## ##
  ## ## Revision 1.21  1997/09/16  15:14:14  peterg
  ## ## Added warning if a component has no bonds.
  ## ##
  ## ## Revision 1.20  1997/08/18  19:39:48  peterg
  ## ## Now generates (exampaded) port_bond list correctely
  ## ##
  ## ## Revision 1.19  1997/08/14  11:59:47  peterg
  ## ## Vector ports added!!
  ## ##
  ## ## Revision 1.18  1997/08/14  11:01:42  peterg
  ## ## Reordered algorithms as follows:
  ## ## bond end coordinates
  ## ## associate port labels with bonds (port_bond)
  ## ## associate bonds with components
  ## ## unsorted list of bonds on each component (components)
  ## ## interpret strokes and setup the causality of the bonds (bonds)
  ## ## expand vector ports & add new bonds and connections
  ## ## sort bonds on each component according to the labels -- two ports
  ## ## default included here.
  ## ##
  ## ## Revision 1.17  1997/08/09 11:31:16  peterg
  ## ## Default two port list is [in;out] (or [out;in])
  ## ## Dont do global default if no ports labels.
  ## ##
  ## ## Revision 1.16  1997/08/07  16:12:36  peterg
  ## ## Fixed sorting bug: now puts the jth component from the unsorted list
  ## ## into the kth component of the sorted list .. not vice versa!
  ## ##
  ## ## Revision 1.15  1997/08/06  21:43:19  peterg
  ## ## Corrected error in creating component list: the kth component of the
  ## ## list is given by the jth component of the original list NOT vice
  ## ## versa.
  ## ##
  ## ## Revision 1.14  1997/08/04 14:18:55  peterg
  ## ## If no ports labels at all, just use the default component list.
  ## ##
  ## ## Revision 1.13  1997/08/04 12:50:39  peterg
  ## ## Many bug fixes to the named port version + tied up the logic and
  ## ## supporting comments.
  ## ##
  ## ## Revision 1.12  1997/08/02 19:37:53  peterg
  ## ## Now uses named ports.
  ## ##
  ## ## Revision 1.11  1997/04/29 09:12:37  peterg
  ## ## Added error message if port label near to >1 bond.
  ## ##
  ## ## Revision 1.10  1997/03/17  13:45:42  peterg
  ## ## Added more error info.
  ## ##
  ## ## Revision 1.9  1996/12/31  11:25:57  peterg
  ## ## Clearer error messages for incorrect ports.
  ## ##
  ## ## Revision 1.8  1996/12/04 21:52:39  peterg
  ## ## Now uses fopen.
  ## ##
  ## ## Revision 1.7  1996/11/01 18:01:57  peterg
  ## ## Rationalised port ordering.
  ## ## Fixed port bug.
  ## ##
  ## ## Revision 1.6  1996/08/25 08:27:14  peter
  ## ## Now checks ports correctely - I hope.
  ## ##
  ## ## Revision 1.5  1996/08/24 19:21:26  peter
  ## ## More specific error messages.
  ## ##
  ## ## Revision 1.4  1996/08/24 18:00:33  peter
  ## ## Fixed bug with finding ports.
  ## ##
  ## ## Revision 1.3  1996/08/09 08:26:35  peter
  ## ## Cosmetic tidy up.
  ## ##
  ## ## Revision 1.2  1996/08/04 18:37:57  peter
  ## ## Fixed  no causal strokes bug.
  ## ##
  ## ## Revision 1.1  1996/08/04 18:30:14  peter
  ## ## Initial revision
  ## ##
  ## ###############################################################


  ##Default to no components
  components = [0];

  ## Xfig scaling factor
  scale = 1200.0/2.54546;

  ## Rotation matrix
  rot = [0 -1; 1 0];

  ## Find number of strokes
  [n_strokes,columns] = size(rstrokes);
  if (columns ~= 4)&(n_strokes>0)
    error('Incorrect rstrokes matrix: must have 4 columns');
  endif


  ## Find number of bonds
  [n_bonds,columns] = size(rbonds);
  if (columns ~= 6)&(n_bonds>0)
    error('Incorrect rbonds matrix: must have 6 columns');
  endif


  ## Find number of components
  [n_components,columns] = size(rcomponents);

  ## Find the number of ports refered to within the component
  [n_ports,columns] = size(port_coord)

  ## If port_name is empty, make it a empty string
  if (length(port_name)==0)
    port_name="";
  endif


  ## Determine coordinates of the arrow end of the bond and the other end
  other_end_1 = rbonds(:,1:2);
  arrow_end   = rbonds(:,3:4);
  other_end_2 = rbonds(:,5:6);

  distance_1   = length2d(other_end_1 - arrow_end);
  distance_2   = length2d(other_end_2 - arrow_end);
  which_end    = (distance_1>distance_2)*[1 1];
  one          = ones(size(which_end));
  other_end    = which_end.*other_end_1 + (one-which_end).*other_end_2;
  arrow_vector = ( which_end.*other_end_2 + (one-which_end).*other_end_1 ) - ...
      arrow_end;
  
  ## Locate the bond end nearest to each port
  ## col 1 of port_near_bond contains a signed bond number (+ for arrow end)
  ## col 2  of port_near_bond contains the corresponding port index
  port_bond = [];
  for i = 1:n_ports
    near_bond = adjbond(port_coord(i,1:2),arrow_end,other_end);
    [rows,cols]=size(near_bond);
    if rows>1
      error(sprintf ...
	    ("A port is near to more than one bond at coordinates %g,%g\n", ...
	     port_coord(i,1)/scale,  port_coord(i,2)/scale));
    endif
    

    ##The (signed) bond corresponding to the ith port label
    port_bond(i) = near_bond(1)*sign(1.5-near_bond(2));
  endfor

  port_bond
  ##We now have the (signed) bond (port_bond(i)) correponding to the
  ## ith port label within the component 

  ## Locate the components at the ends of each bond
  ## col 1 of comp_near_bond contain the component nearest to the arrow end
  ## col 2 of comp_near_bond contain the component nearest to the other end
  for i = 1:n_bonds
    comp_near_bond(i,:) = adjcomp(arrow_end(i,:),other_end(i,:),rcomponents);
  endfor

  comp_near_bond
  ## We now have a list (comp_near_bond) of the component(s) at each end
  ## of each bond

  ## Now do a list of the bonds on each component - unsorted at this stage.
  ## Also expand aliases using the alias list for each component
  components = []; 
  i_vector=0;			# Counter for vector components
  for i = 1:n_components
    ##Get component type
    eval(['[comp_type, comp_name] = ', name, '_cmp(i)']);

    
    ## There are n_comp_bonds bonds on this component with corresponding index
    [index,n_comp_bonds] = getindex(comp_near_bond,i);

    if index(1,1)==0
      mtt_error(sprintf("Component %s (%s) has no bonds", comp_name,
			comp_type),errorfile);
    endif
    
    
    ## Create the signed list of bonds on this component
    one = ones(n_comp_bonds,1);
    bond_list = index(:,1); %  bond at component
    
    ## Check that all bonds are unique -- error if not
    if unique(bond_list)==0
      mtt_error(sprintf("Component %s (%s) is at both ends of a bond", comp_name,
			comp_type),errorfile);
    endif
    
    

    ## which end of bond at component?
    bond_end = index(:,2); 
    direction = -sign(bond_end-1.5*one);
    signed_bond_list = bond_list.*direction;
    components = add_bond(components,signed_bond_list',i);
    
    ## Unalias and/or default all the ports on this componen
    unlabelled_ports = 0;  
    in_bonds = 0;
    out_bonds = 0;
    if ((comp_type=="0")||(comp_type=="1")) # A junction
      disp("---- default junctions ---- ");
      junction_names = 0;
      for j=1:n_comp_bonds
	port_name_index = getindex(port_bond,signed_bond_list(j));
	if port_name_index>0
	  junction_port_name = port_name(port_name_index,:);
	  named_bond_index = j;
	  junction_names++;
	endif
      endfor
      if junction_names==1	# one named port
	mtt_info(sprintf("Defaulting all ports on junction %s to %s", comp_name, junction_port_name));
	## Make the other n-1 names the same.
	junction_port_name = mtt_strip_name(junction_port_name);
	for j=1:n_comp_bonds;
	  if j!=named_bond_index
	    port_name = [port_name; ["[" junction_port_name "]"]]; # add to list
	    [port_name_index,junk] = size(port_name); # the corresponding index
	    port_bond(port_name_index,:) = signed_bond_list(j); # add to port bond
	  endif
	endfor
      elseif (junction_names!=0)&&(junction_names!=n_comp_bonds) # not allowed
	mtt_error(sprintf("Junction %s must have 0, 1 or %i port labels", comp_name,n_comp_bonds),errorfile);
      endif
      port_name = port_name
    else			# Not a junction
      for j=1:n_comp_bonds
	signed_bond = signed_bond_list(j);
	port_name_index = getindex(port_bond,signed_bond);
	port_direction = sign(signed_bond);
	
	if port_name_index==0	# There is no port on this bond - so try
				# to default
	  unlabelled_ports++;
	  if(unlabelled_ports==1)
	    if port_direction>0
	      in_bonds++;
	      port_name_i = "in";
	    else
	      out_bonds++;
	      port_name_i = "out";
	    endif
	    
	  elseif (unlabelled_ports==2)
	    if port_direction>0
	      if (++in_bonds>1)
		mtt_error(["More than one unlabelled INport on component " \
			   comp_name " (" comp_type ")"],errorfile);
	      else
		port_name_i = "in";
	      end
	    else
	      if (++out_bonds>1)
		mtt_error(["More than one unlabelled OUTport on component " \
			   comp_name " (" comp_type ")"],errorfile);
	      else
		port_name_i = "out";
	      end
	    endif
	    
	  else
	    mtt_error(["More than two unlabelled ports on component " \
		       comp_name " (" comp_type ")"],errorfile);
          endif
	  
	  mtt_info(["Defaulting port name [" port_name_i "]\t on component " \
		    comp_name " (" comp_type ")" ],infofile);
	  port_name = [port_name; ["[" port_name_i "]"]];	# add to list
	  [port_name_index,junk] = size(port_name); # the corresponding
				# index
	  port_bond(port_name_index,:) = signed_bond; # add to port bond
	else  
	  port_name_i = mtt_strip_name(port_name(port_name_index,:));
	  ## port_name_i = deblank(port_name(port_name_index,:));
	  ## port_name_i = port_name_i(2:length(port_name_i)-1) # strip []
	endif
	
	
	## Replace by alias -- if any
    	eval( ["alias = ", comp_type, '_alias';]); # Get aliases
    	if is_struct(alias)		# are there any aliases
          if struct_contains(alias,port_name_i) # Is this an alias?
	    eval(["new_port_name_i = alias.",port_name_i]);
	    mtt_info(["Aliasing name [" port_name_i "]\t on component " \
		      comp_name " (" comp_type ")\t to [" new_port_name_i "]"],infofile);
	    port_name = replace_name(port_name, \
				     ["[",new_port_name_i,"]"], \
				     port_name_index);
	  endif
	  
      	endif
	
      endfor
      
    endif
    
  endfor
  
  ## At this point, every port should be labeled (port_name) and \
  ## associated with a bond (port_bond).
  disp("--- Completed portnames and the corresponding bonds ---")
  port_name, port_bond


  ## Deduce causality from the strokes (if any) and create the list of bonds
  causality = zeros(n_bonds,2);
  if n_strokes>0
    ## Find out location of centre and ends of stroke.
    stroke_end_1 = [rstrokes(:,1) rstrokes(:,2)];
    stroke_end_2 = [rstrokes(:,3) rstrokes(:,4)];
    
    stroke_centre = (stroke_end_1 + stroke_end_2)/2;
    stroke_vector = (stroke_end_1 - stroke_end_2);
    stroke_length = length2d(stroke_vector);

    ## Deduce bond causality from the strokes 
    for i = 1:n_strokes
      stroke = [stroke_centre(i,:) 
		stroke_end_1(i,:)
		stroke_end_2(i,:)];


      ## Find the nearest bond end.
      [index,distance] = adjbond(stroke(1,:),arrow_end,other_end);
      if (distance>2*stroke_length(i))
	info = sprintf('Stroke at (%4.3f,%4.3f) is %4.3f away from the nearest bond\n', ...
		       stroke(1,1)/scale, stroke(1,2)/scale, distance/scale);
      endif
      
      
      ## Bond end coordinates
      j = index(1,1);
      which_end = index(1,2)==1;
      bond_end = arrow_end(j,:)*which_end + other_end(j,:)*(1-which_end);
      
      ## Now decide which bit of the stroke is nearest
      stroke_index = adjbond(bond_end,stroke,zeros(size(stroke)));
      
      if stroke_index(1)==1 ## uni-causal stroke
	causality(j,1:2) = (2*which_end-1)*[1 1];
      else ## bicausal stroke
	## Find out whether stroke is on flow side of bond
	stroke_direction = stroke(1,:) - stroke(stroke_index(1),:);
	flow_side = stroke_direction*arrow_vector(j,:)'>0;
	causality(j,1+flow_side) = 2*which_end-1;
      endif
      
    endfor
    
  endif


  bonds = causality;


  ## Find number of bonds on each component BEFORE vectorisation
  for i=1:n_components
    n_vector_bonds(i) = length(nozeros(components(i,:)))
  endfor
  
  ## Now expand vector ports
  disp("Expanding vector ports");
  [n_bonds,junk] = size(bonds);
  n_ports = length(port_bond);
  n_exp_ports=n_ports;
  exp_port_name="";
  exp_port_bond = [];
  ##exp_comps = [];
  for i=1:n_ports
    port_name_i = port_name(i,:)
    [subport,n_subports] = split_port(port_name_i, ','); ## Find the components of the vector port

    if n_subports==1 ## an ordinary port
      exp_port_name = [exp_port_name; subport(1,:)]; ## Write out the only port
      exp_port_bond = [exp_port_bond; port_bond(i)]; ## and the port_bond
    else ## its a vector port
      ## Check that there is a corresponding vector port at the other end of the
      ## bond
      signed_bond_index = port_bond(i);
      [other_bond_index,n_other] = getindex(port_bond,-signed_bond_index);
      if n_other == 1
	other_port_name = port_name(other_bond_index,:);
	[other_subport,n_other_subports] = split_port(other_port_name, ',');
	if n_other_subports~=n_subports
	  mtt_error(['Vector ports ', port_name_i, ' and ', other_port_name, 'are not compatible'],errorfile);
	end
      else # No explicit matching vector port
 	mtt_error(['Vector port ', port_name_i, ' has no matching port'], errorfile);
      endif
      
      
      if other_bond_index>i ##then its not been done yet
	mtt_info(["Vector port: ", port_name_i],infofile);
	mtt_info(["matching: ", other_port_name],infofile);
	## Remove sign info.
	bond_index = abs(signed_bond_index);
	sig = sign(signed_bond_index);
	
	## Put the first element of each port list in the expanded list
	exp_port_name = [exp_port_name; subport(1,:)];
	exp_port_name = [exp_port_name; other_subport(1,:)];
	
	## Add to the expanded port_bond list
	exp_port_bond = [exp_port_bond; signed_bond_index; ...
			 -signed_bond_index];
	
	## Add the other names to the expanded list and augment the bonds,
	## components and port_bond lists.
	for j=2:n_subports
	  ## Add a new name (for each end) to give a non-vector list
	  exp_port_name = [exp_port_name; subport(j,:)];
	  exp_port_name = [exp_port_name; other_subport(j,:)];
	  
	  ## Add one more bond to the list
	  bonds = [bonds; bonds(bond_index,:)];
	  n_bonds = n_bonds + 1;
	  
	  ## Add bond to the expanded port_bond list (ports at both ends)
	  exp_port_bond = [exp_port_bond; sig*n_bonds; -sig*n_bonds];


	  ## Add the new bond to the component at both ends (taking note 
	  ## of the direction).
	  arrow_index = comp_near_bond(bond_index,1);
	  components = add_bond(components, n_bonds, arrow_index);
	  other_index = comp_near_bond(bond_index,2);
	  components = add_bond(components, -n_bonds, other_index);
	endfor
	
      endif
      
    endif
    
  endfor



  ##Replace old list by new
  port_name = exp_port_name
  port_bond = exp_port_bond

  ## Resize the lists
  [n_ports,junk] = size(port_name);

  port_name, components
  ## Produce a list of bonds on each component (within this component) 
  ##  - sorted if explicit port numbers
  for i = 1:n_components    
    disp('-----------------');
    ##Get component type
    eval(['[comp_type, comp_name] = ', name, '_cmp(i)']);


    ##Convert junction names   
    if comp_type(1)=='0'	# Zero junction
      comp_type = 'zero';
      isa_junction = 1;
    elseif comp_type(1)=='1'	# One junction
      comp_type = 'one';
      isa_junction = 1;
    else
      isa_junction = 0;
    endif

    ## Find the (unsorted) bond list on this component
    signed_bond_list = nozeros(components(i,:));
    n_comp_bonds = length(signed_bond_list);
    direction = sign(signed_bond_list);
    
    ##Find the port list for this component
    if exist([comp_type, '_cause'])==0
      eval(["ABG = ",comp_type, "_abg;"]);
      if struct_contains (ABG, "portlist")
	port_list = ABG.portlist;
      else
	error(sprintf("Component %s has no ports", comp_type));
        port_list = [];
      endif
    else
      port_list=comp_ports(comp_type,n_comp_bonds)
    endif
    

    [n_comp_ports,m_comp_ports] = size(port_list);
    subport_list="";
    for p=1:n_comp_ports		# Expand any vector ports
      [subport,n_sub] = split_port(port_list(p,:), ','); # Find the components
				# of the vector port
      if n_sub>1
	mtt_info(sprintf("Expanding vector port %s of component type %s",\
			 port_list(p,:), comp_type, infofile));	
      endif
      
      subport_list = [subport_list; subport];
    endfor
    
    port_list = subport_list;	# Set the expanded port list.
    

    ## Check that number of bonds on the component is the same as the number of
    ## ports
    [n_comp_ports,m_comp_ports] = size(port_list);
    if (n_comp_ports~=n_comp_bonds) & ...
	  ~(strcmp(comp_type,'zero')|strcmp(comp_type,'one'))
      message=sprintf('Component %s (%s) has %1.0f impinging bonds but has %1.0f ports', ...
		      comp_name,comp_type,n_comp_bonds,n_comp_ports);
      mtt_error(message, errorfile);
    endif
    
    
    unsorted_port_list="";
    if n_ports>0 ## then there are some named ports
      ## so find those associated with the bonds on this component.
      k=0; 
      for j = 1:n_comp_bonds
	b = signed_bond_list(j); 
	## Find the port label on component end of bond (if any)
	[port_index,m] = getindex(port_bond,b);
	if m==1
	  k=k+1;
	  unsorted_port_list(k,:) = port_name(port_index,:);
	endif
	
      endfor
      
    else 
      k=0;
    endif
    
    %Compute the number of labeled ports
    [n_unsorted_ports,m_unsorted_ports] = size(unsorted_port_list);
    if m_unsorted_ports==0
      n_unsorted_ports = 0;
    endif
    
    ## Junctions (order of ports unimportant)
    if strcmp(comp_type,'zero')|strcmp(comp_type,'one')
      for j = 1:n_comp_bonds
	components(i,j) = signed_bond_list(j);
      endfor
      
    else ##Order of ports is important
      unsorted_port_list, port_list
      if n_unsorted_ports==0
	mtt_error(['Component ', comp_name, ' (', comp_type, ') has no labeled ports'], errorfile); 
      endif
      
      ##Write out the signed bond list in the correct order
      unsorted_port_list
      [n_list,m_list] = size(unsorted_port_list);
      if n_list!=n_comp_bonds
	error(sprintf("Component %s (%s) has %i bonds but %i port lables",\
		      comp_name, comp_type, n_comp_bonds, n_list))
      endif

      for j = 1:n_comp_bonds
	j
	name_k = unsorted_port_list(j,:)
	k = name_in_list(name_k, port_list);
	## Check that it only appears once in port list
	if length(k)>1
	  mtt_error(['Component ', comp_name, ' (', comp_type, ') has ports with the same name:  ', name_k], errorfile); 
	endif
	
	
	##Check that it only appears one in the label list
	kk = name_in_list(name_k,unsorted_port_list);
	if length(kk)>1
	  mtt_error(['Component ', comp_name, ' (', comp_type, ') has multiple port labels:  ', name_k], errorfile); 
	endif
	
	
	if k==0
	  mtt_error(['Component ', comp_name, ' (', comp_type, ') has an unrecognised port: ', name_k], errorfile); 
	else
	  components(i,k) = signed_bond_list(j);     
	endif
      endfor
    endif
  endfor

endfunction



















Deleted mttroot/mtt/bin/trans/m/rc_sim.m version [bf245ec09e].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [y,x] = rc_sim(mttx_0,mttU,mttT,MTTpar);

  ## Initialise
  [MTTu]  = zero_input(1);	# Zero the input

  [MTTx] = mttx_0;	        # Read in initial state

  N = length(mttT);
  Nx = length(mttx_0);

  y = zeros(1,N);
  x = zeros(Nx,N);

  mttdt = mttT(2)-mttT(1);
  for i = 1:N
    MTTt = mttT(i);
    MTTu = mttU(i);
    [MTTy] = rc_cseo(MTTx,MTTu,MTTt,MTTpar);    # Output 
    y(1,i) = MTTy;
    x(:,i) = MTTx;
    if 1>0			# Dont if no states
      [MTTdx] = rc_cse(MTTx,MTTu,MTTt,MTTpar); # State derivative
      [mttAA] = rc_smxa(MTTx,MTTu,mttdt,MTTpar);	# (I-Adt)
      [mttAA] = reshape(mttAA,Nx,Nx);
      [mttAAx] = rc_smxax(MTTx,MTTu,mttdt,MTTpar);	# (I-Adt)x
      [MTTopen] = rc_switchopen(MTTx);        # Open switches
      [MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,1,MTTopen); # Implicit update
    else 
    endif;			# 1>0

  endfor;				# Integration loop

endfunction

Deleted mttroot/mtt/bin/trans/m/rcs_header.txt version [52b8d3c3d8].

1
2
3
4
5
6
7
8








-
-
-
-
-
-
-
-

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Deleted mttroot/mtt/bin/trans/m/replace_name.m version [f5eb963580].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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;
  
  if L<M			# Pad the new string
    new = [new, blanks(M-L)];
  elseif M<L			# Pad the array
    for i=1:L-M
      string_array=[string_array, blanks(N)'];
    end
  end

  string_array(index,:) = new;	# Replace ith row by new string

endfunction

    
    


Deleted mttroot/mtt/bin/trans/m/sign2name.m version [815733e396].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = sign2name(sign);
% sign2name - converts sign to a string
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  sign2name


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



if sign==1
  name = '+';
elseif sign ==-1
  name = '-';
else
  name = '??';
end;

Deleted mttroot/mtt/bin/trans/m/sm2ir.m version [cdcd279f9b].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Y,X] = sm2ir(A,B,C,D,T,u0,x0);
% sm2ir - Constrained-state matrix to impulse response.
%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  sm2ir
% [Y,X] = sm2ir(A,B,C,D,T,u0,x0);
% A,B,C,D,E - (constrained) state matrices
% T vector of time points
% u0 input gain vector: u = u0*unit impulse.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[Ny,Nu] = size(D);
[Ny,Nx] = size(C);

if max(max(abs(D)))~=0
  mtt_info('D matrix non-zero - ignoring');
end;

if nargin<6
  u0 = zeros(Nu,1);
  u0(1) = 1;
end;

if nargin<7
  x0 = zeros(Nx,1);
end;

[N,M] = size(T);
if M>N
  T = T';
  N = M;
end;



one = eye(Nx);

Y = zeros(N,Ny);
X = zeros(N,Nx);

dt = T(2)-T(1);% Assumes fixed interval
expAdt = expm(A*dt); % Compute matrix exponential
expAt = one;
i = 0;
x = (B*u0+x0);
for t = T'
  i=i+1;
  if Nx>0
    % expAt = expm(A*t);
    x = expAdt*x;
    X(i,:) = x';
    if Ny>0
      y = C*x;
      Y(i,:) = y';
    end;
  end;
end;






Deleted mttroot/mtt/bin/trans/m/sm2sr.m version [d2d3e4bb56].

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
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 [Y,X] = sm2sr(A,B,C,D,T,u0,x0);
% sm2sr - Constrained-state matrix to step response.
%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  sm2sr
% [Y,X] = sm2sr(A,B,C,D,T,u0,x0);
% A,B,C,D,E - (constrained) state matrices
% T vector of time points
% u0 input gain vector: u = u0*unit step.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.4  1996/12/05 10:18:52  peterg
% %% Saved (quite old) version which integrates IR to give SR
% %%
% %% Revision 1.3  1996/10/27  10:39:04  peterg
% %% Only compute matrix exponential once.
% %%
% %% Revision 1.2  1996/09/10  16:48:21  peter
% %% Changed ar counts in default settings.
% %%
% %% Revision 1.1  1996/08/19 15:34:29  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[Ny,Nu] = size(D);
[Ny,Nx] = size(C);

if nargin<6
  u0 = zeros(Nu,1);
  u0(1) = 1;
end;

if nargin<7
  x0 = zeros(Nx,1);
end;

[N,M] = size(T);
if M>N
  T = T';
  N = M;
end;



one = eye(Nx);

Y = zeros(N,Ny);
X = zeros(N,Nx);

dt = T(2)-T(1);% Assumes fixed interval
expAdt = expm(A*dt); % Compute matrix exponential
i = 0;
expAt = one;

for t = T'
  i=i+1;
  if Nx>0
    x = ( A\(expAt-one) )*B*u0 + expAt*x0;
    expAt = expAt*expAdt;
    X(i,:) = x';
    if Ny>0
      y = C*x + D*u0;
      Y(i,:) = y';
    end;
  elseif Ny>0
    y = D*u0;
    Y(i,:) = y';
  end;
end;

% $$$ % Compute the impulse response
% $$$ [Y,X] = sm2ir(A,B,C,D,T,u0,x0);
% $$$ 
% $$$ % Assume fixed sample interval
% $$$ dT = T(2)-T(1);
% $$$ 
% $$$ % Do an Euler integration on it
% $$$  Y = mtt_euler(Y,dT);
% $$$  
% $$$  if nargout>1
% $$$    X = mtt_euler(X,dT);
% $$$  end;
% $$$  



Deleted mttroot/mtt/bin/trans/m/split_port.m version [833076f503].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [subport,n]=split_port(port_name);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



  subport = "";
  raw_subport = split(port_name, ','); # Find the components of the vector
				# port 
  [n,m] = size(raw_subport);	# Number of ports

  for i = 1:n
    s = deblank(raw_subport(i,:));
    l = length(s);

    if s(1)=="["		# Remove leading [ (if any)
      l = l-1;
      s = substr(s,2,l);
    end

    if s(l)=="]"		# Remove trailing ] (if any)
      l = l-1;
      s = substr(s,1,l);
    end

    s = ["[",s,"]"];		# Surround by []
    
    subport = [subport ;s];	# Return to the array
  end;

endfunction;





Deleted mttroot/mtt/bin/trans/m/str2ch.m version [367266a7c0].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function ch = str2ch(str,n)
% str2ch - pulls the nth char from a string
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  str2ch.m
% ch = str2ch(str,n)
% Copyright (c) P.J. Gawthrop, 1996.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/08/30  09:54:44  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
implicit_str_to_num_ok = 1;

astr = abs(str);
if (n>0) &  (n<=length(str)) & (strcmp(str,'')==0)
  ch = setstr(astr(n));
else
  ch = '';
end;















Deleted mttroot/mtt/bin/trans/m/subs_arg.m version [5ca842278f].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90


























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function args_out = subs_arg(args,Args, ...
    default,full_name,comp_type,comp_name,fileID)
% subs_arg - substitutes arguments into args from Args
% FS defaults to `;'.
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  subs_arg.m
% args_out = subs_arg(args,Args,default,comp_type,comp_name,infofile)
% Copyright (c) P.J. Gawthrop, 1996.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.6  1998/07/27 09:53:44  peterg
% %% No change
% %%
% %% Revision 1.5  1998/07/21 16:43:26  peterg
% %% Now writes to an explicit fileID - otherwise we may run out of IDs.
% %%
% %% Revision 1.4  1996/12/10 16:04:11  peterg
% %% Changed file handling on mtt_info.
% %%
% %% Revision 1.3  1996/12/07  18:19:39  peterg
% %% Replaces null argument by a default and tells user.
% %%
% %% Revision 1.2  1996/12/04 21:47:41  peterg
% %% Skips main loop when arg is null.
% %%
% %% Revision 1.1  1996/12/04 21:46:52  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Symbolic argument sign
S = '$';

args_out = '';
if strcmp(args,'')==0
  L = length(args);
  args_count = 1;
  num_count=0;
  while args_count <= L
    ch = str2ch(args,args_count);
    if ch~=S % copy character
      args_out = [args_out, ch];
      args_count = args_count+1;
    else % find argument number
      args_count = args_count+1;
 	
      ch = str2ch(args,args_count);    
      ## Modification for $p1 $a1 etc
      if !((ch>='0') & (ch<='9')) # It's not numerical - so loose it
	args_count = args_count+1;
	ch = str2ch(args,args_count);    
      endif

     i=0;
      while (ch>='0') & (ch<='9')
	i = 10*i + abs(ch)-abs('0');
	if args_count==L
	  args_count = args_count+1;
	  break
	end;
	args_count = args_count+1;
	ch = str2ch(args,args_count);
      end;
      arg_out = args2arg(Args,i);


      % Test for empty argument -- replace by default and tell user
      message = 'Argument %1.0f of component %s(%s) of system %s is undefined - \n replacing by %s';
      if strcmp(arg_out,'')
	info = sprintf(message, ...
	    i, comp_name, comp_type, full_name, default);
	arg_out = default;
      else
	info = sprintf("Replacing $%i \t by %s for component %s (%s) \
	within %s", i, arg_out, comp_name, comp_type, full_name);
      end;
      mtt_info(info,fileID);
      args_out = [args_out, arg_out];
    end;
  end;
end;

Deleted mttroot/mtt/bin/trans/m/unique.m version [feff63e110].

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 u = unique(x);
% if all the elements of x are different, returns 1 else returns 0


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


n = length(x);
u=1;

for i=1:n
  for j = 1:i-1
    if x(i)==x(j)
      u = 0;
      break;
    end;
  end;
end;

    

Deleted mttroot/mtt/bin/trans/m/varname.m version [ff219e7dd5].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = varname(name,index,causality);
% varname - Creates name of bond graph variable

% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  varname.m
% Acausal bond graph to causal bond graph: mfile format


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% 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));

Deleted mttroot/mtt/bin/trans/m/write_abg.m version [e3b347e99b].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function write_abg(system_name,bonds,connections,n_vector_bonds);

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  1999/10/18 22:41:41  peterg
## Corrected vector junction expansion
##
## Revision 1.7  1999/10/18 05:16:51  peterg
## Now vectorises 0 and 1 junctions !!
##
## Revision 1.6  1998/09/02 11:35:20  peterg
## Removed port.index field
##
## Revision 1.5  1998/09/02 10:30:30  peterg
## Now writes out list of ports ans list of subsystems.
## These ordereded lists determine the order of processing of ports ans
## subsystems.
##
## Revision 1.4  1998/08/26 12:45:38  peterg
## Just prefix ports (comps can't start with numeral)
## Prefix with mttp
##
## Revision 1.3  1998/08/26 12:31:07  peterg
## numerical names prefixed by mtt
##
## Revision 1.2  1998/08/26 11:59:20  peterg
## Don't use strrep to remove[]
##
## Revision 1.1  1998/08/25 06:22:02  peterg
## Initial revision
##
###############################################################


  fid=fopen([system_name,"_abg.m"], "w");
  [N,M]=size(connections);
  Sformat = "  %s.subsystems.%s.%s = \"%s\";\n";
  PSformat = "  %s.ports.%s.%s = \"%s\";\n";
  Iformat = "  %s.subsystems.%s.%s = %i;\n";
  PIformat = "  %s.ports.%s.%s = %i;\n";
  Cformat = "  %s.subsystems.%s.connections = [";
  PCformat = "  %s.ports.%s.connections = [";
  Bformat = "  %s.bonds = [\n";

  fprintf(fid,"function [%s] =  %s_abg\n", system_name, system_name);
  fprintf(fid,"# This function is the acausal bond graph representation of %s\n",system_name);
  fprintf(fid,"# Generated by MTT on %s",ctime(time));
  fprintf(fid,"# The file is in Octave format\n");

  fprintf(fid,"\n# Subsystems and Ports\n");
  i_port=0; SubsystemList = ""; PortList ="";
  for i=1:N
    eval(["[comp_type, name, cr, arg, repetitions] = ", system_name, "_cmp(i);"]);
    c = nozeros(connections(i,:));# Connections to this component
    m = length(c);		# Number of connections

    ## Vectorise junctions?
    n_bonds = n_vector_bonds(i);
    if strcmp(comp_type,"0")||strcmp(comp_type,"1")
            n_vector = m/n_bonds;
	    m_vector = n_bonds;
    else
      n_vector = 1;
      m_vector = m;
    endif
      
    if index(name,"[")==0	# Not a port
      for i_vector = 1:n_vector;

	if i_vector>1		# Extras
	  new_name = sprintf("%sv%i", name,i_vector);
	else
	  new_name = name;
	endif
	
	SubsystemList = [SubsystemList; new_name];
	fprintf(fid,"\n# Component %s\n", new_name);
	fprintf(fid,Sformat,system_name,new_name,"type",comp_type);
	fprintf(fid,Sformat,system_name,new_name,"cr",cr);
	fprintf(fid,Sformat,system_name,new_name,"arg",arg);
	fprintf(fid,Iformat,system_name,new_name,"repetitions",repetitions);
	fprintf(fid,Iformat,system_name,new_name,"status",-1);

	##Connections
	fprintf(fid,Cformat,system_name,new_name);
	## Each vector junction has n*m bonds
	## n - dimension of vector
	## m - number of bonds
	
	## The first m bonds (in c) correspond to the first vector element
	if i_vector==1		
	  for j=1:m_vector
      	    fprintf(fid,"%i ", c(j) );
	  endfor
	  ## The next block of n-1 bonds are the first bonds on vector elements 2,3 ...
	  ## followed by a  block of n-1 bonds being the second bonds on vector elements 2,3 ...
	  ## etc
	else	
	  k = m_vector+i_vector-1; # index of first bond at level i_vector
	  for j=1:m_vector
      	    fprintf(fid,"%i ", c(k) );
	    k = k + n_vector-1;
	  endfor
	endif
	
	fprintf(fid,"];\n");
      endfor
    else			# Its a port
      name=name(2:length(name)-1); # Strip []
      ch=name(1);		# First char of name
      if (ch>="0")&&(ch<="9")	# Its a numeral
      	name=["mttp",name];	# prefix by mttp
      endif;

      for i_port=1:m
	if m>1			# Index the port name
	  name_i = sprintf("%s_%i",name,i_port);
	else
	  name_i = name;	# Leave it alone
	endif;

	PortList = [PortList; name_i]; # Update port list
	
	fprintf(fid,"\n# Port %s\n", name_i); 
	fprintf(fid,PSformat,system_name,name_i,"type",comp_type);
	fprintf(fid,PSformat,system_name,name_i,"cr",cr);
	fprintf(fid,PSformat,system_name,name_i,"arg",arg);
	fprintf(fid,PIformat,system_name,name_i,"repetitions",repetitions);
	fprintf(fid,PIformat,system_name,name_i,"status",-1);
	
	fprintf(fid,PCformat,system_name,name_i);
      	fprintf(fid,"%i ", c(i_port));
	fprintf(fid,"];\n");

      endfor;
    endif;
  endfor;

  [N,M]=size(PortList);
  if N>0			# Put name in list
    fprintf(fid,"\n# Ordered list of Port names\n");
    for i=1:N
      fprintf(fid,"  %s.portlist(%i,:) = \"%s\";\n", system_name, i, PortList(i,:));
    endfor;
  endif;

  [N,M]=size(SubsystemList);
  if N>0			# Put name in list
    fprintf(fid,"\n# Ordered list of subsystem names\n");
    for i=1:N
      fprintf(fid,"  %s.subsystemlist(%i,:) = \"%s\";\n", system_name, i, SubsystemList(i,:));
    endfor;
  endif;


  fprintf(fid,"\n# Bonds \n");
  [N,M]=size(bonds);		# Bonds
  fprintf(fid,Bformat,system_name);
  for i=1:N
    fprintf(fid,"      ");
    for j=1:M
      fprintf(fid,"%i ", bonds(i,j));
    endfor;
    fprintf(fid,"\n");
  endfor;
  fprintf(fid,"      ];\n");
    
  fprintf(fid,"\n# Aliases \n");
  fprintf(fid,"# A double underscore __ represents a comma \n");
  eval(["alias = ", system_name, "_alias;"]);
  if is_struct(alias)
    for [val,key] = alias
      fprintf(fid,"%s.alias.%s = \"%s\";\n", system_name,key,val);
    endfor
  endif

  fprintf(fid,"\n# Interface Definition\n");
  eval(["icd = ",system_name, "_icd;"]);
  if is_struct(icd)
    for [val,key] = icd
      fprintf(fid,"%s.icd.%s = \"%s\";\n",system_name,key,val);
    endfor
  endif
	

  fclose(fid);
  

Deleted mttroot/mtt/bin/trans/m/write_cbg.m version [9ac520a74a].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81

















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function write_cbg(system_name,system_type,system,Flipped)

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/08/25 20:05:33  peterg
## Write flipped port info
##
## Revision 1.2  1998/08/25 06:21:19  peterg
## Just writes additional information; basic info from the abg structure.
##
## Revision 1.1  1998/08/25 05:55:10  peterg
## Initial revision
##
###############################################################


  fid=fopen([system_name,"_cbg.m"], "w");# Open file

  StatusFormat = "  %s.%s.%s.status = %i;\n";
  Bformat = "  %s.bonds = [\n";
  Iformat = "  %s.%s.%s.connections(%i) = %i;\n";


  fprintf(fid,"function [%s] =  %s_cbg\n", system_name, system_name);
  fprintf(fid,"# This function is the causal bond graph representation of %s\n",system_name);
  fprintf(fid,"# Generated by MTT on %s",ctime(time));
  fprintf(fid,"# The file is in Octave format\n");
  
  fprintf(fid,"\n# Acausal bond graph structure\n");
  fprintf(fid,"  [%s] =  %s_abg;\n", system_name, system_type);

  fprintf(fid,"\n# Status information\n");
#  if struct_contains(system,"ports")
#    for [port,name]=system.ports
#      fprintf(fid,StatusFormat,system_name,"ports",name,port.status);
#    endfor;
#  endif
  if struct_contains(system,"subsystems")
    for [subsystem,name]=system.subsystems
      fprintf(fid,StatusFormat,system_name,"subsystems",name,subsystem.status);
    endfor;
  endif
  
  [N,M]=size(system.bonds);		# Bonds
  fprintf(fid,"\n# Causal bond information\n");
  fprintf(fid,Bformat,system_name);
  for i=1:N
    fprintf(fid,"      ");
    for j=1:M
      fprintf(fid,"%i ", system.bonds(i,j));
    endfor;
    fprintf(fid,"\n");
  endfor;
  fprintf(fid,"      ];\n");

  [N,M]=size(Flipped.ports);
  if (N>0)&&(M>0)		# Flipped ports exist
    fprintf(fid,"\n# Flipped port information\n");
    for i=1:N
      name=deblank(Flipped.ports(i,:));
      eval(["con = system.ports.",name,".connections;"]);
      fprintf(fid,Iformat,system_name,"ports",name,1,con);
    endfor;
  endif;

  [N,M]=size(Flipped.subs);
  if (N>0)&&(M>0)		# Flipped subs exist
    for i=1:N
      name=deblank(Flipped.subs(i,:));
      k=Flipped.cons(i);
      eval(["con = system.subsystems.",name,".connections(",num2str(k),");"]);
      fprintf(fid,Iformat,system_name,"subsystems",name,k,con);
    endfor;
  endif;

  fclose(fid);
  

Deleted mttroot/mtt/bin/trans/m/write_matrix.m version [ed4ac445d1].

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


























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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
% %% Puts a tab between columns.
% %%
% %% Revision 1.1  1996/08/14 08:21:27  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


filename = [name, '.m'];
filenum = fopen(filename,'w');

% Write the function m-file for the causal bond graph
pc = '%';
fprintf(filenum, 'function data = %s\n', name);
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;

fprintf(filenum, '];\n');
fprintf(filenum, '\n');

fclose(filenum);


Deleted mttroot/mtt/bin/trans/m/zero_input.m version [2299a73554].

1
2
3



-
-
-
function [x] = zero_input(N);
  x = zeros(N,1);
endfunction;

Deleted mttroot/mtt/bin/trans/m/zero_matrix.m version [4f191aac68].

1
2
3



-
-
-
function [A] = zero_matrix(N);
  A = zeros(N,N);
endfunction;

Deleted mttroot/mtt/bin/trans/m2dat version [943f13e957].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: m2dat

# Transforms data in .m file to just the data - ie strips the matlab stuff

# Copyright (c) P.J.Gawthrop, 1996.

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

echo Creating $1.dat

awk '$1 ~ /[0-9]/ && NF>0 {print} ' <$1.m  >$1.dat

Deleted mttroot/mtt/bin/trans/make_ode2odes version [ca4305faeb].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.68  2002/04/15 10:54:31  geraint
## Statically declare outputs and initialise to zero.
## This is necessary to prevent spurious values from being output when no assignments are made (i.e. when "y(i) := 0 for all u"  (Reduce:see NERO)).
##
## Revision 1.67  2002/04/09 12:04:21  geraint
## Replaced ios:: with std::ios:: for g++-3.0 compatability.
##
## Revision 1.66  2002/03/26 11:58:58  geraint
## Added cputime monitoring.
##
## Revision 1.65  2001/11/15 06:24:11  geraint
## Updated (-i dassl) residual function to use new DAEFunc (octave-2.1.35).
## YZ residual dependency on Ui still requires some work.
##
## Revision 1.64  2001/08/08 02:15:00  geraint
## Rationalisation of solver code, beginning with algebraic solvers.
##
## Revision 1.63  2001/08/07 04:39:24  geraint
## Consolidated dassl and residual functions.
##
## Revision 1.62  2001/08/01 22:14:32  geraint
## Bug fix for dassl.
##
## Revision 1.61  2001/08/01 04:06:07  geraint
## Added -i dassl for -cc and -oct.
##
## Revision 1.60  2001/07/16 22:23:00  geraint
## Fixed misleading variable name in .cc rep.
##
## Revision 1.59  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.58  2001/07/13 00:51:39  geraint
## Fixed generation of odes.sg from .m and .oct simulations.
## .cc, .m and .oct simulations now all write mtt_data (lower case).
##
## Revision 1.57.2.5  2001/07/13 04:02:31  geraint
## Implemented numerical algebraic solution for _ode2odes.oct.
##
## Revision 1.57.2.4  2001/07/02 00:34:56  geraint
## gcc-3.0 compatibility.
##
## Revision 1.57.2.3  2001/06/25 23:28:29  geraint
## Generic mtt_rate and mtt_output - allows method independent calls.
##
## Revision 1.57.2.2  2001/06/05 03:20:40  geraint
## added -ae option to select algebraic equation solution method.
##
## Revision 1.57.2.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
##
## Revision 1.57  2001/04/01 03:38:54  geraint
## Reset row to zero after write to file, ready for subsequent runs.
## Eliminates SIGSEGV in Octave when _ode2odes called multiple times.
##
## Revision 1.56  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.55  2001/03/27 13:21:59  geraint
## Octave version compatibility for save_ascii_data(_for_plotting).
##
## Revision 1.54  2001/03/27 01:14:27  geraint
## Improved determination of Octave version.
##
## Revision 1.53  2001/03/21 03:24:59  geraint
## Calculate inputs before outputs (.cc).
##
## Revision 1.52  2001/03/19 02:28:52  geraint
## Branch merge: merging-ode2odes-exe back to MAIN.
##
## Revision 1.51.2.7  2001/03/17 09:51:07  geraint
## Implemented Runge-Kutta IV fixed-step method (-i rk4).
##
## Revision 1.51.2.6  2001/03/16 03:56:13  geraint
## Removed psignal/siginfo.h - problematic and unnecessary.
##
## Revision 1.51.2.5  2001/03/12 23:16:37  geraint
## Minor improvements to signal handling (.exe).
##
## Revision 1.51.2.4  2001/03/12 03:59:30  geraint
## SIGINT  (C-c C-c) now causes simulation data to be dumped to MTT.core.
## SIGQUIT (C-c C-\) as for SIGINT, then raises default SIGQUIT.
## SIGFPE  as for SIGINT, then raises default SIGABRT.
##
## Revision 1.51.2.3  2001/03/07 04:06:55  geraint
## Irix: catch SIGFPE and write data before aborting (.exe).
## GNU/Linux: nada.
##
## Revision 1.51.2.2  2001/03/02 00:45:21  geraint
## Separated Euler and Implicit methods in .cc code and dependencies.
##
## Revision 1.51.2.1  2001/03/01 05:05:53  geraint
## Minor revisions.
##
## Revision 1.51  2001/02/19 06:33:19  geraint
## Removed operation form loop.
##
## Revision 1.50  2001/02/18 09:18:49  geraint
## Removed temporary Matrices from mtt_implicit.cc
##
## Revision 1.49  2001/02/14 06:06:34  geraint
## Removed octave_value_list wrappers from standalone.exe - speed improvements
##
## Revision 1.48  2001/02/11 07:08:59  geraint
## Static declarations of octave_value_lists: small .exe speed improvement
##
## Revision 1.47  2001/02/11 05:25:52  geraint
## Reduced number of matrix operations during .oct simulation data write
##
## Revision 1.46  2001/02/05 08:32:31  geraint
## typo
##
## Revision 1.45  2001/02/05 04:32:35  geraint
## Octave version 2.1.x compatability and #ifdef statements for standalone rep
##
## Revision 1.46  2001/01/08 06:21:59  geraint
## #ifdef STANDALONE stuff
##
## Revision 1.45  2001/01/07 01:25:49  geraint
## Compatibility with Octave 2.1.33
##
## Revision 1.44  2000/12/05 12:11:45  peterg
## Changed function name to name()
##
## Revision 1.43  2000/12/04 10:59:40  peterg
## *** empty log message ***
##
## Revision 1.42  2000/11/10 14:19:50  peterg
## Corrected the csex and cseo functions
##
## Revision 1.41  2000/11/09 17:06:39  peterg
## Now does euler for cc
##
## Revision 1.40  2000/10/17 09:55:00  peterg
## Replaced switchopen by logic
##
## Revision 1.39  2000/10/14 08:04:40  peterg
## Changed arguments to _inout for consistency
##
## Revision 1.38  2000/10/11 09:08:08  peterg
## cse --> csex
##
## Revision 1.37  2000/08/01 12:25:06  peterg
## Now includes euler
##
## Revision 1.36  2000/05/19 17:48:16  peterg
## Argument to state
##
## Revision 1.35  2000/05/18 18:59:40  peterg
## Removed the First time stuff
##
## Revision 1.34  2000/05/16 18:56:14  peterg
## *** empty log message ***
##
## Revision 1.33  2000/05/11 19:33:18  peterg
## Uniform version for _sim.m
##
## Revision 1.32  2000/05/11 08:30:00  peterg

##
## Revision 1.31  2000/05/10 18:33:25  peterg
## Use smxa and smxax in place of smx
##
## Revision 1.30  2000/04/18 11:24:19  peterg
## Removed _numpar.
##
## Revision 1.29  2000/04/07 19:10:57  peterg
## *** empty log message ***
##
## Revision 1.28  1999/12/08 05:56:52  peterg
## Reordered the writing of the input and output.
## Note that last value now discarded.
##
## Revision 1.27  1999/11/15 22:47:53  peterg
## Generates method-specific code.
##
## Revision 1.26  1999/10/20 01:31:43  peterg
## *** empty log message ***
##
## Revision 1.25  1999/08/29 06:55:26  peterg
## Removed [MTTu]  = zero_input($Nu);	# Zero the input
## to avoide the p2c bug ????
##
## Revision 1.24  1999/08/27 06:02:16  peterg
## removed zero_input to avoid p2c bug
##
## Revision 1.23  1999/08/02 13:39:19  peterg
## Replaced zero_vector by zero_input
##
## Revision 1.22  1999/04/20 06:16:07  peterg
## Removed initialisation of AA and AAx
## Remove _switch calls -- uses _switchopen exclusively
##
## Revision 1.21  1999/04/02 06:29:25  peterg
## New implicit method - solves numerical prob with ISW
##
## Revision 1.20  1999/04/02 02:13:58  peterg
## Back to RCS
##
## Revision 1.19  1999/03/30 21:39:25  peterg
## In implicit approach, set derivatives to zero (when switch is off)
## before update. This seems to stop numerical leakage though non-return
## switches.
##
## Revision 1.18  1999/03/15 01:17:07  peterg
## Removed some spurious debugging code
##
## Revision 1.17  1999/03/15 01:09:15  peterg
## Fixed bugs when Nx=0 (no state)
##
## Revision 1.16  1999/03/06 02:28:38  peterg
## Rearranged evaluation to: state - input - output - write
##
## Revision 1.15  1999/03/06 02:19:43  peterg
## Changed args to _input
##
## Revision 1.14  1998/10/01 16:02:01  peterg
## Integration with switches handled separately fro Euler and Implicit.
##
## Revision 1.13  1998/09/30 17:41:24  peterg
## Implicit method now allows for switches via _switchA
##
## 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
## 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
## INcluded othe integration methods.
##
## Revision 1.5  1998/07/26 11:02:20  peterg
## Put mtt or MTT  in front of variable names to avoid clashes with
## globals
##
## Revision 1.4  1998/07/25 20:14:00  peterg
## update code added for flexibility and octave efficiency
##
###############################################################


# Bourne shell script: make_ode2odes

# Copyright (c) P.J.Gawthrop July 1998.

# Tell user
sys=$1
lang=$2
filename=${sys}_ode2odes.${lang}

if [ -n "$3" ]; then
  method=$3    
else
  method=implicit  
fi

if [ -n "$4" ]; then
    algebraic_solver=$4
else
  algebraic_solver="Reduce_Solver"
fi

echo Creating $filename with $method integration method

# Find system constants
Nx=`mtt_getsize $sys x` # States
Nu=`mtt_getsize $sys u` # Inputs 
Ny=`mtt_getsize $sys y` # Outputs  

case "$method" in
    "implicit")
	ode=csex
	odeo=cseo
	algorithm="mtt_implicit(x,dx,AA,AAx,ddt,$Nx,open_switches)"
	;;
    "dassl")
	ode=ode
	odeo=odeo
	algorithm="mtt_dassl(x,u,t,par,dx,ddt,MTTNX,MTTNYZ,open_switches)"
	;;
    "euler" | "rk4" | *)
	ode=ode
	odeo=odeo
	algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)"
	;;
esac

make_m()
{
#lang_header  $1 ode2odes m  'x,par,simpar' '[Y,X,t]' > $filename
mtt_header ${sys} ode2odes m > $filename
cat <<EOF >> $filename 
global MTT_data;

  if nargin<3
    simpar = ${sys}_simpar(); 
    [simpar.dt] = mtt_simpar_update;
  endif
  if nargin<2
    par = ${sys}_numpar(); 
    [par] = mtt_numpar_update(par);
  endif
  if nargin<1
    [x0]  =  ${sys}_state(par); 
    [x0] = mtt_state_update(x);
  endif

  ## Initialise
  t = 0.0;
  ddt = simpar.dt/simpar.stepfactor;
  ilast = round(simpar.last/ddt)+1; # Total number of steps
  x = x0;

## Following removed due to p2c bug
##  [u]  = zero_input($Nu);		# Zero the input
  for MTTi=1:$Ny
    y(MTTi) = 0;
  endfor;

  mttj = 0;
    for it = 1:ilast		#Integration loop
    [u] = ${sys}_input(x,y,t,par);	# Input
    [y] = ${sys}_$odeo(x,u,t,par);  # Output 
    if mttj==0
     mtt_write(t,x,y,$Nx,$Ny);   # Write it out
    endif
EOF

if [ "$method" = "rk4" ]; then
cat << EOF >> $filename
    [k1] = ddt * ${sys}_${ode}(x,u,t,par);
    [k2] = ddt * ${sys}_${ode}(x+k1/2,u,t+ddt/2,par);
    [k3] = ddt * ${sys}_${ode}(x+k2/2,u,t+ddt/2,par);
    [k4] = ddt * ${sys}_${ode}(x+k3,u,t+ddt,par);
    [dx] = [k1 + 2.0 * [k2 + k3] + k4] / (6.0 * ddt);
EOF
else
cat << EOF >> $filename
    [dx] = ${sys}_$ode(x,u,t,par);	# State derivative
EOF
fi

if [ "$method" = "implicit" ]; then
cat<< EOF >> $filename

    [AA] = ${sys}_smxa(x,u,ddt,par);	# (I-Adt) and (I-Adt)x
    [AAx] = ${sys}_smxax(x,u,ddt,par); # (I-Adt) and (I-Adt)x

EOF
fi

cat <<EOF >> $filename
    [open_switches] = ${sys}_logic(x,u,t,par); # Switch logic
    [x] = $algorithm; # Integration update
    t = t + ddt;   # Time update
    mttj = mttj+1;    # Increment counter
    if mttj==simpar.stepfactor
       mttj = 0;      # Reset counter
    endif

  endfor;			# Integration loop

## Create the output data
    mtt_data = MTT_data;
endfunction

EOF
} # make_m

make_cc() 
{
# get octave version
case `$MATRIX --version | awk -F\. '{print $2}'` in
    0) # stable
	vector_value=vector_value
	feval_header=toplev.h
	save_ascii_data_function=save_ascii_data
	;;
    1) # development
	vector_value=column_vector_value
	feval_header=parse.h
	save_ascii_data_function=save_ascii_data_for_plotting
	;;
    *)
	vector_value=column_vector_value
	feval_header=parse.h
	save_ascii_data_function=save_ascii_data_for_plotting
	;;
esac

cat <<EOF  > $filename
#include <octave/oct.h>
#include <octave/load-save.h>
#include <octave/lo-mappers.h>
#include <octave/ov-struct.h>
#include <octave/variables.h>

#ifndef STANDALONE
#include <octave/${feval_header}>
#endif

#include "${sys}_def.h"
#include "${sys}_sympar.h"

#include "mtt_${algebraic_solver}.hh"

#include <fstream>
#ifdef STANDALONE
#include <csignal>

extern ColumnVector F${sys}_ae (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_input (
	ColumnVector &x,
	ColumnVector &y,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_logic (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_numpar (
	void);

extern Octave_map F${sys}_simpar (
     	void);

extern ColumnVector F${sys}_state (
	ColumnVector &par);

extern ColumnVector F${sys}_${ode} (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_${odeo} (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

EOF
case "$method" in
    "implicit")
	cat <<EOF >> $filename
extern ColumnVector Fmtt_implicit (
	ColumnVector &x,
	ColumnVector &dx,
	Matrix &AA,
	ColumnVector &AAx,
	const double &ddt,
	const int &nx,
	const ColumnVector &open_switches);

extern Matrix F${sys}_smxa (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);

extern ColumnVector F${sys}_smxax (
	ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par);
 
EOF
    ;;
    "dassl")
	cat <<EOF >> $filename
extern ColumnVector Fmtt_dassl (
	ColumnVector &x,
	const ColumnVector &u,
	const double &t,
	const ColumnVector &par,
	const ColumnVector &dx,
	const double &ddt,
	const int nx,
	const int nyz,
	const ColumnVector &open_switches);

EOF
    ;;
    "euler" | "rk4" | *)
	cat <<EOF >> $filename
extern ColumnVector Fmtt_euler (
	ColumnVector &x,
	const ColumnVector &dx,
	const double &ddt,
	const int &nx,
	const ColumnVector &open_switches);
 
EOF
    ;;
esac
cat <<EOF >> $filename

void set_signal_handlers (void);

#endif // STANDALONE

ColumnVector
mtt_ae (ColumnVector &x,
	ColumnVector &u,
	const double &t,
	ColumnVector &par)
{
#ifdef STANDALONE
    return F${sys}_ae(x,u,t,par);
#else
    static octave_value_list args, f;
    args (0) = octave_value (x);
    args (1) = octave_value (u);
    args (2) = octave_value (t);
    args (3) = octave_value (par);
    f = feval ("${sys}_ae", args, 1);
    return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_input (ColumnVector &x,
	   ColumnVector &y,
	   const double &t,
	   ColumnVector &par)
{
  static MTT::${algebraic_solver} ae(MTTNPAR,MTTNU,MTTNX,MTTNY,MTTNYZ);
  static ColumnVector u  (MTTNU);

#ifdef STANDALONE
  u = F${sys}_input (x, y, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (y);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_input", args, 1);
  u = f(0).${vector_value} ();
#endif
  if (MTTNYZ == 0)
    {
      return u;
    }
  else
    {
      return ae.solve(x,u,t,par);
    }
}

inline ColumnVector
mtt_logic (ColumnVector &x,
	   ColumnVector &u,
	   const double &t,
	   ColumnVector &par)
{
#ifdef STANDALONE
  return F${sys}_logic (x, u, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (u);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_logic", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_numpar (void)
{
#ifdef STANDALONE
  return F${sys}_numpar ();
#else
  static octave_value_list args, f;
  f = feval ("${sys}_numpar", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline Octave_map
mtt_simpar (void)
{
#ifdef STANDALONE
  return F${sys}_simpar ();
#else
  static octave_value_list args;
  static Octave_map f;
  f["first"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["first"];
  f["dt"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["dt"];
  f["last"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["last"];
  f["stepfactor"]     	= feval ("${sys}_simpar", args, 1)(0).map_value ()["stepfactor"];
  f["wmin"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["wmin"];
  f["wmax"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["wmax"];
  f["wsteps"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["wsteps"];
  f["input"]		= feval ("${sys}_simpar", args, 1)(0).map_value ()["input"];
  return (f);
#endif
}

inline ColumnVector
mtt_state (ColumnVector &par)
{
#ifdef STANDALONE
  return F${sys}_state (par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (par);
  f = feval ("${sys}_state", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_rate (ColumnVector &x,
	  ColumnVector &u,
	  const double &t,
	  ColumnVector &par)
{
#ifdef STANDALONE
  return F${sys}_${ode} (x, u, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (u);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_${ode}", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline ColumnVector
mtt_output (ColumnVector &x,
	     ColumnVector &u,
	     const double &t,
	     ColumnVector &par)
{
#ifdef STANDALONE
  return F${sys}_${odeo} (x, u, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (u);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_${odeo}", args, 1);
  return f(0).${vector_value} ();
#endif
}

EOF
case "$method" in
    "implicit")
	cat <<EOF >> $filename
inline ColumnVector
mtt_implicit (ColumnVector &x,
	      ColumnVector &dx,
	      Matrix &AA,
	      ColumnVector &AAx,
	      const double &ddt,
	      const int &nx,
	      const ColumnVector &open_switches)
{
#ifdef STANDALONE
  return Fmtt_implicit (x, dx, AA, AAx, ddt, nx, open_switches);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (dx);
  args (2) = octave_value (AA);
  args (3) = octave_value (AAx);
  args (4) = octave_value (ddt);
  args (5) = octave_value ((double)nx);
  args (6) = octave_value (open_switches);
  f = feval ("mtt_implicit", args, 1);
  return f(0).${vector_value} ();
#endif
}

inline Matrix
mtt_smxa (ColumnVector &x,
	  ColumnVector &u,
	  const double &t,
	  ColumnVector &par)
{
#ifdef STANDALONE
  return F${sys}_smxa (x, u, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (u);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_smxa", args, 1);
  return f(0).matrix_value ();
#endif
}

inline ColumnVector
mtt_smxax (ColumnVector &x,
	   ColumnVector &u,
	   const double &t,
	   ColumnVector &par)
{
#ifdef STANDALONE
  return F${sys}_smxax (x, u, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (u);
  args (2) = octave_value (t);
  args (3) = octave_value (par);
  f = feval ("${sys}_smxax", args, 1);
  return f(0).${vector_value} ();
#endif
}

EOF
    ;;
    "dassl")
cat <<EOF >> $filename
inline ColumnVector
mtt_dassl (ColumnVector &x,
	   const ColumnVector &u,
	   const double &t,
	   const ColumnVector &par,
	   const ColumnVector &dx,
	   const double &ddt,
	   const int &nx,
	   const int &nyz,
	   const ColumnVector &open_switches)
{
#ifdef STANDALONE
   return Fmtt_dassl (x, u, t, par, dx, ddt, nx, nyz, open_switches);
#else
   static octave_value_list args, f;
    args (0) = octave_value (x);
    args (1) = octave_value (u);
    args (2) = octave_value (t);
    args (3) = octave_value (par);
    args (4) = octave_value (dx);
    args (5) = octave_value (ddt);
    args (6) = octave_value (static_cast<double> (nx));
    args (7) = octave_value (static_cast<double> (nyz));
    args (8) = octave_value (open_switches);
    f = feval ("mtt_dassl", args, 1);
    return f(0).${vector_value} ();
#endif
}

#ifdef STANDALONE
ColumnVector
Fmtt_residual (const ColumnVector &X,
	      const ColumnVector &DX,
	      double t,
	      int &ires)
{
#else // !STANDALONE
DEFUN_DLD (mtt_residual, args, , "mtt_residual")
{
    static ColumnVector	X  (MTTNX+MTTNYZ);
    static ColumnVector	DX (MTTNX+MTTNYZ);
    static double      	t;
    static int		&ires;

    X  = args(0).${vector_value} ();
    DX = args(1).${vector_value} ();
    t  = args(2).double_value ();
    ires = static_cast<int>(args(3).double_value ());
#endif // STANDALONE

    static ColumnVector residual (MTTNX+MTTNYZ);
    static ColumnVector U (MTTNU+MTTNYZ);
    static ColumnVector u (MTTNU);
    static ColumnVector y (MTTNY,0.0);
    static ColumnVector par (MTTNPAR);
    static ColumnVector dx(MTTNX);
    static ColumnVector yz(MTTNYZ);

    static ColumnVector x (MTTNX);
    static ColumnVector ui (MTTNYZ);

    static octave_value_list new_args;

    x = X.extract (0,MTTNX-1);
    if (MTTNYZ > 0)
      ui = X.extract (MTTNX,MTTNX+MTTNYZ-1);    

#ifdef STANDALONE
    par = F${sys}_numpar();
    u = F${sys}_input(x,y,t,par);
#else
    par = feval ("${sys}_numpar",  new_args, 1)(0).${vector_value} ();
    new_args(0) = octave_value (x);
    new_args(1) = octave_value (u);
    new_args(2) = octave_value (t);
    new_args(3) = octave_value (par);
    u = feval ("${sys}_input", new_args, 1)(0).${vector_value} ();
#endif

    U.insert (u,0);
    if (MTTNYZ > 0)
      U.insert (ui,MTTNU);

#ifdef STANDALONE
    dx = F${sys}_${ode} (x,U,t,par);
    yz = F${sys}_ae (x,U,t,par);
#else
    new_args(1) = octave_value (U);
    dx = feval ("${sys}_${ode}", new_args, 1)(0).${vector_value} ();
    yz = feval ("${sys}_ae", new_args, 1)(0).${vector_value} ();
#endif

    for (register int i = 0; i < MTTNX; i++)
      residual (i) = dx(i) - DX(i);
    
    if (MTTNYZ > 0)
      {
	residual.insert (yz,MTTNX);

	// XXX:
	// DASSL needs residual to be dependent on Ui and Uidot
	// mtt_dassl always sets the initial Ui to zero, so
	// Ui - h*Uidot should equal zero BUT, we don't know h
	static double t_old;
	double step;
	if (t != t_old)
	  {
	    step = t - t_old;
	    t = t_old;
	  }
	else
	  step = t;	
	for (register int i = MTTNX; i < MTTNX+MTTNYZ; i++)
	  residual(i) += X(i) - DX(i)*step;
      }

#ifdef STANDALONE
    return residual;
#else // !STANDALONE
    return octave_value (residual);
#endif // STANDALONE
}
    
EOF
    ;;
    "euler" | "rk4" | *)
cat <<EOF >> $filename
inline ColumnVector
mtt_euler (ColumnVector &x,
	   const ColumnVector &dx,
	   const double &ddt,
	   const int &nx,
	   const ColumnVector &open_switches)
{
#ifdef STANDALONE
  return Fmtt_euler (x, dx, ddt, nx, open_switches);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);
  args (1) = octave_value (dx);
  args (2) = octave_value (ddt);
  args (3) = octave_value ((double)nx);
  args (4) = octave_value (open_switches);
  f = feval ("mtt_euler", args, 1);
  return f(0).${vector_value} ();
#endif
}

EOF
    ;;
esac
cat <<EOF >> $filename

inline void
mtt_write (const double &t,
	   ColumnVector &x,
	   ColumnVector &y,
	   const int &nrows,
	   const bool dump_data = false,
	   std::ostream &file = std::cout)
{
  static Matrix data;
  static int row;

  if (dump_data)
    {
       if (row > 0)
         {
           Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1);
           $save_ascii_data_function (file, written_data, "mtt_data");
	 }
       return;
    }

  const int nx = x.length (), ny = y.length ();
  register int col = 0;

  if (0 == row)
    data = Matrix (nrows, 1+ny+1+nx, 0.0);

  data.elem (row, col) = t;
  for (register int i = 0; i < ny; i++)
    data.elem (row, ++col) = y.elem (i);
  data.elem (row, ++col) = t;
  for (register int i = 0; i < nx; i++)
    data.elem (row, ++col) = x.elem (i);

  row++;

  static std::fstream fcputime ("MTT.cputime", std::ios::out | std::ios::trunc | std::ios::app);
  static clock_t cputime0 = clock();
  static clock_t cputime1 = cputime0;
  clock_t cputime = clock();
  fcputime << t << '\t'
	   << static_cast <double> (cputime - cputime0) / CLOCKS_PER_SEC << '\t'
	   << static_cast <double> (cputime - cputime1) / CLOCKS_PER_SEC << std::endl;
  cputime1 = cputime;

  if (nrows == row)
    {
#ifdef STANDALONE
      $save_ascii_data_function (file, data, "mtt_data");
//    std::cout << data << std::endl;
#else // ! STANDALONE
  set_global_value ("MTT_data", data);
#endif
    row = 0;
    fcputime.close();
    }
}

#ifdef STANDALONE
void dump_data (std::ostream &file)
{
  ColumnVector null (0);
  mtt_write (0.0, null, null, 0, true, file);
}

void handle_signal (int signum)
{
  // handle some signals to ensure data is written.
  std::cerr << "# Writing data to MTT.core (signal " << signum << ")" << std::endl;
  std::ofstream corefile ("MTT.core");
  dump_data (corefile);
  switch (signum)
    {
      case SIGFPE:
        // Intel chips do not raise SIGFPE for DIVZERO :-(
//        raise (SIGABRT);
        break;
      case SIGINT:
	break;
      case SIGQUIT:
	signal (SIGQUIT, SIG_DFL);
	raise (SIGQUIT);
	break;
      default:
        std::cerr << "# Warning: make_ode2odes needs updating!" << std::endl;
	signal (signum, SIG_DFL);
	raise (signum);
        break;
    }
  corefile.close ();
  set_signal_handlers ();
}

void set_signal_handlers (void)
{
  signal (SIGFPE,	handle_signal);
  signal (SIGINT,	handle_signal);
  signal (SIGQUIT,	handle_signal);
}

int main (void) {
  set_signal_handlers ();
#else
DEFUN_DLD (${sys}_ode2odes, args, ,
"Octave ode2odes representation of system with $method integration method\nUsage: mtt_data = ${sys}_ode2odes (x0, par, simpar)\n")
{
  static octave_value_list retval;
#endif // STANDALONE
  static ColumnVector	x0;
  static ColumnVector	par;
  static Octave_map	simpar;

  static double
    first	= 0.0,
    dt		= 0.0,
    last	= 0.0,
    stepfactor	= 0.0;
#ifndef STANDALONE
  int nargin = args.length ();
  switch (nargin)
    {
    case 3:
      first		= args (2).map_value ()["first"].double_value ();
      dt		= args (2).map_value ()["dt"].double_value ();
      last		= args (2).map_value ()["last"].double_value ();
      stepfactor     	= args (2).map_value ()["stepfactor"].double_value ();
      par    		= args (1).${vector_value} ();
      x0      		= args (0).${vector_value} ();
      break;
    case 2:
      first		= mtt_simpar ()["first"].double_value ();
      dt		= mtt_simpar ()["dt"].double_value ();
      last		= mtt_simpar ()["last"].double_value ();
      stepfactor     	= mtt_simpar ()["stepfactor"].double_value ();
      par    		= args (1).${vector_value} ();
      x0      		= args (0).${vector_value} ();
      break;
    case 1:
      first		= mtt_simpar ()["first"].double_value ();
      dt		= mtt_simpar ()["dt"].double_value ();
      last		= mtt_simpar ()["last"].double_value ();
      stepfactor     	= mtt_simpar ()["stepfactor"].double_value ();
      par    		= mtt_numpar ();
      x0      		= args (0).${vector_value} ();
      break;
    case 0:
#endif // ! STANDALONE
      first		= mtt_simpar ()["first"].double_value ();
      dt		= mtt_simpar ()["dt"].double_value ();
      last		= mtt_simpar ()["last"].double_value ();
      stepfactor     	= mtt_simpar ()["stepfactor"].double_value ();
      par    		= mtt_numpar ();
      x0      		= mtt_state (par);
#ifndef STANDALONE
      break;
    default:
      usage("${sys}_ode2odes (x par simpar)", nargin);
      error("aborting.");
    }
#endif // STANDALONE
  static ColumnVector	dx (MTTNX, 0.0);
  static ColumnVector	x (MTTNX, 0.0);
  static ColumnVector	u (MTTNU, 0.0);
  static ColumnVector	y (MTTNY, 0.0);

  static Matrix	AA (MTTNX, MTTNX, 0.0);
  static ColumnVector	AAx (MTTNX, 0.0);
  
  static ColumnVector	open_switches (MTTNX, 0.0);

  register double t	= 0.0;

  const double	ddt	= dt / stepfactor;
  const int	ilast	= static_cast<int> (round ((last - first) / ddt)) + 1;
  const int	nrows	= static_cast<int> (round ((last - first) / dt)) + 1;

  for (register int i = 0; i < MTTNY; i++)
    {
      y (i) = 0.0;
    }

  for (register int i = 0; i < MTTNX; i++)
    {
      x (i) = x0 (i);
    }

  for (register int j = 0, i = 1; i <= ilast; i++)
    {
      u	= mtt_input (x, y, t, par);
      y	= mtt_output (x, u, t, par);
      if (0 == j)
	{
           mtt_write (t, x, y, nrows);
	}
EOF
case "$method" in
    "rk4")
	cat << EOF >> $filename
      {
        static ColumnVector
          k1 (MTTNX,0.0),
          k2 (MTTNX,0.0),
          k3 (MTTNX,0.0),
          k4 (MTTNX,0.0);

        const double
          t1 = t + ddt/2.0,
          t2 = t + ddt;

        ColumnVector
          x1 (x),
          x2 (x),
          x3 (x);

        k1 = ddt * mtt_rate (x , u, t , par); x1 += k1 * 0.5;
        k2 = ddt * mtt_rate (x1, u, t1, par); x2 += k2 * 0.5;
        k3 = ddt * mtt_rate (x2, u, t1, par); x3 += k3;
        k4 = ddt * mtt_rate (x3, u, t2, par);
        dx = (k1 + 2.0 * (k2 + k3) + k4) / (6.0 * ddt);
      }
EOF
    ;;
    "dassl")
    ;;
    "implicit")
	cat << EOF >> $filename
      dx = mtt_rate (x, u, t, par);
      AA = mtt_smxa (x, u, ddt, par);
      AAx = mtt_smxax (x, u, ddt, par);
EOF
    ;;
    "euler" | *)
	cat << EOF >> $filename
      dx = mtt_rate (x, u, t, par);
EOF
    ;;
esac

## Common stuff
cat <<EOF >> $filename
      open_switches = mtt_logic (x, u, t, par);
      x =  $algorithm; 
      t += ddt;
      j++;
      j = (j == static_cast<int> (stepfactor)) ? 0 : j;
    }

#ifdef STANDALONE
  return 0;
#else
/*  
  retval (0) = octave_value (y);
  retval (1) = octave_value (x);
  retval (2) = octave_value (t);
*/
  retval = octave_value (get_global_value ("MTT_data"));
  return (retval);
#endif // STANDALONE
}
EOF
}

case ${lang} in
    m)
        make_m	
	;;
    cc)
	make_cc
	;;
    *)
	echo Language ${lang} is not supported
esac

Deleted mttroot/mtt/bin/trans/make_sim version [2bb203ef7d].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## Makes the sensitivity simulation
## Copyright (C) 2001 by Peter J. Gawthrop

sys=$1
lang=$2

outfile=${sys}_sim.${lang}

echo Creating $outfile
make_m() {
mtt_header ${sys} sim m >  ${outfile}
cat >> ${outfile} <<EOF

 ## Pass input as a global
 global MTT_input MTT_input_index MTT_input_last

  [nx,ny] = ${sys}_def;
  y_par = [];
  MTT_input = u;
  [MTT_input_last,m] = size(u);

  MTT_input_index = 0;
  [mtt_data] = ${sys}_ode2odes(x0,par,simpar);
  y = mtt_data(:,2:1+ny);
  x = mtt_data(:,3+ny:2+ny+nx);
  ypar = [];

endfunction
EOF

}

case ${lang} in
    m)
	make_m
	;;
    *)
	echo Language ${lang} not supported - sorry
esac

Deleted mttroot/mtt/bin/trans/make_ssim version [8d96ecb705].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## Makes the sensitivity simulation
## Copyright (C) 2001 by Peter J. Gawthrop

sys=$1
lang=$2

outfile=${sys}_ssim.${lang}

echo Creating $outfile
make_m() {
mtt_header ${sys} ssim m >  ${outfile}
cat >> ${outfile} <<EOF

  ## Pass input as a global
  global MTT_input MTT_input_index MTT_input_last

  if nargin>4  
    [n,m] = size(index);
    if (n>m)       # Make sure its a row vector
      index = index';
    endif
  endif

  [nx2,ny2] = ${sys}_def;
  y_par = [];
  MTT_input = u;
  [MTT_input_last,m] = size(u);

  if nargin<5			# No index given
    MTT_input_index = 0;
    [mtt_data] = ${sys}_ode2odes(x0,par,simpar);
    y = mtt_data(:,2:2:1+ny2);
    x = mtt_data(:,3+ny2:2:2+ny2+nx2);
    ypar = [];
  else				# Compute sensitivities as well
    for i=index
      MTT_input_index = 0;
      p = par;           # Reset parameters
      p(i) = 1;          # Set sensitivity index to 1
      [mtt_data] = ${sys}_ode2odes(x0,p,simpar);
      if (i==index(1))
	y = mtt_data(:,2:2:1+ny2);
      endif
      y_par = [y_par, mtt_data(:,3:2:2+ny2)];
      x = mtt_data(:,3+ny2:2+ny2+nx2);
    endfor
  endif

endfunction
EOF

}

case ${lang} in
    m)
	make_m
	;;
    *)
	echo Language ${lang} not supported - sorry
esac

Deleted mttroot/mtt/bin/trans/make_stdin version [c1f26ffe2e].

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
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
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









































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

## 	$Id$	

# Copyright (C) 1999,2000 by Peter J. Gawthrop

# Tell user
Sys=$1
lang=$2
date=`date`
outfile=$1_input.$2

Nu=`mtt_getsize ${Sys} u` # Inputs 
echo  "Creating $outfile for standard input"

## Pascal code
make_p()
{
cat <<EOF > $outfile
PROCEDURE ${Sys}_input(VAR mttu : InputVector;
                       mttx : StateVector;
                       mtty : OutputVector;
                       mttt : REAL;
                       par  : ParameterVector);

{Created by MTT on $date for standard input to simulation}

VAR t : REAL; Start:BOOLEAN;

BEGIN{${Sys}_input}
  {Zap comments}
  IF (input^ = chr("#")) THEN
  BEGIN
    readln;
    WHILE (input^ = chr("#")) DO readln;
  END;

  read(t); { Read, and discard, first column (time) }
  FOR mtti:=1 TO $Nu DO {Read the inputs}
    read(mttu[mtti]);
  readln; {Next line}


END{${Sys}_input};
EOF
}

make_m() {
mtt_header ${Sys} input m stdin > $outfile
cat >> $outfile <<EOF
## The "standard input"
global MTT_input MTT_input_index MTT_input_last
  
  MTT_input_index = min(++MTT_input_index,MTT_input_last);
  mttu = MTT_input(MTT_input_index,:);
## END Code
endfunction
EOF

}


make_cc() {
cat > $outfile <<EOF
// -*-c++-*- Put emacs into c++-mode

// 
// System ${Sys}, representation input, language oct; 
// File ${Sys}_input.oct; 
// Generated by MTT on `date`; 

#ifdef STANDALONE
#include <octave/oct.h>
#include "${Sys}_def.h"

void strip_comments (istream &str)
{
  char c;
  c = str.peek ();
  while (c == '#')
    {
      str.unsetf(ios::skipws);
      while (c != '\n')
	{
	  str >> c;
	}
      str.setf(ios::skipws);
      c = str.peek ();
    }
}

ColumnVector F${Sys}_input (
	ColumnVector	&mttx,
	ColumnVector	&mtty,
	const double	&mttt,
	ColumnVector	&mttpar
)
{
#endif // STANDALONE
#ifndef STANDALONE
#include <octave/oct.h>
#include <variables.h>
#include "${Sys}_def.h"

DEFUN_DLD (${Sys}_input, args, ,
"Usage: [mttu] = ${Sys}_input()
Octave input (-stdin) representation of system ${Sys}
Generated by MTT on `date`")
{

  octave_value_list retval;
#endif // ! STANDALONE

  ColumnVector	mttu	(MTTNU);

  // Set up the mttu vector
#ifndef STANDALONE
  int MTT_input_index	= static_cast<int>(get_global_value ("MTT_input_index").double_value ());
  int MTT_input_last	= static_cast<int>(get_global_value ("MTT_input_last").double_value ());
  Matrix MTT_input 	= get_global_value ("MTT_input").matrix_value();

  mttu = MTT_input.row (MTT_input_index);

  if (MTT_input_index < (MTT_input_last - 1))
    {
      set_global_value ("MTT_input_index", static_cast<double>(++MTT_input_index));
    }
  
#else
  double t, u;
  strip_comments (cin);
  cin >> t;
  for (register int i = 0; i < MTTNU; i++)
    {      
      cin >> u;
      mttu(i) = u;
    }
#endif


#ifndef STANDALONE
  retval (0)	= octave_value (mttu);
  return (retval);
}
#endif // ! STANDALONE
#ifdef STANDALONE
  return mttu;
}
#endif // STANDALONE
EOF
}

case $lang in
    p)
	make_p 
	;;
    m)
	make_m
	;;
    cc)
	make_cc
	;;
    *)
	echo language $lang not supported - sorry
esac

Deleted mttroot/mtt/bin/trans/makecr version [b85c8207c2].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: makecr

# Copyright (c) P.J.Gawthrop 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1996/09/12 12:06:38  peter
## Removed reducndant lines.
##
## Revision 1.3  1996/09/12 12:05:01  peter
## Removed default crs.
##
## Revision 1.2  1996/09/10 16:18:37  peter
## Uses default constitutive relationship mtt/cr/r
##
## Revision 1.1  1996/08/24 14:53:06  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_cr.r

echo % Default CR file			>  $1_cr.r
echo % File $1_cr.r			>> $1_cr.r
echo % Generated by MTT on `date`.	>> $1_cr.r
echo					>> $1_cr.r
cat $MTTPATH/trans/m/rcs_header.txt	>> $1_cr.r
echo 'END;'				>> $1_cr.r








Deleted mttroot/mtt/bin/trans/makedesc version [57b7600dfe].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: maketex
# Makes template for (TeX) system description.

# P.J.Gawthrop August 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/07/22 08:58:51  peterg
## Corrected spelling.
##
## Revision 1.2  1997/05/21 10:00:51  peterg
## Tidied up.
##
## Revision 1.1  1997/05/21 09:19:27  peterg
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_desc.tex

echo '% -*-latex-*- Put EMACS into LaTeX-mode' > $1_desc.tex
echo "% Verbal description for system $1 ($1_desc.tex)" >> $1_desc.tex
echo "% Generated by MTT on" `date`. >> $1_desc.tex                  	   
cat $MTTPATH/trans/m/rcs_header.txt  >> $1_desc.tex

cat<<EOF >> $1_desc.tex                  
   The acausal bond graph of system \textbf{$1} is
   displayed in Figure \Ref{fig:$1_abg.ps} and its label
   file is listed in Section \Ref{sec:$1_lbl}.
   The subsystems are listed in Section \Ref{sec:$1_sub}.
EOF

   

Deleted mttroot/mtt/bin/trans/makedoc version [577d894696].

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
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
























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: makedoc
# Encapsulates a tex file in a document.

# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1997/05/17 13:55:42  peterg
## Initial revision
##
# Revision 1.2  1997/04/23  10:06:51  peterg
# Put output in the correct file!
#
# Revision 1.1  1997/04/23  10:03:41  peterg
# Initial revision
#
###############################################################

date=`date`
switches=$1
system=$2
representation=$3
lang=$4
args=$5
documenttype=$6
ps=$7

if [ "$documenttype" = "book" ]; then
  document=book
else
  document=article
fi

if [ "$documenttype" = "book" ]||[ "$documenttype" = "article" ]; then
    title="\title{Report on $system}"
else
    title="\title{System $system, representation $representation}"
fi

filename=$2_$3.doc
texname=$2_$3.tex
indexname=$2_$3.ind

# Inform user
echo "Creating $filename"
# Make arguments acceptable to LateX
Args=`echo $args | sed 's/_/\\\_/g'`

cat<<EOF  > $filename 
\nonstopmode
\documentclass[12pt,a4paper]{$document}
    $title
    \author{Generated by MTT using :\\\\
     (mtt $switches $system $representation $lang $Args)}
    \date{$date}
EOF

if [ "$documenttype" = "book" ]; then
  cat <<EOF   >> $filename 
  \makeindex
EOF
fi

cp -v $MTTPATH/trans/*.sty .
cat  >> $filename <<EOF
\usepackage{mtt_$ps}
EOF

cat <<EOF  >> $filename 
\begin{document}
  \maketitle
EOF

if [ "$documenttype" = "book" ]||[ "$documenttype" = "article" ]; then
  cat $MTTPATH/trans/contents.tex >> $filename
fi

cat <<EOF  >> $filename 
%Fancy headings
  \pagestyle{fancy}
  \renewcommand{\sectionmark}[1]{\markboth{#1}{}}
  \lhead{Report \textbf{$system}}
  \rhead{Representation \textbf{$representation}}
  \rfoot{Page \thepage.}\cfoot{}
  \lfoot{\emph{$date}}

  \input{$texname}
EOF

if [ "$documenttype" = "book" ]; then
  cat <<EOF   >> $filename 
  \input{$indexname}
EOF
fi

cat<<EOF  >> $filename 
\end{document}
EOF












Deleted mttroot/mtt/bin/trans/makerep_txt version [62b9ce9298].

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
68
69
70
71







































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: makerep_tex
# Makes template for (TeX) system description.

# P.J.Gawthrop July 1998
# Copyright (c) P.J.Gawthrop, 1998.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  2000/11/04 12:32:43  peterg
## Added more reps + more default reps
##
## Revision 1.4  1999/03/02 22:02:16  peterg
## Octave-mode style
##
## Revision 1.3  1998/11/18 10:47:39  peterg
## Added transfer function rep
##
## Revision 1.2  1998/11/10 09:16:41  peterg
## Added structure rep
##
## Revision 1.1  1998/07/22 09:14:42  peterg
## Initial revision
##
###############################################################


#Inform user
echo Creating $1_rep.txt

cat <<EOF > $1_rep.txt
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system $1 ($1_rep.txt)
## Generated by MTT on" `date`.

EOF

cat $MTTPATH/trans/rcs_header.sh >> $1_rep.txt

cat <<EOF >> $1_rep.txt
mtt $1 abg tex			# The system description
mtt $1 cbg ps 		        # The causal bond graph
mtt $1 struc tex	        # The system structure
mtt $1 sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt $1 dae tex	        # The system dae
## mtt $1 ode tex	        # The system ode 
## mtt $1 sspar tex		# Steady-state parameters
## mtt $1 ss tex 		# Steady state
## mtt $1 dm tex		# Descriptor matrices (of linearised system)
## mtt $1 sm tex		# State matrices (of linearised system)
## mtt $1 tf tex		# Transfer function (of linearised system)
## mtt $1 lmfr ps		# log modulus of frequency response (of linearised system)
## mtt $1 simpar tex		# Simulation parameters
## mtt $1 numpar tex		# Numerical simulation parameters
## mtt $1 state tex		# Simulation initial state
## mtt $1 input tex		# Simulation input
## mtt $1 logic tex		# Logic control
## mtt $1 odeso ps		# Simulation output

## mtt $1 rep txt		# This file
EOF

Deleted mttroot/mtt/bin/trans/makesspar version [74fdc0a727].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: makesspar
# Makes default sspar file: all states zero.

# P.J.Gawthrop February 1998
# Copyright (c) P.J.Gawthrop, 1998.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/02/09 08:39:27  peterg
## Set inputs to zero as well.
##
## Revision 1.1  1998/02/06 15:53:49  peterg
## Initial revision
##
###############################################################


#Inform user
echo Creating $1_sspar.r

echo "% Steady-state parameters for system $1 ($1_sspar.r)"> $1_sspar.r
echo "% Generated by MTT on" `date`. >> $1_sspar.r                  	   
cat $MTTPATH/trans/m/rcs_header.txt  >> $1_sspar.r
echo "% Set all states and inputs to zero" >> $1_sspar.r                  	   

$MATRIX  <<EOF >> /dev/null

fnum=fopen("$1_sspar.r","a");

[nx,ny,nu,nz,nyz] = $1_def;

for i = 1:nx
  fprintf(fnum,"MTTX%i := 0;\n", i);
end;
fprintf(fnum,"\n");
for i = 1:nu
  fprintf(fnum,"MTTU%i := 0;\n", i);
end;
   
  
EOF

 
echo "END;;" >> $1_sspar.r   

Deleted mttroot/mtt/bin/trans/makesubs version [070575132f].

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
68
69
70
71
72
73
74
75
76
77
78














































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: makesubs
# Makes the default substitution file

# Copyright (C) 2000 by Peter J. Gawthrop


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 09:09:52  peterg
## Initial revision
##
##
###############################################################

#Inform user
echo Creating $1_subs.r

cat > $1_subs.r <<EOF
% Default SUBS file
% File $1_subs.r
% Generated by MTT on `date`.

EOF

cat $MTTPATH/trans/m/rcs_header.txt	>> $1_subs.r

cat >> $1_subs.r <<EOF
% Put algebraic substitution commands here
FOR ALL i LET arbint(i) = 0; % Zap arbitary constants
END;
EOF


exit

## NB the following messes up the expansion switch ????
cat >> $1_subs.r <<EOF
% Ordering switch
ORDER
EOF

# Symbolic params first
awk '{
  print $1 ","
}' < $1_sympar.txt >> $1_subs.r

# Then states
Nx=`mtt_getsize $1 x` # States

awk 'END{
  for (k=1;k<Nx;k++){
    printf("mttx%i,\n", k);
  }
    printf("mttx%i;\n", Nx);
  
}' Nx=$Nx < $1_sympar.txt >> $1_subs.r

cat >> $1_subs.r <<EOF
END;
EOF









Deleted mttroot/mtt/bin/trans/matlab_header version [f6f0a00194].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: matlab_header
# Generic octave function header


#Write some file headers
echo "function [$3] = $1_$2" 
echo "% $2 function for system $1 ($1_$2.m)"   
echo "% Generated by MTT at `date`"  
echo  

#Globals
sympar2global_txt2m $1 
echo  ';'
echo  



Deleted mttroot/mtt/bin/trans/matlab_matrix.r version [d9d59df9cf].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     %%%%% Model Transformation Tools %%%%%
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Reduce function to write matrices in matlab form
% P.J.Gawthrop  March 1998
% Copyright (c) P.J.Gawthrop, 1998


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.1  1998/03/22 10:26:47  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := 'FORTRAN;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 400;

PROCEDURE matlab_Matrix;
BEGIN
  ON NERO;
  write "mtt_matrix = zeros(", mtt_matrix_n, ",", mtt_matrix_m, ");";
  IF MTT_Matrix_n>0 THEN
    IF MTT_Matrix_m>0 THEN
    BEGIN
    FOR i := 1:MTT_Matrix_n DO
      IF MTT_Matrix_m>1 THEN
        BEGIN
          FOR j := 1:MTT_Matrix_m DO 
            GENTRAN mtt_matrix(i,j) ::=: mtt_matrix(i,j);
        END
        ELSE
        BEGIN
         GENTRAN mtt_matrix(i) ::=: mtt_matrix(i,1);
        END;
    END;
  write MTT_matrix_name, " = mtt_matrix;";
END;

END;;


Deleted mttroot/mtt/bin/trans/matlab_tidy version [3301711ae7].

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































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.3  1997/08/28  13:41:57  peterg
# Removes translation of:
# mttx
# mttdx
# mtty
# mttu
#
# Revision 1.2  1996/08/20  08:26:06  peter
# Version control header added.
#
###############################################################

# Bourne shell script: matlab_tidy
# Tidies up Matlab format files
# P.J.Gawthrop 14 June 1990 13 Nov 1990, 19 Nov 93, April 1994, Dec 1994, 
# June 1995
# Copyright (c) P.J.Gawthrop, 1990, 1994, 1995.

#rm junk
#tr "[A-Z]" "[a-z]" | \

cat $1 | \
sed -e "s/      //" \
    -e "s/      //" \
    -e "s/\$\$//" \
    -e "s/\.\.;;/../" \
    -e "s/\$/;/g" \
    -e "s/;;;//g" \
    -e "s/;;/;/g" \
    -e "s/\.;/./g" \
    -e "s/,;/,/g" \
    -e "s/\*\*/^/g" \
    -e "s/nocr /nocr/g" \
    -e "s/nocr\\nl/nocr/g" \
    -e "s/;;/;/g" \
    -e "s/:=/=/g" \
    -e "s/ e  /e/g" \
    -e "s/*;/* .../g" \
    -e "s/+;/+ .../g" \
    -e "s/     . //g" \
    -e "s/^;$//g" \
    -e "s/\.\.\\$/../g"  \
    -e "s/\\$/;/g"  \
    -e "s/inv(mtte)\*/mtte\\\/g"\
    -e "s/\\$//" |\
tr -s '\012' '\012'\
>junk
mv junk $1




Deleted mttroot/mtt/bin/trans/modpar_txt2r version [0459392ef4].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: modpar_txt2r
# Creates the reduce code for modulated parameters

# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $$Id$
## $Log$
## Revision 1.1  2001/04/02 08:19:18  gawthrop
## Translates modulated parameters into reduce
##
###############################################################

# Inform user
echo Creating $1_modpar.r

#Create the modpar file complete with headers.
echo "% Modpar file ($1_modpar.r)" > $1_modpar.r
echo "% Generated by MTT at `date`" >> $1_modpar.r

parameters=`strip_comments < $1_modpar.txt |  cut -f1`
inputs=`strip_comments < $1_modpar.txt |  cut -f2`


for parameter in $parameters; do
    grep $1_${parameter}_ $1_struc.txt |\
    awk 'BEGIN{
               name["input"] = "u";
               name["output"] = "y";
               name["state"] = "x";
               name["nonstate"] = "z";
	      }
	 {
           printf("%s := mtt%s(%i,1);\n", parameter, name[$1],  $2)
         }' parameter=$parameter >> $1_modpar.r
done

Deleted mttroot/mtt/bin/trans/mtt.sty version [c827d4bd91].

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
68
69
70
71
72
73









































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% mtt.sty -- LaTeX style file for MTT
% P.J.Gawthrop May 1997
% Copyright (c) P.J.Gawthrop, 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.7  2000/11/28 18:28:29  peterg
% %% Removed fancy box - messes up TOC
% %%
% %% Revision 1.6  2000/11/28 18:09:06  peterg
% %% Tidied up:
% %% added hyperef
% %% put fig stuff into mtt_ps.sty and mtt_pdf.sty
% %%
% %% Revision 1.5  1998/11/23 10:45:49  peterg
% %% Reinstated supertabular
% %%
% %% Revision 1.4  1998/07/01 17:34:43  peterg
% %% No change
% %%
% %% Revision 1.3  1997/12/06 16:22:10  peterg
% %% Added another argument - the label.
% %%
% %% Revision 1.2  1997/12/06 15:51:06  peterg
% %% Cahged order of fig args to put file first.
% %%
% %% Revision 1.1  1997/05/19 16:48:10  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Font
\usepackage{times}

%Verbatim file input
\usepackage{verbatim}
\usepackage{moreverb}

%Long tables
\usepackage{supertabular}

%AMS maths
  \usepackage{amsmath}

%Fancy headings
  \usepackage{fancyheadings}

%Fancy boxes
%\usepackage{fancybox}


% Read in a verbatim file
\newcommand{\txt}[2]{
  \subsubsection*{#1}
  \verbatimtabinput{#2}
}

% Read in a LaTeX file
\newcommand{\Input}[1]{
  \input{#1}
}


% Page refs as well.
\newcommand{\Ref}[1]{\ref{#1} (on page \pageref{#1})}

Deleted mttroot/mtt/bin/trans/mtt2reps_txt version [38143b0d0c].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

# mtt2reps_txt: Gives a tabular listing of representations and languages
# P J Gawthrop July 1998, October 1998
# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11  2001/04/28 03:38:36  geraint
## Refined selection of matching patterns - checks for exact match.
##
## Revision 1.10  2000/09/14 07:54:13  peterg
## Removed -e option in echo
##
## Revision 1.9  2000/04/05 08:34:30  peterg
## removed output tab
##
## Revision 1.8  2000/04/05 08:04:01  peterg
## Minor reorganisation
##
## Revision 1.7  2000/04/04 16:15:14  peterg
## Fixed awk prob - must be the same sep. for each field (?)
## So tr tab to space
##
## Revision 1.6  2000/04/04 13:09:51  peterg
## *** empty log message ***
##
## Revision 1.5  2000/01/19 17:26:12  peterg
## Now includes the representation title.
##
## Revision 1.4  1999/03/09 00:03:06  peterg
## Revisions for xmtt
##
## Revision 1.3  1999/03/08 21:24:43  peterg
## Handles * representations:
##
## 	rep* is special
##         rep shows all possible languages
##
## Revision 1.2  1999/03/08 06:34:07  peterg
## Removed mtt help - replaced by grep #SUMMARY - quicker
##
## Revision 1.1  1998/10/20 08:15:08  peterg
## Initial revision
##
###############################################################

sep='|'; # Separates the languages from the rest.

## List of all representations (deleting the *)
representations=`grep '#SUMMARY' $MTTPATH/mtt | awk '{sub("\*","+"); print $2'} | sort -u `


for rep in $representations ; do
    Rep=`echo $rep | tr '+' '*'`
    ## Title should be same for all languages -- but extract the first non-empty version
      title=`grep '#SUMMARY' $MTTPATH/mtt | tr '\t' ' ' | grep "[ *]$Rep[ *]" | \
      awk  '{if (NF>2) {for (i=3;i<NF-1;i++) printf("%s ",$i); NF1=NF-1; printf("%s\n",$NF1)}}' |\
      head -1`
      
    language=`grep '#SUMMARY' $MTTPATH/mtt |\
      awk '
        {
          if (index(rep,"*")==length(rep)){
            if ($2==rep) print $NF
          }
          else
            if (($2==rep)||($2==sprintf("%s*",rep))) print $NF
        }' rep=$Rep |\
      sort -u | sed 's/[()]//g'` 

      Title='('$title')'
      echo "$Rep" $Title  $sep $language
     
done




Deleted mttroot/mtt/bin/trans/mtt_error version [8a6269ba81].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_error
# Does the error handing for transformations and forces error exit.
# P.J.Gawthrop  August 1996
# Copyright (c) P.J.Gawthrop, 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/03/06 17:14:09  peterg
## Cospetic change to message
##
## Revision 1.6  1998/03/05 10:17:41  peterg
## Cosmetic change
##
## Revision 1.5  1998/03/05 10:14:37  peterg
## Toned down the error warning message
##
## Revision 1.4  1998/02/26 10:21:51  peterg
## Revised to take account of new (??) wc output - now echos the file
## name (??)
##
## Revision 1.3  1998/02/25 21:35:00  peterg
## Put "" round if argument in case $err_length is null.
##
## Revision 1.2  1996/08/26 09:46:37  peterg
## Changed $() to ``
##
# Revision 1.1  1996/08/25  09:20:00  peter
# Initial revision
#
###############################################################

error_file=$1;

# Test for errors and print if any
err_length=`wc -c <$error_file | awk '{print $1}'`
if [ "$err_length" != "0" ]
then
  echo "INFORMATION: An MTT transformation has generated the following messages"
#  echo "             (which may not be important)"
  cat $error_file
  exit 1
else
  exit 0
fi

Deleted mttroot/mtt/bin/trans/mtt_error_r version [8500aa4349].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_error_r
# Does the error handing for transformations and forces error exit.
# This is the version for resuce which does not use error output.
# P.J.Gawthrop  August 1996
# Copyright (c) P.J.Gawthrop, 1996

log_file=$1

#Reduce writes errors to std output with ***** in front.
grep '\*\*\*\*\*' $log_file >mtt_error.txt

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

Deleted mttroot/mtt/bin/trans/mtt_get_subsystems version [f462408545].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
# Gets the subsystems

while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-strip )
                strip=yes;
		;;
	*)
		echo "$1 is an invalid argument - ignoring";
                exit ;;
  esac
  shift
done

subsystems=`sh $1_sub.sh "echo grep " " $1_abg.m" |\
            sh | awk -F '.' '{print $3}'`

if [ -n "$strip" ]; then
      echo $subsystems  
   else
      for subsystem in $subsystems; do
	# echo -n $1_$subsystem' '
        echo $1_$subsystem #| awk '{printf("%s ",$1)}'
    done
    echo
fi










Deleted mttroot/mtt/bin/trans/mtt_getsize version [ca21605aad].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_getsize

# Gets array sizes for the def.r file
# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop

    #$Id$	

while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-internal )
                internal=yes;
		;;
	-external )
                external=yes;
		;;
	*)
		echo "$1 is an invalid argument - ignoring";
                exit ;;
  esac
  shift
done

if [ -n "$internal" ]; then
    name=MTT$2"[0-9]"; # echo $name
    grep -i "$name" $1_ese.r | wc -l
    exit
fi

if [ -n "$external" ]; then
    name="^MTT"$2"("; #echo $name
    grep -i "$name" $1_ese.r | wc -l
    exit
fi

## The original version for external sizes.
if [ "$2" = "xx" ]; then
  n=`mtt_getsize $1 x`
  N=`echo "$n * $n" | bc` 
else
  N=`grep "MTTN$2 " <$1_def.r | awk '{print $3}' | sed 's/;//'`
fi

echo $N

Deleted mttroot/mtt/bin/trans/mtt_header version [0a1d86f26e].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903







































































































































































































































































































































































































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_header
# Headings for functions
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.39  2002/04/15 10:54:31  geraint
## Statically declare outputs and initialise to zero.
## This is necessary to prevent spurious values from being output when no assignments are made (i.e. when "y(i) := 0 for all u"  (Reduce:see NERO)).
##
## Revision 1.38  2001/07/23 23:43:15  gawthrop
## header only version does not need to compute sizes from _def.r
##
## Revision 1.37  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.36  2001/07/12 04:00:51  gawthrop
## Now zeros y correctly - ie Ny NOT Nx elements
##
## Revision 1.35  2001/06/13 10:39:51  gawthrop
## Zeros output matices in csex and cseo just in case some elements are
## actually zero and not set in code. Works for m and oct.
##
## Revision 1.34  2001/05/26 18:36:43  gawthrop
## Further modifications. Now works on rcPPP
##  -- next jobs:
##     add identification to ppp_nlin_sim
##     create real-time ppp_nlin_run
##
## Revision 1.33  2001/05/26 15:46:38  gawthrop
## Updated to account for new nonlinear ppp
##
## Revision 1.32  2001/05/24 07:42:12  gawthrop
## Included and updated the missing tf_r2m
##
## Revision 1.31.2.2  2001/07/02 00:34:56  geraint
## gcc-3.0 compatibility.
##
## Revision 1.31.2.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
##
## Revision 1.31  2001/04/03 14:49:42  gawthrop
## Revised to incorporate new ssim (sensitivity simulation)
## representation (m only just now).
##
## Revision 1.30  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.29  2001/03/27 13:10:23  geraint
## Improved determination of Octave version.
##
## Revision 1.28  2001/02/17 03:48:17  geraint
## Use assignment LHS to gather tmp variable names.
## Prevents collection of long expressions, eg: tmp34*(tmp75
##
## Revision 1.27  2001/02/14 06:06:34  geraint
## Removed octave_value_list wrappers from standalone.exe - speed improvements
##
## Revision 1.26  2001/02/05 08:50:58  geraint
## Octave 2.1.x compatability.
##
## Revision 1.28  2001/01/17 21:16:15  geraint
## uncomment parameter assignments in .m reps
##
## Revision 1.27  2001/01/14 23:51:26  geraint
## declare parameters as variables instead of constants
##
## Revision 1.26  2001/01/07 21:22:47  geraint
## Compatibility with Octave 2.1.x
## vector_value ---> column_vector_value
##
## Revision 1.25  2000/12/05 12:05:26  peterg
## Changed to () form
##
## Revision 1.24  2000/12/05 10:04:52  peterg
## Fixed dummy variable bug
##
## Revision 1.23  2000/12/05 09:47:50  peterg
## Include crs as c files
##
## Revision 1.22  2000/12/04 12:19:12  peterg
## Changed $() to `` and $() to expr for sh compatibility -- geraint
##
## Revision 1.21  2000/12/04 08:52:40  peterg
## Zapped () in functions for sh compatibility
##
## Revision 1.20  2000/12/04 08:19:27  peterg
## Added switch declarations - in logic.cc
##
## Revision 1.19  2000/12/03 16:11:43  peterg
## Corrected bug in logic declatations
##
## Revision 1.18  2000/12/03 16:06:22  peterg
## Fixed bug in generating dummies
## Added logic declarations
##
## Revision 1.17  2000/12/01 20:55:01  peterg
## Added Geraint's fix for zeroing matrices
##
## Revision 1.16  2000/12/01 17:56:30  peterg
## Removed spurious  echo '## Set matrices to zero' - thanks Geraint
##
## Revision 1.15  2000/11/29 21:06:16  peterg
## Removed Npar creation - not needed??
##
## Revision 1.14  2000/11/27 11:51:43  peterg
## Added zero matrices in matlab code
##
## Revision 1.13  2000/11/09 17:19:52  peterg
## Geraint's pow() mods
##
## Revision 1.12  2000/11/09 16:09:46  peterg
## Declare dummy variables (mtt_s1 etc)
##
## Revision 1.11  2000/11/09 15:29:35  peterg
## lower-case declarations
##
## Revision 1.10  2000/11/07 17:20:51  peterg
## useful-functions.hh now included locally
##
## Revision 1.9  2000/11/07 16:56:24  peterg
## Version from Geraint
##
## Revision 1.2  2000/11/03 00:55:42  geraint
## typo: missed out 'd' in mttedx
## todo: need to accommodate mttsimpar
##
## Revision 1.1  2000/11/02 04:28:39  geraint
## Initial revision
##
## Revision 1.8  2000/10/17 16:35:03  peterg
## No parameter,state or input conversion in txt files
##
## Revision 1.7  2000/10/17 09:53:20  peterg
## Fixed logic rep
##
## Revision 1.6  2000/10/17 08:37:23  peterg
## Included logic rep
##
## Revision 1.5  2000/10/14 09:12:14  peterg
## No dies arguments and output itself
##
## Revision 1.4  2000/10/14 06:49:31  peterg
## Make parameter listing representation dependent
##
## Revision 1.3  2000/10/11 08:59:15  peterg
## Added csex rep
##
## Revision 1.2  2000/10/11 08:01:42  peterg
## Added noglobal fudge
##
## Revision 1.1  2000/10/10 21:02:27  peterg
## Initial revision
##
###############################################################

# Arguments
system=$1
rep=$2
language=$3
fun_name=${1}_${2}

other=$4 # Anything else eg stdin

if [ -z "$system" ]; then
  echo 'Usage: mtt_header sys rep lang [stdin]'
  exit
fi


# get octave version
octave_development=`octave --version | awk '{print $4}' | awk -F\. '{print $2}'`
case `$MATRIX --version | awk -F\. '{print $2}'` in
    0) # stable
	vector_value=vector_value
	;;
    1) # development
	vector_value=column_vector_value
	;;
    *)
	vector_value=column_vector_value
	;;
esac


# Representation-specific stuff

eqnargs='mttx,mttu,mttt,mttpar'
inputeqnargs='mttx,mtty,mttt,mttpar'
case $rep in
    ae)
	states=yes;
	inputs=yes;
	parameters=yes;
	output=mttyz;
	args=$eqnargs;
	;;
    cse)
	states=yes;
        inputs=yes;
	parameters=yes;
        output='mttdx,mtte'
        args=$eqnargs
	;;
    csex)
	states=yes;
        inputs=yes;
	parameters=yes;
        output=mttedx
        args=$eqnargs
        zeromatrices='edx';
	;;
    cseo)
	states=yes;
        inputs=yes;
	parameters=yes;
        output=mtty
        args=$eqnargs
        zeromatrices='y';
	;;
    dm)
	states=no;
	inputs=no;
	parameters=yes;
        output='mtta,mttb,mttc,mttd,mtte'
        args=mttpar
        zeromatrices='a b c d e';
	;;
   input)
	inputs=no;
        output=mttu
        args=$inputeqnargs
        if [ "$other" = "stdin" ]; then
	  states=no;
	  parameters=no;
          declareinputs=no;
        else
	  states=yes;
	  parameters=yes;
          declareinputs=yes
	  declarestates=yes
        fi
	;;
    logic)
	states=no;
	inputs=no;
	parameters=yes;
        output=mttopen
        args=$eqnargs
        declareinputs=yes
        declarestates=yes
	declareswitches=yes
	;;
    numpar)
	states=no;
	inputs=no;
	parameters=no;
        output='mttpar'
	;;
    ode)
	states=yes;
        inputs=yes;
	parameters=yes;
        output='mttdx'
        args=$eqnargs
	;;
    odeo)
	states=yes;
        inputs=yes;
	parameters=yes;
        output='mtty'
        args=$eqnargs
	;;
    ode2odes)
	states=no;
        inputs=no;
	parameters=no;
        output='mtt_data'
        args='x0,par,simpar'
	;;
    simpar)
	states=no;
	inputs=no;
	parameters=no;
        output='mttsimpar'
	;;
    sm)
	states=no;
	inputs=no;
	parameters=yes;
        output='mtta,mttb,mttc,mttd'
        args=mttpar;
        zeromatrices='a b c d';
	;;
     smxa)
	states=no;
        inputs=no;
	parameters=yes;
        output='mtta'
        args=$eqnargs
	;;
    smxax)
	states=no;
        inputs=no;
	parameters=yes;
        output='mttax'
        args=$eqnargs
	;;
    state)
	states=no;
	inputs=no;
	parameters=yes;
        output=mttx
        args=mttpar
        declarestates=yes
	;;
    sim)
	states=no;
        inputs=no;
	parameters=no;
        output='y,x'
        args='x0,par,simpar,u'
	;;
    ssim)
	states=no;
        inputs=no;
	parameters=no;
        output='y,y_par,x'
        args='x0,par,simpar,u,index'
	;;
    tf)
	states=no;
	inputs=no;
	parameters=yes;
        output='mttnum,mttden'
        args=mttpar;
	;;    
    type)
	states=no;
	inputs=no;
	parameters=no;
	header_only=yes;
	;;

     *)
	echo Representation $rep not supported - sorry; exit 1
esac

## Sort out parentheses
if [ -n "$args" ]; then
    Args='('$args')'
fi
if [ -n "$output" ]; then
    Output="[$output] = "
fi


# Lanuage specific stuff
case $language in
    m)
	Lc='##';
	Rc='';
	Lb='(';
	Rb=')';
	function="function"
	declaration="$Output$1_$rep$Args;"
        if [ "$other" != "stdin" ]; then
	  noglobals=true; # Fudge to make mtt_m2p work
        fi     
        start='## BEGIN Code'
        finish='## END Code'
        var_declaration=
        declarestates=no
        declareinputs=no
	declareswitches=no
	;;
    sh)
	modeline='## -*-shell-script-*- Put Emacs into shell-script-mode ##';
	Lc='##';
	Rc='';
	Lb='(';
	Rb=')';
	function=""
	declaration=""
        start=''
        parameters=no
	states=no
	inputs=no
        declarestates=no
        declareinputs=no
	declareswitches=no
	;;
    txt)
	modeline='## -*-octave-*- Put Emacs into octave-mode ##';
	Lc='##';
	Rc='';
	Lb='(';
	Rb=')';
	function=""
	declaration=""
        start=''
        parameters=no
	states=no
	inputs=no
        declarestates=no
        declareinputs=no
	declareswitches=no
	;;
    oct)
	modeline="// -*-c++-*- Put Emacs into c++-mode";
	Lc='//';
	oct_header=yes;
        constant_declaration="const double "
        var_declaration="double "
	minusone="-1"
	map="_map"
        declaredummies=yes
	;;
    *)
	echo Language $language not supported - sorry; exit 1
esac

if [ "$rep" = "simpar" ]; then
   output=${output}${map}    # Output is simpar_map in this case
fi

get_sizes()
    {
    Nx=`mtt_getsize $system x` # States
    Nxx=`mtt_getsize $system xx` # States x States
    Nu=`mtt_getsize $system u` # Inputs 
    Ny=`mtt_getsize $system y` # Outputs 
    Nyz=`mtt_getsize $system yz` # Zero outputs
    ##Npar=`wc -l $system\_sympar.txt | awk '{print $1}'`
    }

zero_matrices()
{
## Set matrices to zero
echo
 ## echo '## Set matrices to zero'
for name in $zeromatrices; do
    case $name in
	a)
	    N=$Nx; M=$Nx
	    ;;
	b)
	    N=$Nx; M=$Nu
	    ;;
	c)
	    N=$Ny; M=$Nx
	    ;;
	d)
	    N=$Ny; M=$Nu
	    ;;
	e)
	    N=$Nx; M=$Nx
	    ;;
	edx)
	    N=$Nx; M=1
	    ;;
	y)
	    N=$Ny; M=1
	    ;;
	*)
	    
    esac

    if [ "${language}" = "oct" ]; then
      if [ "$M" = "1" ]; then
        echo "   mtt$name = zeros($N);"
      else
        echo "   mtt$name = zeros($N,$M);"
      fi
    else
      echo "   mtt$name = zeros($N,$M);"
    fi
done
}

declare_dummies()
{
# Get the dummies
dummies="mtt_tmp"
rm -f mtt_dummies
for dummy in $dummies; do
    grep "${dummy}[0-9]*[ \t\n]*=" < ${fun_name}.m |\
    awk '{ 
          if (match($1,dummy)==1)
             print $1
         }' dummy=$dummy >> mtt_dummies
done

dummy_list=`sort -u mtt_dummies`

# Comments
cat <<EOF

$Lc  Declarations of dummies $Rc
EOF

for dummy in $dummy_list; do
    echo '  ' $var_declaration $dummy';'
done
} # declare_dummies

declare_switches ()
{
cat <<EOF

$Lc  Declarations of switches $Rc
EOF
 strip_comments <${system}_switch.txt |\
 awk '{printf("  double %s_logic = 0;\n", tolower($1))}' 
} # declare_switches

declare_vars()
{
# Grab the names
names=`awk '{if ($1==var_type) print tolower($4)}' var_type=$1 ${system}_struc.txt`

# Comments
cat <<EOF

$Lc  Declarations for $1 names $Rc
EOF
# Declarations
for name in $names; do
    echo '  '$var_declaration $name';'
done
}


array2constant()
{
# Parameters
if [ "$parameters" = "yes" ]; then
cat <<EOF

$Lc Parameters $Rc
EOF
sympar2par_txt2m ${system} ""  "$var_declaration" "$minusone"
fi

# States
if [ "$states" = "yes" ]; then
cat <<EOF

$Lc States $Rc
EOF
N=`n2m 1 $Nx`
for i in $N; do
    echo $constant_declaration 'mttx'$i' = mttx('$i$minusone');'
done
fi

if [ "$declarestates" = "yes" ]; then
  declare_vars state
fi

# Inputs
if [ "$inputs" = "yes" ]; then
cat <<EOF

$Lc Inputs $Rc
EOF

N=`n2m 1 $Nu`
for i in $N; do
  echo $constant_declaration 'mttu'$i' = mttu('$i$minusone');'
done
cat <<EOF

$Lc Unknown Inputs $Rc
EOF

Ni=`n2m 1 $Nyz`
for i in $Ni; do
  echo $constant_declaration 'mttui'$i' = mttu('$Nu+$i$minusone');'
done
fi

if [ "$declareinputs" = "yes" ]; then
  declare_vars input
fi

if [ "$declaredummies" = "yes" ]; then
  declare_dummies
fi

if [ "$declareswitches" = "yes" ]; then
  declare_switches
fi

zero_matrices;

}

# Argument specific stuff
get_arg_specific_stuff ()
{
    arg_name=${1:-""}
    case ${arg_name} in
	mtta | mtte)
	    arg_type="Matrix"
	    arg_init="(MTTNX,MTTNX,0.0)"
	    ;;
	mttb)
	    arg_type="Matrix"
	    arg_init="(MTTNX,MTTNU,0.0)"
	    ;;
	mttc)
	    arg_type="Matrix"
	    arg_init="(MTTNY,MTTNX,0.0)"
	    ;;
	mttd)
	    arg_type="Matrix"
	    arg_init="(MTTNY,MTTNU,0.0)"
	    ;;
	mttax | mttdx | mttedx | mttx | mttopen)
	    arg_type="ColumnVector"
	    arg_init="(MTTNX,0.0)"
	    ;;
	mttpar)
	    arg_type="ColumnVector"
	    arg_init="(MTTNPAR,0.0)"
	    ;;
	mttsimpar_map)
	    arg_type="Octave_map"
	    arg_init="";
	    ;;
	mttu)
	    arg_type="ColumnVector"
	    arg_init="(MTTNU,0.0)"
	    ;;
	mttyz)
	    arg_type="ColumnVector"
	    arg_init="(MTTNYZ,0.0)"
	    ;;
	mtty)
	    arg_type="ColumnVector"
	    arg_init="(MTTNY,0.0)"
	    ;;
	mttt)
	    arg_type="const double"
	    arg_init=""
	    ;;
	nil)
	    arg_type="void *"
	    arg_init="(0x0)"
	    ;;
	*)
	    echo "Argument ${arg} not supported - sorry"; exit 1
    esac
}


get_field ()
{ # parse comma separated string
    s=${1:-""}					# comma separated string
    i=${2:-0}					# field number in string

    if [ 0 -eq ${i} ]; then			# return number of fields
	echo ${s} |\
	awk -F\, '{ print NF }'
    else					# return ith field
	echo ${s} |\
	awk -F\, -v i=${i} '{ print $i }'
    fi
}


get_extra_fields ()
{ # return list of words in s2 and not in s1
    s1=${1:-""}					# comma separated list
    s2=${2:-""}					# comma separated list

    c1=`get_field ${s1} 0`			# count words in s1
    c2=`get_field ${s2} 0`			# count words in s2
	
    ans=""
	
    i2=0					# s2 word index
    while [ ${i2} -lt ${c2} ]; do
        flag=0					# appearance of word in s1 and s2?
	i2=`expr ${i2} + 1`
	w2=`get_field ${s2} ${i2}`		# i2 th word in s2
	i1=0					# s1 word index
	while [ ${i1} -lt ${c1} ]; do
	    i1=`expr ${i1} + 1`
	    w1=`get_field ${s1} ${i1}`		# i1 th word in s1
	    if [ ${w2} = ${w1} ]; then
		flag=1				# w2 occurs in s1
	    fi
        done
	if [ ${flag} -eq 0 ]; then		# w2 is not in s1?
	    if [ -z ${ans:-""} ]; then		#  string is empty?
		ans=${w2}			#   assign w2
	    else
		ans=${ans},${w2}		#   append w2
	    fi
        fi
    done
    echo ${ans}
}


write_DLD_header()
{
    cat <<EOF
#ifndef STANDALONE
#include <octave/oct.h>
#include <octave/ov-struct.h>
#include <octave/toplev.h>
#include <math.h>
#include "useful-functions.hh"
#include "${system}_cr.h"
#include "${system}_def.h"
#include "${system}_sympar.h"

DEFUN_DLD (${system}_${rep}, args, ,
"Usage: [$output] = ${system}_${rep}($args)\nOctave ${rep} representation of system ${system}\nGenerated by MTT on `date`")
{

  octave_value_list retval;
#endif // ! STANDALONE

EOF
}


map_DLD_inputs ()
{
    s=${1:-""}					# comma separated input list
    if [ -z ${s:-""} ];then return; fi
    printf "#ifndef STANDALONE\n"
    c=`get_field ${s} 0`			# count of inputs
    i=0
    printf "  if (${c} != args.length ()) usage (\"${fun_name} expected ${c} argument(s): ${s}\");\n\n"
    while [ ${i} -lt ${c} ]; do
	j=${i}
	i=`expr ${i} + 1`
	w=`get_field ${s} ${i}`		# argument name
	get_arg_specific_stuff ${w}
	case ${arg_type} in
	    "const double")
		printf "  ${arg_type}\t${w}\t= args(${j}).double_value ();\n"
		;;
	    ColumnVector | Matrix | *)
		printf "  ${arg_type}\t${w}\t= args(${j}).%s ();\n" ${vector_value}
		;;
	esac
    done
    printf "#endif // ! STANDALONE\n\n"
}	


declare_DLD_outputs ()
{
    s=${1:-""}					# comma separated output list
    c=`get_field ${s} 0`			# count of outputs
    i=0
    while [ ${i} -lt ${c} ]; do
	i=`expr ${i} + 1`
	w=`get_field ${s} ${i}`		# argument name
	get_arg_specific_stuff ${w}
	printf "  static ${arg_type}\t${w}\t${arg_init};\n"
    done
}


return_DLD_outputs ()
{
    s=${1:-""}					# comma separated output list
    c=`get_field ${s} 0`			# count of outputs
    i=0
    cat <<EOF

\/\/ END Code

#ifndef STANDALONE
EOF
    while [ ${i} -lt ${c} ]; do
	j=${i}
	i=`expr ${i} + 1`
	w=`get_field ${s} ${i}`
	printf "  retval (${j})\t= octave_value (${w});\n"
    done
    cat <<EOF
  return (retval);
}
#endif // ! STANDALONE
EOF
}

write_standalone_header ()
{
    get_arg_specific_stuff ${output}
    cat <<EOF

#ifdef STANDALONE
#include <octave/oct.h>
#include <octave/ov-struct.h>
#include "useful-functions.hh"
#include "${system}_cr.h"
#include "${system}_def.h"
#include "${system}_sympar.h"

${arg_type} F${system}_${rep} (
EOF
    if [ -z ${args:-""} ]; then
	printf "\tvoid"
    else
	c=`get_field ${args:-""} 0`
	i=0
	while [ ${i} -lt ${c} ]; do
	    i=`expr ${i} + 1`
	    if [ ${i} -lt ${c} ]; then
		comma=","
	    else
		comma=""
	    fi
	    w=`get_field ${args} ${i}`
	    get_arg_specific_stuff ${w}
	    printf "\t${arg_type}\t&${w}${comma}\n"
	done
    fi
    cat <<EOF
)
{
#endif // STANDALONE
EOF
}

return_standalone_output ()
{
    cat <<EOF
#ifdef STANDALONE
  return ${output};
}
#endif // STANDALONE
EOF
}

# Header information
cat<<EOF
$modeline
$function $declaration
$Lc $declaration
$Lc System $system, representation $rep, language $language; $Rc
$Lc File $1_$rep.$language; $Rc
$Lc Generated by MTT on `date`; $Rc
EOF

if [ -n "${header_only}" ]; then
    exit
else
    get_sizes;
fi

if [ ${language} = "oct" ];then
    write_standalone_header
    write_DLD_header
    map_DLD_inputs ${args}
    undeclared=`get_extra_fields ${args:-"nil"} ${output:-"nil"}`
    declare_DLD_outputs ${undeclared}
    array2constant
    cat <<EOF

// BEGIN Code

EOF
    return_DLD_outputs ${output}
    return_standalone_output
else

if [ -n "$noglobals" ]; then
cat<<EOF

## Horrible fudge to make mtt_m2p work
global ...
mtt_no_globals ;
EOF
fi

## Arrays 
array2constant

# Mark start of code
echo
echo $start

fi

Deleted mttroot/mtt/bin/trans/mtt_langname version [c54b9eac8f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_langname

# Returns the language name from System_rep.lang

# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop

echo $1 | awk -F '.' '{print $2}'

Deleted mttroot/mtt/bin/trans/mtt_m2p version [82311a7db2].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631























































































































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh


     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_m2p
# Reduce octave 2 Pascal converter for MTT   
# P.J.Gawthrop July 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.66  2001/03/30 15:13:58  gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.65  2001/02/09 02:56:46  geraint
## Translate some binary operators
## Allows use of ! in logic.txt
##
## Revision 1.64  2001/02/03 14:00:01  gawthrop
## Geraint's temp. variable patch applied
##
## Revision 1.63  2000/12/04 08:24:29  peterg
## Added swithc logic declarations
##
## Revision 1.62  2000/12/03 17:15:18  peterg
## *** empty log message ***
##
## Revision 1.61  2000/11/10 14:46:53  peterg
## More fixes to avoid interpering variables as funs - basicly all
## functions now have at least ()
##
## Revision 1.60  2000/11/10 09:38:30  peterg
## Got rid of sys_name functions with no ()
##
## Revision 1.59  2000/11/10 09:29:31  peterg
## Changed the name regexp to be at least 3 characters long
##  - avoids problem translating som state files - but needs more work
##
## Revision 1.58  2000/10/17 09:54:29  peterg
## replaced switchopen by logic
##
## Revision 1.57  2000/10/15 10:35:35  peterg
## Fixed _input.p header
##
## Revision 1.56  2000/10/14 09:14:24  peterg
## *** empty log message ***
##
## Revision 1.55  2000/10/11 09:06:17  peterg
## New csex rep (uses scope optimisation)
##
## Revision 1.54  2000/09/30 14:10:06  peterg
## Zap lines containing "Remove in mtt_m2p"
##
## Revision 1.53  2000/08/24 17:10:59  peterg
## New dummy variables mtt_o (for optimisation), mtt_s (for segmentation)
##
## Revision 1.52  2000/08/24 08:30:45  peterg
## *** empty log message ***
##
## Revision 1.51  2000/08/01 12:25:24  peterg
## Some changes to include files
##
## Revision 1.50  2000/05/19 17:46:41  peterg
## New version of state with par argument
##
## Revision 1.49  2000/05/18 09:45:45  peterg
## Fixed missing ;
##
## Revision 1.48  2000/05/18 09:39:38  peterg
## Removed fifth argument from _input
##
## Revision 1.47  2000/05/16 18:56:03  peterg
## Upgraded for new simulation approach - uses data files to input
## parameters -- no more argv stuff
##
## Revision 1.46  2000/05/16 11:59:01  peterg
## Updated for new data file parameter/state update
##
## Revision 1.45  2000/05/13 13:16:52  peterg
## Matrix initialisation for smxa
##
## Revision 1.44  2000/05/13 11:52:16  peterg
## A now matrix in smxa rep
##
## Revision 1.43  2000/05/11 19:35:16  peterg
## Major revisions for new paprameter passing versions
##
## Revision 1.42  2000/04/18 11:11:44  peterg
## mtt_parameters ---> mttpar
## mtt_n_parameters ---> mttnpar
##
## Revision 1.41  2000/04/18 10:13:43  peterg
## Getargs now after numpar file
##
## Revision 1.40  2000/04/07 19:09:04  peterg
## New smxa and smxax reps
##
## Revision 1.39  2000/04/07 13:38:13  peterg
## New mtt_getsize to replace bc
##
## Revision 1.38  2000/04/07 13:24:41  peterg
## Modified for smxa and smxax
##
## Revision 1.37  2000/04/07 08:17:37  peterg
## Added mttpar to the arg list of cse and cseo
##
## Revision 1.36  1999/11/29 06:49:26  peterg
## Upped number of mtt_tnn
##
## Revision 1.35  1999/11/15 22:47:17  peterg
## Generates method-specific code for the ode2odeso rep.
##
## Revision 1.34  1999/10/28 05:08:48  peterg
## Added elseif
##
## Revision 1.33  1999/09/17 04:25:01  peterg
## END --> END; in translation
##
## Revision 1.32  1999/08/29 06:54:42  peterg
## Added code (mtt_parameters, get args etc) to allow arguments to the
## a.out file
##
## Revision 1.31  1999/08/02 13:40:03  peterg
## Added zero-state and zero_input to include list
## Removed zero_matrix
##
## Revision 1.30  1999/04/20 06:16:46  peterg
## Removed calls to _switch.m
##
## Revision 1.29  1999/04/02 06:27:55  peterg
## Modified for new implicit method with swoitches
##
## Revision 1.28  1999/02/17 02:59:54  peterg
## Added -q switch to mtt
##
## Revision 1.27  1999/02/16 21:56:52  peterg
## Now gets standard include files directly from source,
##
## Revision 1.26  1999/02/16 21:43:54  peterg
## Revises smx generation.
##
## Revision 1.25  1999/02/16 04:38:09  peterg
## Now forces creation of _smx file if METHOD=IMPLICIT in simpar.txt
##
## Revision 1.24  1998/11/18 16:56:15  peterg
## Now handles comments after IFS
##
## Revision 1.23  1998/11/18 14:38:01  peterg
## Now convert ALL globals to VAR .. the last one isn't repeated now
##
## Revision 1.22  1998/11/17 17:39:45  peterg
## Put _smx include at end of list (?????)
##
## Revision 1.21  1998/11/17 17:26:11  peterg
## Put sign.p first
##
## Revision 1.20  1998/10/01 16:01:09  peterg
## Now does implicit integration with switches
##
## Revision 1.19  1998/09/29 15:37:18  peterg
## Declare mttINPUT
##
## Revision 1.18  1998/08/27 08:55:40  peterg
## Mods to integration methods
##
## Revision 1.17  1998/08/27 07:38:40  peterg
## About to change to new integration (Euler/Implicit only)
##
## Revision 1.16  1998/08/19 08:46:00  peterg
## Now translates ; % to #
##
## Revision 1.15  1998/08/15 13:46:01  peterg
## Included new sparse update routines
##
## Revision 1.14  1998/08/12 15:21:12  peterg
## Added type definition for the SVD procedures
##
## Revision 1.13  1998/08/11 09:32:07  peterg
## Added comments at procedure begin and end.
##
## Revision 1.12  1998/07/30 11:30:42  peterg
## Included zeros function
##
## Revision 1.11  1998/07/29 14:18:34  peterg
## Reorganised rep dependednt output
##
## Revision 1.10  1998/07/27 20:26:15  peterg
## Added new VARs mttWSTEPS, MTTWMIN,mttWMAX
##
## Revision 1.9  1998/07/27 17:20:42  peterg
## Allow , between ()
##
## Revision 1.8  1998/07/26 19:38:17  peterg
## Replaced t0..t9 by mtt_temp0..
##
## Revision 1.7  1998/07/25 20:06:23  peterg
## Does the mtt_update function
##
## Revision 1.6  1998/07/25 16:59:40  peterg
## Give other procedures local i,j vars.
##
## Revision 1.5  1998/07/25 15:06:17  peterg
## Added DDT VAR
##
## Revision 1.4  1998/07/25 15:05:54  peterg
## DD
##
## Revision 1.3  1998/07/25 14:03:30  peterg
## Added () to [] conversion when the variable is i j k or an integer or
## combination
##
## Revision 1.2  1998/07/25 12:39:57  peterg
## begin on same line as for and if
##
## Revision 1.1  1998/07/25 09:42:52  peterg
## Initial revision
##
###############################################################



# Set up variables
args=`echo $1 | sed 's/_/ /' | sed 's/\./ /'`
Sys=`echo $args  | awk '{print $1}'`
sys=`echo $Sys  | awk '{print tolower($1)}'`
rep=`echo $args  | awk '{print $2}'`
Sys_rep="$Sys""_""$rep"
Sys_smx="$Sys""_smx"
Sys_smxp="$Sys""_smx.p"
Filename="$Sys""_""$rep.p"
filename="$sys""_""$rep.p"

Method=$2; # The integration method
Stdin=$3;  # Using standard input

if [ -n "$Method" ]; then
  MethodBlurb=" with $Method integration method"
fi

if [ -n "$Stdin" ]; then
   StdinBlurb=" using standard input"
fi

# Inform user
  echo Creating $Filename $MethodBlurb $StdinBlurb 

# Find system constants
Nx=`mtt_getsize $Sys x` # States
Nxx=`mtt_getsize $Sys xx` # States x States
Nu=`mtt_getsize $Sys u` # Inputs 
Ny=`mtt_getsize $Sys y` # Inputs 
Npar=`wc -l $Sys\_sympar.txt | awk '{print $1}'`


#if [ "$rep" = "simpar" ]; then
#    mtt -q $Sys smx p
#fi

# Heading
(case $rep in
    state)
        echo "PROCEDURE $Sys_rep(VAR mttx : StateVector; 
                                     mttpar : ParameterVector);"
        ;;
    numpar)
        echo "PROCEDURE $Sys_rep(VAR mttpar : ParameterVector);"
        ;;
    simpar)
        echo "PROCEDURE $Sys_rep(VAR mttsimpar : SimulationParameters);"
        ;;
    input)
        echo "PROCEDURE $Sys_rep(VAR mttu : InputVector;"
	echo "                       mttx : StateVector;"
	echo "                       mtty : OutputVector;"
	echo "                       mttt : REAL;"
	echo "                       mttpar : ParameterVector);"
	;;
    logic)
	echo "PROCEDURE $Sys_rep(VAR mttopen : StateVector;"
	echo "                       mttx : StateVector;"
	echo "                       mttu : InputVector;"
	echo "                       mttt : REAL;"
	echo "                       mttpar : ParameterVector);"
	;;
    ode)
	echo "PROCEDURE $Sys_rep(VAR mttdx: StateVector;"
	echo "                       mttx : StateVector;"
	echo "                       mttu : InputVector;"
	echo "                       mttt : REAL;"
	echo "                       mttpar : ParameterVector);"
	;;
    odeo)
	echo "PROCEDURE $Sys_rep(VAR mtty : OutputVector;"
	echo "                       mttx : StateVector;"
	echo "                       mttu : InputVector;"
	echo "                       mttt : REAL;"
	echo "                       mttpar : ParameterVector);"
	;;
    csex)
	echo "PROCEDURE $Sys_rep(VAR mttedx: StateVector;"
	echo "                       mttx : StateVector;"
	echo "                       mttu : InputVector;"
	echo "                       mttt : REAL;"
	echo "                       mttpar : ParameterVector);"
	;;
    cseo)
	echo "PROCEDURE $Sys_rep(VAR mtty : OutputVector;"
	echo "                       mttx : StateVector;"
	echo "                       mttu : InputVector;"
	echo "                       mttt : REAL;"
	echo "                       mttpar : ParameterVector);"

	;;
    smx )
	echo "PROCEDURE $Sys_rep(VAR mtta       : StateMatrix;"
	echo "                   VAR mttax      : StateVector;"
	echo "                       mttx       : StateVector;"
	echo "                       mttu       : InputVector;"
	echo "                       mttdt      : REAL;"
	echo "                       mttpar     : ParameterVector);"
	;;
    smxa )
	echo "PROCEDURE $Sys_rep(VAR mtta       : StateMatrix;"
	echo "                       mttx       : StateVector;"
	echo "                       mttu       : InputVector;"
	echo "                       mttt      : REAL;"
	echo "                       mttpar     : ParameterVector);"
	;;
    smxax )
	echo "PROCEDURE $Sys_rep(VAR mttax      : StateVector;"
	echo "                       mttx       : StateVector;"
	echo "                       mttu       : InputVector;"
	echo "                       mttt      : REAL;"
	echo "                       mttpar     : ParameterVector);"
	;;
    ode2odes)
	echo "PROGRAM $Sys_rep;"
        echo ""
	echo "CONST"
	echo "    MTT_MaxParameters = 100;"
	echo "    MTT_Npar = $Npar;"
	echo "    MTT_Nx = $Nx;"
        echo ""
	echo "TYPE"
	echo "    StateVector  = ARRAY[1..$Nx] OF REAL;"
	echo "    InputVector  = ARRAY[1..$Nu] OF REAL;"
	echo "    OutputVector = ARRAY[1..$Ny] OF REAL;"
	echo "    ParameterVector = ARRAY[1..$Npar] OF REAL;"
	echo "    SimulationParameters = RECORD"
	echo "    dt, first, input, last, stepfactor, wmax, wmin, wsteps: REAL"
	echo "                           END;"
	echo "    StateMatrix  = ARRAY[1..$Nx,1..$Nx] OF REAL;"
	echo "    StateMatrixVector  = ARRAY[1..$Nxx] OF REAL;"
	echo "    glnparray    = StateVector;"
	echo "    glmparray    = StateVector;"
	echo "    glnarray     = StateVector;"
	echo "    glnpbynp     = StateMatrix;"
	echo "    glmpbynp     = StateMatrix;"
	## echo "    IntegrationMethod = 1..4;"
	echo ""
	echo "VAR"
	echo "    simpar                      : SimulationParameters;"
        echo "    t,ddt                       : REAL;"
	echo "    x,x0,dx,AAx                 : StateVector;"
	echo "    mttx,mttdx,mttAAx,mttedx    : StateVector;"
	echo "    u,mttu                      : InputVector;"
	echo "    y,mtty                      : OutputVector;"
	echo "    par                         : ParameterVector;"
	echo "    mttpar                      : ParameterVector;"
	echo "    mttnpar                     : INTEGER;"
	echo "    AA,mtte                     : StateMatrix;"
	echo "    MTTi,MTTj,it,iLast: INTEGER;"
	##echo "    mttSTEPFACTOR,mttWSTEPS,mttSTEPS,mttINPUT : INTEGER;"
	## echo "    mttMETHOD : IntegrationMethod;"
	echo "    open_switches  : StateVector;"
	echo "    numparfile, statefile, simparfile  : TEXT;"
        strip_comments <${Sys}_switch.txt |\
          awk '{printf("%s_logic : REAL;\n", tolower($1))}' 
	echo ""
        mtt_txt2declare $Sys sympar p
        mtt_txt2declare $Sys struc p
        ;;
#    switchopen)
#	echo "PROCEDURE $Sys_rep(VAR open : StateVector; mttx : StateVector);"
#	echo "VAR"
#	echo "    MTTi,MTTj :  INTEGER;"
#	;;
    *)	echo "PROCEDURE $Sys_rep;"
	echo "VAR"
	echo "    MTTi,MTTj :  INTEGER;"
        ;;
esac) > $Filename

cat<<EOF >> $Filename

{*** System $Sys, rep $rep, language Pascal, file $Filename ***}
{*** Translated by MTT from $Sys_rep.m on `date` ***}

EOF

# Regexps
  name="[a-zA-Z0-9_]*"
  fun_name="$Sys\_$name"
  mttfun_name=$name
  tab='	'
  space="[ $tab]*"
  spaces="[ $tab][ $tab]*"
  non_space="[^ ]*"
  args='[a-zA-Z0-9,._"]*'

# Body	
fix_operators ()
{
    m_neq="(\!\=)|(\~\=)"
    m_not="\!"
    m__eq="\=\="

    p_neq="\<\>"
    p_not="NOT\ "
    p__eq="\="

    sed "s/$m_neq/$p_neq/g"	|\
    sed "s/$m_not/$p_not/g"	|\
    sed "s/$m__eq/$p__eq/g"
}

cat $Sys_rep.m |\
grep -v 'Remove in mtt_m2p'  |\
grep -v '^[ ]*function'  |\
grep -v '^[ ]*endfunction'  |\
grep -v 'MTT_data'  |\
sed "s/^$space%/#/" | sed "s/\([;)]$space\)%/\1#/" |\
awk -F# '{printf("%s",$1) 
          if (NF>1) printf("{* %s *}", $2)
          printf("\n") 
         }' |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)/\2(\1)/" |\
sed "s/$space\($non_space\)$spaces=${spaces}zeros(\([0-9]*\),1)/zero_state(\1,\2)/" |\
sed "s/$space\($non_space\)$spaces=$spaces\($fun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/,)/)/" |\
fix_operators |\
awk '
function printvar(Name,N) {
  if (N<1) return;
  width = 10;
  kk = 0; 
  for (k=1;k<=N;k++) {
    printf("mtt%s%i", Name, k);
    if (k==N)
      printf(" : REAL;\n")
    else
      printf(", "); 
    kk++;
    if (kk==width){printf("\n"); kk=0}
  }
}
BEGIN{
  comment_regexp = "{"
  doing_header = 0
  doing_globals = 0
  N_tmp = 100;
  inc ="$I"
}
{
  if ($1=="global") 
    doing_globals = 1
  else{ 
    if (doing_globals==1){
      global[++i]=$1; 
      if (match($0,";")==0){
      }
      else{
        doing_globals = 0
        doing_header = 1
      }
    }
    else 
    {
      if (doing_header==1){
        if (rep=="ode2odes"){
          printf("\n{%s $MTTPATH/trans/p/mtt_write.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_par_update.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/sign.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_euler.p}\n",inc)
          #printf("{%s $MTTPATH/trans/p/mtt_solve.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/mtt_implicit.p}\n",inc)
          #printf("{%s $MTTPATH/trans/p/zero_matrix.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/zero_input.p}\n",inc)
          printf("{%s $MTTPATH/trans/p/zero_state.p}\n",inc)
          printf("{%s %s_simpar.p}\n",inc,Sys) 
          printf("{%s %s_numpar.p}\n",inc,Sys)
          # printf("{%s $MTTPATH/trans/p/mtt_getargs.p}\n",inc)
          printf("{%s %s_state.p}\n",inc,Sys)
          printf("{%s %s_input.p}\n",inc,Sys)

          if (Method=="euler") {
            printf("{%s %s_ode.p}\n",inc,Sys)
            printf("{%s %s_odeo.p}\n",inc,Sys)
          }
          if (Method=="implicit") {
            printf("{%s %s_csex.p}\n",inc,Sys)
            printf("{%s %s_cseo.p}\n",inc,Sys)
            printf("\n{%s %s_smxa.p}\n",inc,Sys);
            printf("\n{%s %s_smxax.p}\n",inc,Sys);
          }
          printf("{%s %s_logic.p}\n\n",inc,Sys)

          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("\nBEGIN{%s}\n", Sys_rep)
          printf("  open(statefile,\"%s_state.dat\");\n", Sys)
          printf("  open(simparfile,\"%s_simpar.dat\");\n", Sys)
          printf("  open(numparfile,\"%s_numpar.dat\");\n", Sys)
        }
        else{
          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("VAR \n");
          for (k=1;k<i;k++) printf("  %s,\n",global[k])
          printf("%s : REAL;\n", global[i])
          printvar("x",Nx);
          printvar("u",Nu);
          printvar("y",Ny);
	  if ((rep=="ode")||(rep=="odeo")||(rep=="csex")||(rep=="cseo")||(rep=="smx")||(rep=="smxa")||(rep=="smxax")){
	    printvar("_tmp",N_tmp);
	    printvar("_s",N_tmp);
	  }
          printf("VAR mtt_i, mtt_j : INTEGER;\n");
          #if ( (rep=="smxa")||(rep=="smxax") ) {
          #  printvar("_t",Nt);
          #}
          printf("\nBEGIN{%s}\n", Sys_rep)
          if (rep=="smxa"){
            printf("FOR mtt_i:= 1 to %i DO\n\tFOR mtt_j:= 1 to %i DO\n\tmtta[mtt_i,mtt_j] := 0;\n", Nx,Nx);
          }
          if (rep=="smxax"){
            printf("FOR mtt_i:= 1 to %i DO\n\tmttax[mtt_i] := 0;\n", Nx);
          }
       }
        doing_header = 0;
      }
      if (match($1,comment_regexp)>0){
        if (doing_header==1)
          comment[++j] = $0
        else
          printf("%s\n", $0)
      }
      else {
        if ($1=="if") {
          sub(/==/, "=", $0)
            gsub(/&&/," AND ",$0)
            gsub(/\|\|/," OR ",$0)
          printf("%s THEN BEGIN\n", $0)
        }
        else { 
          #if ((match($1,"mtt_write")>0)&&(length(Stdin)>0)) {
          # sub(/mtt_write/, "if NOT eof THEN mtt_write");
          #}
          if ($1=="for"){
            if (($2=="it")&&(length(Stdin)>0)){
	      printf("WHILE NOT eof DO BEGIN {Integration loop}\n")
            }
            else {
              sub(/:/," TO ",$0)
              sub(/=/,":=",$0)
              printf("%s DO BEGIN\n", $0)
            } 
          }
          else{
            sub(/=/,":=",$0)
            sub(/endif/,"END;{IF}",$0)
            sub(/endfor/,"END;{FOR}",$0)
            sub(/elseif/,"END ELSEIF BEGIN",$0)
            sub(/else/,"END ELSE BEGIN",$0)
            gsub(/\^/,"**",$0)
            gsub(/&&/," AND ",$0)
            gsub(/\|\|/," OR ",$0)
            printf("%s\n",$0)
          }
        }
      }
    }
  }
}
END{
  if (rep=="def"){
    printf("EULER = 1,\n")
    printf("IMPLICITL = 2;\n")
    printf("IMPLICIT = 3;\n")
    }
    else
      if (rep=="ode2odes")
                printf("END{%s}.\n", Sys_rep)
      else
        printf("END{%s};\n", Sys_rep)
}' Sys=$Sys sys=$sys Sys_rep=$Sys_rep rep=$rep \
   Nx=$Nx Nu=$Nu Ny=$Ny Method=$Method Stdin=$Stdin |\
sed 's/\\$//'    |\
sed 's/(\([ijk0-9,]*\))/\[\1\]/g'    |\
sed 's/(\(MTT[ijk0-9],[0-9]*\))/\[\1\]/g' |\
sed 's/(\([0-9]*,MTT[ijk0-9]\))/\[\1\]/g' |\
sed 's/(\(MTT[ijk0-9],MTT[ijk0-9]\))/\[\1\]/g' |\
sed 's/(\(MTT[ijk0-9,]*\))/\[\1\]/g'  |\
sed 's/switcha(mttAA,/switcha(/g'   |\
sed 's/switch(MTTx,/switch(/g'  |\
sed 's/if nargin<[1-9] THEN//'  |\
sed 's/if nargin>[0-9] THEN//'  \
>> $Filename

# p2c doesn't like mixed case filenames!
#if [ "$Filename" != "$filename" ]; then
#  echo Creating $filename
#  cp -f $Filename $filename
#fi

if [ "$rep" = "ode2odes" ]; then
    # Explicitly include files
    mtt_pinclude $Filename>junk.p
    mv junk.p $Filename
fi



Deleted mttroot/mtt/bin/trans/mtt_make_menu version [b7552da8d5].

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
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










































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_make_menu
# Creates tk/tcl menus for xmtt.
# Copyright (c) P.J.Gawthrop, 1998,1999

## Paths for its files
dotfile="$HOME/.mtt"
xdotfile="${dotfile}/xmtt"

repfile="${xdotfile}/reps"
exfile="${xdotfile}/examples"

#MTT blurb
title=`mtt --version`

#Collect all systems (inc dir name)
pwd=`pwd`;
dirname=`basename $pwd`
systems=`echo *_abg.fig | sed 's/\([a-zA-Z0-9]*\)_abg.fig/\1/g'`
dirname_in_systems=`echo $systems | grep -c $dirname`
if [ "$dirname_in_systems" = "0" ]; then
    systems="$systems $dirname"
fi

# Default system
system=$dirname

cat<<EOF
# Default system
set system "$system"

# Arguments to mtt
set args {-q}

# Default the again command
set mtt {mtt \$args warranty}

# The top level menu
button .mtt -text "$title \n Directory: $dirname \n NO WARRANTY \n (press for details)" -command "exec mtt warranty &"
menubutton .man -text "Manual" -menu .man.man
menubutton .util  -text "Utilities" -menu .util.util
menubutton .opt  -text "Options" -menu .opt.opt
menubutton .sys -text "Systems" -menu .sys.sys
menubutton .rep -text "Representations (major)" -menu .rep.rep
menubutton .repall -text "Representations (all)" -menu .repall.repall
menubutton .exam -text "Examples" -menu .exam.exam
#button .again -text "Again" -command "exec echo \$mtt &; exec \$mtt  &"
button .mtt_quit -text "Quit" -command exit
pack .mtt .exam .rep  .repall .sys  .util .opt  .man .mtt_quit

 
menu .man.man
.man.man add command -label "Browser (html)" -command "exec mtt -q hinfo &"
.man.man add command -label "Info" -command "exec xterm -e mtt -q info &"
.man.man add command -label "Text (ps)" -command "exec mtt -q manual &"

menu .util.util
# .mtt.opt.util add command -label "copy example" -command 
# .mtt.opt.util add command -label "copy" 
.util.util add command -label "clean" -command "exec mtt -q Clean &"
.util.util add command -label "recursive clean" -command "exec mtt -q rclean &"

menu .opt.opt


# System choice
menu .sys.sys
EOF

for sys in $systems; do
    echo .sys.sys add radio -label "$sys"  -command {set system "$sys"} 
done

# Create the options menu
mtt |  awk '{
  if (Options) {
    option=substr($1,2);
    label="";
    for (i=2;i<=NF;i++)
      label = sprintf("%s %s",label,$i);
    printf(".opt.opt add check -label \"%s (-%s)\" -variable %s -command {set args \"$args -%s\" }\n", label, option, option, option); 
  }
  if ($1=="Options:") Options = 1;
}'

# Examples menu
cat <<EOF
menu .exam.exam
EOF

echo '#' Examples menu
strip_comments <${exfile} | examples_txt2tk

# Representations menu
echo '#' Representations menu
cat<<EOF
menu .rep.rep
menu .repall.repall
EOF

strip_comments <${repfile}  | reps_txt2tk 

Deleted mttroot/mtt/bin/trans/mtt_make_sim version [d2886556d7].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238














































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

   ###################################### 
   ##### Model Transformation Tools #####
   ######################################


# Bourne shell script: mtt_make_sim
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## 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
##
## Revision 1.5  2000/05/17 16:01:42  peterg
## Fixed bug for n_y>1
##
## Revision 1.4  2000/05/16 18:57:15  peterg
## Still debugging
##
## Revision 1.3  2000/05/16 11:59:34  peterg
## Stard new version with data files not argv.
##
## Revision 1.2  2000/05/11 19:32:29  peterg
## Put in c version + sensitivity computation
##
## Revision 1.1  2000/04/08 10:43:26  peterg
## Initial revision
##
###############################################################

# Tell user
Sys=$1
method=$2
computation=$3

if [ -z "$method" ]; then
    method=implicit    
fi

if [ -n "$computation" ]; then
   blurb="for language $computation"    
fi

echo  "Creating $1_sim.m with $method integration method $blurb"

if [ $method = "implicit" ]; then
    ode=cse
    odeo=cseo
else
    ode=ode
    odeo=odeo
fi

# Find system constants
Nx=`mtt_getsize $Sys x` # States
Nu=`mtt_getsize $Sys u` # Inputs 
Ny=`mtt_getsize $Sys y` # Inputs 
Npar=`wc -l $Sys\_sympar.txt | awk '{print $1}'`

# Header
lang_header -noglobals $1 sim m 'x0,u,t,par,sensitivities' '[y,ys]' > $1_sim.m

cat >> $1_sim.m <<EOF
##  tick=time; 
  if nargin<5
    sensitivities = [];
  endif;

  ##Sizes
  N = length(t);
  [n_u,N_u] = size(u);

  ## Doing sensitivities (assumes sensitivity system is invoked)
  n_sens = length(sensitivities);
  doing_sensitivities = (n_sens>0);
  if doing_sensitivities
    n_y = $Ny/2;
    doing_state=0;
    ys = [];
  else
    n_y = $Ny;
    doing_state=(nargout>1);
  endif;



  ## Initialise
  ui = zeros(n_u,1);	# Initial control
  [xi] = x0;	        # Read in initial state

  ## Timing parameters
  first = t(1);
  dt = t(2) - t(1);
  n_t = length(t);
  last = t(n_t);
EOF

if [ "$computation" = "c" ]; then
cat >> $1_sim.m <<EOF
  T = "";
  S = "";

  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);
      else # not doing_state
        command = sprintf("./$1_ode2odes.out< $1_input.dat | cut -f %i-%i | tail -%i;", i_1,i_2,n_t);
      endif

  ## Execute external programme
  S = [S;sprintf("Run %i\t",i_sim)];
  tim = time;
  yy_str=system(command);
  dtime = time-tim;
  T = [T; num2str(dtime)];

  ## Convert data
  S = [S;sprintf("Conv %i\t",i_sim)];
  tim = time;
  yy = str2num(yy_str)'; #'
  dtime = time-tim;
  T = [T; num2str(dtime)];


  [N_yy,M_yy] = size(yy);

  if i_sim==1
    if doing_sensitivities
      y = yy(1:n_y:2*n_y,:);              # Output
      ys = yy(2:n_y:2*n_y,:);
    else
      y = yy(1:n_y,:);
    endif;
    if doing_state 
      i_1 = n_y+1;
      i_2 = i_1 + $Nx - 1;
      ys = yy(i_1:i_2,:);
    endif;
  else # i_sim>1
    if doing_sensitivities
      ys =  [ys; yy(2:n_y:2*n_y,:)];
    endif; 
  endif

   endfor;
  ##RealTime = [S T]
endfunction

EOF
    
else

cat >> $1_sim.m <<EOF    
  A = zeros($Nx,$Nx);
  Ax = zeros($Nx,1);
  dx = zeros($Nx,1);

  ## Step size
  dt = t(2)-t(1);
  iFirst = first/dt;
  for i = 1:N
    ti = t(i);
    ui = u(:,i);
    yi = $1_cseo(xi,ui,ti,par);    # Output 
    y(:,i) = yi;
    x(:,i) = xi;
    dxi = $1_cse(xi,ui,ti,par); # State derivative
    A = $1_smxa(xi,ui,dt,par);	# (I-Adt)
    #A = reshape(A,$Nx,$Nx);
    Ax = $1_smxax(xi,ui,dt,par);	# (I-Adt)x
    #open = eval(sprintf("%s_switchopen(x);", system_name));        # Open switches
    #x = mtt_implicit(x,dx,A,Ax,dt,$Nx,zeros(20,1)); # Implicit update
    xi = A\(Ax + dxi*dt);        # Implicit update
  endfor;			

endfunction
EOF
fi

Deleted mttroot/mtt/bin/trans/mtt_make_substruc version [39e2eb4e04].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

# Makes subsystem structure files for partitioning
# Copyright (C) 2000 by Peter J. Gawthrop

sys=$1
rep=$2
lang=$3

echo Creating structure files for subsystems
# Get subsystems
  subsystems=`mtt_get_subsystems -strip ${sys}`;

for subsystem in $subsystems; do
  grep $subsystem < ${sys}_struc.txt > ${sys}_${subsystem}_struc.txt
done

Deleted mttroot/mtt/bin/trans/mtt_make_subsystems version [9acb3856cd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

# Makes subsystems for partitioning
# Copyright (C) 2000 by Peter J. Gawthrop

sys=$1
rep=$2
lang=$3

echo Creating subsystem representations for ${sys}_${rep}.${lang}
# Get subsystems
  subsystems=`mtt_get_subsystems -strip ${sys}`;

for subsystem in $subsystems; do
    
mtt $options -u -q -sub $subsystem ${sys} ${rep} ${lang}
    ## Repeating systems need sorting out !!!!
    #cp $1_$subsystem"_"$2.$3 $1_$subsystem"_1_"$2.$3
done

Deleted mttroot/mtt/bin/trans/mtt_make_sympar version [fab900c9ec].

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
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
123



























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_make_sympar
# Makes the sympar.txt file
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.9  2001/07/23 05:16:39  geraint
## Simple filter for Reduce reserved words in sympar.
##
## Revision 1.8  2001/07/04 06:00:12  gawthrop
## Fixed a funny with tr - changed SEPS and REPS - something to do with ^
##
## Revision 1.7  2001/04/13 07:14:12  geraint
## Implemented lower level lbl.txt recognition of #NOT[V|P]AR
##
## Revision 1.6  2001/04/10 12:54:50  gawthrop
## Minor fixes for sensitivity versions
##
## Revision 1.5  2000/11/03 14:57:06  peterg
## Corrected regexp notvar
##
## Revision 1.4  2000/11/02 18:53:46  peterg
## Added NOPAR words to unwanted list.
##
## Revision 1.3  2000/10/16 09:41:29  peterg
## Fixed bug with printing a blank line.
##
## Revision 1.2  2000/10/16 09:10:08  peterg
## Now strips out "unwanted" bits frome the _aliased.txt file
##
## Revision 1.1  2000/10/12 19:24:28  peterg
## Initial revision
##
##
###############################################################


sys=$1 # System name
filename=$1_sympar.txt
# Inform user
echo Creating $filename

# Create list of all sympars including those that are aliased
sh $1_type.sh 'echo ' ' ' ' ' |\
awk '{printf("abg2sympar_m2txt %s %s\n ", $1, $2)}' |\
sh | sort -u > mtt_all_sympar.txt

# Sort the aliased list
mtt_strip_args < $1_aliased.txt | sort -u  > mtt_aliased_sort.txt

# Create list of unwanted stuff
cat  mtt_aliased_sort.txt> mtt_unwanted.txt

notvar="[%|#]NOT[V|P]AR";
sh $1_type.sh 'strip_notvars.sh ' ' ' ' mtt_unwanted.txt'

sort -u mtt_unwanted.txt > mtt_unwanted_sort.txt

# Compare it with the aliased list and show the differences
diff mtt_all_sympar.txt mtt_unwanted_sort.txt |\
awk '{if ($1=="<") printf("%s\t%s\n", $2,$3)}' > mtt_sympar.txt

# Assume same name in different system is the same
awk '{
    if ($1==name){
	sysname[i++]=$2
    }
    
    if ($1!=name){
        if (length(name)>0){
          printf("%s\t",name)
          comma="";
          for (j=1;j<=i;j++){
            printf("%s%s", comma, sysname[j]);
            comma=",";
          }
          printf("\n")
        }
        i=1;
        sysname[1]=$2;
    }
    name = $1
}
END{
        printf("%s\t",name)
        comma="";
        for (j=1;j<=i;j++){
          printf("%s%s", comma, sysname[j]);
          comma=",";
        }
        printf("\n")

}' < mtt_sympar.txt >$filename

reserved_words=`\
    cat ${MTT_LIB}/reduce/reserved_words.txt	|\
    awk '{printf "%s ", $0}'			|\
    tr [a-z] [A-Z]`
sympar_words=`\
    cat ${filename}				|\
    cut -f1					|\
    awk '{printf "%s ", $0}'			|\
    tr [a-z] [A-Z]`
flag=0
for reserved_word in ${reserved_words}; do
    for sympar_word in ${sympar_words}; do
	if [ ${sympar_word} = ${reserved_word} ]; then
	    echo ""
	    echo "*** MTT Warning:"
	    echo "    ${sympar_word} is reserved (Reduce)"
	    echo ""
	fi
    done
done

Deleted mttroot/mtt/bin/trans/mtt_mend_lines version [b94de50d4f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

# Copyright (C) 2000 by Peter J. Gawthrop

# Fixes broken lines from reduce.

#sed 's/[^#]\(.*\)[^;]$/\1\\/' 

awk '{
  if ((match($1,"#")==0)&&(match($1,"global")==0)&&(match($1,"endfunction")==0)) {
    if(match($0,";")!=length($0))
      printf("%s \\\n",$0)
    else
      print $0
  }
  else print $0
   
}'

Deleted mttroot/mtt/bin/trans/mtt_multi version [c98cabcb91].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

# Does mutiple commands down the hierarchy

command=$1
system=$2
rep=$3
lang=$4
relative_level=$5

current_level=`echo $system | awk '{N=split($1,foo,"_"); print N-1}'`

if [ -z "$relative_level" ]; then
  relative_level=0;    
fi

mtt_xargs.sh "ls" "$2*_$3.$4"  |\
awk '{
  level=split($1,foo,"_")-2;
  maxlevel = current_level +  relative_level;
  if (level<=maxlevel) print command, $0, "&";
'} command=$command relative_level=$relative_level current_level=$current_level

Deleted mttroot/mtt/bin/trans/mtt_name2array version [6eeef7468b].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_name2array

# Generates array elements from names
# Copyright (C) 2000 by Peter J. Gawthrop


case $2 in
    numpar)
        name=mttpar
	cat $1_sympar.txt>mtt_infile
	;;
    state)
        name=mttx
	awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \
        <$1_struc.txt >mtt_infile
	;;
    input)
        name=mttu
	awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \
        <$1_struc.txt >mtt_infile
	;;
    *)
	echo Repesentation $2 not supported
esac

case $3 in
    zero)
	  strip_comments <mtt_infile | grep "$filter"  |\
          awk '{
          i++; printf("  %s = 0.0;\n", tolower($1));
          }'
	;;
    set)
	  strip_comments <mtt_infile  |\
         awk '{
           i++; printf("  %s(%i)\t= %s;\n", name, i, tolower($1));
         }' name=$name
        ;;
    *)
         strip_comments <mtt_infile  |\
         awk '{
           i++; printf("  %s \t= %s(%i);\n", tolower($1), name, i);
         }' name=$name
	;;
esac




Deleted mttroot/mtt/bin/trans/mtt_p2C version [15da882620].

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
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



































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: p2C

# Pascal to a c program - intermediate step for mtt_p2oct
# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop

    #$Id$	


sys_rep="$1_$2"
begin="BEGIN{$sys_rep}"

# Inform user
# echo "Creating $1_$2.pas"

# Find system constants
Nx=`mtt_getsize $1 x`
Nxx=`mtt_getsize $1 xx`
Nu=`mtt_getsize $1 u`
Ny=`mtt_getsize $1 y`

Npar=`wc -l $1_sympar.txt | awk '{print $1}'`


echo "PROCEDURE $1_$2;" > $1_$2.pas
echo "TYPE"             >>$1_$2.pas
echo "    StateVector  = ARRAY[1..$Nx] OF REAL;"        >>$1_$2.pas
echo "    StateMatrix  = ARRAY[1..$Nx,1..$Nx] OF REAL;" >>$1_$2.pas
echo "    StateMatrixVector  = ARRAY[1..$Nxx] OF REAL;" >>$1_$2.pas
echo "    InputVector  = ARRAY[1..$Nu] OF REAL;"        >>$1_$2.pas
echo "    OutputVector  = ARRAY[1..$Ny] OF REAL;"       >>$1_$2.pas
echo "    ParameterVector  = ARRAY[1..$Npar] OF REAL;"  >>$1_$2.pas


# Create the predefined vars
echo "VAR"     >>$1_$2.pas
awk '{
       printf("%s,", $1)
     }
     END{print "JUNK : REAL;"}'< $1_sympar.txt     >>$1_$2.pas

if [ "$2" = "ode2odes" ]; then
    first='PROCEDURE'
    awk '
    {
    if (writing) print $0;
    if (i++==0) writing=1
    if (match($1,"PROCEDURE")==1) writing=0;
    }'  < $1_$2.p >>$1_$2.pas
else
    first='BEGIN'

 # Convert VAR format in the headings
    awk 'BEGIN{writing=1}
    {
    if (match($1,"BEGIN")==1) writing=0;
    if (writing) print $0;
    }'  < $1_$2.p | \
    sed \
	-e 's/PROCEDURE [a-zA-Z_0-9]*(VAR/VAR/' \
	-e 's/PROCEDURE [a-zA-Z_0-9]*;//' \
	-e 's/REAL);/REAL;/' \
	-e 's/OutputVector);/OutputVector;/' \
	-e 's/ParameterVector);/ParameterVector;/' \
	>>$1_$2.pas
fi

# Write out the actual code until the begining of the procedure
awk 'BEGIN{writing=0}
{
  if (match($1,first)==1) writing=1;
  if (writing) print $0;
  if (match($1,begin)==1) writing=0;

}' begin=$begin first=$first   < $1_$2.p  >>$1_$2.pas

# Write out the parameters
echo {Parameters}   >>$1_$2.pas
awk '{
       printf("  %s \t:= mttpar[%i];\n", $1, ++i);
     }'< $1_sympar.txt  >>$1_$2.pas

# Write out the actual code from the end of the procedure
awk 'BEGIN{writing=0}
{
  if (writing) print $0;
  if (match($1,begin)==1) writing=1;
}' begin=$begin   < $1_$2.p  >>$1_$2.pas

#echo "Creating $1_$2.C"
p2c -o $1_$2.C $1_$2.pas > mtt_p2C.log 2>> mtt_p2C.log


Deleted mttroot/mtt/bin/trans/mtt_p2c version [d5850baa69].

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
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
123
124
125
126
127































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh


     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_p2c
# Pascal to c converter for MTT
# Uses the wonderful GNU p2c by  Dave Gillespie, daveg@csvax.cs.caltech.edu.    
# P.J.Gawthrop July 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.12  2001/04/11 07:36:10  gawthrop
## Now uses system_cr.h in place of system.h in .c rep -
##   compatible with older code
##
## Revision 1.11  2001/03/29 19:24:14  gawthrop
## Can now use c representations of crs when using -c option
##
## Revision 1.10  2000/09/15 09:01:41  peterg
## Updated internal comments
##
## Revision 1.9  2000/05/16 18:56:58  peterg
## Now realised that libp2c.a avoids many probs - so simplified it.
##
## Revision 1.8  2000/05/11 19:34:50  peterg
## *** empty log message ***
##
## Revision 1.7  1999/08/29 06:14:27  peterg
## No longer remove "PASCAL_MAIN"
##
## Revision 1.6  1999/04/20 06:17:15  peterg
## Fudge to avoid a bizzare bug (?) in p2c which corrupts "zero_matrix"
##
## Revision 1.5  1998/08/12 14:14:18  peterg
## Added pretty heading and explicitly include p2c header.
##
## Revision 1.4  1998/07/29 13:56:34  peterg
## Replces p2c include by local include.
##
## Revision 1.3  1998/07/27 20:32:51  peterg
## Now gives immediate warnings
##
## Revision 1.2  1998/07/25 16:35:43  peterg
## Sorted out log files etc
##
## Revision 1.1  1998/07/25 16:28:38  peterg
## Initial revision
##
###############################################################


# Options
info=''
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;
                ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

## Create p2crc with various configs.
cat > p2crc <<EOF
EatNotes [221]   # No warning messages about symbols
EOF

# Inform user
echo Creating $1_$2.c

# Use p2c to do the translation 
p2c -V  $1_$2.p  | grep Warning # > mtt_p2c.log 2>> mtt_p2c.log
cat $1_$2.log >> mtt_p2c.log
mv $1_$2.c mtt_junk.c

# Change p2c.h include.
#mv $1_$2.c mtt_junk1#
#cat mtt_junk1 | grep -v 'p2c/p2c.h'> mtt_junk2

# pretty heading
DATE=`date`

cat <<EOF  >$1_$2.c
/* C program  $1_$2.c */
/* Generated by MTT on $DATE */

/* Compile with gcc -lm -lp2c $1_$2.c -o $1_$2.out */
/* Note that p2c must be correctly installed so that p2c.h and libp2c.a are accessible */

/* Header file for user-defined crs (implemented in c) */ 
#include "$1_cr.h"
EOF

#cat<<EOF >>$1_$2.c
#/* The following is the header file included here for completeness */
#EOF

#cat $MTTPATH/trans/c/p2c.h >> $1_$2.c

#cat <<EOF >> $1_$2.c
#/* End of the header file. */
#
#
#EOF

## The sed item is to avoid a bizzare bug (?) in p2c which corrupts "zero_matrix"
###cat mtt_junk2 | sed 's/zero_matrix/mttmat/g'>> $1_$2.c

## Sort out the pascal EOF, PASCAL_MAIN etc
cat mtt_junk.c |\
 grep -v PASCAL_MAIN >> $1_$2.c

if [ -n "$info" ]; then
    cat mtt_p2c.log
fi

# Remove the garbage
rm -f mtt_junk.c

Deleted mttroot/mtt/bin/trans/mtt_p2cc version [7206315b5e].

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
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























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_p2cc

# Pascal to .cc (for octave .oct files).
# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop

    #$Id$	

## Extract the system and rep names.
sys=`mtt_sysname $1` 
rep=`mtt_repname $1` 
sys_rep=$sys"_"$rep

# Find system constants
Nx=`mtt_getsize $sys x` # States
Nu=`mtt_getsize $sys u` # Inputs 
Ny=`mtt_getsize $sys y` # Inputs 

# Create the representation code
mtt_p2C $sys $rep

# Inform user
echo Creating $sys_rep.cc

# Create the c++ code
# Heading
date=`date`

cat > $sys_rep.cc <<EOF
#include <octave/oct.h>

DEFUN_DLD ($sys_rep, args, ,
	   "Usage: $sys_rep(x,u,t,par)\n$sys_rep was generated by MTT on $date")
{
  ColumnVector mttx = args(0).vector_value ();
  ColumnVector mttu = args(1).vector_value ();
  double mttt = args(2).double_value ();
  ColumnVector mttpar = args(3).vector_value ();

EOF

case "$rep" in
    ode)
	echo "  ColumnVector mttdx ($Nx);" >> $sys_rep.cc
	;;
    odeo)
	echo "  ColumnVector mtty ($Ny);" >> $sys_rep.cc
	;;
    cse)
	echo "  ColumnVector mttdx ($Nx);" >> $sys_rep.cc
	;;
    cseo)
	echo "  ColumnVector mtty ($Ny);" >> $sys_rep.cc
	;;
    smx | smxa | smxax)
        Nxx=`echo "$Nx*$Nx" | bc`
	echo "  Matrix mtta ($Nx,$Nx);" >> $sys_rep.cc
	echo "  ColumnVector mttax ($Nx);" >> $sys_rep.cc
	;;
    *)
	
esac

#Extract Type info
echo '/* Types */'                >> $sys_rep.cc
grep typedef $sys_rep.C              >> $sys_rep.cc

#Extract the rep code converting [] to () and deleting mtt variables etc
#The awk part detects the begin and end of the relevant code.
echo "/* Representation $rep information */" >> $sys_rep.cc
awk '{
  if ( (match($1,"}")==1)&&(NF>1)) writing=0;
  if ( (writing) && !(match($2,"mtt[a-z]")==1) ) print $0;
  if (match($1,"{")==1) writing=1;
}' <$sys_rep.C |\
sed 's/\[\([a-z0-9_]*\)\]\[\([a-z0-9_]*\)\]/(\1,\2)/g' |\
sed 's/\[\([a-z_0-9]*\)\]/(\1)/g' >> $sys_rep.cc

# Tail
cat >> $sys_rep.cc <<EOF

EOF

case "$rep" in
    ode)
        echo "return octave_value (mttdx);" >> $sys_rep.cc;
	;;
    odeo)
        echo "return octave_value (mtty); " >> $sys_rep.cc;
	;;
    cse)
        echo "return octave_value (mttdx);" >> $sys_rep.cc;
	;;
    cseo)
        echo "return octave_value (mtty); " >> $sys_rep.cc;
	;;
    smxa)
        echo "return octave_value (mtta); " >> $sys_rep.cc;
	;;
    smxax)
        echo "return octave_value (mttax); " >> $sys_rep.cc;
	;;
    *)
	
esac

# Terminating }
echo "}" >> $sys_rep.cc;

# Convert to octave loadable code
#echo Creating $sys_rep.oct
#mkoctfile $sys_rep.cc

Deleted mttroot/mtt/bin/trans/mtt_p2m version [2ad4e8ad5c].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh
## Chages the Pascal output from gentran to octave form
# Copyright (C) 2000 by Peter J. Gawthrop

sed 's/begin$//' |\
sed 's/end$//' |\
sed 's/end;$/;/' |\
sed 's/\[\([0-9,]*\)\]/(\1)/g' |\
sed 's/:=/ = /' |\
sed 's/\*\*/\^/g' |\
sed 's/mtt\([a-z]\)\([a-z]*\)\([0-9]\)\([0-9]*\)/mtt\1\2(\3\4)/g' |\
awk '{
  sub(/^[\ ]*/, "", $0)
  sub(/\$$/, ";", $0)
  
  if (match($NF,"[;#.%]$")==0){
    Previous[++i] = $0
  }
  else {
    for (j=1;j<=i;j++) printf("%s", Previous[j]);
    printf("%s\n", $0) 
    i=0;
  }
}' |\
sed 's/#/%/g'

Deleted mttroot/mtt/bin/trans/mtt_pdf.sty version [9e3fc0e565].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Style file for postscript document

\usepackage{mtt} % Common stuff

% Figure definition
\newcommand{\fig}[4]{
  \begin{figure}[htbp]
    \begin{center}
      \fbox{
        \pdfimage width #3\linewidth {#1.pdf}
        %\includegraphics[width=#3\linewidth]{#1.ps}
        }
        \caption{#4}
      \label{fig:#2}
    \end{center}
  \end{figure}
  }

% Hyper stuff
\usepackage[implicit=true,
            bookmarks=true,
            pdfauthor={MTT},
            pdftitle={MTT report},
            pdfsubject={MTT},
            pdfkeywords={MTT, bond graphs}]{hyperref}

Deleted mttroot/mtt/bin/trans/mtt_pinclude version [dd55a77a76].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
# pinclude - explicitly includes Pascal files - p2c has probs. doing this

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



awk ' {
  if ( (match($1,"{\\$I")>0) || (match($1,"\\*\\$I")>0) ) {
    sub(/}/,"",$2); 
    command=sprintf("mtt_pinclude %s",$2); 
    system(command)
  }
  else{
  print $0
  }
  

}' <$1

Deleted mttroot/mtt/bin/trans/mtt_prepend.sh version [83feb02b68].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

usage ()
{
cat <<EOF

Usage: $0 [-p] file1 file2

       prepend file1 to file2
    
    options:

      -p preserves time attribute

EOF
}

preserve=''
while [ -n "`echo $1 | grep '^-'`" ]; do
    case $1 in
	-p)
	    preserve='-p'
	    ;;
	-h)
	    usage
	    exit
	    ;;
	 *)
	    echo "Error: invalid option ($1)"
	    usage;
	    exit;
	    ;;
    esac
    shift
done

if [ $# -ne 2 ]; then
    usage;
    exit;
fi

file1=$1
file2=$2
tmp=mtt_prepend.sh_$file1_$file2.tmp

if [ ${preserve:=""} = "-p" ]; then
    time=mtt_prepend.sh_$file2.time
    touch -r $file2 $time
fi

cat $file1 $file2 > $tmp

if [ ${preserve:=""} = "-p" ]; then
    touch -r $time $tmp
    rm $time
fi

cp $preserve $tmp $file2
rm $tmp

Deleted mttroot/mtt/bin/trans/mtt_ps.sty version [b4ff449d16].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Style file for postscript document

\usepackage{mtt} % Common stuff

%Postscript figures 
\usepackage{graphicx}

% Figure definition
\newcommand{\fig}[4]{
  \begin{figure}[htbp]
    \begin{center}
      \fbox{
        \includegraphics[width=#3\linewidth]{#1.ps}
        }
        \caption{#4}
      \label{fig:#2}
    \end{center}
  \end{figure}
  }

Deleted mttroot/mtt/bin/trans/mtt_r2m version [6308144dd1].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_r2m
# Reduce to octave conversion
# Based on obsolete ode_r2m  and ode_r2lang
# Based on obsolete mtt_r2m_old
# P.J.Gawthrop 14 June 1991, 12 Jan 1994, April 1994, Jan 95, May 1998
# July 1998
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.29  2001/09/07 00:25:56  geraint
## Partial fix for insidious bug which eliminates lines of code when parameter
## names of the form (in* or off*) start continuation lines.
##
## Revision 1.28  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.27.4.1  2001/05/04 04:07:24  geraint
## Numerical solution of algebraic equations.
## sys_ae.cc written for unsolved inputs.
## Solution of equations using hybrd from MINPACK (as used by Octave fsolve).
##
## Revision 1.27  2001/02/08 00:39:56  geraint
## Removed clear from code generated by: mtt -c -i euler -o
##
## Revision 1.26  2000/11/27 11:52:10  peterg
## Changed some greps to be case insensitive
##
## Revision 1.25  2000/10/14 08:50:07  peterg
## Use new mtt_header
##
## Revision 1.24  2000/10/11 09:07:53  peterg
## Vectorisation
## csex rep.
##
## Revision 1.23  2000/10/10 21:00:43  peterg
## More reps added
##
## Revision 1.22  2000/09/15 08:27:07  peterg
## Removed debugging lines
##
## Revision 1.21  2000/08/30 11:43:40  peterg
## -optimise switch added
##
## Revision 1.20  2000/08/30 10:43:17  peterg
## Simplified version using GENTRAN matrix :=: matrix
## lang_matrix is no longer used at all
##
## Revision 1.19  2000/08/28 20:17:59  peterg
## Put in Winfried Neun's bug fix
## -- prevents segmentation violation using optimised gentran when matrix
## comtains a number
##
## Revision 1.18  2000/08/24 17:11:40  peterg
## Now optimises as well as segmenting - uses the SCOPE package
##
## Revision 1.17  2000/05/20 15:23:56  peterg
## Paramererised version of sm etc etc (using -parameter switch)
##
## Revision 1.16  2000/04/18 11:14:18  peterg
## Put in the -parameters option
##
## Revision 1.15  2000/02/10 14:58:57  peterg
## *** empty log message ***
##
## Revision 1.14  1999/12/08 02:06:00  peterg
## Now incudes csm rep.
##
## Revision 1.13  1999/11/23 00:59:14  peterg
## Now does ssm.m
##
## Revision 1.12  1999/11/15 22:57:20  peterg
## Removed a debugging line
##
## Revision 1.11  1999/11/01 21:20:14  peterg
## Removed the E matrix from the cse file.
##
## Revision 1.10  1999/10/27 07:38:30  peterg
## Now does cse version -- but not needed now exept for Euler integration
##
## Revision 1.9  1999/10/26 23:47:58  peterg
## Now does cse.m file
##
## Revision 1.8  1999/07/26 06:07:19  peterg
## Reinstated removal of the odeo.p file
##
## Revision 1.7  1999/03/16 00:38:06  peterg
## Done some more tidying up
##
## Revision 1.6  1999/03/15 07:29:25  peterg
## Fixed various obscure reduce bugs
## THIS NEEDS A MAJOR REWRITE!!!!
##
## Revision 1.5  1998/08/13 16:25:07  peterg
## Removed some documentation form odeo.m
##
## Revision 1.4  1998/08/13 15:10:47  peterg
## Change temp var name to mtt_t1 etc
##
## Revision 1.3  1998/08/13 12:43:19  peterg
## Cahnged tmp variable to mtt_1 etc
##
## Revision 1.2  1998/07/27 20:26:44  peterg
## Put in correct N and M values for dm rep
##
## Revision 1.1  1998/07/27 16:30:26  peterg
## Initial revision
##
###############################################################


# Args
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
    -noglobals)
	noglobals='-noglobals';
	;;
    -parameters)
	parameters='-parameters';
        par='mttpar'
	;;
    -optimise)
	;;
    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done

# Set up some strings
rep=$2
ext=m
out=$1"_"$rep.$ext

#Inform user
echo Creating $out

# Remove the old log file
rm -f mtt_r2m.log

#Header
case $rep in
    ae|csex|cseo|ode|odeo)
    vectorise=yes
       ;;
    *)
esac

    mtt_header  $1 $rep $ext  > mtt_junk

#Convert from the (optimised) r file
echo >> mtt_junk
echo '## Code' >> mtt_junk
strip_comments<$1_$2.r | tr [A-Z] [a-z] |\
grep -vi 'MATRIX ' |\
grep -vi 'END;' |\
grep -vi 'clear mtt' |\
grep -v '^off .*\$' |\
grep -v '^in .*\$' |\
sed \
    -e "s/^mtt/  mtt/" \
    -e "s/:=/=/" \
    -e "s/\\$/;/" \
 >> mtt_junk
echo '## END Code' >> mtt_junk
echo endfunction >> mtt_junk

# Mend broken lines
mtt_mend_lines < mtt_junk > mtt_junk_mended
# Vectorise (n,1) arrays when appropriate
if [ -n "$vectorise" ]; then
     mtt_vectorise <mtt_junk_mended >$out
else
     mv mtt_junk_mended $out
fi

# Now invoke the standard error handling.
#mtt_error_r mtt_r2m.log



Deleted mttroot/mtt/bin/trans/mtt_remove_underscore version [539a78771f].

1
2
3



-
-
-
#!/bin/sh

sed 's/_/\\_/g'

Deleted mttroot/mtt/bin/trans/mtt_repname version [35f149671a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_repname

# Returns the representation name from System_rep.lang

# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop

echo $1 | tr '.' '_' | awk -F '_' '{print $2}'

Deleted mttroot/mtt/bin/trans/mtt_strip_args version [9071d8da44].

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
68
69
70
71
72
73
74
75
76
77
78














































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: strip args
# Strips unwanted bits from a list of arguments
# Label file to symbolic parameters conversion
# Copyright (C) 2000 by Peter J. Gawthrop

## $Id$  ##
## $Log$
## Revision 1.5  2001/06/13 14:50:13  gawthrop
## Operator ^ now ok in args in abg and/or lbl
##
## Revision 1.4  2001/05/08 15:18:10  gawthrop
## Added trig and hyperbolic functions to argument exclusion list
##
## Revision 1.3  2000/10/17 12:33:13  peterg
## Added mtt_mod to the zapped list
##
## Revision 1.2  2000/10/16 09:06:26  peterg
## Write out the system as a second columns as well
##
## Revision 1.1  2000/10/16 09:04:04  peterg
## Initial revision
## ##
# Inform user
#echo "Creating $1_sympar.txt"

# Separation characters
SEPS='^=*;+/()-'
# Replace by ,
REPS='[,*]'


# This is the main transformation using gawk
tr $SEPS $REPS | \
awk '
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 {
 not_an_arg = "effort flow state internal external zero unknown\
                mtt_e mtt_f\
		sqrt exp log sign sin asin cos acos tan atan \
		sin asin cos acos tan atan \
		sinh asinh cosh acosh tanh atanh \
                none abs";
}
{
    args=$1
    sys=$2
    N=split(args, arg, ",");
    for (i=1;i<=N;i++){
      if ( (length(arg[i])>0)&&(matches(not_an_arg,arg[i])==0)&&(match(arg[i],"^[0-9]+[.]*")==0) ){
        printf("%s\t%s\n", arg[i], sys);
      }
  }
}' |\
grep -v '^\$' 



Deleted mttroot/mtt/bin/trans/mtt_sysname version [61d88d20d5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_sysname

# Returns the system name from System_rep.lang

# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop

echo $1 | awk -F '_' '{print $1}'

Deleted mttroot/mtt/bin/trans/mtt_txt2declare version [f28a37be46].

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
68
69
70
71
72
73
74
75











































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar_txt2declare

# Symbolic parameters to variable declaration
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/10/14 09:26:48  peterg
## Initial revision
##
## Revision 1.1  2000/10/11 09:08:20  peterg
## Initial revision
##

###############################################################

sys=$1
what=$2
language=$3

case $language in
    p)
        first="VAR";
        delim=", ";
        last=': REAL;';
	;;
    *)
	echo Language $language not supported - sorry; exit 1
esac

case $what in
    struc)
	strip_comments < $sys"_"$what".txt" | awk '{if (($1=="state")||($1=="input"))
                                                      print $4;
                                                   }' >mtt_names
	;;
    sympar)
      	strip_comments < $sys"_"$what".txt" | awk '{print $1}' >mtt_names
	;;
    *)
	echo Argument 2 must be struc or sympar
esac

# Start
cat<<EOF
$first
EOF
#Write out the variables 
awk '{
  i++; 
  var[i] = tolower($1);
}
END{
  n = i;
  for (i=1; i<n; i++){
    printf("%s%s",var[i], delim);
    j++; 
    if (j>4){
    printf("\n"); j=0;
    }
  }
  printf("%s%s\n",var[n], last);

}' "delim=$delim" "last=$last" mtt_names


Deleted mttroot/mtt/bin/trans/mtt_txt2m version [4f5082efa1].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285





























































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_txt2m
# Converts txt file to matlab file (for numpar and state)

# Copyright (c) P.J.Gawthrop 1998


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.15  2002/03/26 12:00:37  geraint
# %% Escaped characters to eliminate awk warnings.
# %%
# %% Revision 1.14  2001/07/13 04:54:04  geraint
# %% Branch merge: numerical-algebraic-solution back to main.
# %%
# %% Revision 1.13.4.2  2001/07/09 00:24:58  geraint
# %% input rep: Removed input name mapping, left state name mapping.
# %%
# %% Revision 1.13.4.1  2001/06/26 01:01:28  geraint
# %% Makes input and state names available for input rep.
# %%
# %% Revision 1.13  2001/02/05 03:33:18  geraint
# %% Convert user-defined txt to lower-case in translation.
# %% Required by logic.m (Octave is case sensitive).
# %%
# %% Revision 1.12  2000/11/08 11:20:49  peterg
# %% removed the empty matrix stuff
# %%
# %% Revision 1.11  2000/10/17 09:55:21  peterg
# %% Added logic rep
# %%
# %% Revision 1.10  2000/10/15 09:51:50  peterg
# %% Set array code in input rep
# %%
# %% Revision 1.9  2000/10/13 11:07:33  peterg
# %% Started conversion to new style state, input ext
# %%
# %% Revision 1.8  2000/09/30 13:53:07  peterg
# %% Default to empty matix in numpar.m -- avoids probs for parameter-free systems
# %%
# %% Revision 1.7  2000/05/19 17:46:17  peterg
# %% Give argument to state
# %%
# %% Revision 1.6  2000/05/19 14:59:03  peterg
# %% MTT --> mtt in fun output
# %%
# %% Revision 1.5  2000/05/19 14:05:10  peterg
# %% Zero parameters in the numpar.m file
# %%
# %% Revision 1.4  2000/05/18 12:05:42  peterg
# %% Replaced sympar by sympars in numpar rep
# %%
# %% Revision 1.3  2000/05/11 16:09:24  peterg
# %% Put in simpar.first parameter
# %%
# %% Revision 1.2  2000/05/11 12:16:46  peterg
# %% New version of simpar - with record
# %%
# %% Revision 1.1  2000/05/11 10:55:57  peterg
# %% Initial revision
# %%
# %% Revision 1.19  2000/02/11 13:35:16  peterg
# %% Added the new MTTpar generation
# %%
# %% Revision 1.18  1999/11/14 22:22:17  peterg
# %% Removed checks for implicit - now done at command-line level.
# %%
# %% Revision 1.17  1999/11/04 04:54:24  peterg
# %% Removed recreation of smx file.
# %%
# %% Revision 1.16  1999/03/06 02:18:10  peterg
# %% Changed argument list.
# %%
# %% Revision 1.15  1999/02/16 21:44:38  peterg
# %% Revised smx generation
# %%
# %% Revision 1.14  1999/02/16 04:38:22  peterg
# %% Now forces creation of _smx file if METHOD=IMPLICIT in simpar.txt
# %%
# %% Revision 1.13  1998/08/31 11:43:37  peterg
# %% Now lower cases globals in numpar files
# %%
# %% Revision 1.12  1998/08/14 10:47:31  peterg
# %% Put ImplicitS sub before Implicit!!
# %%
# %% Revision 1.11  1998/08/14 10:43:44  peterg
# %% Added ImplicitS - sparse integration
# %%
# %% Revision 1.10  1998/08/11 13:27:51  peterg
# %% Lowercase mttLAST etc
# %%
# %% Revision 1.9  1998/07/30 15:07:17  peterg
# %% Added _ to the disallowed chars around t
# %%
# %% Revision 1.8  1998/07/30 12:52:38  peterg
# %% Adds ; to end of statements
# %% Translates ' to " before removal
# %%
# %% Revision 1.7  1998/07/30 09:32:33  peterg
# %% Replaces:
# %% 	euler by 1
# %% 	implicitl by 1
# %% 	implicit  by 3
# %%
# %% Revision 1.6  1998/07/27 18:59:11  peterg
# %% Added WMIN etc
# %%
# %% Revision 1.5  1998/07/26 11:54:20  peterg
# %% Added  mtt to variables
# %%
# %% Revision 1.4  1998/07/26 09:50:12  peterg
# %% More forgiving of txt sytax.
# %%
# %% -- can use () or ()
# %% -- can use mttx() or x()
# %% -- can use mttu() or u()
# %%
# %% Revision 1.3  1998/07/25 20:40:35  peterg
# %% All vars in lower case now
# %%
# %% Revision 1.2  1998/07/25 09:48:31  peterg
# %% Tidied up for Pascal version
# %%
# %% Revision 1.1  1998/02/25 22:10:25  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

system=$1
representation=$2
outfile=$1_$2.m

tolower () { tr [A-Z] [a-z] ;}

# Inform user
echo Creating $outfile

#Create the rep  file complete with headers.
case $representation in
    input)
      name=mttu
      arraycode=$representation
      ;;
    logic)
      name=mttx
      ;;
    numpar)
       name=mttpar
      arraycode=$representation
      ;;
    simpar)
      ;;
    state)
      name=mttx
      arraycode=$representation
      ;;
    *)
      echo Representation $representation not supported
      exit
      #echo "function $name = $1_$2$arg" > $outfile
      #echo "%% $2 file ($1_$2.m)" >> $outfile
      #echo "%% Generated by MTT at `date`" >> $outfile
      #echo "% Global variable list" >>  $outfile
      #sympar2global_txt2m $1 >> $outfile
      ;;
esac

# Generate the header
mtt_header $system $representation m  > $outfile

## Special for logic rep
if [ "$representation" = "logic" ]; then
  echo >> $outfile
  echo "## Inputs" >> $outfile
  mtt_name2array $system input >> $outfile # Set up input by name
  echo >> $outfile
  echo "## States" >>$outfile
  mtt_name2array $system state >> $outfile # Set up state by name
fi

## Special for input rep
if [ "$representation" = "input" ]; then
  echo >> $outfile
  echo "## States" >>$outfile
  mtt_name2array $system state >> $outfile # Set up state by name
fi

## Special for simpar rep
if [ "$representation" = "simpar" ]; then
  cat >> $outfile<<EOF

## Defaults (in case of missing values in txt file)
  mttsimpar.first       =  0.0;      
  mttsimpar.last        =  10.0;      
  mttsimpar.dt          =  0.1;        
  mttsimpar.stepfactor  =  1;          
  mttsimpar.wmin        =  -1;         
  mttsimpar.wmax        =  2;          
  mttsimpar.wsteps      =  100;        
  mttsimpar.input       =  1; 

EOF
fi

# Write out the code from the txt file
echo >> $outfile
echo "## User defined code from $1_$2.txt" >> $outfile
cat  $1_$2.txt | strip_comments | grep -v METHOD |\
awk -F#  'BEGIN{
quote = "\047";
doublequote = "\042";
}
{
  N=split($1,a,"=");
  if (N==2) {
    LHS = a[1];
    RHS = a[2];
    gsub(quote, doublequote, RHS);
    sub(/^[ 	]*FIRST/, "MTTsimpar.FIRST", LHS);
    sub(/^[ 	]*DT/, "MTTsimpar.DT", LHS);
    sub(/^[ 	]*LAST/, "MTTsimpar.LAST", LHS);
    sub(/^[ 	]*STEPFACTOR/, "MTTsimpar.STEPFACTOR", LHS);
    sub(/^[ 	]*METHOD/, "MTTsimpar.METHOD", LHS);
    sub(/^[ 	]*WMIN/, "MTTsimpar.WMIN", LHS);
    sub(/^[ 	]*WMAX/, "MTTsimpar.WMAX", LHS);
    sub(/^[ 	]*WSTEPS/, "MTTsimpar.WSTEPS", LHS);
    sub(/^[ 	]*INPUT/, "MTTsimpar.input", LHS);
    LHS = tolower(LHS);
    RHS = tolower(RHS);
    sub(/["]*euler["]*/, 1, RHS);   
    sub(/["]*implicit["]*/, 2, RHS);  
    statement = sprintf("%s= %s",LHS,RHS);
    if ( (match(statement,";")==0)&&\
         ((match(statement,"if ")==0))&&\
         ((match(statement,"for ")==0)) )
      statement = sprintf("%s;", statement);
  }
  else if (match($1,"global")==1) {
    statement = tolower($1); # Lower case globals as well
  }
  else
    statement = $1;

  if (NF<2) print "  " statement
  if (NF>1)  print statement " # " $2
}' | sed\
     -e 's/\[\([0-9]*\)\]/(\1)/g' \
     -e 's/\([^a-zA-Z_0-9]\)t\([^a-zA-Z_0-9]\)/\1mttt\2/g' \
     -e 's/x(/mttx(/g' \
     -e 's/u(/mttu(/g' \
     -e 's/mttmtt/mtt/g' \
| tolower >> $outfile

if [ -n "$arraycode" ]; then
  new_style=`strip_comments < $1_$2.txt| grep "$name(">/dev/null; echo $?`

  if [ "$new_style" = "1" ]; then
    echo >> $outfile
    echo "  ## Set up the $name vector"  >> $outfile
    ## echo "  $name = []; # Default to empty matrix (Remove in mtt_m2p)"  >> $outfile
    mtt_name2array $1 $arraycode set   >> $outfile
  else
    echo "Old-style file detected: not creating array translations"  
  fi
fi

## Special for logic rep
if [ "$representation" = "logic" ]; then
  echo >> $outfile
  echo "## Open switches" >> $outfile
  switch_txt2m $system | tolower >> $outfile
fi

# End of the function
echo '## END Code' >> $outfile
echo 'endfunction' >> $outfile

Deleted mttroot/mtt/bin/trans/mtt_units.sh version [215c2cb42f].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## MTT units script - wrapper for the units program.

# Copyright (C) 2000 by Peter J. Gawthrop

# Arguments
sys=$1
port=$2
domain=$3
effort=$4
flow=$5

case ${domain} in
    electrical)
	base_effort=volt
	base_flow=amp
	;;
    translational)
	base_effort='newton'
	base_flow='m/s'
	;;
    rotational)
	base_effort='newton*m'
	base_flow='radian/s'
	;;
    fluid)
	base_effort='Pa'
	base_flow='m^3/s'
	;;
    thermal)
	base_effort='degK'
	base_flow='watt/degK'

	;;
    *)
	echo ${sys} ${port} DOMAIN_ERROR invalid domain ${domain}
	exit 1
esac

get_unit()
{
  factor=`units $2 $3 | head -1 | sed 's/\*//'`
  if [ `echo $factor | wc -w` = "1" ]; then
    echo $factor
  else
    echo $1_UNIT_ERROR unit $2 not compatible with domain ${domain}
  fi
}
## Check effort and flow for comptability + find factor
effort_factor=`get_unit EFFORT $effort $base_effort`
flow_factor=`get_unit FLOW $flow $base_flow`

echo ${sys} ${port} ${effort_factor} ${flow_factor}

Deleted mttroot/mtt/bin/trans/mtt_update version [da39fd9946].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238














































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_update
# Generates Updates core representations
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.15  2000/10/17 09:53:05  peterg
## More on logic rep
##
## Revision 1.14  2000/10/17 08:36:56  peterg
## Included logic rep.
##
## Revision 1.13  2000/10/15 09:27:13  peterg
## Better way of generating $infofile
##
## Revision 1.12  2000/10/14 16:11:00  peterg
## Made all variables, states etc lower case
##
## Revision 1.11  2000/10/13 11:07:00  peterg
## Added initialisation for state and input
##
## Revision 1.10  2000/10/13 10:56:07  peterg
## Now uses the full name from the struc file - no need to recreate.
##
## Revision 1.9  2000/10/13 09:55:09  peterg
## Changed state/input name to $4_$3
##
## Revision 1.8  2000/10/13 09:28:16  peterg
## Changed regexp to /\(.*$old.*=\)/
##
## Revision 1.7  2000/10/13 08:56:51  peterg
## Output variables as column, not row.
##
## Revision 1.6  2000/10/13 08:07:24  peterg
## Added state and input - it checks against sympar as well so that
## defined variables may be used here.
##
## Revision 1.5  2000/10/12 19:24:55  peterg
## Corrected output message
##
## Revision 1.4  2000/10/12 17:57:34  peterg
## Fixed header typos
##
## Revision 1.3  2000/10/12 15:11:30  peterg
## Added the update switch
##
## Revision 1.2  2000/10/12 13:45:13  peterg
## Put in the no-file version
##
## Revision 1.1  2000/10/12 12:32:23  peterg
## Initial revision
##
##
###############################################################


sys=$1 # System name
rep=$2 # System representation
update=$3 # Update or not
date=`date`

if [ -z "$2" ]; then
  echo Usage mtt_update system representation [update]    
  exit
fi

rm -f mtt_empty
touch mtt_empty

case $rep in
    numpar)
	    lang=txt
	    textfile=$1_$2.$lang
	    infofile=$1_sympar.$lang
	    moreinfofile=$infofile
	    default='1.0'
	;;
    input)
	    lang=txt
	    textfile=$1_$2.$lang
	    infofile=mtt_list.$lang
	    moreinfofile=mtt_list_numpar.$lang
            awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \
            <$1_struc.txt >$infofile
	    cat $infofile $1_sympar.$lang> $moreinfofile  
	    default='1.0'
         ;;
    state)
	    lang=txt
	    textfile=$1_$2.$lang
	    infofile=mtt_list.$lang
	    moreinfofile=mtt_list_numpar.$lang
            awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \
            <$1_struc.txt >$infofile
	    cat $infofile $1_sympar.$lang> $moreinfofile  
	    default='0.0'
         ;;
    logic) 
	    lang=txt
	    textfile=$1_$2.$lang
	    infofile=mtt_list.$lang
	    moreinfofile=mtt_list_numpar.$lang
            awk '{if ($3=="MTT_SWITCH") printf("%s_logic\n", $4)}' rep=$2 \
            <$1_struc.txt >$infofile
	    cat $infofile $1_sympar.$lang> $moreinfofile  
	    default='1.0'
	;;
    *)
	    echo Representation $rep not implemented
	    exit
esac

# Create a string containing the variables
if [ -f "$textfile" ]; then
  # Inform User
  echo Checking $textfile
else
  echo Creating $textfile
  mtt_header $sys $rep $lang > $textfile 
  info=`cut -f1 $infofile | sort`
  for new in $info; do
    echo $new $default  |\
    awk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile
  done
  exit    
fi

# Remove tmp files
rm -f mtt_in_text mtt_in_info

# Strip files
strip_comments <$textfile | tr 'A-Z' 'a-z' >mtt_text
strip_comments <$infofile | tr 'A-Z' 'a-z' >mtt_info
strip_comments <$moreinfofile  | tr 'A-Z' 'a-z' >mtt_moreinfo

# Use awk to check file
awk '{
  if (FILENAME=="mtt_text") {
    gsub("[\t ]" ,""); # Remove whitespace
    split($0,a,"=");
    text[a[1]] = a[2];
  }
  if (FILENAME=="mtt_info"){
     info[$1] = default;
  }
  if (FILENAME=="mtt_moreinfo"){
     moreinfo[$1] = default;
  }
  }
END{
  # for (iname in info) print iname
  for (tname in text) {
    if (!(tname in moreinfo)) print tname >> "mtt_in_text"
  }
  for (iname in info) {
    if (!(iname in text)) print iname >> "mtt_in_info"
  }
  }'  default=$default mtt_text mtt_info mtt_moreinfo


if [ -z "$update" ]; then
  if [ -f "mtt_in_text" ]; then
    echo "The following variables are defined in $textfile, but do not exist:"
    sort mtt_in_text | awk '{printf("\t%s\n",$1)}'
    echo Use mtt $sys $rep $lang to update
  fi
  if [ -f "mtt_in_info" ]; then
    echo "The following variables exist, but are not defined in $textfile:"
    sort mtt_in_info | awk '{printf("\t%s\n",$1)}'
    echo Use mtt $sys $rep $lang to update
  fi
  exit    
fi
answered=''
if [ -f "mtt_in_text" ]; then
  in_text=`sort mtt_in_text`
  echo "The following variables are defined in $textfile, but do not exist:"
  sort mtt_in_text | awk '{printf("\t%s\n",$1)}'


  while [ -z "$answered" ]; do
    echo "Update $textfile (y/n)?"
    read answer < /dev/tty
    case $answer in
	y)
	    answered=yes
 	    for old in $in_text; do
              echo Commenting out $old
	      sed "s/\(.*$old.*=\)/## Removed by MTT on $date: \1/I"\
               <$textfile > mtt_tmp
              mv mtt_tmp $textfile
              changed=yes
	    done
	    ;;
	n)
	    answered=yes
	    ;;
	*)
    esac
  done      
fi

answered=''
if [ -f "mtt_in_info" ]; then
  echo "The following variables exist, but are not defined in $textfile:"
  sort mtt_in_info | awk '{printf("\t%s\n",$1)}'

  while [ -z "$answered" ]; do
    echo "Update $textfile (y/n)?"
    read answer < /dev/tty
    case $answer in
	y)
	    answered=yes
            in_info=`sort mtt_in_info`
 	    for new in $in_info; do
                echo Adding $new
                echo $new $default  |\
                awk '{printf("%s\t= %s; # Added by MTT on %s\n",$1,$2,strftime())}'\
                >> $textfile
                changed=yes
	    done
	    ;;
	n)
	    answered=yes
	    ;;
	*)
    esac
  done      
fi

Deleted mttroot/mtt/bin/trans/mtt_vectorise version [637c205a0e].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
#!/bin/sh
# Vectorises the matrix output of reduce ie converts (n,1) to (n)
# Copyright (C) 2000 by Peter J. Gawthrop

sed 's/mtt\([a-z]*\)(\([0-9]*\),1)/mtt\1(\2)/g'


Deleted mttroot/mtt/bin/trans/multi_command version [b29c24f12c].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: multi_command

# Copyright (c) P.J.Gawthrop 1996.

# creates a list of commands - one for each file matching $2_*_$3
# Each command is of the form $1 $2_*_$3 &

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2.4.1  2001/06/28 22:58:27  geraint
## Using mtt_xargs.sh to prevent Arg list too long error.
##
## Revision 1.2  1996/11/09 21:16:06  peterg
## *** empty log message ***
##
# Revision 1.1  1996/10/21  12:31:40  peterg
# Initial revision
#
###############################################################


(mtt_xargs.sh "ls" "$2*_$3" \
| sed "s/\(.*_*\)$3/$1 \1$3 \&/")

Deleted mttroot/mtt/bin/trans/multi_command2 version [407726c4d3].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: multi_command2

# Copyright (c) P.J.Gawthrop 1996.

# creates a list of commands - one for each file matching $2_*_$3
# Each command is of the form $1 $2_*_$3 > $2_*_$4

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2.4.1  2001/06/28 22:58:27  geraint
## Using mtt_xargs.sh to prevent Arg list too long error.
##
## Revision 1.2  1996/11/09 21:16:19  peterg
## *** empty log message ***
##
# Revision 1.1  1996/10/21  12:34:47  peterg
# Initial revision
#
###############################################################

(mtt_xargs.sh "ls" "$2*_$3" \
| sed "s/\(.*_*\)$3/$1 \1$3 > \1$4 /")

Deleted mttroot/mtt/bin/trans/n2m version [408bb45747].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: n2m
# Gives sting of integers from n to m (n<=m)
# Copyright (C) 2000 by Peter J. Gawthrop

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

i=`expr $1 - 1`

while [ "$i" != "$2" ]; do
    i=`expr $i + 1`
    echo $i
done

Deleted mttroot/mtt/bin/trans/name2index version [23ba065049].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: name2index

# Converts names to array index

# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1997/12/04 22:10:18  peterg
## Handles argument list - variable names.
##
## Revision 1.3  1997/05/22 09:42:48  peterg
## Returns 0 if no names.
##
## Revision 1.2  1997/05/22 09:28:22  peterg
## Removed trailing , in output.
##
## Revision 1.1  1997/05/22 08:48:21  peterg
## Initial revision
##
###############################################################

awk '
{
  name_index[$4]=$2;
}
END{
  M=split(names,xynames,":");
  if (M==0)
    printf("0\n")
  else
    {
    if (M==1) 
      printf("1,");
    else {  
        printf("%i,",name_index[xynames[1]]+1);
        names=xynames[2]
       }

    N=split(names,Names,",");
    for (i=1; i<N; i++)
      printf("%i,",name_index[Names[i]]+1);
  printf("%i\n",name_index[Names[N]]+1);
  }
}'  names=$2 < $1_struc.txt

  

Deleted mttroot/mtt/bin/trans/numpar_txt2c version [a692cf3be8].

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

































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: numpar_txt2c

# Numerical parameters to c format
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1997/06/13 09:42:25  peterg
## Auto change of () to []
##
# Revision 1.4  1997/05/15  08:33:07  peterg
# Declare state array (x).
#
# Revision 1.3  1997/05/03  15:01:42  peterg
# Don't write out RCS headers.
#
# Revision 1.2  1997/05/01  08:35:18  peterg
# # is now the comment symbol in the .txt file
#
# Revision 1.1  1997/05/01  08:25:31  peterg
# Initial revision
#
###############################################################

system=$1
representation = $2

# Inform user
echo "Creating $1_numpar.c"

rm -f mtt_error

#Write some file headers
echo '/*' > $1_numpar.c
echo "Parameter file for system $1 ($1_numpar.c)"   >> $1_numpar.c
echo "This file provides the system numerical parameters in c form"  >> $1_numpar.c
echo "Generated by MTT at `date`"  >> $1_numpar.c
echo '*/' >> $1_numpar.c
echo  >> $1_numpar.c

echo "extern double x[MTTNX1];"  >> $1_numpar.c
echo "#include \"$1_sympar.c\""  >> $1_numpar.c
echo "$1_numpar()" >> $1_numpar.c
echo '{' >> $1_numpar.c

#Write out the variables in c format.
sed 's/#C-CODE //'< $1_numpar.txt |\
awk -F#  '{
  if (NF<2) print $1
  if (NF>1)  print $1 "/* " $2 " */"
}' | sed 's/(\([0-9]*\))/[\1]/'  >> $1_numpar.c

echo '}'  >> $1_numpar.c


Deleted mttroot/mtt/bin/trans/numpar_txt2m version [55a143892d].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: numpar_txt2m
# Creates the deafault numerical parameters file for the system (txt)

# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/07/25 18:26:33  peterg
## *** empty log message ***
##
# Revision 1.2  1997/05/01  08:24:38  peterg
# Now uses # as the comment symbol in the .txt file
#
# Revision 1.1  1997/05/01  07:45:17  peterg
# Initial revision
#
###############################################################

# Inform user
echo Creating $1_numpar.m

#Create the numpar file complete with headers.
lang_header $1 numpar m '' MTTpar > $1_numpar.m

# Global variable list
#echo  >>  $1_numpar.m
#echo "# Global variable list" >>  $1_numpar.m
#sympar2global_txt2m $1 >> $1_numpar.m

#Write out the variables in m format.
awk -F#  '{
  if (NF==1) print $1
  if (NF==2)  print $1 "# " $2
}' $1_numpar.txt |\
sed 's/double/global/' >> $1_numpar.m


Deleted mttroot/mtt/bin/trans/obs_r2m version [425f980273].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136








































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: obs_r2m
# Reduce GPC obs function to matlab
# P.J.Gawthrop 18 May 1991, 12 Jan 1994, April 1994, Dec 1994, July 1995
# Copyright (c) P.J.Gawthrop 1991, 1994.

# Inform user
echo Creating $1_obs.m

# Remove the old log file
rm -f obs_r2m.log
rm -f $1_obs.m?
rm -f $1_obsa.m

# Is the system affine (look in the _obs.r file
affine=`grep 'affine :=' $1_obs.r | awk '{print $3}' | sed 's/;//'`


# Use reduce to accomplish the transformation
$SYMBOLIC >obs_r2m.log << EOF

%Read the reduce definitions file
in "$1_def.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Set default values - reset by obspar file.
MTTGPCNy := 2;
MTTGPCNu := 0;

%Read the parameters file
in "$1_obspar.r";

%Read the simplification file
in "$1_simp.r";

%Read the reduce state-space equations   file
in "$1_obs.r";


ON BigFloat, NumVal;
PRECISION 16; %Compatible with Matlab
OFF Nat;

ON NERO;        % Suppress zero elements

% Matrix output function
in"$MTTPATH/trans/matlab_matrix.r";

OUT "$1_obs.m2";

write "% Set up the State variables";
FOR i := 1:MTTNx DO
BEGIN
  write "mttx", i, " = x(", i, ");";
END;

IF affine=0 THEN 
BEGIN
write "%"; 
write "% Set up the inputs and input derivatives";
FOR i := 1:MTTNu DO
  BEGIN
    write "mttu", i, " = u(", i, ",1);";
    FOR j := 1:MTTGPCNu DO
    BEGIN
      write "mttu", i,j, " = u(", i, ",", j+1, ");";
    END;
  END;

%write "%"; 
%write "% Set up the Y matrix";
%write "Y = zeros(", mtt_matrix_n, ",1);";
END;


SHUT "$1_obs.m2";

IF affine=1 THEN 
BEGIN
  GENTRANOUT "$1_obs.m3";
  MTT_Matrix := MTTObs_o$ 
  MTT_Matrix_name := "MTTO_o"$
  MTT_Matrix_n := (MTTGPCNY+1)*MTTNy$
  MTT_Matrix_m := 1$
  matlab_Matrix()$
  GENTRAN O_o := mtt_matrix;

  MTT_Matrix := MTTObs_h$ 
  MTT_Matrix_name := "MTTO_h"$
  MTT_Matrix_n := (MTTGPCNy+1)*MTTNy$
  MTT_Matrix_m := (MTTGPCNu+1)*MTTNu$
  matlab_Matrix()$
  GENTRAN O_h := mtt_matrix;

  GENTRANSHUT "$1_obs.m3";
END
ELSE
BEGIN
  GENTRANOUT "$1_obs.m3";
  mtt_matrix := MTTYY$
  mtt_matrix_n := MTTNY*(MTTGPCNy+1)$
  mtt_matrix_m := 1$
  mtt_matrix_name := Y$
  matlab_matrix(); 
  GENTRAN YY := mtt_matrix;
  GENTRANSHUT "$1_obs.m3";
END;

EOF

if [ "$affine" = "1" ]; then
    lang_header $1 obs m x [o_o,o_h] > $1_obs.m1
else
    lang_header $1 obs m x,u yy > $1_obs.m1
fi

# Put together the pieces
matlab_tidy $1_obs.m2
matlab_tidy $1_obs.m3
cat   $1_obs.m? >$1_obs.m

rm -f $1_obs.m?







Deleted mttroot/mtt/bin/trans/obs_r2tex version [f36c171b61].

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
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




























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: obs_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  9 Sep 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/04/07 08:30:20  peterg
## Initial revision
##
# Revision 1.3  1997/06/13  13:50:11  peterg
# Matrices in amstex format
#
# Revision 1.2  1997/04/18  12:54:00  peterg
# No longer does labels.
#
# Revision 1.1  1996/08/19  15:19:23  peter
# Initial revision
#
###############################################################


# Inform user
echo Creating $1_obs.tex

# Remove the old log file
rm -f obs_r2tex.log

# Use reduce to accomplish the transformation
reduce >obs_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the obs file
in "$1_obs.r";

%Read the Obs function parameters
in "$1_obspar.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification parameters
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
OFF EXP;

OUT "$1_obs.tex";

% Write the affine form
IF affine=1 THEN 
BEGIN
  MTT_Matrix := MTTObs_o$ 
  MTT_Matrix_name := "MTTO_o"$
  MTT_Matrix_n := (MTTGPCNY+1)*MTTNy$
  MTT_Matrix_m := 1$
  LaTeX_Matrix()$

  MTT_Matrix := MTTObs_h$ 
  MTT_Matrix_name := "MTTO_h"$
  MTT_Matrix_n := (MTTGPCNy+1)*MTTNy$
  MTT_Matrix_m := (MTTGPCNu+1)*MTTNu$
  LaTeX_Matrix()$
END
ELSE
BEGIN
% Write the obs vector (YY)
  MTT_Matrix := MTTYY$ 
  MTT_Matrix_name := "MTTO"$
  MTT_Matrix_n := (MTTGPCNY+1)*MTTNy$
  MTT_Matrix_m := 1$
  LaTeX_Matrix()$
END;

SHUT "$1_obs.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/octave_ode2odes version [6a41dad2b5].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: octave_ode2odes
# Runs the Octave script $1_ode2odeso.m
# Copyright (c) P.J.Gawthrop 1999

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  2000/05/19 17:47:56  peterg
## Agument to state
##
## Revision 1.2  2000/05/11 13:43:14  peterg
## No change
##
## Revision 1.1  1999/03/15 23:27:16  peterg
## Initial revision
##
###############################################################


echo Creating $1_odes.dat2
$MATRIX  <<EOF >octave_ode2odes.log 2>mtt_error.txt
  ## Set up the simulation parameters
  par = $1_numpar; 
  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

Deleted mttroot/mtt/bin/trans/ode2obs_r version [117332d406].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253





























































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode2obs_r
# Odrinary differential equations to observer function equations
# P.J.Gawthrop 14 June 1991, 8 Aug 1991, 2 April 1992, 14 April 1994, 28 Dec 94,
#               12th July 1995, April 1996
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994, 1995, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/04/07 08:12:12  peterg
## Added affine form.
##
## Revision 1.4  1998/04/07 05:45:12  peterg
## Reverted to an older version due to untraceable bug in new version
##
## Revision 1.3  1996/08/25 10:07:05  peter
## Remove a du state ment causaing touble
##      - but needs more work.
##
## Revision 1.2  1996/08/25 08:38:14  peter
## Error handling added.
##
## Revision 1.1  1996/08/25 08:37:44  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_obs.r

# Remove the old log file
rm -f ode2obs_r.log

# Use reduce to accomplish the transformation
reduce >ode2obs_r.log << EOF

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";


OFF Echo;
OFF Nat;
ON NERO;

in "$1_def.r";
MTTdxs := MTTdX;  %Save the symbolic form of dX

%Set default values - reset by obspar file.
MTTGPCNy := 2;
MTTGPCNu := 0;

%%in "$1_sympar.r";
in "$1_ode.r";
%%in "$1_simp.r";

% Read the obs form parameters.
in "$1_obspar.r";

%Create the U vector of input derivatives.
MTTNuu := (MTTGPCNu+1)*MTTNu;
MTTNuu1 := MTTGPCNu*MTTNu;


%FOR i := 1:MTTNu DO
%  MTTUU(i,1) := MTTU(i,1);
%END;
%
%IF MTTGPCNu>0 THEN
%BEGIN
%  FOR i := 1:MTTNu DO
%    MTTUU(i+MTTNu,1) := MTTdU(i,1);
%  END;
%END;

MTTU := MTTU;
MTTdU := MTTdU; % ---- removed temporarily, needs def file change? 

%Create the Y vector of output derivatives.
MTTNyy := (MTTGPCNy+1)*MTTNy;
Matrix MTTYY(MTTNyy,1);

FOR i := 1:MTTNy DO
  MTTYY(i,1) := MTTY(i,1);
END;

l := MTTNy;
FOR i := 1:MTTGPCNy DO
    FOR j := 1:MTTNy DO
    BEGIN
      l := l+1;
      MTTYY(l,1) := 0;
      FOR k := 1:MTTNx DO %Derivatives wrt x
      BEGIN
        xk := MTTX(k,1);
        MTTYY(l,1) := MTTYY(l,1) + df(MTTYY(l-MTTNy,1), xk, 1)*MTTdX(k,1);
      END;
      IF MTTGPCNu>0 THEN
      FOR k := 1:MTTGPCNu DO %Non-zero derivatives of u
      BEGIN
        FOR kk := 1:MTTNu DO
        BEGIN
          uk := MTTUU(kk,k);
          MTTYY(l,1) := MTTYY(l,1) + df(MTTYY(l,1), uk, 1)*MTTUU(1,k+1);
        END;
      END;
    END;
END;

%%Create O_x - derivative of YY wrt x
%Matrix MTTO_x(MTTNyy,MTTNx);
%FOR j := 1:MTTNx DO
%  BEGIN
%  xj := MTTX(j,1);
%  FOR i := 1:MTTNyy DO
%    BEGIN
%    MTTO_x(i,j) := df(MTTYY(i,1), xj);
%    END;
%  END;

%%Create O_u - derivative of YY wrt u (Assumes GPC Nu = 0)
%MTTNNu := (MTTGPCNu+1)*MTTNu;
%Matrix MTTO_u(MTTNyy,MTTNNu);
%FOR j := 1:MTTNNu DO
%  BEGIN
%  uj := MTTu(j,1);     
%  FOR i := 1:MTTNyy DO
%    BEGIN
%    MTTO_u(i,j) := df(MTTYY(i,1), uj);
%    END;
%  END;


%%Create O_uu - derivative of O_u wrt u (Assumes GPC Nu = 0)
%%This is a multi-dimensional matrix kth elements stacked sideways.
%Matrix MTTO_uu(MTTNyy,MTTNNu*MTTNNu);
%FOR k := 1:MTTNNu DO
%  BEGIN
%  uk := MTTu(k,1);     
%  FOR j := 1:MTTNNu DO
%    BEGIN
%    FOR i := 1:MTTNyy DO
%      BEGIN
%      jk := j+(k-1)*MTTNu;
%      MTTO_uu(i,jk) := df(MTTO_u(i,j), uk);
%      END;
%    END;
%  END;

%%Create O_ux - derivative of O_u wrt x 
%%This is a multi-dimensional matrix kth elements stacked sideways.
%Matrix MTTO_ux(MTTNyy,MTTNu*MTTNx);
%FOR k := 1:MTTNx DO
%  BEGIN
%  xk := MTTx(k,1);     
%  FOR j := 1:MTTNu DO
%    BEGIN
%    FOR i := 1:MTTNyy DO
%      BEGIN
%      jk := j+(k-1)*MTTNu;
%      MTTO_ux(i,jk) := df(MTTO_u(i,j), xk);
%      END;
%    END;
%  END;


% Try and split the obs function into affine form (O(x,u) = o(x) + h(x)u)
affine := 1;
MTTNuu := (MTTGPCNu+1)*MTTNu;
write "1 affine := ", affine, ";";

%IF (affine=1) THEN
%BEGIN
  MATRIX MTTObs_o(MTTNyy,1);
  MATRIX MTTObs_h(MTTNyy,MTTNuu);
write "2 affine := ", affine, ";";
  FOR i := 1:MTTNyy DO
  BEGIN
write "3 affine := ", affine, ";";
    MTTObs_o(i,1) := MTTYY(i,1);
    k := 0;
    FOR j := 1:MTTNu DO
    FOR jj := 0:MTTGPCNu DO
    BEGIN
      k := k+1;
      %Expand as polynomial in u_j^[jj]
      coeffs := coeff(MTTObs_o(i,1), MTTUU(j,jj+1));
      MTTObs_o(i,1) := first(coeffs);
      IF length(coeffs)>1 THEN
        MTTObs_h(i,k) := second(coeffs);
      IF length(coeffs)>2 THEN 
        affine := -1;
    END;
  END;
%END;


%%Create the _obs.r file
OUT "$1_obs.r";

IF affine=1 THEN
  write "affine := 1; % The O function is affine in u"
ELSE
  write "affine := 0; % The O function is not affine in u";


write "% The matrix sizes";
write "MTTNyy := ", MTTNyy, ";";
write "MTTNuu := ", MTTNuu, ";";

mtt_matrix := MTTYY$
mtt_matrix_n := MTTNyy$
mtt_matrix_m := 1$
mtt_matrix_name := "MTTYY"$
reduce_matrix();

IF affine=1 THEN
BEGIN
  mtt_matrix := MTTObs_o$
  mtt_matrix_n := MTTNyy$
  mtt_matrix_m := 1$
  mtt_matrix_name := "MTTObs_o"$
  reduce_matrix();

  mtt_matrix := MTTObs_h$
  mtt_matrix_n := MTTNyy$
  mtt_matrix_m := MTTNuu$
  mtt_matrix_name := "MTTObs_h"$
  reduce_matrix();
END;

%MTTO_x := MTTO_x;
%MTTO_u := MTTO_u;
%MTTO_uu := MTTO_uu;
%MTTO_ux := MTTO_ux;

write ";END;";

SHUT "$1_obs.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r ode2obs_r.log

Deleted mttroot/mtt/bin/trans/ode2odes_m version [e593903528].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229





































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode2odes_m

# Transforms descriptor matrix rep to step response

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.17  1998/06/27 14:49:16  peterg
## No change
##
## Revision 1.16  1998/06/25 08:47:23  peterg
## Put correct arguments for _input -- (x,t)
##
## Revision 1.15  1998/05/21 16:20:27  peterg
## Modified to include explicit algebraic loop solution
##
## Revision 1.14  1998/05/19 19:48:02  peterg
## Read the simpar file now.
##
## Revision 1.13  1998/05/14 08:05:10  peterg
## Put back under RCS
##
## Revision 1.12  1998/02/25 18:02:39  peterg
## Removed the argument passing stuff .
## Replaced by the simpar.m method.
##
## 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.
##
## Revision 1.8  1996/09/13 17:54:08  peter
## Now writes default $PARAMS to $1_args.m - $1_ode may use it.
##
## Revision 1.7  1996/09/12 18:41:48  peter
## Standard error handling added.
##
## Revision 1.6  1996/08/24 14:11:04  peter
## Global parameter passing.
##
## Revision 1.5  1996/08/18 12:01:26  peter
## Unified format of time responses.
##
## Revision 1.4  1996/08/16 13:04:46  peter
## Fixed problem with more than one output (y vector).
##
## Revision 1.3  1996/08/16 06:36:03  peter
## Removed u from default arg list.
##
## Revision 1.2  1996/08/15 16:24:43  peter
## Uses T in place of t to avoid name clash within function.
##
## 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 --verbose << EOF > ode2odes_m.log 2>mtt_error.txt

  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;

  %Read in parameters
  $1_numpar; 

  %Read in state
  x = $1_state;

  %Set the initial output
  %if ny>0
  %  y = $1_odeo(x,0);
  %end; 
 
  %Read in simulation parameters
  $1_simpar;
  T = [0:DT:LAST];

  t=0;	%Just in case it appears in the parameter list.


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

  if exist('METHOD')==0
    METHOD = 'Euler'
  end;

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

  % xx is the composite vector containing x and the internal inputs.
  xx = [x; zeros(nyz,1)];

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

method = tolower(METHOD)

if nx>0
  if strcmp(method,'lsode')
    X = lsode('$1_ode', x, T);
  elseif strcmp(method,'euler')
    %Euler integration
    disp("Euler")
    X=[];
    dt = (T(2)-T(1))/STEPFACTOR;
    for t=T'
      X = [X; xx'];
      ts = t;
      for i=1:STEPFACTOR
        x = xx(1:nx);
        u = $1_input(xx,ts);
        xx = $1_ode(xx,u,ts);
        ts = ts + dt;
        dx = xx(1:nx);
        x = x + dx*dt;
        xx(1:nx) = x;
      end;
    end;
  elseif strcmp(method,'implicitl')
    %Euler integration
    X=[];
    dt = (T(2)-T(1))/STEPFACTOR;
    u = $1_input(x,u,t);
    A = $1_smx(x,u); 
    inverse = inv(eye(nx) - dt*A);
    for t=T'
      X = [X; xx'];
      ts = t;
      u = $1_input(x,t);
      for i=1:STEPFACTOR
        x = xx(1:nx);
        xx = $1_ode(xx,u,ts);
        ts = ts + dt;
        dx = xx(1:nx);
        x = inverse*(x + dt*(dx - A*x));
        xx(1:nx) = x;
      end;
    end;
  elseif strcmp(method,'implicit')
    %Euler integration
    X=[];
    dt = (T(2)-T(1))/STEPFACTOR;
    One = eye(nx);
    for t=T'
      X = [X; xx'];
      ts = t;
      for i=1:STEPFACTOR
        x = xx(1:nx);
        u = $1_input(x,t);
    	A = $1_smx(x,u); 
        xx = $1_ode(xx,u,ts);
        ts = ts + dt;
        dx = xx(1:nx);
        x = (One-A*dt)\(x + dt*(dx - A*x));
        xx(1:nx) = x;
      end;
    end;
  else
    error('Method %s not available here', METHOD);
    return;
  end;
  write_matrix([T,X], '$1_odes');
else
  X = zeros(size(T));
end;

if ny>0 % compute y and print it
  i = 0; Y=[];
  for t=T'
    i = i+1; X(i,:);
    u = $1_input(x,t);
    y = $1_odeo(X(i,:)',u,t);
    Y = [Y; y'];
  end;
  write_matrix([T,Y], '$1_odeso');
end;


EOF

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







Deleted mttroot/mtt/bin/trans/ode2odes_r2c version [3539b59c2d].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269













































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode2odes_r2c
# Reduce ordinary differential equations to  differential-algebraic 
# equations solution in the form of a c program.

# Euler integration of the state is included.

# NB Arrays should are  defined to be one larger than expected 
# - the 0 element is not used.

# Copyright (c) P.J.Gawthrop 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.17  1998/05/15 07:47:23  peterg
## Includes sign.c by default
##
## Revision 1.16  1998/05/14 08:25:52  peterg
## Corrected time skew.
##
## Revision 1.15  1998/05/14 08:20:29  peterg
## Start time at DT - the result at time zero is computed outside the
## loop
##
## Revision 1.14  1998/05/13 08:57:27  peterg
## Now uses simpar.h in place of odes.h
##
## Revision 1.13  1998/02/24 13:34:45  peterg
## Back under RCS
##
# Revision 1.12  1997/05/15  08:39:56  peterg
# Don't initialise states - now done in numpar file.
#
# Revision 1.11  1997/05/12  16:00:54  peterg
# Removed itime again.,
#
# Revision 1.10  1997/05/10  10:05:15  peterg
# Put _input in inner loop in front of call to _ode
#
## Revision 1.9  1997/05/10 09:54:34  peterg
## Moved _input call to after the inner integration loop.
##
## Revision 1.8  1997/05/10 08:12:23  peterg
## Put second argument into _input.
##
## Revision 1.7  1997/05/10 07:01:15  peterg
## _input called in outer loop only.
## time updated in outer loop only.
## Integer time (itime) introduced and updated in outer loop - maybe
## useful for discrete events.
## Integer time (itime) passed to _input.
##
## Revision 1.6  1997/05/06 13:53:32  peterg
## Now uses the preprocessor to declare sizes -- MTTNX etc
##
# Revision 1.5  1997/05/01  13:50:11  peterg
# Replaced float by double.
#
# Revision 1.4  1997/05/01  13:43:44  peterg
# Changed double to float.
#
# Revision 1.3  1997/05/01  11:15:33  peterg
# Back under RCS
#
# Revision 1.2  1997/03/20  14:36:56  peterg
# Includes the sympar.h file
#
## Revision 1.1  1997/01/21 22:54:54  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_odes.c

# Remove the old log file
rm -f ode_r2c.log

# Use reduce to accomplish the transformation
reduce >ode2odes_r2c.log << EOF

%Read the reduce definitions file
in "$1_def.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the symbolic parameters file
%%in "$1_sympar.r";

ON BigFloat, NumVal;
PRECISION 16; %Compatible with Matlab
%OFF Nat;

ON NERO;        % Suppress zero elements

%Generate the Header part
OUT "$1_odes.c";

write "/*"$
write "Program to solve ode for system $1"$
write "NB Arrays are defined to be one larger than expected"$
write " - the 0 element is not used."$

write "File $1_odes.c"$
write "Generated by MTT"$
write "*/"$
write " "$


%Program heading
write "#define MTTNX ", MTTNx $
write "#define MTTNY ", MTTNy $
write "#define MTTNU ", MTTNu $
write "#define MTTNX1 ", MTTNx+1 $
write "#define MTTNY1 ", MTTNy+1 $
write "#define MTTNU1 ", MTTNu+1 $
write "#define MTTNX2 ", MTTNx+2 $
write "#define MTTNY2 ", MTTNy+2 $
write "#define MTTNU2 ", MTTNu+2 $

write "#include <stdio.h>"$
write "#include <math.h>"$
write "#include ""sign.c"" "$
write "#include ""$1_simpar.h"" "$
write "#include ""$1_ode.c"" "$
write "#include ""$1_input.c"" "$
write "#include ""$1_numpar.c"" "$
write "#include ""$1_state.c"" "$

%External (global) variable list
write "#include ""$1_sympar.h"" "$


write "/* Declare standard arrays */"$
write "double y[MTTNY1]; /* $1_ode output */"$
write "double dx[MTTNX1]; /* $1_ode state derivative */"$ 
write "double x[MTTNX1]; /* $1_ode state */"$ 
write "double u[MTTNU1]; /* $1_ode input */"$


write "/* Files */ "$
write "  FILE *fopen(), *fps, *fpso;"$

write "main()"$
write "  "$
write "{"$



write "/* Counters etc*/ "$
write "  double time;"$
write "  double dt;"$
write "  int i;"$
write "  int k;"$

write "/*functions */ "$
write "  extern  $1_numpar();"$

%Open the output files
write "/* %Open the output file */"$
write "fps = fopen(""$1_odes.m"", ""w"");  "$
write "fpso = fopen(""$1_odeso.m"", ""w"");  "$

%Set up user-defined constants
write "/* Set up user-defined constants */"$
write "  $1_numpar();"$

%Set up initial state
write "/* Set up initial state */"$
write "  $1_state();"$

%Initialise main (Euler) integration loop
write "/* Initialise main (Euler) integration loop */"$
write "  time = 0;"$
write "  dt = DT/STEPFACTOR;"$
%% write "  for (i=1; i<=MTTNX; i++)"$
%% write "      x[i] = 0.0;"$

%Set up system inputs
write "/* Set up system inputs */"$
write "  for (i=1; i<=", MTTNu, "; i++)"$
write "      u[i] = 1.0;"$

write "  $1_input(0.0);"$

write "    fprintf(fps, ""function data = ", "$1_odes \n"");"$
write "    fprintf(fps, ""data = [\n"");"$
write "    fprintf(fpso, ""function data = ", "$1_odeso \n"");"$
write "    fprintf(fpso, ""data = [\n"");"$

% Compute the first output
write "/* Compute the first output */"$
write "  $1_ode(y,dx,x,u);"$

%Main (Euler) integration loop
write "/* Main (Euler) integration loop */"$

write "  while (time<(LAST-DT))"$
write "  {"$

%Write to output to file
write "/* Write to output file */"$
write "    fprintf(fpso, ""%5.4g "",time);"$
write "    for (i=1; i<=MTTNY; i++)"$
write "      fprintf(fpso, ""%5.4g "", y[i]);"$
write "    fprintf(fpso, ""\n"");"$

%Write to state to file
write "/* Write to state file */"$
write "    fprintf(fps, ""%5.4g "",time);"$
write "    for (i=1; i<=MTTNX; i++)"$
write "      fprintf(fps, ""%5.4g "", x[i]);"$
write "    fprintf(fps, ""\n"");"$

write "      time = time + DT;"$

write "/* Inner integration loop */"$
write "    for (k=1; k<=STEPFACTOR; k++)"$
write "    {"$
write "      for (i=1; i<=MTTNX; i++)"$
write "        x[i] = x[i] + dx[i]*dt;"$

write "      /* Set up system inputs */"$
write "      $1_input(time);"$
write "      $1_ode();"$
write "    }"$

write "  }"$

%Write to files
%Write to output to file
write "/* Write to output file */"$
write "    fprintf(fpso, ""%5.4g "",time);"$
write "    for (i=1; i<=MTTNY; i++)"$
write "      fprintf(fpso, ""%5.4g "", y[i]);"$
write "    fprintf(fpso, ""\n"");"$

%Write to state to file
write "/* Write to state file */"$
write "    fprintf(fps, ""%5.4g "",time);"$
write "    for (i=1; i<=MTTNX; i++)"$
write "      fprintf(fps, ""%5.4g "", x[i]);"$
write "    fprintf(fps, ""\n"");"$


write "  fprintf(fps, ""];\n"");"$
write "  fprintf(fpso, ""];\n"");"$

write "  return 0;"$
write "}"$


SHUT "$1_odes.c";


EOF



Deleted mttroot/mtt/bin/trans/ode2odess_m version [4c1d52ada1].

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
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















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode2odess_m

# Transforms descriptor matrix rep to step response

# 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
## Fixed problem with default paramaters.
##
## Revision 1.1  1996/09/12 19:26:57  peter
## Initial revision
##
## Revision 1.4  1996/08/16 13:04:46  peter
## Fixed problem with more than one output (y vector).
##
## Revision 1.3  1996/08/16 06:36:03  peter
## Removed u from default arg list.
##
## Revision 1.2  1996/08/15 16:24:43  peter
## Uses T in place of t to avoid name clash within function.
##
## Revision 1.1  1996/08/15 11:56:38  peter
## Initial revision
##
###############################################################

echo Creating $1_odess.m
rm -f ode2odess_m.log

Nx=`mtt_getsize $1 x` # States
Nxx=`mtt_getsize $1 xx` # States x States
Nu=`mtt_getsize $1 u` # Inputs 
Ny=`mtt_getsize $1 y` # Inputs 

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

  %Read in parameters
  par = $1_numpar;

   %Read in simulation parameters
  simpar=$1_simpar;
  T = [0:simpar.dt:simpar.last];

  t=0;	%Just in case it appears in the parameter list.


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

  if exist('x0')==0
    x0 = zeros($Nx,1);
  end;

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

global t;
function dx=f(x)
  global t
  par = $1_numpar;
  u = $1_input(x,zeros($Ny,1),t,par);
  dx = $1_ode(x,u,t,par);;
endfunction;

i=0;
x = x0;
for t=T'
  u = $1_input(x,zeros($Ny,1),t,par);
  y(i) = $1_odeo(x,u,t,par)';
  mtt_write(t,x,y,$Nx,$Ny);   # Write it out
  x = fsolve('f',x)';
end;

i=0;
for t=T'
  i=i+1;
end;

write_matrix([T,x], '$1_odess');
write_matrix([T,y], '$1_odesso');

EOF

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





Deleted mttroot/mtt/bin/trans/ode2odess_m2dat2 version [4e1d5bd33f].

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
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









































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode2odess_m

# Transforms descriptor matrix rep to step response

# 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
## Fixed problem with default paramaters.
##
## Revision 1.1  1996/09/12 19:26:57  peter
## Initial revision
##
## Revision 1.4  1996/08/16 13:04:46  peter
## Fixed problem with more than one output (y vector).
##
## Revision 1.3  1996/08/16 06:36:03  peter
## Removed u from default arg list.
##
## Revision 1.2  1996/08/15 16:24:43  peter
## Uses T in place of t to avoid name clash within function.
##
## Revision 1.1  1996/08/15 11:56:38  peter
## Initial revision
##
###############################################################

echo Creating $1_odess.dat2
rm -f ode2odess_m.log

Nx=`mtt_getsize $1 x` # States
Nxx=`mtt_getsize $1 xx` # States x States
Nu=`mtt_getsize $1 u` # Inputs 
Ny=`mtt_getsize $1 y` # Inputs 

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

   global MTT_data # Where mtt_write puts its stuff
  %Read in parameters
  par = $1_numpar;

   %Read in simulation parameters
  simpar=$1_simpar;
  T = [0:simpar.dt:simpar.last];

  t=0;	%Just in case it appears in the parameter list.


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

  if exist('x0')==0
    x0 = zeros($Nx,1);
  end;

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

global t;
function dx=f(x)
  global t
  par = $1_numpar;
  u = $1_input(x,zeros($Ny,1),t,par);
  dx = $1_ode(x,u,t,par);;
endfunction;

x = x0;
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





Deleted mttroot/mtt/bin/trans/ode2smx_lang version [564d3a89c6].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218


























































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode2smx_lang
# ODE to state matrix (with explicit state values) conversion
# P.J.Gawthrop  6th September 1991, May 1994, July 1998
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11  1998/11/26 10:32:34  peterg
## Include subs.r
##
## Revision 1.10  1998/11/17 17:10:22  peterg
## Read in the constitutive relationship file as well
##
## Revision 1.9  1998/08/27 07:06:25  peterg
## Just genrate xj once.
##
## Revision 1.8  1998/08/27 07:04:44  peterg
## Cleared out mttx array ans use mkid instead.
##
## Revision 1.7  1998/08/27 06:48:20  peterg
## Changed mttxx to mttx - in implicit integration smx is called once
## with x in the linearisation the same as x in the current state
##
## Revision 1.6  1998/08/26 18:25:45  peterg
## SMX now generates both A and Ax
##
## Revision 1.5  1998/08/15 13:51:56  peterg
## smx is now I-Adt NOT A
##
## Revision 1.4  1998/08/13 09:03:35  peterg
## *** empty log message ***
##
## Revision 1.3  1998/07/30 10:49:55  peterg
## Removed zeroing.
##
## Revision 1.2  1998/07/30 10:49:02  peterg
## Put [] round output of zeros.
##
## Revision 1.1  1998/07/19 16:59:56  peterg
## Initial revision
##
###############################################################

# Language
if [ -n "$2" ]; then
    lang=$2
else
    lang="r"
fi


# Inform user
echo Creating $1_smx.$lang
#echo Creating $1_smxx.$lang
#echo Creating $1_smxtx.$lang

# Remove the old log file
rm -f ode2smx_r.log

rm -f $1_smx.$lang
rm -f $1_smxx.$lang
rm -f $1_smxtx.$lang

# Use reduce to accomplish the transformation
reduce << EOF  >ode2smx_lang.log

lang := $lang;

in "$1_subs.r";
in "$1_def.r";
in "$1_ode.r";
in "$1_cr.r";

clear mttx; % Dont need this now - use mkid instead

OFF Echo;

% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := 'Pascal;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_t;

% Matrix output function
in"$MTTPATH/trans/lang_matrix.r";


%Set up output according to the language.
 OFF NAT;
 GENTRANOUT "$1_smx.$lang";

% Set up output according to the language.
    IF (lang = r) THEN 
    BEGIN
      write "matrix mtta(", mttnx, ",", mttnx, ");";    
      write "matrix mttb(", mttnx, ",", mttnu, ");";    
      write "matrix mttc(", mttny, ",", mttnx, ");";    
      write "matrix mttd(", mttny, ",", mttnu, ");";    
    END;

% find MTTA : the A matrix
  FOR i := 1:MTTNx DO
  BEGIN
    mttAAx_i := 0;
%%    xi := mkid(mttx,i);
    FOR j := 1:MTTNx DO
    BEGIN
      xj := mkid(mttx,j);
      a_ij := df(MTTdx(i,1), xj, 1);
%%      a_ji := df(MTTdx(j,1), xi, 1);
      IF i=j THEN
      BEGIN
        aa_ij := 1 - mttdt*a_ij;
%%        aa_ji := aa_ij;
      END
      ELSE
      BEGIN
        aa_ij := -mttdt*a_ij;
%%        aa_ji := -mttdt*a_ji;
      END;
      IF (aa_ij NEQ 0) THEN
        GENTRAN mtta(i,j) ::=: aa_ij;
      mttAAx_i := mttAAx_i + aa_ij*xj;
      %%%mttAAtx(i,1) := mttAAtx(i,1) + aa_ji*mkid(mttx,j);
    END;
    IF (mttAAx_i NEQ 0) THEN
      GENTRAN mttax(i) ::=: mttAAx_i;
  END;



%% Find MTTB : the B matrix
%  FOR j := 1:MTTNu DO
%    BEGIN
%    uj := MTTU(j,1);
%    FOR i := 1:MTTNx DO
%      WriteElement("mttb",i,j,df(MTTdx(i,1), uj, 1));
%    END;
%
%% Find MTTC : the C matrix
%  FOR i := 1:MTTNy DO
%    FOR j := 1:MTTNx DO
%    BEGIN
%      xj := MTTX(j,1);
%      WriteElement("mttc",i,j,df(MTTY(i,1), xj, 1));
%    END;
%
%% Find MTTD : the D matrix
%  FOR i := 1:MTTNy DO
%    FOR j := 1:MTTNu DO
%    BEGIN
%      xj := MTTU(j,1);
%      WriteElement("mttd",i,j,df(MTTY(i,1), xj, 1));
%    END;

%Shut the  output according to the language.
 GENTRANSHUT "$1_smx.$lang";


%% The AAx matrix;
%GENTRANOUT "$1_smxx.$lang";
%FOR i := 1:MTTNx DO
%BEGIN
%  ax_i := mttAAx(i,1);
%  IF (ax_i NEQ 0) THEN
%    GENTRAN mttax(i) ::=: ax_i;
%END
%GENTRANSHUT "$1_smxx.$lang";
%
%% The AAtx matrix;
%GENTRANOUT "$1_smxtx.$lang";
%FOR i := 1:MTTNx DO
%BEGIN
%  atx_i := mttAAtx(i,1);
%  IF (atx_i NEQ 0) THEN
%    GENTRAN mttax(i) ::=: atx_i;
%END
%GENTRANSHUT "$1_smxtx.$lang";

EOF

if [ "$lang" = "m" ]; then
  mv $1_smx.$lang  mtt_junk
#  lang_header $1 smx m 'mttx,mttu,mttdt' '[mtta,mttax]' > $1_smx.m
  mtt_header $1 $2 m
  cat mtt_junk | mtt_p2m >> $1_smx.m
  rm -f mtt_junk

#  mv $1_smxx.$lang  mtt_junk
#  lang_header $1 smxx m 'mttx,mttu,mttxx,mttdt' '[mttax]' > $1_smxx.m
#  cat mtt_junk | mtt_p2m >> $1_smxx.m
#  rm -f mtt_junk
#
#  mv $1_smxtx.$lang  mtt_junk
#  lang_header $1 smxtx m 'mttx,mttu,mttxx,mttdt' '[mttax]' > $1_smxtx.m
#  cat mtt_junk | mtt_p2m >> $1_smxtx.m
#  rm -f mtt_junk
#
#
fi

# Now invoke the standard error handling.
mtt_error_r ode2smx_lang.log




Deleted mttroot/mtt/bin/trans/ode_r2c version [572667c334].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189





























































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode_r2c
# Reduce ordinary differential equations to c differential-algebraic 
# equations

# Euler integration of the state is included.

# NB Arrays should be defined to be one larger than expected 
# - the 0 element is not used.

# Copyright (c) P.J.Gawthrop 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1997/05/01 13:50:55  peterg
## Replaced float by double.
##
# Revision 1.4  1997/05/01  13:44:19  peterg
# Changed double to float.
#
# Revision 1.3  1997/03/20  14:51:11  peterg
# Includes the sympar.c file.
#
# Revision 1.2  1997/01/21  22:57:17  peterg
# Various bug fixes.
#
## Revision 1.1  1997/01/21 10:52:23  peterg
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_ode.c

# Remove the old  files
rm -f  $1_ode.c1 $1_ode.c2 $1_ode.c

# Remove the old log file
rm -f ode_r2c.log

# Use reduce to accomplish the transformation
reduce >ode_r2c.log << EOF

%Read the reduce definitions file
in "$1_def.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the symbolic parameters file
%%in "$1_sympar.r";

%Read the reduce state-space equations   file
in "$1_ode.r";


ON BigFloat, NumVal;
PRECISION 16; %Compatible with Matlab
%OFF Nat;

ON NERO;        % Suppress zero elements


%Generate the Header part
OUT "$1_ode.c1";

write "/*"$
write "Differential algebraic eqns in c form for system $1"$
write "NB Arrays should be defined to be one larger than expected"$
write " - the 0 element is not used."$

write "File $1_ode.c"$
write "Generated by MTT"$
write "*/"$
write " "$


%Function heading - c style

write "void $1_ode()"$

write "  "$
write "{"$

write "/* Declare standard arrays */"$
write "  extern double y[", MTTNy+1, "]; /* $1_ode output */"$
write "  extern double dx[", MTTNx+1, "]; /* $1_ode state derivative */"$ 
write "  extern double x[", MTTNx+1, "]; /* $1_ode state */"$ 
write "  extern double u[", MTTNu+1, "]; /* $1_ode input */"$

%Declare the dummy variables t0--t9
write "/* Dummy variable list */ "$
write "  double t0;"$
FOR i := 1:9 DO
BEGIN
  write "  double t", i, ";"$
END$

%Declarations$
write "/* State variable list */ "$
FOR i := 1:MTTNx DO
BEGIN
  write "  double mttx", i, ";"$
END$

write "/* Input variable list */ "$
FOR i := 1:MTTNu DO
BEGIN
  write "  double mttu", i, ";"$
END$

write "/* Counter */ "$
write "  int i;"$

write "/* Parameter  list */ "$
write "#include ", """$1_sympar.c"""$

write "  "$
write "    /*====== Set up the state variables ======*/"$
FOR i := 1:MTTNx DO
BEGIN
  write "    mttx", i, " = x[", i, "];"$
END$

write "  "$
write "    /*====== Set up the input variables ======*/"$
IF MTTNu>0 THEN
BEGIN
  FOR i := 1:MTTNu DO
  BEGIN
    write "    mttu", i, " = u[", i, "];"$
  END$
END$


write "  "$
write "    /*====== Compute the state derivative and output ======*/"$

SHUT "$1_ode.c1";

% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := 'C;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 80;
ON DOUBLE;

% let it know that sign is a function
GENTRAN DECLARE sign : function;
GENTRAN DECLARE r_switch : function;
GENTRAN DECLARE i_switch : function;

GENTRANOUT "$1_ode.c2";
%Do the translation
%State
IF MTTNx>0 THEN
BEGIN
  FOR i := 1:MTTNx DO
  BEGIN
        GENTRAN dx(i) ::=: mttdx(i,1)$
  END
END$

%Output
IF MTTNy>0 THEN
BEGIN
  FOR i := 1:MTTNy DO
  BEGIN
        GENTRAN y(i) ::=: mtty(i,1)$
  END
END$


GENTRANSHUT "$1_ode.c2";

EOF

echo '}' > $1_ode.c3
cat $1_ode.c1 $1_ode.c2 $1_ode.c3> $1_ode.c


Deleted mttroot/mtt/bin/trans/ode_r2lang version [7b0000767e].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245





















































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode_r2lang
# Reduce ODE to general language ODE
# Based on obsolete ode_r2m  
# P.J.Gawthrop 14 June 1991, 12 Jan 1994, April 1994, Jan 95, May 1998
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/07/19 16:22:29  peterg
## Changed header to inculde mttu
##
## Revision 1.2  1998/06/21 10:40:58  peterg
## Added fsolve error message.
##
## Revision 1.1  1998/05/23 16:17:14  peterg
## Initial revision
##
###############################################################

# Set up the language specific stuff
language=$2

case $language in
    m)
	ext='m';
	codegenerator='PASCAL'
	Lc='#';
	Rc='#';
	Lb='(';
	Rb=')';
	;;
    c)
	ext='c';
	codegenerator='C'
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    java)
	ext='java';
	codegenerator='C'
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
       *)
       echo Language $2 not supported - sorry; exit 1
esac

#Inform user
echo Creating $1_ode.$ext
echo Creating $1_odea.$ext
echo Creating $1_odeo.$ext


# Remove the old log file
rm -f ode_r2lang.log

#Remove the temporary files
rm -f $1_ode.$ext.1
rm -f $1_odea.$ext.1
rm -f $1_odeo.$ext.1

# Use reduce to accomplish the transformation
$SYMBOLIC  << EOF #>ode_r2lang.log

%Read the reduce definitions file
in "$1_def.r";

%Read the reduce  ODE   file
in "$1_ode.r";


% Set up the code generator
% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := '$codegenerator;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_temp;

% Matrix output function
in"$MTTPATH/trans/lang_matrix.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the parameter file
in "$1_sympar.r";

% The body of the ode function
  GENTRANOUT "$1_ode.$ext.1";
  mtt_matrix := MTTdX$
  mtt_matrix_n := MTTNx$
  mtt_matrix_m := 1$
  mtt_matrix_name := 'MTTdX$
  lang_matrix()$ 
  GENTRANSHUT "$1_ode.$ext.1";
  
% The algebraic equations (if any)
  GENTRANOUT "$1_odea.$ext.1";
  mtt_matrix := MTTYz$
  mtt_matrix_n := MTTNYz$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTYz$
  lang_matrix()$ 
  GENTRANSHUT "$1_odea.$ext.1";


% Now do the y = g(x,t) function.
% The body of the odeo function
  GENTRANOUT "$1_odeo.$ext.1";
  mtt_matrix := MTTy$
  mtt_matrix_n := MTTNy$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTy$
  lang_matrix()$ 
  GENTRANSHUT "$1_odeo.$ext.1";

EOF

# Create the ode.$ext function
lang_header $1 ode $ext 'mttx,mttu,t' mttdx > $1_ode.$ext

# Algebraic bits
$MATRIX -q  <<EOF  >> $1_ode.$ext
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;
if nyz>0
  printf("global mttxx mttt;\n");
  printf("mttxx = mttx; mttt=t;\n");

  printf("$Lc====== Extract the internal input variables ======$Rc\n");
  for i = 1:nyz
    printf("  mttui$Lb%i$Rb = mttx$Lb%i$Rb;\n",i,i+nx);
  end;
  printf("\n");

  printf("[mttui,info] = fsolve('$1_odea',mttui);\n");
  printf("if (info!=1)\n"); 
  printf("  error('fsolve has not converged')\n");
  printf("end\n");
  printf("\n");

  printf("$Lc====== Set up the internal input variables ======$Rc\n");
  for i = 1:nyz
    printf("  mttui%i = mttui$Lb%i$Rb;\n",i,i);
  end;
  printf("\n");

  printf("$Lc====== Put internal input variables at end of state derivative ======$Rc\n");
  for i = 1:nyz
    printf(" mttdx$Lb%i$Rb = mttui%i;\n",i+nx,i);
  end;
  printf("\n");
end;

EOF

cat <<EOF >> $1_ode.$ext

$Lc The differential equations $Rc
EOF

sed 's/mtt_matrix/mttdx/' $1_ode.$ext.1 >> $1_ode.$ext

# Java terminating }
if [ "$language" = "java" ]; then
cat <<EOF     >> $1_ode.$ext
}
EOF
fi


# Create the odea.$ext function
lang_header $1 odea $ext 'mttui' mttyz 'global mttxx mttt; mttx = mttxx; t=mttt;' > $1_odea.$ext

$MATRIX -q  <<EOF  >> $1_odea.$ext
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;
if nyz>0
  printf("$Lc====== Set up the internal input variables ======$Rc\n");
  for i = 1:nyz
    printf("  mttui%i = mttui$Lb%i$Rb;\n",i,i);
  end;
  printf("\n");
end;
EOF

cat <<EOF >> $1_odea.$ext

% The algebraic equations
EOF
sed 's/mtt_matrix/mttyz/' $1_odea.$ext.1 >> $1_odea.$ext


# Create the odeo.$ext function
lang_header $1 odeo $ext 'mttx,mttu,t' mtty > $1_odeo.$ext

$MATRIX -q  <<EOF  >> $1_odeo.$ext
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;
if nyz>0
  printf("$Lc====== Extract the internal input variables ======$Rc\n");
  for i = 1:nyz
    printf("  mttui$Lb%i$Rb = mttx$Lb%i$Rb;\n",i,i+nx);
  end;
  printf("\n");

  printf("$Lc====== Set up the internal input variables ======$Rc\n");
  for i = 1:nyz
    printf("  mttui%i = mttui$Lb%i$Rb;\n",i,i);
  end;
  printf("\n");
end;

EOF


cat <<EOF >> $1_odeo.$ext

% The output equations
EOF
sed 's/mtt_matrix/mtty/' $1_odeo.$ext.1 >> $1_odeo.$ext

# Convert from Pascal syntax to Octave syntax
mv $1_ode.m mtt_junk; mtt_p2m<mtt_junk > $1_ode.m
mv $1_odeo.m mtt_junk; mtt_p2m<mtt_junk > $1_odeo.m
mv $1_odea.m mtt_junk; mtt_p2m<mtt_junk > $1_odea.m




Deleted mttroot/mtt/bin/trans/ode_r2m version [574a94f900].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314


























































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode_r2m
# Reduce ODE to matlab  ODE  
# P.J.Gawthrop 14 June 1991, 12 Jan 1994, April 1994, Jan 95.
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.13  1998/05/21 16:19:54  peterg
## Modified to include explicit algebraic loop solution
##
## Revision 1.12  1998/05/21 12:55:48  peterg
## Put in algebraic equation stuff
##
## Revision 1.11  1998/05/21 08:05:23  peterg
## Back under RCS
##
## Revision 1.10  1998/04/14 07:25:02  peterg
## _input now has arguments (x,t)
##
## Revision 1.9  1998/03/30 14:18:07  peterg
## Removed NERO command
##
## Revision 1.8  1998/02/25 18:03:49  peterg
## Removed the argument reading bits.
##
## Revision 1.7  1997/08/29 07:58:17  peterg
## Changed MTT to mtt in the .m files.
##
# Revision 1.6  1997/01/05  19:34:35  peterg
# Don't write globals which are already assigned to a number.
#
## Revision 1.5  1996/09/13 19:41:39  peter
## *** empty log message ***
##
## Revision 1.4  1996/09/12 18:33:32  peter
## Put back under rcs
##
## Revision 1.3  1996/08/30 11:04:28  peter
## Changed line length to 500.
##
## Revision 1.2  1996/08/24 14:09:41  peter
## Global parameter passing.
##
## Revision 1.1  1996/08/18 12:03:49  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_ode.m
echo Creating $1_odea.m
echo Creating $1_odeo.m


# Remove the old log file
rm -f ode_r2m.log

#Remove the temporary files
rm -f $1_ode.mc
rm -f $1_ode.m1
rm -f $1_ode.m2
rm -f $1_ode.m3
rm -f $1_ode.m4
rm -f $1_odea.m1;
rm -f $1_odeo.m1;

# Use reduce to accomplish the transformation
reduce >ode_r2m.log << EOF

%Read the reduce definitions file
in "$1_def.r";

%Read the reduce  ODE   file
in "$1_ode.r";

% Matrix output function
in"$MTTPATH/trans/matlab_matrix.r";


%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the parameter file
in "$1_sympar.r";

%ON NERO;        % Suppress zero elements

%Define the common part of the functions.

PROCEDURE common;
BEGIN
  write "% Read in the input";
  write "u = $1_input(x,t)";

  write "% Read in the definitions";
  write "[nx,ny,nu,nz,nyz] = $1_def";

%  write "% Read in the arguments";
%  write "$1_args";
  
  write "% Set up the State variables";
  FOR i := 1:MTTNx DO
  BEGIN
    write "mttx", i, " = x(", i, ");";
  END;
  
  write "% Set up the Input variables";
  IF MTTNu>0 THEN
  FOR i := 1:MTTNu DO
  BEGIN
    write "mttu", i, " = u(", i, ");";
  END;

END;

% The common part
OUT "$1_ode.mc";
common();
SHUT "$1_ode.mc";

% Set up internal inputs (if any)
OUT "$1_ode.m3";
  write "% Set up the Internal Input variables";
  IF MTTNyz>0 THEN
  FOR i := 1:MTTNyz DO
  BEGIN
    write "mttui", i, " = mttui(", i, ");";
  END;
SHUT "$1_ode.m3";

OUT "$1_ode.m4";
  write "% Set up the Internal Input variables (saved in the state vector)";
  IF MTTNyz>0 THEN
  FOR i := 1:MTTNyz DO
  BEGIN
    write "mttui(", i, ") = x(", i+MTTNx, ");";
  END;
SHUT "$1_ode.m4";

% The body of the ode function
  GENTRANOUT "$1_ode.m1";
  mtt_matrix := MTTdX$
  mtt_matrix_n := MTTNx$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTdX$
  matlab_matrix(); 
  GENTRAN MTTdx := mtt_matrix;
  GENTRANSHUT "$1_ode.m1";
  
% The algebraic equations (if any)
  GENTRANOUT "$1_odea.m1";
  mtt_matrix := MTTYz$
  mtt_matrix_n := MTTNYz$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTYz$
  matlab_matrix(); 
  GENTRAN MTTYz := mtt_matrix;
  GENTRANSHUT "$1_odea.m1";

 
%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 10000$
OFF period$

MTTdx := MTTdx;


SHUT "$1_ode.m";

OUT "$1_odea.m";
write "function zero = $1_odea(x,t);";
write "% zero = $1_odea(x,t);";
write "%Algebraic equations in octave form for system $1;;";
write "%File $1_odea.m;;";
write "%Generated by MTT;;";

%Write algebraic equations if any ...
zero := MTTYz;
SHUT "$1_odea.m";

% Now do the y = g(x,t) function.
% The body of the odeo function
  GENTRANOUT "$1_odeo.m1";
  mtt_matrix := MTTy$
  mtt_matrix_n := MTTNy$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTy$
  matlab_matrix(); 
  GENTRAN MTTy := mtt_matrix;
  GENTRANSHUT "$1_odeo.m1";


EOF

# Create the ode.m function
cat <<EOF > $1_ode.m
function mttdx = $1_ode(x,t);
% mttdx = $1_ode(x,t);
%ODE in Octave form for system $1;
%File $1_ode.m;
%Generated by MTT on `date`;
EOF

# Create the globals
sympar2global_txt2m $1 >> $1_ode.m

#Common bit
cat $1_ode.mc >> $1_ode.m

#Extract internal input from state vector
cat $1_ode.m4 >> $1_ode.m

cat <<EOF >> $1_ode.m
% Solve the algebraic equations (if any)
if nyz>0
  global xx tt;
  xx = x; tt=t;
  MTTui = fsolve('$1_odea',mttui);
else
 mttui = [];
end
EOF

cat $1_ode.m3 >> $1_ode.m

cat <<EOF >> $1_ode.m

% The differential equations
EOF
cat $1_ode.m1 >> $1_ode.m

cat <<EOF >> $1_ode.m

% Append the internal inputs to the state derivative
mttdx = [mttdx; mttui];
EOF


# Create the odea.m function
cat <<EOF > $1_odea.m
function mttyz = $1_odea(mttui);
% mttyz = $1_odea(mttui);
%Algebraic equations in Octave form for system $1;
%File $1_odea.m;
%Generated by mtt on `date`;
EOF

# Create the globals
sympar2global_txt2m $1 >> $1_odea.m

cat <<EOF >> $1_odea.m

global xx tt;
x = xx; t=tt;
EOF

#Common bit
cat $1_ode.mc >> $1_odea.m

# Internal inputs
cat $1_ode.m3 >> $1_odea.m

cat <<EOF >> $1_odea.m

% The algebraic equations
EOF
cat $1_odea.m1 >> $1_odea.m

# Create the odeo.m function
cat <<EOF > $1_odeo.m
function mtty = $1_odeo(x,t);
% mtty = $1_odeo(x,t);
%Algebraic equations in Octave form for system $1;
%File $1_odeo.m;
%Generated by MTT  on `date`;
EOF

# Create the globals
sympar2global_txt2m $1 >> $1_odeo.m


#Common bit
cat $1_ode.mc >> $1_odeo.m

#Extract internal input from state vector
cat $1_ode.m4 >> $1_odeo.m

# Internal inputs
cat $1_ode.m3 >> $1_odeo.m

cat <<EOF >> $1_odeo.m

% The output equations
EOF
cat $1_odeo.m1 >> $1_odeo.m







Deleted mttroot/mtt/bin/trans/ode_r2tex version [d72a266090].

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
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

























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode_r2tex
# Reduce differential-algebraic to LaTex differential-algebraic equations.
# P.J.Gawthrop 10th May 1991, April 1994
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/01/23 15:51:01  peterg
## Repleace eqnarray by equation + aligned -- this works with Latex2html
##
## Revision 1.2  1996/12/20 08:59:10  peterg
## Now writes out mtti instead of mtt_{i} -- lets latex_tidy do the
## conversion.
##
## Revision 1.1  1996/12/20 08:53:57  peterg
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_ode.tex

# Remove the old log file
rm -f ode_r2tex.log

# Use reduce to accomplish the transformation
reduce >ode_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the differential-algebraic equations file
in "$1_ode.r";

%Read the symbolic parameter file
%%in "$1_sympar.r";



OFF Echo;
OFF Nat;

%Read the substitution file
IN "$1_subs.r";

%Read the simplifying expressions file
IN "$1_simp.r";

OUT "$1_ode.tex";

%Write out the  differential-algebraic equations.

write "%File: $1_ode.tex";

write "%ordinary differential equations";
write "% Generated by MTT";

IF MTTNx>0 THEN
BEGIN
  write"\begin{equation} \label{eq_$1_ode_x}";
  write"\begin{aligned}";
  FOR Row := 1:MTTNx DO
  BEGIN
	write "\dot MTTX", Row, " &= ";
	write "{";
	write MTTdx(Row,1);
	write "}";
        IF Row<MTTNx THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;

IF MTTNyz>0 THEN
BEGIN
  write"\begin{equation}";
  write"\begin{aligned}";
FOR Row := 1:MTTNyz DO
  BEGIN
	write "0 &= ";
	write "{";
	write MTTyz(Row,1);
	write "}";
        IF Row<MTTNyz THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;

IF MTTNy>0 THEN
BEGIN
  write"\begin{equation} \label{eq_$1_ode_y}";
  write"\begin{aligned}";
  FOR Row := 1:MTTNy DO
  BEGIN
	write "MTTy", Row, " &= ";
	write "{";
	write MTTy(Row,1);
	write "}";
        IF Row<MTTNy THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;





SHUT "$1_ode.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/odes_dat2sdat version [10897a37e0].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: odeso_dat2sdat

# Structure file - dat to sdat conversion
# P.J.Gawthrop April 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  2000/12/28 12:38:24  peterg
## Put under RCS
##
## Revision 1.1  1999/03/28 21:29:40  peterg
## Initial revision
##
###############################################################



# Inform user
echo "Creating $1_odeso.sdat"

dat2sdat $1 odes | dat2siag > $1_odes.sdat

Deleted mttroot/mtt/bin/trans/odeso_dat2sdat version [055c2bffbd].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: odeso_dat2sdat

# Structure file - dat to sdat conversion
# P.J.Gawthrop April 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1999/03/28 21:29:40  peterg
## Initial revision
##
###############################################################



# Inform user
echo "Creating $1_odeso.sdat"

dat2sdat $1 odeso | dat2siag > $1_odeso.sdat

Deleted mttroot/mtt/bin/trans/p/README version [4d29246b85].

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
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

















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Some of the files in this directory are derived from the NUMERICAL
RECIPES PASCAL SHAREWARE DISKETTE. Please note that any use of these
filse may be subject to the following notice:


             NUMERICAL RECIPES PASCAL SHAREWARE DISKETTE

The entire contents of this diskette are
Copyright (C) 1986 by Numerical Recipes Software.

HERE ARE ANSWERS TO YOUR IMMEDIATE QUESTIONS:

** What is this diskette?  ** This NUMERICAL  RECIPES PASCAL SHAREWARE
DISKETTE contains Pascal procedures originally published as the Pascal
Appendix to the FORTRAN book NUMERICAL RECIPES: THE  ART OF SCIENTIFIC
COMPUTING (Cambridge University Press, 1986), and test driver programs
originally published as the  NUMERICAL  RECIPES EXAMPLE BOOK  (PASCAL)
(Cambridge University Press, 1986).

** What kinds of procedures  are these Numerical Recipes? **  They are
practically a complete library for  scientific computation.  Numbering
more than  200,  their scope  includes   integration,  linear algebra,
differential  equations, Fourier methods,  data analysis,  statistics,
lots of special functions, random   numbers,  sorting, root   finding,
optimization, and much more.

** Do I really get this whole library for FREE? ** Yes, providing that
you follow these  simple  rules:   (1) You must   read and accept  the
disclaimer of warranty at the end of this  document.  (2) You must not
expect any  user support from  Numerical Recipes Software,   Cambridge
University Press, or the authors of  the Numerical Recipes books.  (3)
You must not copy  or redistribute any  of  the programs or procedures
for commercial purposes.  You CAN make copies of the programs for your
friends  and    colleagues, providing   that you  include   this  file
(especially its copyright notice and  disclaimer of warranty) with any
copy that you make.

** What's  the  catch, then?  **    None at  all.   Many  thousands of
satisfied users paid more than $20 to purchase exactly the programs on
this disk,  which were sold   by Cambridge  University  Press (C.U.P.)
between 1986 and 1989.  C.U.P.  now sells a  revised  version  of  the
Numerical  Recipes program library,  whose   Pascal  style   is   much
improved, but whose basic algorithmic  workings are identical  to this
disk.  Rather  than  let  the older version go  to waste,  its authors
decided to make it available to the shareware community of users.

** How can I figure out what the procedures do? ** One way is  to read
the brief descriptions of all the programs in the  file NRINFO.DOC.  A
better  way is to  look  at the  book   Numerical Recipes: The  Art of
Scientific Computing  in   any  one of its  three  editions  (FORTRAN,
Pascal, or  C).  If you  don't  want to buy this book   from Cambridge
University Press   (see the file  NRINFO.DOC),  you  can  find   it in
libraries.  Or, take  a pencil and   a small  piece  of paper  into  a
bookstore that carries the book and take  notes  on which programs you
might find interesting.

** How do I figure out how to use  the procedures? **  Again, you have
several  options.   All  the   procedures  (named   *.PAS)  come  with
demonstration  programs  (named *.DEM).   These demonstration programs
are included on this shareware diskette.  (When sold, they are sold as
a separate  diskette.)  Usually  you can figure    out how  to   use a
procedure by figuring out its .DEM program.  Another way is to look at
the Numerical Recipes book in a library or bookstore.

** Aren't you just trying to get me to  buy the book?  **  Think of it
this way: Most shareware comes with the requirement that if you use it
more than casually, you are  required to become  a registered user and
pay a fee.  We are not requiring any  fee at all.   We think that  you
will  be able to  use MOST of the procedures  on this diskette without
the Numerical Recipes book.  If you become a more-than-casual user, or
if you look at the book in a bookstore, we  are betting  that you will
WANT to buy it,  and  perhaps  then  want to purchase  the revised and
improved versions of the programs, also.   But it is completely  up to
you.

** OK, what if I do want to get the book? ** Call Cambridge University
Press at their  toll-free  number,  800-872-7423.  (In  New York  call
800-227-0247 or 914-937-9600.)  Ask for "Numerical Recipes in Pascal",
ISBN  number  0-521-37516-9.  We think  you'll like it.  (Over 100,000
copies of the book are in print, in FORTRAN, Pascal, and C.)

** What  are the files  on this diskette? **  All  the  procedures, in
Pascal source  code, are  in   the ZIP   file NRPAS13.ZIP.   You   use
PKUNZIP.EXE to decompress them.  (For  info  just execute PKUNZIP with
no  command  line  arguments.)  All  the  demonstration  programs  are
similarly in NRPEX10.ZIP (PEX means Pascal EXamples).  Some data files
used by the procedures and demonstrations programs are in NRPDATA.ZIP.
The files NRPAS13.LST and NRPEX10.LST each list the names of the files
in their corresponding ZIP file.   The short file  MODFILE.PAS is used
by many of the  procedures to customize  to your particular variety of
Pascal  compiler; feel free to modify  it, if  you need to.  The  file
NRINFO.DOC tells about the book Numerical Recipes in Pascal and  gives
a   brief description of  all the  procedures.   The  file you are now
reading is NRREADME.DOC.

Good luck, and happy number-crunching!

                       DISCLAIMER OF WARRANTY
                       ---------- -- -------- 
THE PROGRAMS AND  PROCEDURES  ON  THIS DISKETTE  ARE PROVIDED "AS  IS"
WITHOUT  WARRANTY OF  ANY KIND.   WE  MAKE NO  WARRANTIES, EXPRESS  OR
IMPLIED, THAT THE PROGRAMS  AND PROCEDURES ARE FREE  OF ERROR, OR  ARE
CONSISTENT WITH ANY  PARTICULAR  STANDARD OF MERCHANTABILITY,  OR THAT
THEY WILL MEET YOUR REQUIREMENTS FOR ANY PARTICULAR APPLICATION.  THEY
SHOULD NOT BE RELIED ON FOR SOLVING A PROBLEM WHOSE INCORRECT SOLUTION
COULD RESULT IN INJURY TO A PERSON OR LOSS OF PROPERTY.  IF YOU DO USE
THE PROGRAMS OR PROCEDURES IN SUCH A MANNER, IT  IS AT YOUR OWN  RISK.
THE AUTHORS   AND  PUBLISHER   DISCLAIM ALL LIABILITY    FOR   DIRECT,
INCIDENTAL, OR  CONSEQUENTIAL DAMAGES RESULTING FROM YOUR  USE  OF THE
PROGRAMS OR PROCEDURES ON THIS DISKETTE.  ANY LIABILITY  OF THE PERSON
OR PERSONS FROM WHOM YOU DIRECTLY OR INDIRECTLY OBTAINED THIS DISKETTE
WILL BE LIMITED EXCLUSIVELY  TO PRODUCT REPLACEMENT OF DISKETTES  WITH
MANUFACTURING DEFECTS.

Deleted mttroot/mtt/bin/trans/p/mtt_euler.p version [6de6bf5883].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_euler(VAR x_out, x,dx : StateVector;
			dt	    : REAL;
			Nx	    : INTEGER;
			Open	    : StateVector);

VAR i : INTEGER;
   
BEGIN{mtt_euler}
   FOR i := 1 TO Nx DO
   BEGIN
      IF Open[i]>0.5 THEN{Open switch}
	 x_out[i] := 0.0
      ELSE
	 x_out[i] := x[i] + dx[i]*dt;
   END;
END;{mtt_euler}

Deleted mttroot/mtt/bin/trans/p/mtt_getargs.p version [8b9348a180].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{ Substitute for p2c PASCAL_MAIN
   Copies pogramme arguments in to mtt_parameters array
   This c code is embedded in a pascal routine in a p2c compatible way
}

{EMBED
Static Void  PASCAL_MAIN(argc, argv)
int argc;
char *argv[];

\[
 int i;
 mttnpar = argc-1;
 if (mttnpar>0) \[
   for (i=0;i<MTT_Nx;i++)\[
     x[i] = strtod(argv[i+1],0);
  \]
   for (i=0;i<MTT_Npar;i++)\[
     par[i] = strtod(argv[i+MTT_Nx+1],0);
  \]
 simpar.first=strtod(argv[MTT_Nx+MTT_Npar+1],0);
 simpar.dt=strtod(argv[MTT_Nx+MTT_Npar+2],0);
 simpar.last=strtod(argv[MTT_Nx+MTT_Npar+3],0);
 \]
\]
}

Deleted mttroot/mtt/bin/trans/p/mtt_implicit.p version [e4c58449c4].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_implicit(VAR xnew	: StateVector;
			   x,dx	: StateVector;
			   AA	: StateMatrix;
			   AAx	: StateVector;
			   dt	: REAL;
			   Nx	: INTEGER;
			   open	: StateVector);

VAR
   i,ii,j,jj,Nxsub : INTEGER;
   BB,xsub   : StateVector;
   AAsub     : StateMatrix;
   
(*$I $MTTPATH/trans/p/mtt_solve.p *)

BEGIN{mtt_implicit}
   ii := 0;
   FOR i := 1 TO  Nx DO {BB is (1-A*dt)*x +dx*dt}
   BEGIN
      IF open[i]<0.5 THEN
      BEGIN
	 ii := ii+1; jj := 0;
	 BB[ii] := AAx[i] + dt*dx[i];
	 FOR j := 1 TO Nx DO
	    IF open[j]<0.5 THEN
	    BEGIN
	       jj := jj+1;
	       AAsub[ii,jj] := AA[i,j];
	    END;
      END;
   END;

   Nxsub := ii; {New size}
   mtt_solve(xsub,AAsub,BB,Nxsub); {Solve AAx=BB}

   ii := 0;
   FOR i := 1 TO Nx DO
      BEGIN
	 IF open[i]<0.5 THEN
	 BEGIN
	    ii := ii+1; 
	    xnew[i] := xsub[ii];
	 END
	 ELSE
	 xnew[i] := 0.0;
      END;
END;{mtt_implicit}			  

Deleted mttroot/mtt/bin/trans/p/mtt_lubksb.p version [c3d7f1be65].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_lubksb(a: StateMatrix; n: INTEGER; indx: StateVector; VAR b: StateVector);

{ This file is derived from the NUMERICAL RECIPES PASCAL SHAREWARE DISKETTE.
 Please read the README file in $MTTPATH/trans/p
 }

{
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/08/17 12:58:16  peterg
## Initial revision
##
###############################################################
}


(* Programs using LUBKSB must define the types
TYPE
   glnarray = ARRAY [1..n] OF real;
   glindx = ARRAY [1..n] OF integer;
   glnpbynp = ARRAY [1..np,1..np] OF real;
in the main routine *)
VAR
   j,ip,ii,i: integer;
   sum: real;
BEGIN
   ii := 0;
   FOR i := 1 TO n DO BEGIN
      ip := indx[i];
      sum := b[ip];
      b[ip] := b[i];
      IF  (ii <> 0) THEN BEGIN
         FOR j := ii TO i-1 DO BEGIN
            sum := sum-a[i,j]*b[j]
         END
      END ELSE IF (sum <> 0.0) THEN BEGIN
         ii := i
      END;
      b[i] := sum
   END;
   FOR i := n DOWNTO 1 DO BEGIN
      sum := b[i];
      IF (i < n) THEN BEGIN
         FOR j := i+1 TO n DO BEGIN
            sum := sum-a[i,j]*b[j]
         END
      END;
      b[i] := sum/a[i,i]
   END
END;

Deleted mttroot/mtt/bin/trans/p/mtt_ludcmp.p version [46fed2d80a].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84




















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_ludcmp(VAR a: StateMatrix; n: integer;
		     VAR indx: StateVector; VAR d: real);

{ This file is derived from the NUMERICAL RECIPES PASCAL SHAREWARE DISKETTE.
 Please read the README file in $MTTPATH/trans/p
 }

{
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/08/14 07:58:13  peterg
## Initial revision
##
###############################################################
}

(* Programs using LUDCMP must define the types
TYPE
   glnpbynp = ARRAY [1..np,1..np] OF real;
   glnarray = ARRAY [1..n] OF real;
   glindx = ARRAY [1..n] OF integer;
in the main routine. *)

CONST
   tiny=1.0e-20;

VAR
   k,j,imax,i: integer;
   sum,dum,big: real;
   vv: glnarray;

BEGIN
   d := 1.0;
   FOR i := 1 TO n DO BEGIN
      big := 0.0;
      FOR j := 1 TO n DO IF (abs(a[i,j]) > big) THEN big := abs(a[i,j]);
      IF (big = 0.0) THEN BEGIN
         writeln('pause in LUDCMP - singular matrix'); readln
      END;
      vv[i] := 1.0/big
   END;
   FOR j := 1 TO n DO BEGIN
      FOR i := 1 TO j-1 DO BEGIN
         sum := a[i,j];
         FOR k := 1 TO i-1 DO BEGIN
            sum := sum-a[i,k]*a[k,j]
         END;
         a[i,j] := sum
      END;
      big := 0.0;
      FOR i := j TO n DO BEGIN
         sum := a[i,j];
         FOR k := 1 TO j-1 DO BEGIN
            sum := sum-a[i,k]*a[k,j]
         END;
         a[i,j] := sum;
         dum := vv[i]*abs(sum);
         IF (dum > big) THEN BEGIN
            big := dum;
            imax := i
         END
      END;
      IF (j <> imax) THEN BEGIN
         FOR k := 1 TO n DO BEGIN
            dum := a[imax,k];
            a[imax,k] := a[j,k];
            a[j,k] := dum
         END;
         d := -d;
         vv[imax] := vv[j]
      END;
      indx[j] := imax;
      IF (a[j,j] = 0.0) THEN a[j,j] := tiny;
      IF (j <> n) THEN BEGIN
         dum := 1.0/a[j,j];
         FOR i := j+1 TO n DO BEGIN
            a[i,j] := a[i,j]*dum
         END
      END
   END;
END;

Deleted mttroot/mtt/bin/trans/p/mtt_par_update.p version [5ebd9ad207].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_numpar_update(VAR new_numpar : ParameterVector;
				   old_numpar : ParameterVector);
VAR i : INTEGER;
   
BEGIN {mtt_numpar_update}

   for i:=1 TO MTT_Npar DO {copy values}
      new_numpar[i] := old_numpar[i];
   
   WHILE NOT eof(numparfile) DO {read and update values}
      IF NOT (numparfile^ = chr("#")) THEN
      BEGIN
	 read(numparfile,i); read(numparfile,new_numpar[i]);
      END
      ELSE
	 readln(numparfile);
   
END {mtt_numpar_update};

PROCEDURE mtt_state_update(VAR new_state : StateVector;
			       old_state : StateVector);

VAR i : INTEGER;
   
BEGIN {mtt_state_update}

   for i:=1 TO MTT_Nx DO {copy values}
      new_state[i] := old_state[i];

   WHILE NOT eof(statefile) DO {read and update values}
      IF NOT (statefile^ = chr("#")) THEN
      BEGIN
	 read(statefile,i); read(statefile,new_state[i]);
      END
      ELSE
	 readln(statefile);
      
END {mtt_state_update};

PROCEDURE mtt_simpar_update(VAR dt : REAL);
BEGIN {mtt_simpar_update}

   WHILE NOT eof(simparfile) DO {read and update values}
   BEGIN
      IF NOT (simparfile^ = chr("#")) THEN
	 read(simparfile,dt);
      readln(simparfile); 
   END
END {mtt_simpar_update};

Deleted mttroot/mtt/bin/trans/p/mtt_solve.p version [284b083bf3].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_solve(VAR x : StateVector;
			A : StateMatrix;
			B : StateVector;
			n : integer);

{

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.3  1999/10/26 23:44:36  peterg
% % Now packages up mtt_solve_lud OR mtt_solve_svd
% %
% % Revision 1.2  1998/08/14 12:09:13  peterg
% % A passed by value - its destroyed by SVDcm
% %
% % Revision 1.1  1998/08/13 08:51:57  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 }

VAR
   i	     : integer;
   wmax,wmin : real;
   w	     : StateVector ;
   v	     : StateMatrix;


(*$I $MTTPATH/trans/p/mtt_solve_lud.p *)
(* I $MTTPATH/trans/p/mtt_solve_svd.p *)

BEGIN{mtt_solve}
      mtt_solve_lud(x,A,B,N);
      (*** mtt_solve_svd(x,A,B,N); ***)
END{mtt_solve};

Deleted mttroot/mtt/bin/trans/p/mtt_solve_lu.p version [a11985cf48].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_solve_lu.p(VAR x     : StateVector;
			A     : StateMatrix;
		    VAR B     : StateVector;
			n     : integer;
			Small : real);

{
Linear equation solution via LU factorisation}

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.2  1998/08/14 12:09:13  peterg
% % A passed by value - its destroyed by SVDcm
% %
% % Revision 1.1  1998/08/13 08:51:57  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 }

VAR
   i	     : integer;
   wmax,wmin : real;
   w	     : StateVector ;
   v	     : StateMatrix;

(*$I svdcmp.p *)
(*$I svbksb.p *)

BEGIN{mtt_solve}
(* decompose matrix A using SVD *)
   svdcmp(A,n,n,w,v);
   
(* find maximum singular value *)
   wmax := 0.0;
   FOR i := 1 to n DO BEGIN
      IF  (w[i] > wmax) THEN  wmax := w[i]
   END;
   
(* define "small" *)
   wmin := wmax*Small;
   
(* zero the "small" singular values *)
   FOR i := 1 to n DO BEGIN
      IF  (w[i] < wmin) THEN  w[i] := 0.0
   END;
   
(* backsubstitute for B *)
      svbksb(A,w,v,n,n,B,x);
   
END{mtt_solve};

Deleted mttroot/mtt/bin/trans/p/mtt_solve_lud.p version [ec0698602b].

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





























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_solve_lud(VAR x     : StateVector;
			A     : StateMatrix;
		        B     : StateVector;
			n     : integer);

{
Linear equation solution via LU factorisation

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.3  1999/10/26 23:37:20  peterg
% % Put include files here.
% %
% % Revision 1.2  1998/08/17 15:56:10  peterg
% % Uses LU decomposition - much faster than SVD when N>100
% %
% % Revision 1.1  1998/08/17 12:52:16  peterg
% % Initial revision
% %
% % Revision 1.1  1998/08/17 12:41:37  peterg
% % Initial revision
% %
% % Revision 1.2  1998/08/14 12:09:13  peterg
% % A passed by value - its destroyed by SVDcm
% %
% % Revision 1.1  1998/08/13 08:51:57  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 }

VAR
   i	 : integer;
   d	 : real;
   Index : StateVector;


(*$I $MTTPATH/trans/p/mtt_ludcmp.p *)
(*$I $MTTPATH/trans/p/mtt_lubksb.p *)

BEGIN{mtt_solve_lud}
   (* decompose matrix A using LU decomposition *)
   mtt_ludcmp(A,n,Index,d);
   
   (* backsubstitute for B *)
   mtt_lubksb(A,n,Index,B);

   (* x now lives in B *)
   FOR i := 1 TO n DO
      x[i] := B[i];
   
END{mtt_solve_lud};






Deleted mttroot/mtt/bin/trans/p/mtt_solve_svd.p version [4ad1314c58].

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































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_solve_svd(VAR x : StateVector;
			    A : StateMatrix;
			VAR B : StateVector;
			    n : integer);

{Solve linear equation via svd}

{

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.2  1998/08/17 12:40:25  peterg
% % Renamed mtt_solve to mtt_solve_svd
% % -- now also have mtt_solve_lu
% %
% % Revision 1.1  1998/08/17 12:38:52  peterg
% % Initial revision
% %
% % Revision 1.2  1998/08/14 12:09:13  peterg
% % A passed by value - its destroyed by SVDcm
% %
% % Revision 1.1  1998/08/13 08:51:57  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 }

CONST
   Small =  1e-6; (* Criteroion for small svd *)
VAR
   i	     : integer;
   wmax,wmin : real;
   w	     : StateVector ;
   v	     : StateMatrix;

(*$I svdcmp.p *)
(*$I svbksb.p *)

BEGIN{mtt_solve}
(* decompose matrix A using SVD *)
   svdcmp(A,n,n,w,v);
   
(* find maximum singular value *)
   wmax := 0.0;
   FOR i := 1 to n DO BEGIN
      IF  (w[i] > wmax) THEN  wmax := w[i]
   END;
   
(* define "small" *)
   wmin := wmax*Small;
   
(* zero the "small" singular values *)
   FOR i := 1 to n DO BEGIN
      IF  (w[i] < wmin) THEN  w[i] := 0.0
   END;
   
(* backsubstitute for B *)
      svbksb(A,w,v,n,n,B,x);
   
END{mtt_solve};

Deleted mttroot/mtt/bin/trans/p/mtt_sparse.p version [c94532268f].

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
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




























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_sparse(	 b	 : glnarray;
			 n,iters : INTEGER;
		     VAR x	 : glnarray);

{ This file is derived from the NUMERICAL RECIPES PASCAL SHAREWARE DISKETTE.
 Please read the README file in $MTTPATH/trans/p
 }
{*
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/08/15 13:49:19  peterg
## iters now passed as an argument.
##
## Revision 1.4  1998/08/15 09:33:25  peterg
## Deleted the commented out stuff
##
## Revision 1.3  1998/08/15 09:30:05  peterg
## Commented out the cariabel iteration stuff
##
## Revision 1.2  1998/08/15 08:26:30  peterg
## This is variable interations version - now going on to fixed
## iterations
##
## Revision 1.1  1998/08/13 14:58:35  peterg
## Initial revision
##
## Revision 1.1  1998/08/13 08:40:40  peterg
## Initial revision
##
###############################################################
*}

(* Programs using routine SPARSE must define the type
TYPE
   glnarray = ARRAY [1..n] OF real;
in the main routine. They must also provide two routines,
PROCEDURE asub(x: glnarray; VAR y: glnarray; n: integer);
and
PROCEDURE atsub(x: glnarray; VAR z: glnarray; n: integer);
which calculate A*x and (A transpose)*x *)
   
VAR
   j,iter,irst: integer;
   rp,gg,gam,eps2,dgg,bsq,anum,aden: real;
   g,h,xi,xj: glnarray;
   
BEGIN {mtt_sparse}
   mtt_asub(x,xi,n);
   rp := 0.0;
   bsq := 0.0;
   FOR j := 1 TO n DO BEGIN
      xi[j] := xi[j]-b[j];
   END;
   mtt_atsub(xi,g,n);
   FOR j := 1 TO n DO BEGIN
      g[j] := -g[j];
      h[j] := g[j]
   END;
   FOR iter := 1 TO iters DO BEGIN
      mtt_asub(h,xi,n);
      anum := 0.0;
      aden := 0.0;
      FOR j := 1 TO n DO BEGIN
         anum := anum+g[j]*h[j];
         aden := aden+sqr(xi[j])
      END;
      anum := anum/aden;
      FOR j := 1 TO n DO BEGIN
         xi[j] := x[j];
         x[j] := x[j]+anum*h[j]
      END;
      mtt_asub(x,xj,n);
      FOR j := 1 TO n DO BEGIN
         xj[j] := xj[j]-b[j];
      END;
      mtt_atsub(xj,xi,n);
      gg := 0.0;
      dgg := 0.0;
      FOR j := 1 TO n DO BEGIN
         gg := gg+sqr(g[j]);
         dgg := dgg+(xi[j]+g[j])*xi[j]
      END;
      gam := dgg/gg;
      FOR j := 1 TO n DO BEGIN
         g[j] := -xi[j];
         h[j] := g[j]+gam*h[j]
      END
   END;
END {mtt_sparse};

Deleted mttroot/mtt/bin/trans/p/mtt_update.p version [36e3f6e075].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_update(VAR xnew	    : StateVector;
		         dx,x,AAx   : StateVector;
		     VAR AA	    : StateMatrix;
			 DT	    : REAL;
			 STEPFACTOR : INTEGER;
			 Nx	    : INTEGER;
			 METHOD	    : IntegrationMethod);

{
 ###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/08/15 13:48:35  peterg
## New update methods
##
## Revision 1.4  1998/08/14 10:54:58  peterg
## Use sparse computation where possible
##
###############################################################
}

CONST
   Small = 0.000001;
   
VAR
   i,j : INTEGER;
   BB  : StateVector;
   DDT : REAL;
   
(*$I mtt_solve_lud.p *)
(*$I mtt_sparse.p *)
   
BEGIN{mtt_update}
   
   IF Method=1 THEN {Euler}
   BEGIN{Euler}
      DDT := DT/STEPFACTOR;
	 FOR i := 1 TO  Nx DO
	    xnew[i] := xnew[i] + dx[i]*DDT;
   END {Euler}
   ELSE IF (Method=2) OR (METHOD=3) OR (METHOD=4) THEN {Implicit}
      BEGIN {Implicit methods}
	 
	 FOR i := 1 TO  Nx DO {BB is (1-A*dt)*x +dx*dt}
	    BB[i] := AAx[i] + DT*dx[i];

	 {Solve the equation AAx = B}
	 IF (Method=2) OR (METHOD=3) THEN {Use SVD}
	    mtt_solve_lud(xnew,AA,BB,Nx)
	 ELSE {Sparse CG solution}
	    mtt_sparse(BB,Nx,STEPFACTOR,xnew);
      END{Implicit methods}
      ELSE
	 Writeln("Method >4 is not defined");
   
END{mtt_update};




Deleted mttroot/mtt/bin/trans/p/mtt_write.p version [0a11e8a899].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE mtt_write(t	  : REAL;
		    x	  : StateVector;
		    y	  : OutputVector;
		    nx,ny : INTEGER);

{*
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
      Pascal function mtt_write
      P.J. Gawthrop July 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1999/03/15 21:57:38  peterg
## Removed the # symbol
##
## Revision 1.4  1998/11/26 13:31:30  peterg
## Put missing space after 2nd t
##
## Revision 1.3  1998/07/25 20:41:38  peterg
## Spaces between numbers
##
## Revision 1.2  1998/07/25 14:04:14  peterg
## Changed format
##
## Revision 1.1  1998/07/25 09:47:25  peterg
## Initial revision
##
###############################################################


*}

CONST TAB=9;
 
VAR
   i : INTEGER;
   
BEGIN
   write(t,chr(TAB));
   FOR i := 1 TO ny DO
      write(y[i],chr(TAB));

   write(t,chr(TAB));
   FOR i := 1 TO nx DO
      write(x[i],chr(TAB));
   writeln;
END;
   

Deleted mttroot/mtt/bin/trans/p/sign.p version [52b4a0069f].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
FUNCTION sign(x	: REAL) : REAL;
{ This useful function is missing from Pascal }

BEGIN
   IF X>=0 THEN
      sign := 1
   ELSE
      sign := -1;
END; { sign }

Deleted mttroot/mtt/bin/trans/p/sparse.p version [a1c1b1b77d].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91



























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE sparse(b: glnarray; n: integer; VAR x: glnarray; VAR rsq: real);
{*
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################
*}

(* Programs using routine SPARSE must define the type
TYPE
   glnarray = ARRAY [1..n] OF real;
in the main routine. They must also provide two routines,
PROCEDURE asub(x: glnarray; VAR y: glnarray; n: integer);
and
PROCEDURE atsub(x: glnarray; VAR z: glnarray; n: integer);
which calculate A*x and (A transpose)*x *)
LABEL 1,99;
CONST
   eps=1.0e-6;
VAR
   j,iter,irst: integer;
   rp,gg,gam,eps2,dgg,bsq,anum,aden: real;
   g,h,xi,xj: glnarray;
BEGIN
   eps2 := n*sqr(eps);
   irst := 0;
1:   irst := irst+1;
   asub(x,xi,n);
   rp := 0.0;
   bsq := 0.0;
   FOR j := 1 TO n DO BEGIN
      bsq := bsq+sqr(b[j]);
      xi[j] := xi[j]-b[j];
      rp := rp+sqr(xi[j])
   END;
   atsub(xi,g,n);
   FOR j := 1 TO n DO BEGIN
      g[j] := -g[j];
      h[j] := g[j]
   END;
   FOR iter := 1 TO 10*n DO BEGIN
      asub(h,xi,n);
      anum := 0.0;
      aden := 0.0;
      FOR j := 1 TO n DO BEGIN
         anum := anum+g[j]*h[j];
         aden := aden+sqr(xi[j])
      END;
      IF (aden = 0.0) THEN BEGIN
         writeln('pause in routine SPARSE');
         writeln('very singular matrix'); readln
      END;
      anum := anum/aden;
      FOR j := 1 TO n DO BEGIN
         xi[j] := x[j];
         x[j] := x[j]+anum*h[j]
      END;
      asub(x,xj,n);
      rsq := 0.0;
      FOR j := 1 TO n DO BEGIN
         xj[j] := xj[j]-b[j];
         rsq := rsq+sqr(xj[j])
      END;
      IF ((rsq = rp) OR (rsq <= bsq*eps2)) THEN GOTO 99;
      IF (rsq > rp) THEN BEGIN
         FOR j := 1 TO n DO BEGIN
            x[j] := xi[j]
         END;
         IF (irst >= 3) THEN GOTO 99;
         GOTO 1
      END;
      rp := rsq;
      atsub(xj,xi,n);
      gg := 0.0;
      dgg := 0.0;
      FOR j := 1 TO n DO BEGIN
         gg := gg+sqr(g[j]);
         dgg := dgg+(xi[j]+g[j])*xi[j]
      END;
      IF (gg = 0.0) THEN GOTO 99;
      gam := dgg/gg;
      FOR j := 1 TO n DO BEGIN
         g[j] := -xi[j];
         h[j] := g[j]+gam*h[j]
      END
   END;
   writeln('pause in routine SPARSE');
   writeln('too many iterations'); readln;
99:   END;

Deleted mttroot/mtt/bin/trans/p/svbksb.p version [d97150a209].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE svbksb(u: glmpbynp; w: glnparray; v: glnpbynp;
       m,n: integer; b: glmparray; VAR x: glnparray);
{

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.2  1998/08/12 11:09:54  peterg
% % Taken from NR share library nrpas13 as  SVBKSB.PAS
% % and renamed  svbksb.p
% %
% % Revision 1.1  1998/08/12 11:09:02  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 }


(* Programs using SVBKSB must define the types
TYPE
   glnparray = ARRAY [1..np] OF real;
   glmparray = ARRAY [1..mp] OF real;
   glnpbynp = ARRAY [1..np,1..np] OF real;
   glmpbynp = ARRAY [1..mp,1..np] OF real;
in the main routine. *)
VAR
   jj,j,i: integer;
   s: real;
   tmp: glnparray;
BEGIN
   FOR j := 1 TO n DO BEGIN
      s := 0.0;
      IF (w[j] <> 0.0) THEN BEGIN
         FOR i := 1 TO m DO BEGIN
            s := s+u[i,j]*b[i]
         END;
         s := s/w[j]
      END;
      tmp[j] := s
   END;
   FOR j := 1 TO n DO BEGIN
      s := 0.0;
      FOR jj := 1 TO n DO BEGIN
         s := s+v[j,jj]*tmp[jj];
      END;
      x[j] := s
   END
END;

Deleted mttroot/mtt/bin/trans/p/svdcmp.p version [33402da454].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
























































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCEDURE svdcmp(VAR a: glmpbynp; m,n: integer;
		 VAR w: glnparray; VAR v: glnpbynp);

{ This file is derived from the NUMERICAL RECIPES PASCAL SHAREWARE DISKETTE.
 Please read the README file in $MTTPATH/trans/p
 }

{
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.4  1998/08/12 11:26:39  peterg
% % Zapped unnecessary np and mp arguments
% %
% % Revision 1.3  1998/08/12 11:08:03  peterg
% % Put in pythag routine to compute z = sqrt(y^2 + z^2) (as in book)
% % Save loop index l as ll when jumping from loop - using l itself is
% % undefined
% %
% % Revision 1.2  1998/08/12 11:05:33  peterg
% % Taken from NR share library nrpas13 as SVDCMP.PAS
% % and renamed svdcmp.p
% %
% % Revision 1.1  1998/08/12 11:03:57  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}


(* Programs using routine SVDCMP must define the types
TYPE
   glnparray = ARRAY [1..np] OF real;
   glmpbynp = ARRAY [1..mp,1..np] OF real;
   glnpbynp = ARRAY [1..np,1..np] OF real;
in the main routine. *)
LABEL 1,2,3;
CONST
   nmax=100;
VAR
   nm,l,k,j,jj,its,i,ll	       : integer;
   z,y,x,scale,s,h,g,f,c,anorm : real;
   rv1			       : ARRAY [1..nmax] OF real;
			  
FUNCTION pythag(a,b : real): real;
VAR p,at,bt : REAL;
BEGIN
   at:=abs(a);
   bt:=abs(b);
   IF at>bt THEN
      p:= at*sqrt(1.0+sqr(bt/at))
   ELSE
      IF bt=0.0 THEN
	 p := 0.0
      ELSE
	 p := bt*sqrt(1.0+sqr(at/bt));
   pythag := p;
END{pythag};
			   
   
FUNCTION sign(a,b : real): real;
   BEGIN
      IF (b >= 0.0) THEN sign := abs(a) ELSE sign := -abs(a)
   END;
FUNCTION max(a,b: real): real;
   BEGIN
      IF (a > b) THEN max := a ELSE max := b
   END;
BEGIN
   g := 0.0;
   scale := 0.0;
   anorm := 0.0;
   FOR i := 1 TO n DO BEGIN
      l := i+1;
      rv1[i] := scale*g;
      g := 0.0;
      s := 0.0;
      scale := 0.0;
      IF (i <= m) THEN BEGIN
         FOR k := i TO m DO BEGIN
            scale := scale+abs(a[k,i])
         END;
         IF (scale <> 0.0) THEN BEGIN
            FOR k := i TO m DO BEGIN
               a[k,i] := a[k,i]/scale;
               s := s+a[k,i]*a[k,i]
            END;
            f := a[i,i];
            g := -sign(sqrt(s),f);
            h := f*g-s;
            a[i,i] := f-g;
            IF (i <> n) THEN BEGIN
               FOR j := l TO n DO BEGIN
                  s := 0.0;
                  FOR k := i TO m DO BEGIN
                     s := s+a[k,i]*a[k,j]
                  END;
                  f := s/h;
                  FOR k := i TO m DO BEGIN
                     a[k,j] := a[k,j]+
                        f*a[k,i]
                  END
               END
            END;
            FOR k := i TO m DO BEGIN
               a[k,i] := scale*a[k,i]
            END
         END
      END;
      w[i] := scale*g;
      g := 0.0;
      s := 0.0;
      scale := 0.0;
      IF ((i <= m) AND (i <> n)) THEN BEGIN
         FOR k := l TO n DO BEGIN
            scale := scale+abs(a[i,k])
         END;
         IF (scale <> 0.0) THEN BEGIN
            FOR k := l TO n DO BEGIN
               a[i,k] := a[i,k]/scale;
               s := s+a[i,k]*a[i,k]
            END;
            f := a[i,l];
            g := -sign(sqrt(s),f);
            h := f*g-s;
            a[i,l] := f-g;
            FOR k := l TO n DO BEGIN
               rv1[k] := a[i,k]/h
            END;
            IF (i <> m) THEN BEGIN
               FOR j := l TO m DO BEGIN
                  s := 0.0;
                  FOR k := l TO n DO BEGIN
                     s := s+a[j,k]*a[i,k]
                  END;
                  FOR k := l TO n DO BEGIN
                     a[j,k] := a[j,k]
                        +s*rv1[k]
                  END
               END
            END;
            FOR k := l TO n DO BEGIN
               a[i,k] := scale*a[i,k]
            END
         END
      END;
      anorm := max(anorm,(abs(w[i])+abs(rv1[i])));
   END;
   FOR i := n DOWNTO 1 DO BEGIN
      IF (i < n) THEN BEGIN
         IF (g <> 0.0) THEN BEGIN
            FOR j := l TO n DO BEGIN
	       v[j,i] := (a[i,j]/a[i,l])/g;
	    END;
            FOR j := l TO n DO BEGIN
               s := 0.0;
               FOR k := l TO n DO BEGIN
                  s := s+a[i,k]*v[k,j]
               END;
               FOR k := l TO n DO BEGIN
                  v[k,j] := v[k,j]+s*v[k,i]
               END
            END
         END;
         FOR j := l TO n DO BEGIN
            v[i,j] := 0.0;
            v[j,i] := 0.0
         END
      END;
      v[i,i] := 1.0;
      g := rv1[i];
      l := i
   END;
   FOR i := n DOWNTO 1 DO BEGIN
      l := i+1;
      g := w[i];
      IF (i < n) THEN BEGIN
         FOR j := l TO n DO BEGIN
            a[i,j] := 0.0
         END
      END;
      IF (g <> 0.0) THEN BEGIN
         g := 1.0/g;
         IF (i <> n) THEN BEGIN
            FOR j := l TO n DO BEGIN
               s := 0.0;
               FOR k := l TO m DO BEGIN
                  s := s+a[k,i]*a[k,j]
               END;
               f := (s/a[i,i])*g;
               FOR k := i TO m DO BEGIN
                  a[k,j] := a[k,j]+f*a[k,i]
               END
            END
         END;
         FOR j := i TO m DO BEGIN
            a[j,i] := a[j,i]*g
         END
      END ELSE BEGIN
         FOR j := i TO m DO BEGIN
            a[j,i] := 0.0
         END
      END;
      a[i,i] := a[i,i]+1.0
   END;
   FOR k := n DOWNTO 1 DO BEGIN
      FOR its := 1 TO 30 DO BEGIN
         FOR l := k DOWNTO 1 DO BEGIN
            nm := l-1;
            IF ((abs(rv1[l])+anorm) = anorm) THEN
	       BEGIN
		  ll:=l;
		  GOTO 2;
	       END;
	    IF nm>0 THEN {* Put in by me - see book *}
	       IF ((abs(w[nm])+anorm) = anorm) THEN
		  BEGIN
		     ll:=l;
		     GOTO 1
		  END;
         END;
1:         c := 0.0;
         s := 1.0;
         FOR i := ll TO k DO BEGIN
            f := s*rv1[i];
            IF ((abs(f)+anorm) <> anorm) THEN BEGIN
	       g := w[i];
	       {**h := sqrt(f*f+g*g);**}
	       h := pythag(f,g);
               w[i] := h;
               h := 1.0/h;
               c := (g*h);
               s := -(f*h);
               FOR j := 1 TO m DO BEGIN
                  y := a[j,nm];
                  z := a[j,i];
                  a[j,nm] := (y*c)+(z*s);
                  a[j,i] := -(y*s)+(z*c)
               END
            END
         END;
2:         z := w[k];
         IF (ll = k) THEN BEGIN
            IF (z < 0.0) THEN BEGIN
               w[k] := -z;
               FOR j := 1 TO n DO BEGIN
               v[j,k] := -v[j,k]
            END
         END;
         GOTO 3
         END;
         IF (its = 30) THEN BEGIN
            writeln ('no convergence in 30 SVDCMP iterations'); readln
	 END;
         x := w[l];
         nm := k-1;
         y := w[nm];
         g := rv1[nm];
         h := rv1[k];
         f := ((y-z)*(y+z)+(g-h)*(g+h))/(2.0*h*y);
	 {***g := sqrt(f*f+1.0); writeln(g);***}
	 g := pythag(f,1.0);
         f := ((x-z)*(x+z)+h*((y/(f+sign(g,f)))-h))/x;
         c := 1.0;
         s := 1.0;
         FOR j := ll TO nm DO BEGIN
            i := j+1;
            g := rv1[i];
            y := w[i];
            h := s*g;
            g := c*g;
            {**z := sqrt(f*f+h*h);**}
	    z := pythag(f,h);
            rv1[j] := z;
            c := f/z;
            s := h/z;
            f := (x*c)+(g*s);
            g := -(x*s)+(g*c);
            h := y*s;
            y := y*c;
            FOR jj := 1 TO n DO BEGIN
               x := v[jj,j];
               z := v[jj,i];
               v[jj,j] := (x*c)+(z*s);
               v[jj,i] := -(x*s)+(z*c)
            END;
            {**z := sqrt(f*f+h*h);**}
	    z := pythag(f,h);
            w[j] := z;
            IF (z <> 0.0) THEN BEGIN
               z := 1.0/z;
               c := f*z;
               s := h*z
            END;
            f := (c*g)+(s*y);
            x := -(s*g)+(c*y);
            FOR jj := 1 TO m DO BEGIN
               y := a[jj,j];
               z := a[jj,i];
               a[jj,j] := (y*c)+(z*s);
               a[jj,i] := -(y*s)+(z*c)
            END
         END;
         rv1[l] := 0.0;
         rv1[k] := f;
         w[k] := x
      END;
3:   END
END;

Deleted mttroot/mtt/bin/trans/p/zero_input.p version [c982d1d936].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
PROCEDURE zero_input(VAR x : InputVector;
			 N : INTEGER);
VAR i : INTEGER;
   
BEGIN
   FOR i:=1 TO N DO
      x[i] := 0.0;
END;


Deleted mttroot/mtt/bin/trans/p/zero_matrix.p version [799bc2655a].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
PROCEDURE zero_matrix(VAR A : StateMatrix;
			  N : INTEGER);
VAR i,j	:  INTEGER;
   
BEGIN
   FOR i:=1 TO N DO
      FOR j:=1 TO N DO
	 A[i,j] := 0.0;
END;


Deleted mttroot/mtt/bin/trans/p/zero_state.p version [e67a8f8538].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
PROCEDURE zero_state(VAR x : StateVector;
			 N : INTEGER);
VAR i : INTEGER;
   
BEGIN
   FOR i:=1 TO N DO
      x[i] := 0.0;
END;


Deleted mttroot/mtt/bin/trans/p/zero_vector.p version [51fb965f2c].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
PROCEDURE zero_vector(VAR x : StateVector;
			  N : INTEGER);
VAR i : INTEGER;
   
BEGIN
   FOR i:=1 TO N DO
      x[i] := 0.0;
END;


Deleted mttroot/mtt/bin/trans/p/zeros.p version [e8ec334d34].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
PROCEDURE zeros(VAR A	: StateMatrix;
		    N	: INTEGER);
VAR i,j	:  INTEGER;
   
BEGIN
   FOR i:=1 TO N DO
      FOR j:=1 TO N DO
	 A[i,j] = 0.0;
END;


Deleted mttroot/mtt/bin/trans/p2oct version [5c9f2513fe].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2cr_txt2txt

# Label file to constitutive relationship conversion
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/07/29 11:09:39  peterg
## Now matches ^$1$ not $1!
##
## Revision 1.2  1998/03/08 21:02:55  peterg
## Now does multiple crs.
##
# Revision 1.1  1997/03/20  12:23:21  peterg
# Initial revision
#
###############################################################



# Inform user
echo "Creating $1_cr.txt"

rm -f mtt_error


# This is the main transformation using gawk 
# And remove crs with same name as system
awk -f $MTTPATH/trans/awk/lbl2cr.awk $1_lbl.txt  2>mtt_error.txt |\
grep -v "^$1$" \
> $1_cr.txt

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


Deleted mttroot/mtt/bin/trans/rbg2abg_m version [dfb39a93d4].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230






































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: rbg2abg_m
#
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.17  2000/12/05 12:04:03  peterg
## Changed function name to name()
##
## Revision 1.16  2000/12/05 09:04:08  peterg
## Fixed function () compatibility problem.
##
## Revision 1.15  2000/11/03 14:53:33  peterg
## Copy NOTPAR as well
##
## Revision 1.14  2000/09/14 08:41:35  peterg
## Strip off the additional direction info from rbonds
##
## Revision 1.13  2000/03/16 12:53:26  peterg
## Added copy of the %VAR declarations
## Put in the endfunction statement
##
## Revision 1.12  1998/07/28 19:07:48  peterg
## Writes out N_ports as well as n_ports
##
## Revision 1.11  1998/07/25 16:14:44  peterg
## *** empty log message ***
##
## Revision 1.10  1998/07/08 15:34:56  peterg
## Sorted out error exit status
##
## Revision 1.9  1998/07/08 08:24:26  peterg
## Added -I option -- if set prints out the indormation messages
##
## Revision 1.8  1998/02/19 08:57:02  peterg
## Fixed mtt-info bug -- confused filename with number
##
## Revision 1.7  1997/08/05 08:38:23  peterg
## Added n-ports to the argument list in the comment.
##
## Revision 1.6  1996/12/04 21:52:01  peterg
## Uses filenum and fopen instead of filename.
##
## Revision 1.5  1996/08/25 09:20:32  peter
## General error handling.
##
## Revision 1.4  1996/08/24 17:57:41  peter
## Removed `touch mtt_info.txt'
##
## Revision 1.3  1996/08/24 14:58:56  peter
## Fixed missprint - mtt_err --> mtt_error
##
## Revision 1.2  1996/08/24 14:33:07  peter
## Error handling included.
##
## Revision 1.1  1996/08/05 12:22:16  peter
## Initial revision
##
###############################################################

# Raw bond graph to structured acausal bond graph: mfile format
# The structured BG is described by four matrices:
#   junctions: describes the junctions -
#     Column 1   Index of component (see components)
#     Column 2.. Indices of bonds on junction (see jbonds)
#                  rows may be padded with zeros
#
#   jbonds:    describes the true bonds -
#     Column 1     Index of component (see components)
#     Column 2     Direction
#                    1 away from junction
#                   -1 towards junction
#     Column 3     Causality 
#                     1 stroke at arrow end
#                    -1 stroke at other end
#                     0 no stroke (ie acausal)
#     Columns 4:5  x,y coordinates of non-arrow end (in Fig)
#     Columns 6:7  x,y coordinates of arrow end (in Fig)
#
#   mbonds:    describes the modulation bonds -
#     Column 1     Index of component at non-arrow end
#     Column 2     Index of component at arrow end
#     Columns 4:5  x,y coordinates of non-arrow end (in Fig)
#     Columns 6:7  x,y coordinates of arrow end (in Fig)
#
#   components: describes the comonents -
#     Column 1     Type of component
#                    0  0-junction
#                    1  1-junction
#                    2  R component
#                    3  C component
#                    4  I component
#                    11 TF component
#                    12 GY component
#                    13 A  component
#     Column 2     Flag for explicit junction
#                    4  Explicit component (4 means text type)
#                    0  Implicit component
#     Column 3-14    fig file information (see fig documentation)
#
# P.J.Gawthrop May 1996
# Copyright (c) P.J.Gawthrop, 1996.

while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;;
	-nounits )
                units=no;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

## Set up some vars
sys=$1
lbl_file=${sys}_lbl.txt
abg_file=${sys}_abg.m

# Remove the old log file
rm -f rbg2abg_m.log
rm -f ${abg_file}

#Inform user
echo Creating ${abg_file}

# Use matrix manipulation to accomplish the transformation
$MATRIX > rbg2abg_m.log  2>mtt_error.txt << EOF
  name = '$1'
  infofile = fopen('mtt_info.txt', 'w');
  errorfile = fopen('mtt_error.txt', 'w');

  %Convert from the fig version of the bonds to a structured version
  [rbonds,rstrokes,rcomponents,port_coord,port_name,port_list] = $1_rbg;
  [n_ports, junk] = size(port_list);
 
  N_ports = 0;
  for i=1:n_ports		# Count the true number of ports.
    [subport,n_sub] = split_port(port_list(i,:), ',');
    N_ports = N_ports+n_sub;
  end;
 
 
  rbonds = rbonds(:,1:6);  # Strip  the directional information
  [bonds,components,n_vector_bonds] = rbg2abg(name,rbonds,rstrokes,rcomponents,port_coord,port_name,\
                               infofile,errorfile);

  %Write the function m-file for the causal bond graph
  write_abg(name,bonds,components,n_vector_bonds);    
EOF

## Sets the units for the abg file
test_units()
{ 
  grep '^[\s]*[#|%]UNITS' < ${lbl_file} >/dev/null
  if [ $? = "0" ]; then 
    grep '^[\s]*[#|%]UNITS' < ${lbl_file} |\
    awk '{
      printf("mtt_units.sh %s %s %s %s %s\n", sys, $2, $3, $4, $5)
    }' sys=${sys}  | sh | grep ERROR
    if [ $? = "0" ]; then
      echo "    " *MTT_ERRROR: domains and units are not OK - exiting
      exit 1  
    else
      echo "    " domains and units are OK 
    fi
  else
    echo "  no domains or units declared"
  fi
} 

check_ports_exist()
{
 declared_ports=`grep '^[\s]*[#|%]UNITS' < ${lbl_file} | awk '{print $2}'`
  for declared_port in $declared_ports; do
    grep "${sys}\.ports\.${declared_port}\.type" ${abg_file} >/dev/null
    if [ $? = "1" ]; then
      echo "*MTT_ERRROR: Units declared for non-existent port ${declared_port}"
      exit 1
    fi
  done
}

set_units()
{ 
  grep '^[\s]*[#|%]UNITS' < ${lbl_file} |\
  awk '{
    printf("  %s.ports.%s.domain = \"%s\";\n", sys, $2, $3);
    printf("  %s.ports.%s.units.effort = \"%s\";\n", sys, $2, $4);
    printf("  %s.ports.%s.units.flow = \"%s\";\n", sys, $2, $5);
  }' sys=${sys}
} 

if [ -z "$units" ]; then
  echo Checking port domains and units
  check_ports_exist;
  test_units;
  echo "## Port domain and units" >> ${abg_file}
  set_units >> ${abg_file}
fi

# Append any VAR declarations
if [ -f "$1_lbl.txt" ]; then
  echo "## Explicit variable declarations" >> ${abg_file}
  grep '^[\s]*[%|#][V|P]AR' $1_lbl.txt | tr '%' '#' >> ${abg_file}    
  grep '^[\s]*[%|#]NOT[V|P]AR' $1_lbl.txt | tr '%' '#' >> ${abg_file}    
fi

## Close off the function
echo "endfunction" >> ${abg_file}

## Errors and info
if [ "$info" = "info" ]; then
  cat mtt_info.txt    
fi

if mtt_error mtt_error.txt
then
    exit 0
else
    exit 1
fi

Deleted mttroot/mtt/bin/trans/rbg_fig2m version [cca83822e8].

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
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













































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: rbg_fig2m
# Raw  bond-graph conversion from fig to matlab
# P.J.Gawthrop May 1996
# Modified June 1996 to handle xfig version 3
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.8  2001/10/15 14:25:44  gawthrop
## Now handles white space at the end of component names
## Converts ports lables [1:5] into [1,2,3,4,5]
##
## Revision 1.7  2001/07/24 22:42:59  geraint
## Fixes problem when lbl.txt does not end with newline.
##
## Revision 1.6  2001/05/24 07:48:17  gawthrop
## Include artwork in the cbg.fig file
##
## Revision 1.5  2001/03/23 14:56:21  gawthrop
## Now puts space after header fields + write _port.fig
##
## Revision 1.4  2000/09/14 08:41:51  peterg
## *** empty log message ***
##
## Revision 1.3  1997/03/19 09:50:24  peterg
## Now creates the sabg (stripped abg) file.
##
# Revision 1.2  1996/08/30  10:17:41  peter
# New path for awk script.
#
## Revision 1.1  1996/08/05 20:13:33  peter
## Initial revision
##
###############################################################


# Inform user
echo "Creating $1_rbg.m"
echo "Creating $1_cmp.m"
echo "Creating $1_head.fig"
echo "Creating $1_fig.fig"
echo "Creating $1_cmp.fig"
echo "Creating $1_port.fig"
echo "Creating $1_sabg.fig"
echo "Creating $1_art.fig"


# Remove some files that I'm going to append to.
rm -f $1_fig.fig
rm -f $1_head.fig
rm -f $1_cmp.fig
rm -f $1_port.fig
rm -f $1_bnd.fig
rm -f $1_art.fig

# Create blank files
touch $1_fig.fig
touch $1_head.fig
touch $1_cmp.fig
touch $1_port.fig
touch $1_bnd.fig
touch $1_art.fig

# Deletes trailing white space in component names
# and break compound objects
sed 's/[	 ]*\\001/\\001/' < $1_abg.fig |\
grep -v "^6 [0-9 ]*" | grep -v "^-6$" >$1_abg.mtt1

# Replace [1:5] with [1,2,3,4,5]
awk '{
   if (match($14, /\[1:[0-9]*\]/)){
    range = substr($14,2,length($14)-6);
    split(range,a,":");
    str = "1";
    for (i=2;i<=a[2];i++) str = sprintf("%s,%i", str, i);
    sub(/1:[0-9]*/, str, $14);
   }
    print $0
}' < $1_abg.mtt1 > $1_abg.mtt2


# The following horrible sed thing is to replace tab by ----
# this is because I can't get sed to recognise tabs even if FS=" ".
echo "" > $1_abg.mtt3
sed 's/	/---- /'<$1_abg.mtt2 >> $1_abg.mtt3

# This is the main transformation using awk
cat $1_lbl.txt $1_abg.mtt3 |  awk -f $MTTPATH/trans/awk/rbg_fig2m.awk $1

rm -f $1_abg.mtt

#Create the stripped abg file
cat $1_head.fig $1_bnd.fig $1_cmp.fig> $1_sabg.fig







Deleted mttroot/mtt/bin/trans/rcs_header.m version [48ce935dee].

1
2
3
4
5
6
7
8
9









-
-
-
-
-
-
-
-
-

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Deleted mttroot/mtt/bin/trans/rcs_header.sh version [0521c8429a].

1
2
3
4
5
6
7







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

Deleted mttroot/mtt/bin/trans/rdae2dae_r version [96eb754660].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251



























































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: rdae2dae_r
# Reduce equations to raw differential-algebraic equation conversion
# P.J.Gawthrop  8th May 1991, May 1994, June 1996
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  2001/04/11 09:44:26  gawthrop
## Fixed cc and c problems to do with pow(x,y) and integers
## mtt/lib/reduce/fix_c.r is included in rdae2dae and cse2smx_lang for
## -c, -cc and -oct options
##
## Revision 1.6  2001/02/03 13:40:45  gawthrop
## Added explicit MTTNu
##
## Revision 1.5  2000/12/28 12:39:02  peterg
## Put under RCS
##
## Revision 1.4  2000/09/04 08:42:53  peterg
## Put in extra echo to space output
##
## Revision 1.3  2000/09/02 15:55:11  peterg
## Now doesn't include def files in da files
##
## Revision 1.2  2000/09/01 13:36:15  peterg
## Added -partition option
##
## Revision 1.1  2000/09/01 12:14:44  peterg
## Initial revision
##
## Revision 1.3  1998/03/07 12:57:19  peterg
## Fixed logname bug
##
## Revision 1.2  1998/03/07 12:51:20  peterg
## This is the new version of ese2dae - it does not do the CRs at this
## stage to give reduce an easier time.
##
## rese2ese_r does the constitutive relationship bit
##
## Revision 1.1  1998/03/07 12:49:31  peterg
## Initial revision
##
## Revision 1.12  1998/01/31 16:22:59  peterg
## Added IF MTTNx>0 THEN and IF MTTNy>0 THEN before the relevant
## assignements of MTTdX and MTTY to themselves.
##
## Revision 1.11  1997/09/18 09:45:08  peterg
## Canged the comment about linux reduce -- reduce reads this for some
## reason.
##
## Revision 1.10  1997/09/15 14:21:18  peterg
## Reads ese file twice to avoid a bug in Linux reduce !!!???
##
## Revision 1.9  1997/08/30 09:59:31  peterg
## Changed mehtod of writing out mtty to avoid a strange segmentation violation.
## Now uses MTTY := MTTY; approach.
##
## Revision 1.8  1997/04/23 09:31:20  peterg
## Now reads in the (top level) def file in the generated reduce code.
##
# Revision 1.7  1997/04/23  09:23:15  peterg
# Two argument version in preparation for heirarchical version
#
# Revision 1.6  1996/11/21  15:47:48  peterg
# Now inputs _params.r not _sympar.r
#
## Revision 1.5  1996/11/02 10:17:35  peterg
## Removed default constitutive relationship input.
##
# Revision 1.4  1996/09/12  12:10:05  peter
# Now reads the default constitutive relationship file.
#
## Revision 1.3  1996/08/25 09:43:26  peter
## General error handling.
##
## Revision 1.2  1996/08/25 08:31:28  peter
## Error handling added.
##
###############################################################


while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;;
	-partition )
                partition=yes;
                blurb='with partitioning';
		;;
	-fixcc )
                include=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'`
                blurb2='fixing c and cc code';
		;;
	*)
		echo "$1 is an invalid argument - ignoring";
                exit ;;
  esac
  shift
done

#Create the top-level system name
topname=$1

#Create the system names
if [ -z "$2" ]; 
    then
	sysname=$topname;
    else
	sysname=$1_$2;
fi

defname=$topname"_def.r"
crname=$topname"_cr.r"
subsname=$topname"_subs.r"
rdaename=$sysname"_rdae.r"
daename=$sysname"_dae.r"
logname="rdae2dae.log"

# Inform user
echo Creating $daename $blurb $blurb2

# Remove the old log file
rm -f $logname

# Use symbolic algebra to accomplish the transformation
$SYMBOLIC >$logname  << EOF

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

% CRs
in "$crname";

% Raw dae
in "$rdaename";

% Substitution
in "$subsname";

% Fix c code if required
$include


OFF Echo;
OFF Nat;

%Create the output file
OUT "$daename";

%write "in ""$defname""";

write "MTTNu := ", MTTNu;
write "MTTNx := ", MTTNx;
write "MTTNz := ", MTTNz;
write "MTTNy := ", MTTNy;
write "MTTNyz := ", MTTNyz;

% State
MTT_Matrix := MTTdX$ 
MTT_Matrix_name := "MTTdX"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Nonstate
MTT_Matrix := MTTZ$ 
MTT_Matrix_name := "MTTZ"$
MTT_Matrix_n := MTTNz$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Output
MTT_Matrix := MTTy$ 
MTT_Matrix_name := "MTTy"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Zero outputs
MTT_Matrix := MTTYz$ 
MTT_Matrix_name := "MTTYz"$
MTT_Matrix_n := MTTNyz$
MTT_Matrix_m := 1$
Reduce_Matrix()$
SHUT "$daename";
quit;

EOF

#if [ -n "$partition" ]; then
#  rm -f mtt_junk
#  # Now for the subsystems
#  # Find subsystems
#  subsystems=`mtt_get_subsystems $1`
#
#  for subsystem in $subsystems; do
#  echo Doing $subsystem
#  ucname="MTT_"$subsystem"_uc"
#
#  Nu=`mtt_getsize -internal $subsystem u`
#  echo Nu $Nu
#
#  # Use symbolic algebra to accomplish the transformation
#  $SYMBOLIC >$logname  << EOF
#
#  %Read the formatting function
#  in "$MTTPATH/trans/reduce_matrix.r";
#
#  % Definitions
#  in "$defname";
#
#  % Elementary system equations
#  in "$rdaename";
#
#  OFF Echo;
#  OFF Nat;
# 
#  %Create the output file
#  OUT "mtt_junk";
#  % Connecting inputs
#  MTT_Matrix := $ucname $
#  MTT_Matrix_name := "$ucname" $
#  MTT_Matrix_n := $Nu $
#  MTT_Matrix_m := 1$
#  Reduce_Matrix()$
#
#  shut "mtt_junk";
#EOF
#  echo >> $1_dae.r
#  echo %Connections for subsystem $subsystem  >> $1_dae.r
#  echo >> $1_dae.r
#
#  cat mtt_junk >> $1_dae.r
#  rm -rf mtt_junk
#  done
#fi

echo "END;" >> $1_dae.r

# Now invoke the standard error handling.
mtt_error_r $logname

Deleted mttroot/mtt/bin/trans/reduce_matrix.r version [80a2f375d5].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     %%%%% Model Transformation Tools %%%%%
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Reduce function to write matrices in reduce form
% P.J.Gawthrop  January 22 1998
% Copyright (c) P.J.Gawthrop, 1998


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.1  1998/01/22 10:39:01  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




PROCEDURE Reduce_Matrix;
BEGIN
  IF MTT_Matrix_n>0 THEN
    IF MTT_Matrix_m>0 THEN
    BEGIN
     write "clear ", MTT_Matrix_name, ";";
     write "MATRIX ", MTT_Matrix_name, "(", MTT_Matrix_n, ",",
                                            MTT_Matrix_m, ");";
    
    FOR i := 1:MTT_Matrix_n DO
      FOR j := 1:MTT_Matrix_m DO IF MTT_Matrix(i,j) NEQ 0 THEN
        write MTT_Matrix_name, "(", i, ",", j, ") := ",
                                            MTT_Matrix(i,j), ";";
    END;
END;

END;;

Deleted mttroot/mtt/bin/trans/rep_txt2sh version [03dd3f0d6b].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: rep_txt2sh
# Executes shell commands for report.

# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1998/04/14 18:17:15  peterg
## More messages about Makefile
##
## Revision 1.3  1998/04/14 18:01:04  peterg
## Now executes a Makefile (if it exists)
##
# Revision 1.2  1997/12/06  14:27:53  peterg
# No changes.
#
## Revision 1.1  1997/08/26 09:06:11  peterg
## Initial revision
##
###############################################################

# Execute a make if Makefile exists
if [ -f Makefile ]; then
  echo Executing the Makefile
  make    
  echo Done executing the Makefile
  echo
fi

## Get switches (if any)
mtt_switches=$2

# Inform user
echo "Creating representations for $1_rep.tex"

# Check for old (2 arg) version and update if necessary
mtt_count=`strip_comments < $1_rep.txt | grep -c 'mtt '`
if [ "$mtt_count" = "0" ]; then
  echo 'Hmm .. seems to be an old format. creating new file'
  echo "Old version saved as $1_rep.txt.SAVE"
  mv $1_rep.txt $1_rep.txt.SAVE
  strip_comments < $1_rep.txt.SAVE |\
  awk '{print "mtt", sys, $1, $2}' sys="$1" >$1_rep.txt
fi

# Execute the commands - quietly and untidily!
# But use switches
strip_comments< $1_rep.txt | sed "s/mtt /mtt -q -u $mtt_switches /" | tee -a JUNK  | sh

echo "Done creating representations for $1_rep.tex"




Deleted mttroot/mtt/bin/trans/rep_txt2tex version [d29f0048ba].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194


































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: rep_txt2tex
# Converts the text file dercribing a report to a report.
# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.15  2000/04/06 10:57:12  peterg
## Removed debug line
##
## Revision 1.14  2000/04/06 10:51:14  peterg
## replaces $PWD by `pwd` for sh compatibility
##
## Revision 1.13  1999/10/19 23:47:27  peterg
## Rewrote for the extra representations - but with .ps at the end
## Need to retrofit old desc files using multiple figures
##
## Revision 1.12  1999/10/19 03:33:01  peterg
## Temporaraly removed argument stripping
##
## Revision 1.11  1999/02/17 02:00:29  peterg
## Absolute pathname for files.
## Indirect include via \input
##
## Revision 1.10  1998/08/25 12:45:27  peterg
## Added icad to languages
##
## Revision 1.9  1998/03/09 13:26:22  peterg
## Removed `system' from part and section headers.
##
## Revision 1.8  1998/02/09 08:59:35  peterg
## Minor debugging lines removed.
##
## Revision 1.7  1998/01/29 19:32:33  peterg
## Removed a spurious X from the file -- tried to run  the X server !!!
##
## Revision 1.6  1997/12/04 22:08:52  peterg
## Handles multiple odes.ps files
##
## Revision 1.5  1997/12/04 17:05:57  peterg
## Now handles multiple odeso.ps files
##
## Revision 1.4  1997/08/25 09:15:48  peterg
## Don't do sections for unrecognised languages.
##
# Revision 1.3  1997/06/27  13:28:25  peterg
# New version using explicit command line arguments in the text file
#
## Revision 1.2  1997/05/19 16:11:36  peterg
## Modified section headers.
##
# Revision 1.1  1996/08/18  20:00:38  peter
# Initial revision
#
###############################################################

documenttype=$2; 

if [  "$documenttype" = "book" ]; then # do book version
  # Inform user
  echo "Creating $1_rep.tex (directory version)"
  strip_comments < $1_rep.txt|\
  awk '
BEGIN{
oldpart = ""
}
{
  # Find directory name.
  for (i=1;i<NF;i++){
    if ($i=="-d") 
       directory=$(i+1);
  }
  # Find next to last name
  N=split(directory,a,"/");
  if (N>1) 
    part = a[N-1];
  if (length(part)>0)
    if (part!=oldpart)
      printf("\\part{\\textbf{%s}}\n", part);
  oldpart=part;
  printf("\\chapter{\\textbf{%s}}\n", $(NF-2));
  printf("\\label{chap:%s(%s)}\n", $(NF-2), directory);
  printf("\\input{%s/%s_rep}\n\n", directory, $(NF-2));
  }' > $1_rep.tex


else # do article and section version

if [ -z "$3" ]; then
  directory="";
else
  directory=$3/;
fi

# Inform user
echo "Creating $1_rep.tex"

# Create the LaTeX file
strip_comments <$1_rep.txt |\
awk '
{
  ## Count the switches (noting that -i has an argument)
  Switches=0;
  for (i=2;i<=NF;i++) {
    if (match($i,"-")==1) Switches++;
    if (match($i,"-i")==1) Switches++;
  }

  System = $(Switches+2)
  Representation = $(Switches+3);
  Multiple = "odes odeso sms smso daes daeso";
  Language = $(Switches+4);
  Languages = "tex txt r m c h ps icad";
  args = $(Switches+5);
  quote = "\047";
  args = gensub(quote, "", "g",  args);
  args = gensub(/"/, "", "g",  args);
#  args = substr(Args,2,length(Args)-2);
#  if ( (length(Args)>0)&&(match(Multiple,Representation)>0)) {
  if ( (length(args)>0)&&(match(Language,"ps")>0)) {
    _Args = sprintf("-%s", args); 
    __Args = sprintf("-%s", gensub(/_/, "-", "g", args) );
    ___Args = sprintf("-%s", gensub(/,/, "-", "g", args) );
  }
  else
  {
  _Args = "";
  __Args = "";
  ___Args = "";
  }
#  print "DEBUG", Language, args, _Args, __Args
  RepLang = sprintf("%s%s.%s", Representation, __Args, Language);
  SysRepLang = sprintf("%s_%s", System, RepLang);
  SysRep = sprintf("%s_%s%s", System, Representation, _Args);
  filename = gensub(/,/, "-", "g", SysRep);
  section_head = sprintf("\\textbf{%s.%s}: System %s, representation \\textbf{%s%s}, language \\textbf{%s}",
   Representation,Language,System,Representation,__Args,Language);
   
# section headings
    if (match(Languages,Language)>0) {
    print "\n\n\\section{" section_head "}";
    print "\\label{sec:" SysRepLang "}";
    print "\\index{\\textbf{" System "} -- " Representation "}";
    
    print "\n\nMTT command:";
    print "\\begin{verbatim}";
      for (i=1;i<=NF;i++) printf("%s ", $i);
    print "\n\\end{verbatim}";
    }

# tex files
    if( match("tex",Language)>0) {
      printf("  \\input{%s/%s_%s.%s}\n", PWD, System, Representation, Language);
#      command = sprintf("sed s!fig{!fig{%s! < %s_%s.%s", Directory, System, Representation, Language);
#      system(command);    
}

# text files
    if( match("txt r m c h icad",Language)>0) {
      print "  \\begin{verbatim}";
      command = sprintf("cat %s_%s.%s", System, Representation, Language);
      system(command);
      print "  \\end{verbatim}";  
    }
# ps files
    if( match("ps",Language)>0) {
      printf("This representation is given as Figure \\Ref{fig:%s}.\n", SysRepLang);
      FileName = sprintf("%s/%s", PWD, filename);
      Label = sprintf("%s", SysRepLang);
      Caption = sprintf("System \\textbf{%s}, representation %s%s", System, Representation, __Args);
      printf("\\fig{%s}\n    {%s}\n    {0.9}\n    {%s}\n",FileName,Label,Caption);
  }
}
END {

}' system=$1 Directory=$directory PWD=`pwd` > $1_rep.tex

fi







Deleted mttroot/mtt/bin/trans/reps_txt2tk version [3e47e7c9bc].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: reps_txt2tk
# Creates tk/tcl file for xmtt.
# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  2000/04/05 07:37:27  peterg
## *** empty log message ***
##
## Revision 1.3  1999/08/18 06:15:48  peterg
## Stripped down to just representations menu - see mtt_make_menu
##
## Revision 1.2  1999/03/09 00:03:19  peterg
## Revisions for xmtt
##
## Revision 1.1  1998/10/20 08:13:14  peterg
## Initial revision
##
###############################################################

sep='|'; # Separates the languages from the rest.

# Create reps menu
awk --field-separator=$sep '{
  
# Find the rep and the title
  split($1,REP," ");
  rep=REP[1];
# find the languages
  N=split($2,LANG," ");

# Important representation?
 if (index(rep,"*")) {
    # Zap *
    rep=substr(rep,1,length(rep)-1);
    sub(/\*/,"",$1);
    printf("\n# Menus for representation %s\n", rep)
    printf(".rep.rep add  cascade -label \"%s\" -menu .rep.rep.%s\n", $1, rep);
    printf("menu .rep.rep.%s\n", rep);
    for (i=1;i<=N;i++) {
      lang = LANG[i];
      printf(" set mtt {mtt_pause $args $system %s %s} \n", rep, lang); 
      title = sprintf("Output_log_for_representation_%s_(language_%s)", rep, lang);
      printf(".rep.rep.%s add  command -label  \"%s\" ", rep, lang);
      printf(" -command  \"exec xterm -title %s -e $mtt  &\" \n", title); 
   }
 }
 else {
    printf("\n# Menus for representation %s\n", rep)
    printf(".repall.repall add  cascade  -label \"%s\" -menu .repall.repall.%s\n", $1, rep);
    printf("menu .repall.repall.%s\n", rep);
    for (i=1;i<=N;i++) {
      printf(" set mtt {mtt $args $system %s %s; mtt_pause} \n", rep, LANG[i]); 
      printf(".repall.repall.%s add  command -label  \"%s\" ", rep, LANG[i]);
      printf(" -command  \"exec echo $mtt &; exec $mtt &\" \n"); 
   }
 }
}'

Deleted mttroot/mtt/bin/trans/rest version [2530ab00f0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: rest
# Gives remainder of space seperated string
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/10/10 07:44:20  peterg
## Initial revision
##
###############################################################

echo $1 | cut -d ' ' -f 2-

Deleted mttroot/mtt/bin/trans/simpar_txt2h version [a1e5b7a064].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: simpar_txt2h

# Numerical parameters to c format
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.

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


system=$1


# Inform user
echo "Creating $1_simpar.h"

rm -f mtt_error

#Write some file headers
echo '/*' > $1_simpar.h
echo "Simulation parameter file for system $1 ($1_simpar.h)"   >> $1_simpar.h
echo "This file provides the system simulation parameters in c form"  >> $1_simpar.h
echo "Generated by MTT at `date`"  >> $1_simpar.h
echo "from $1_simpar.txt"  >> $1_simpar.h
echo '*/' >> $1_simpar.h
echo  >> $1_simpar.h

# Now do the parameters

sed 's/ //g' $1_simpar.txt |\
 awk -F '=' '/=/ {print "#define", $1, $2}'   >> $1_simpar.h






Deleted mttroot/mtt/bin/trans/sm2can_r version [27a5fb1925].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372




















































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sm2can_r
# state matrices to various canonical forms.
# P.J.Gawthrop  12 Jan 1997
# Copyright (c) P.J.Gawthrop 1997

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


# Inform user
echo Creating $1_can.r -- NOTE this is for SISO systems only.

# Remove the old log file
rm -f sm2can_r.log

# Use reduce to accomplish the transformation
reduce >sm2can_r.log << EOF

in "$1_def.r";
in "$1_sm.r";
in "$1_tf.r";

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";


OFF Echo;
OFF Nat;

% Find the controllability and observibility matrices.
MATRIX MTTCon(MTTNx,MTTNX);
MTTAB := MTTB;
FOR j := 1:MTTNx DO
  BEGIN
   FOR i := 1:MTTNx DO 
      MTTCon(i,j) := MTTAB(i,1);
   MTTAB := MTTA*MTTAB;
  END;

MATRIX MTTObs(MTTNx,MTTNX);
MTTCA := MTTC;
FOR i := 1:MTTNx DO
  BEGIN
   FOR j := 1:MTTNx DO 
      MTTObs(i,j) := MTTCA(1,j);
   MTTCA := MTTCA*MTTA;
  END;

%Canonical forms:
% This statement makes Gs a scalar transfer function
Gs := MTTtf(1,1);

% Numerator and denominator polynomials
bs := num(gs);
as := den(gs);

% extract coeficients and divide by coeff of s^n
% reverse operator puts list with highest oder coeffs first
ai := reverse(coeff(as,s));
a0 := first(ai);
MTTn := length(ai) - 1;


% Normalised coeficients;
ai := reverse(coeff(as/a0,s));
bi := reverse(coeff(bs/a0,s));
MTTm := length(bi)-1;

% Zap the (unity) first element of ai list;
ai := rest(ai);

% System in controller form
% MTTA_c matrix
matrix MTTA_c(MTTn,MTTn);

% First row is ai coefficients
for i := 1:MTTn do
  MTTA_c(1,i) := -part(ai,i);

% (MTTn-1)x(MTTn-1) unit matrix in lower left-land corner (if n>1)
if MTTn>1 then
  for i := 1:MTTn-1 do
    MTTA_c(i+1,i) := 1;

% B_c vector;
matrix MTTB_c(MTTn,1);
MTTB_c(1,1) := 1;

% C_c vector;
matrix MTTC_c(1,MTTn);
for i := 1:MTTm+1 do
  MTTC_c(1,i+MTTn-MTTm-1) := part(bi,i);

% D_c
MTTD_c := MTTD;

%Observable form.
MTTA_o := tp(MTTA_c);
MTTB_o := tp(MTTC_c);
MTTC_o := tp(MTTB_c);
MTTD_o := MTTD;

%Controllability matrix of controllable form
MATRIX MTTCon_c(MTTNx,MTTNX);
MTTAB := MTTB_c;
FOR j := 1:MTTNx DO
  BEGIN
   FOR i := 1:MTTNx DO 
      MTTCon_c(i,j) := MTTAB(i,1);
   MTTAB := MTTA_c*MTTAB;
  END;

% Transformation matrix;
MTTT_c := MTTCon_c*MTTCon^(-1);

%Observability matrix of observer form
MATRIX MTTObs_o(MTTNx,MTTNX);
MTTCA := MTTC_o;
FOR i := 1:MTTNx DO
  BEGIN
   FOR j := 1:MTTNx DO 
      MTTObs_o(i,j) := MTTCA(1,j);
   MTTCA := MTTCA*MTTA_o;
  END;

% Transformation matrix;
MTTT_o := MTTObs^(-1)*MTTObs_o;

%%%%  Controller design %%%%%

% gain in controller form:
matrix MTTk_c(1,mttn);
matrix alpha_c(9,1);
alpha_c(1,1) := alpha_c1;
alpha_c(2,1) := alpha_c2;
alpha_c(3,1) := alpha_c3;
alpha_c(4,1) := alpha_c4;
alpha_c(5,1) := alpha_c5;
alpha_c(6,1) := alpha_c6;
alpha_c(7,1) := alpha_c7;
alpha_c(8,1) := alpha_c8;
alpha_c(9,1) := alpha_c9;


for i := 1:MTTNx do
 MTTk_c(1,i) := alpha_c(i,1) - part(ai,i);

% Gain in physical form
MTTk := MTTk_c*MTTT_c;

%%%%  Observer design %%%%%
% gain in Observer form:
matrix MTTl_o(MTTn,1);
matrix alpha_o(9,1);
alpha_o(1,1) := alpha_o1;
alpha_o(2,1) := alpha_o2;
alpha_o(3,1) := alpha_o3;
alpha_o(4,1) := alpha_o4;
alpha_o(5,1) := alpha_o5;
alpha_o(6,1) := alpha_o6;
alpha_o(7,1) := alpha_o7;
alpha_o(8,1) := alpha_o8;
alpha_o(9,1) := alpha_o9;

for i := 1:MTTNx DO
 MTTL_o(i,1) := alpha_o(i,1) - part(ai,i);

% Gain in physical form
MTTL := MTTT_o*MTTL_o;

% Steady-state stuff
% Create the matrix [A B; C D];
matrix ABCD(MTTn+1,MTTn+1);
for i := 1:MTTNx do
  for j := 1:MTTNx do
    ABCD(i,j) := MTTA(i,j);

for i :=1:MTTNx do
  ABCD(i,MTTNx+1) := MTTB(i,1);

for j := 1:MTTNx do
  ABCD(MTTNx+1,j) := MTTC(1,j);

ABCD(MTTNx+1,MTTNx+1) := MTTD(1,1);

matrix zero_one(MTTNx+1,1);
zero_one(MTTNx+1,1) := 1;

%Find N vector
Nxu := ABCD^(-1)*zero_one;

%Extract the parts
MATRIX MTTX_r(MTTNx,1);
FOR i := 1:MTTNx DO
  MTTX_r(i,1) := Nxu(i,1);

MTTu_r := Nxu(MTTNx+1,1);


% Compensator

matrix zero(MTTNx,1);
%State matrices
MTTA_comp := MTTA - MTTL*MTTC - MTTB*MTTK;
MTTB_comp := -MTTL;
MTTC_comp := -MTTK;

%Transfer function
%Ds := C_d*((s*MTTI - A_d)^(-1))*B_d;
%MTTTFC := Ds;

%Create the output file
OUT "$1_can.r";

%Write out the matrices.

% Controllable form
MTT_Matrix := MTTA_c$ 
MTT_Matrix_name := "MTTA_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

MTT_Matrix := MTTB_c$ 
MTT_Matrix_name := "MTTB_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
Reduce_Matrix()$

MTT_Matrix := MTTC_c$ 
MTT_Matrix_name := "MTTC_c"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$


% Observable form
MTT_Matrix := MTTA_o$ 
MTT_Matrix_name := "MTTA_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

MTT_Matrix := MTTB_o$ 
MTT_Matrix_name := "MTTB_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
Reduce_Matrix()$

MTT_Matrix := MTTC_o$ 
MTT_Matrix_name := "MTTC_o"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Controllability matrix";
MTT_Matrix := MTTCon$ 
MTT_Matrix_name := "MTTCon"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  -Observability matrix";
MTT_Matrix := MTTObs$ 
MTT_Matrix_name := "MTTObs"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  -Controllability matrix - controller form";
MTT_Matrix := MTTCon_c$ 
MTT_Matrix_name := "MTTCon_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Transformation matrix - controller form";
MTT_Matrix := MTTT_c$ 
MTT_Matrix_name := "MTTT_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Gain matrix - controller form";
MTT_Matrix := MTTK_c$ 
MTT_Matrix_name := "MTTK_c"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTK$ 
MTT_Matrix_name := "MTTK"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$


write "%  -Observability matrix - Observer form";
MTT_Matrix := MTTObs_o$ 
MTT_Matrix_name := "MTTObs_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Transformation matrix - Observer form";
MTT_Matrix := MTTT_o$ 
MTT_Matrix_name := "MTTT_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Observer Gain matrix - observer form";
MTT_Matrix := MTTL_o$ 
MTT_Matrix_name := "MTTL_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNy$
Reduce_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTL$ 
MTT_Matrix_name := "MTTL"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNy$
Reduce_Matrix()$


% Controllable form
MTT_Matrix := MTTA_comp$ 
MTT_Matrix_name := "MTTA_comp"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

MTT_Matrix := MTTB_comp$ 
MTT_Matrix_name := "MTTB_comp"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
Reduce_Matrix()$

MTT_Matrix := MTTC_comp$ 
MTT_Matrix_name := "MTTC_comp"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$


KX := MTTK*MTTX_r;
MTTu_r := MTTu_r + KX(1,1);



MTTu_r := MTTu_r;
write "END;";

SHUT "$1_can.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r sm2can_r.log

Deleted mttroot/mtt/bin/trans/sm2ir_m version [eae4b74875].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sm2ir_m

# Transforms descriptor matrix rep to step response


# Copyright (c) P.J.Gawthrop, 1996.


echo Creating $1_ir.m
echo Creating $1_iro.m
rm -f sm2ir_m.log
rm -f $1_ir.m
rm -f $1_iro.m
rm -f mtt_error

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

# PARAMS="$PARAMS ;"

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

  % Read in the numeric system parameters
  mttpar = $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('u0')==0
    u0 = ones(nu,1);
  end;

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


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

  [A,B,C,D] = $1_sm(mttpar);
  [y,x] = sm2ir(A,B,C,D,T,u0,x0);

  if nx>0
    write_matrix([T x], '$1_ir');
  end;
  if ny>0
    write_matrix([T y], '$1_iro');
  end;

EOF

# Write info
touch mtt_info.txt
cat mtt_info.txt

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


Deleted mttroot/mtt/bin/trans/sm2smc_r version [78545ed4d4].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195



































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sm2smc_r
# state matrices to controller canonical form + related matrices
# P.J.Gawthrop  12 Jan 1997
# Copyright (c) P.J.Gawthrop 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/01/22 13:17:37  peterg
## Initial revision
##
###############################################################
Nu=`mtt_getsize $1 u`
Ny=`mtt_getsize $1 y`

if [ "$Nu" = "1" ]; then
  if [ "$Ny" = "1" ]; then
    blurb=' for this siso system'    
  else
    blurb=" using first output of $Ny"
  fi
else
  if [ "$Ny" = "1" ]; then
    blurb=" using first input of $Nu"
  else
    blurb=" using first input of $Nu and using first output of $Ny"
  fi
fi


# Inform user
echo Creating $1_smc.r $blurb

# Remove the old log file
rm -f sm2smc_r.log

# Use reduce to accomplish the transformation
reduce >sm2smc_r.log << EOF

in "$1_def.r";
in "$1_sm.r";
in "$1_tf.r";

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";


OFF Echo;
OFF Nat;

% Find the controllability matrix
MATRIX MTTCon(MTTNx,MTTNX);
MTTAB := MTTB;
FOR j := 1:MTTNx DO
  BEGIN
   FOR i := 1:MTTNx DO 
      MTTCon(i,j) := MTTAB(i,1);
   MTTAB := MTTA*MTTAB;
  END;


%Canonical forms:
% This statement makes Gs a scalar transfer function
Gs := MTTtf(1,1);

% Numerator and denominator polynomials
bs := num(gs);
as := den(gs);

% extract coeficients and divide by coeff of s^n
% reverse operator puts list with highest oder coeffs first
ai := reverse(coeff(as,s));
a0 := first(ai);
MTTn := length(ai) - 1;


% Normalised coeficients;
ai := reverse(coeff(as/a0,s));
bi := reverse(coeff(bs/a0,s));
MTTm := length(bi)-1;

% Zap the (unity) first element of ai list;
ai := rest(ai);

% System in controller form
% MTTA_c matrix
matrix MTTA_c(MTTn,MTTn);

% First row is ai coefficients
for i := 1:MTTn do
  MTTA_c(1,i) := -part(ai,i);

% (MTTn-1)x(MTTn-1) unit matrix in lower left-land corner (if n>1)
if MTTn>1 then
  for i := 1:MTTn-1 do
    MTTA_c(i+1,i) := 1;

% B_c vector;
matrix MTTB_c(MTTn,1);
MTTB_c(1,1) := 1;

% C_c vector;
matrix MTTC_c(1,MTTn);
for i := 1:MTTm+1 do
  MTTC_c(1,i+MTTn-MTTm-1) := part(bi,i);

% D_c
MTTD_c := MTTD;

%Controllability matrix of controllable form
MATRIX MTTCon_c(MTTNx,MTTNX);
MTTAB := MTTB_c;
FOR j := 1:MTTNx DO
  BEGIN
   FOR i := 1:MTTNx DO 
      MTTCon_c(i,j) := MTTAB(i,1);
   MTTAB := MTTA_c*MTTAB;
  END;

% Transformation matrix;
MTTT_c := MTTCon_c*MTTCon^(-1);



%Create the output file
OUT "$1_smc.r";

%Write out the matrices.

% Controllable form
write "%  - Controller form";
MTT_Matrix := MTTA_c$ 
MTT_Matrix_name := "MTTA_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

MTT_Matrix := MTTB_c$ 
MTT_Matrix_name := "MTTB_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Reduce_Matrix()$

MTT_Matrix := MTTC_c$ 
MTT_Matrix_name := "MTTC_c"$
MTT_Matrix_n := 1$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

MTT_Matrix := MTTD_c$ 
MTT_Matrix_name := "MTTD_c"$
MTT_Matrix_n := 1$
MTT_Matrix_m := 1$
Reduce_Matrix()$


write "%  - Controllability matrix";
MTT_Matrix := MTTCon$ 
MTT_Matrix_name := "MTTCon"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$


write "%  -Controllability matrix - controller form";
MTT_Matrix := MTTCon_c$ 
MTT_Matrix_name := "MTTCon_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Transformation matrix - controller form";
MTT_Matrix := MTTT_c$ 
MTT_Matrix_name := "MTTT_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "END;";

SHUT "$1_smc.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r sm2smc_r.log

Deleted mttroot/mtt/bin/trans/sm2smo_r version [f17cab7b54].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196




































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sm2smo_r
# state matrices to cobserver form
# P.J.Gawthrop  12 Jan 1997
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  2000/09/11 10:53:54  peterg
## Uses 1st io of mimo to create siso
##
## Revision 1.2  1998/01/22 13:25:22  peterg
## Added END;; to output file.
##
## Revision 1.1  1998/01/22 13:16:43  peterg
## Initial revision
##
###############################################################

Nu=`mtt_getsize $1 u`
Ny=`mtt_getsize $1 y`

if [ "$Nu" = "1" ]; then
  if [ "$Ny" = "1" ]; then
    blurb=' for this siso system'    
  else
    blurb=" using first output of $Ny"
  fi
else
  if [ "$Ny" = "1" ]; then
    blurb=" using first input of $Nu"
  else
    blurb=" using first input of $Nu and using first output of $Ny"
  fi
fi
# Inform user
echo Creating $1_smo.r $blurb

# Remove the old log file
rm -f sm2smo_r.log

# Use reduce to accomplish the transformation
reduce >sm2smo_r.log << EOF

in "$1_def.r";
in "$1_sm.r";
in "$1_tf.r";

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";


OFF Echo;
OFF Nat;

% Find  observibility matrix.
MATRIX MTTObs(MTTNx,MTTNX);
MTTCA := MTTC;
FOR i := 1:MTTNx DO
  BEGIN
   FOR j := 1:MTTNx DO 
      MTTObs(i,j) := MTTCA(1,j);
   MTTCA := MTTCA*MTTA;
  END;

%Canonical forms:
% This statement makes Gs a scalar transfer function
Gs := MTTtf(1,1);

% Numerator and denominator polynomials
bs := num(gs);
as := den(gs);

% extract coeficients and divide by coeff of s^n
% reverse operator puts list with highest oder coeffs first
ai := reverse(coeff(as,s));
a0 := first(ai);
MTTn := length(ai) - 1;


% Normalised coeficients;
ai := reverse(coeff(as/a0,s));
bi := reverse(coeff(bs/a0,s));
MTTm := length(bi)-1;

% Zap the (unity) first element of ai list;
ai := rest(ai);

% System in observer form
% MTTA_o matrix
matrix MTTA_o(MTTNx,MTTNx);

% First column is ai coefficients
for i := 1:MTTNx do
  MTTA_o(i,1) := -part(ai,i);

% (MTTNx-1)x(MTTNx-1) unit matrix in upper right-hand corner (if n>1)
if MTTNx>1 then
  for i := 1:MTTNx-1 do
    MTTA_o(i,i+1) := 1;

% C_o vector;
matrix MTTC_o(1,MTTNx);
  MTTC_o(1,1) := 1;
MTTC_o;
% B_o vector;
matrix MTTB_o(MTTNx,1);
for i := 1:MTTm+1 do
  MTTB_o(i+MTTNx-MTTm-1,1) := part(bi,i);

% D_o
MTTD_o := MTTD;

%Observability matrix of observer form
MATRIX MTTObs_o(MTTNx,MTTNX);
MTTCA := MTTC_o;
FOR i := 1:MTTNx DO
  BEGIN
   FOR j := 1:MTTNx DO 
      MTTObs_o(i,j) := MTTCA(1,j);
   MTTCA := MTTCA*MTTA_o;
  END;

% Transformation matrix;
MTTT_o := MTTObs^(-1)*MTTObs_o;


%Create the output file
OUT "$1_smo.r";

%Write out the matrices.

% Observable form
MTT_Matrix := MTTA_o$ 
MTT_Matrix_name := "MTTA_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

MTT_Matrix := MTTB_o$ 
MTT_Matrix_name := "MTTB_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Reduce_Matrix()$

MTT_Matrix := MTTC_o$ 
MTT_Matrix_name := "MTTC_o"$
MTT_Matrix_n := 1$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

MTT_Matrix := MTTD_o$ 
MTT_Matrix_name := "MTTD_o"$
MTT_Matrix_n := 1$
MTT_Matrix_m := 1$
Reduce_Matrix()$

write "%  -Observability matrix";
MTT_Matrix := MTTObs$ 
MTT_Matrix_name := "MTTObs"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$


write "%  -Observability matrix - Observer form";
MTT_Matrix := MTTObs_o$ 
MTT_Matrix_name := "MTTObs_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Transformation matrix - Observer form";
MTT_Matrix := MTTT_o$ 
MTT_Matrix_name := "MTTT_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$


write "END;;";
SHUT "$1_smo.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r sm2smo_r.log

Deleted mttroot/mtt/bin/trans/sm2sr_m version [9750108aef].

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
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


























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sm2sr_m

# Transforms descriptor matrix rep to step response


# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.16  1998/08/11 13:31:05  peterg
## Lowercase mttLAST etc
##
## Revision 1.15  1998/07/27 20:31:40  peterg
## New simpar version
##
## Revision 1.14  1998/07/25 10:00:48  peterg
## *** empty log message ***
##
## Revision 1.13  1997/06/13 12:52:18  peterg
## Removed extra ; from $PARAMS
##
# Revision 1.12  1996/09/12  18:45:31  peter
# Back to rcs.
#
# Revision 1.11  1996/08/24  14:02:39  peter
# Included glabal parameter passing.
# Proper error handling.
#
## Revision 1.10  1996/08/19 15:34:14  peter
## Now based on state - not descriptor matrices.
##
## Revision 1.9  1996/08/18 12:01:45  peter
## Unified format of time responses.
##
## Revision 1.8  1996/08/15 16:23:39  peter
## Uses T in place of t to avoid name clash within function.
##
## Revision 1.7  1996/08/15 11:54:32  peter
## Now has optional initial condition.
##
## Revision 1.6  1996/08/14 09:15:02  peter
## Now encapsulates the data into an m file
## Name changed
##
## Revision 1.5  1996/08/12 20:19:06  peter
## Fiddled about with parameter passing - still not right
##
## Revision 1.4  1996/08/11 19:48:04  peter
## Parameter passing added.
##
## Revision 1.3  1996/08/11 10:38:30  peter
## Minor debugging changes.
##
## Revision 1.2  1996/08/11 10:06:50  peter
## Now allows e format and NaN numbers.
##
## Revision 1.1  1996/08/11 09:45:46  peter
## Initial revision
##
###############################################################

echo Creating $1_sr.m
echo Creating $1_sro.m
rm -f sm2sr_m.log
rm -f $1_sr.m
rm -f $1_sro.m
rm -f mtt_error


# PARAMS="$PARAMS ;"

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

  % Read in the numeric system parameters
  mttpar = $1_numpar;

  % Read in the simulation parameters
  simpar = $1_simpar;

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

  T=[0:simpar.dt:simpar.last]'

  if exist('u0')==0
    u0 = ones(nu,1);
  end;

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


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

  [A,B,C,D] = $1_sm(mttpar);
  [y,x] = sm2sr(A,B,C,D,T,u0,x0);

  if nx>0
    write_matrix([T x], '$1_sr');
  end;
  if ny>0
    write_matrix([T y], '$1_sro');
  end;

EOF

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

Deleted mttroot/mtt/bin/trans/sm_r2m version [30c0587225].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sm_r2m
# Reduce constained state-space A,B,C,D and E matrices to Matlab
# P.J.Gawthrop July 1990, Feb 1991, May 1991, Sep 91, Dec 93, Jan 94, May 94.
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/06/23 19:18:33  peterg
## Added optional state argument.
##
# Revision 1.6  1997/02/24  14:43:21  peterg
# Now ignores parameters that are numerical.
#
## Revision 1.5  1996/09/12 18:34:44  peter
## Back under rcs.
##
# Revision 1.4  1996/08/24  14:12:26  peter
# Global parameter passing.
#
## Revision 1.3  1996/08/19 18:38:43  peter
## Read in the numerical params etc ...
##
## Revision 1.2  1996/08/19 16:25:18  peter
## Fixed bug when Nx=0.
##
## Revision 1.1  1996/08/19 15:14:51  peter
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_sm.m

# Remove the old log file
rm -f sm_r2m.log

#Header
lang_header $1 sm m '' '[mtta,mttb,mttc,mttd]' >$1_sm.m

# Use reduce to accomplish the transformation
$SYMBOLIC >sm_r2m.log << EOF

%Read in the definitions file
IN "$1_def.r";

%Read the reduce state-space A,B,C and D matrices file
IN "$1_sm.r";

%Read in the parameter file
IN "$1_sympar.r";

OUT "$1_sm.m1";

%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
OFF period$

write "mtta = zeros(", MTTNx, ",", MTTNx, ");";
write "mttb = zeros(", MTTNx, ",", MTTNu, ");";
write "mttc = zeros(", MTTNy, ",", MTTNx, ");";
write "mttd = zeros(", MTTNy, ",", MTTNu, ");";

ON NERO;	% Suppress zero elements.
mtta := mtta;
mttb := mttb;
mttc := mttc;
mttd := mttd;

OFF FORT;
write "";

SHUT "$1_sm.m1";
EOF

cat $1_sm.m1 >> $1_sm.m
#rm -f $1_sm.m1

Deleted mttroot/mtt/bin/trans/sm_r2tex version [d3ad0d67bd].

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
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

































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sm_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  9 Sep 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1998/02/18 08:25:36  peterg
## Now uses latex_matrix for formatting
##
## Revision 1.3  1997/06/13 13:50:11  peterg
## Matrices in amstex format
##
# Revision 1.2  1997/04/18  12:54:00  peterg
# No longer does labels.
#
# Revision 1.1  1996/08/19  15:19:23  peter
# Initial revision
#
###############################################################


# Inform user
echo Creating $1_$2.tex

# Remove the old log file
rm -f sm_r2tex.log

# Use reduce to accomplish the transformation
reduce >sm_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the constrained-state matrices file
in "$1_$2.r";

%Read the symbolic parameters file
%%in "$1_sympar.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;

MATRIX MTT_Matrix(MTTNx,MTTNx);

OUT "$1_$2.tex";

%Write out the state matrices.
write "%state  matrices $1";
write "%File: $1_$2.tex";
write"";

MTT_Matrix := MTTA$ 
MTT_Matrix_name := "MTTA"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB$ 
MTT_Matrix_name := "MTTB"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC$ 
MTT_Matrix_name := "MTTC"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTD$ 
MTT_Matrix_name := "MTTD"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

SHUT "$1_$2.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/smc2ssk_r version [06844ee033].

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
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





















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: smc2ssk_r
# controller-form state matrices to controller gain k
# P.J.Gawthrop  Jan 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/02/09 14:16:52  peterg
## Writes end statement to the o/p file
##
## Revision 1.2  1998/01/23 09:30:36  peterg
## Fixed a sign error - the coeficients of a(s) appear with - signs in
## the A_c matrix!
##
## Revision 1.1  1998/01/22 13:16:16  peterg
## Initial revision
##
###############################################################

Nu=`mtt_getsize $1 u`
Ny=`mtt_getsize $1 y`

if [ "$Nu" = "1" ]; then
  if [ "$Ny" = "1" ]; then
    blurb=' for this siso system'    
  else
    blurb=" using first output of $Ny"
  fi
else
  if [ "$Ny" = "1" ]; then
    blurb=" using first input of $Nu"
  else
    blurb=" using first input of $Nu and using first output of $Ny"
  fi
fi

# Inform user
echo Creating $1_ssk.r $blurb

# Remove the old log file
rm -f smc2ssk_r.log

# Use reduce to accomplish the transformation
reduce >smc2ssk_r.log << EOF

in "$1_def.r";
in "$1_smc.r";

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";


OFF Echo;
OFF Nat;


%%%%  Controller design %%%%%

% gain in controller form:
matrix MTTk_c(1,MTTNx);

matrix alpha_c(9,1);
alpha_c(1,1) := alpha_c1;
alpha_c(2,1) := alpha_c2;
alpha_c(3,1) := alpha_c3;
alpha_c(4,1) := alpha_c4;
alpha_c(5,1) := alpha_c5;
alpha_c(6,1) := alpha_c6;
alpha_c(7,1) := alpha_c7;
alpha_c(8,1) := alpha_c8;
alpha_c(9,1) := alpha_c9;


for i := 1:MTTNx do
 MTTk_c(1,i) := alpha_c(i,1) + MTTA_c(1,i);

% Gain in physical form
MTTk := MTTk_c*MTTT_c;


%Create the output file
OUT "$1_ssk.r";

%Write out the matrices.

write "%  - Gain matrix - controller form";
MTT_Matrix := MTTK_c$ 
MTT_Matrix_name := "MTTK_c"$
MTT_Matrix_n := 1$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTK$ 
MTT_Matrix_name := "MTTK"$
MTT_Matrix_n := 1$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

write "END;";

SHUT "$1_ssk.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r smc2ssk_r.log

Deleted mttroot/mtt/bin/trans/smc_r2tex version [0a9685fd8a].

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
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


















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: smc_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  2000/08/24 11:43:42  peterg
## Include subs file
##
## Revision 1.1  1998/01/22 13:25:55  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_smc.tex

# Remove the old log file
rm -f smc_r2tex.log

# Use reduce to accomplish the transformation
$SYMBOLIC >smc_r2tex.log<< EOF

%Read the definitions file
in "$1_def.r";

%Read the smconical-form matrices file
in "$1_smc.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;


OUT "$1_smc.tex";

%Write out the canonical matrices
write "%Canonical-form  matrices $1";
write "%File: $1_smc.tex";
write"";


% Controllable form
MTT_Matrix := MTTA_c$ 
MTT_Matrix_name := "MTTA_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB_c$ 
MTT_Matrix_name := "MTTB_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
LaTeX_Matrix()$

MTT_Matrix := MTTC_c$ 
MTT_Matrix_name := "MTTC_c"$
MTT_Matrix_n := 1$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTD_c$ 
MTT_Matrix_name := "MTTD_c"$
MTT_Matrix_n := 1$
MTT_Matrix_m := 1$
LaTeX_Matrix()$

write "%  - Controllability matrix";
MTT_Matrix := MTTCon$ 
MTT_Matrix_name := "MTTCon"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  -Controllability matrix - controller form";
MTT_Matrix := MTTCon_c$ 
MTT_Matrix_name := "MTTCon_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Transformation matrix - controller form";
MTT_Matrix := MTTT_c$ 
MTT_Matrix_name := "MTTT_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$


SHUT "$1_smc.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/smo2ssl_r version [a8920b8d83].

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
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











































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: smo2ssl_r
# observer-form state matrices to Kobserver gain
# P.J.Gawthrop  Jan 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/01/23 09:31:03  peterg
## Initial revision
##
###############################################################

Nu=`mtt_getsize $1 u`
Ny=`mtt_getsize $1 y`

if [ "$Nu" = "1" ]; then
  if [ "$Ny" = "1" ]; then
    blurb=' for this siso system'    
  else
    blurb=" using first output of $Ny"
  fi
else
  if [ "$Ny" = "1" ]; then
    blurb=" using first input of $Nu"
  else
    blurb=" using first input of $Nu and using first output of $Ny"
  fi
fi


# Inform user
echo Creating $1_ssl.r $blurb

# Remove the old log file
rm -f smo2ssl_r.log

# Use reduce to accomplish the transformation
reduce >smo2ssl_r.log << EOF

in "$1_def.r";
in "$1_smo.r";

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

OFF Echo;
OFF Nat;


%%%%  Observer design %%%%%
% gain in Observer form:
matrix MTTl_o(MTTNx,1);
matrix alpha_o(9,1);
alpha_o(1,1) := alpha_o1;
alpha_o(2,1) := alpha_o2;
alpha_o(3,1) := alpha_o3;
alpha_o(4,1) := alpha_o4;
alpha_o(5,1) := alpha_o5;
alpha_o(6,1) := alpha_o6;
alpha_o(7,1) := alpha_o7;
alpha_o(8,1) := alpha_o8;
alpha_o(9,1) := alpha_o9;

for i := 1:MTTNx DO
 MTTL_o(i,1) := alpha_o(i,1) + MTTA_o(i,1);

% Gain in physical form
MTTL := MTTT_o*MTTL_o;

%Create the output file
OUT "$1_ssl.r";

%Write out the matrices.


write "%  - Observer Gain matrix - observer form";
MTT_Matrix := MTTL_o$ 
MTT_Matrix_name := "MTTL_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNy$
Reduce_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTL$ 
MTT_Matrix_name := "MTTL"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNy$
Reduce_Matrix()$

write "END;";

SHUT "$1_ssl.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r smo2ssl_r.log

Deleted mttroot/mtt/bin/trans/smo_r2tex version [b9ffb95882].

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
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
















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: smo_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/01/22 13:17:14  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_smo.tex

# Remove the old log file
rm -f smo_r2tex.log

# Use reduce to accomplish the transformation
reduce >smo_r2tex.log<< EOF

%Read the definitions file
in "$1_def.r";

%Read the observer-form matrices file
in "$1_smo.r";


%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;


OUT "$1_smo.tex";

%Write out the canonical matrices
write "%Canonical-form  matrices $1";
write "%File: $1_smo.tex";
write"";


% Observable form
MTT_Matrix := MTTA_o$ 
MTT_Matrix_name := "MTTA_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB_o$ 
MTT_Matrix_name := "MTTB_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC_o$ 
MTT_Matrix_name := "MTTC_o"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTD_o$ 
MTT_Matrix_name := "MTTD_o"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

write "%  - Observability matrix";
MTT_Matrix := MTTObs$ 
MTT_Matrix_name := "MTTObs"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  -Observability matrix - Observer form";
MTT_Matrix := MTTObs_o$ 
MTT_Matrix_name := "MTTObs_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Transformation matrix - Observer form";
MTT_Matrix := MTTT_o$ 
MTT_Matrix_name := "MTTT_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$


SHUT "$1_smo.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/sort_sympar version [883628776a].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sort_sympar
# Sorts the symbolic parameters in a nice way.
# P.J.Gawthrop March 1998
# Copyright (c) P.J.Gawthrop, 1998.

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


# Step 1: sort by variable name
# Step 2: put all varables with same name on same line


sort -k 1,1  | \
awk '{
    var = $1; sys = $2;
    if (var==oldvar) {
      oldsys=sprintf("%s,%s",oldsys,sys)
    }
    else{
      if (length(oldvar)>0) print oldvar "\t" oldsys;
      oldvar=var; oldsys=sys
    }
}
END{
    print oldvar "\t" oldsys;
}' 

Deleted mttroot/mtt/bin/trans/ss_r2m version [dec8c0a922].

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
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






























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ss_r2m
# Reduce steady-state values to Fortran
# P.J.Gawthrop 10 July 1990, Dec 1993, Jan 1994, May 1994.
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1993, 1994.

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

#Inform user
echo Creating $1_ss.m
# Remove the old log file
rm -f ss_r2m.log

# Usv reduce to accomplish the transformation
reduce >ss_r2m.log << EOF

%Read the reduce definitions file
in "$1_def.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the reduce steady-state values file
in "$1_ss.r";

%Read in the parameter file
in "$1_sympar.r";

ON BigFloat, numval;
PRECISION 16; %Compatible with Matlab

OUT "$1_ss.m";
%Headings - Matlab style
%(Note. The ;; are deleted by for2mat)

IF MTTNvar>0 THEN
BEGIN
  write "function [MTTX0,MTTY0,MTTU0] = $1_ss(...";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write MTTVar(i,1), ",..."
                  ELSE write MTTVar(i,1), ");;";
  END;
END
ELSE write "function [MTTX0,MTTY0,MTTU0] = $1_ss;;";


IF MTTNvar>0 THEN
BEGIN
  write "%function [MTTX0,MTTY0,MTTU0] = $1_ss(...";
  FOR i := 1:MTTNvar DO
  BEGIN
     IF i<MTTNvar THEN write "%", MTTVar(i,1), ",..."
                  ELSE write "%", MTTVar(i,1), ");;";
  END;
END
ELSE write "%function [MTTX0,MTTY0,MTTU0] = $1_ss;;";


write "%Steady-state values for system $1";
write "%File $1_ss.m";
write "%Generated by MTT";


ON NERO;	% Suppress zero elements.

%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
OFF period$

write "MTTX0 = zeros(", MTTNx, ",1)";
write "MTTy0 = zeros(", MTTNy, ",1)";
write "MTTu0 = zeros(", MTTNu, ",1)";


MTTX0 := MTTX0;
MTTY0 := MTTY0;
MTTU0 := MTTU0;

SHUT "$1_ss.m";

Deleted mttroot/mtt/bin/trans/ss_r2tex version [5d4b26acd7].

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
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





























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ss_r2tex
# Reduce transfer-function matrices to LaTex transfer-function matrices.
# P.J.Gawthrop 9 June 1990, 8 July 1990, May 1994
# Copyright (c) P.J.Gawthrop, 1990, 1994.



# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.2  1998/02/24 09:21:36  peterg
# %% Put under rcs
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


#Unform user
echo Creating $1_ss.tex

# Remove the old log file
rm -f ss_r2tex.log

# Use reduce to accomplish the transformation
reduce >ss_r2tex.log << EOF


%Read the definitions file
in "$1_def.r";

%Read the parameter file
%%in "$1_sympar.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplifiy file
in "$1_simp.r";

%Read the CR file
in "$1_cr.r";

%Read the steady-state file
in "$1_ss.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
%ON Rounded;
%Precision 5;

OUT "$1_ss.tex";
write "%  - X0";
MTT_Matrix := MTTX$ 
MTT_Matrix_name := "MTTX"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
LaTeX_Matrix()$

write "%  - U";
MTT_Matrix := MTTU$ 
MTT_Matrix_name := "MTTU"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := 1$
LaTeX_Matrix()$


write "%  - Y";
MTT_Matrix := MTTY$ 
MTT_Matrix_name := "MTTY"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := 1$
LaTeX_Matrix()$

write "%  - dX";
MTT_Matrix := MTTdX$ 
MTT_Matrix_name := "MTTdX"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
LaTeX_Matrix()$

SHUT "$1_ss.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/ssk2ctf_r version [5b4425092f].

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
68
69
70
71
72
73
74
75











































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh 
     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ssk2ctf_r
# Controller gain k and observer gain l to controller TF
# P.J.Gawthrop  Feb 1998
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/02/09 14:04:00  peterg
## Renamed matrix to cTF;
##
## Revision 1.1  1998/02/09 13:54:34  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_ctf.r

# Remove the old log file
rm -f ssk2ctf_r.log

# Use reduce to accomplish the transformation
reduce >ssk2ctf_r.log << EOF

in "$1_def.r";
in "$1_ssk.r";
in "$1_ssl.r";
in "$1_sm.r";

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";


OFF Echo;
OFF Nat;



%State matrices of the compensator
A_d := MTTA - MTTL*MTTC - MTTB*MTTK;
B_d := -MTTL;
C_d := -MTTK;
D_d := 0;

%Transfer function
MTTcTF := C_d*((s*MTTI - A_d)^(-1))*B_d;

%Create the output file
OUT "$1_ctf.r"; 
%Write out the matrices.

write "%  - Compensator TF";
MTT_Matrix := MTTcTF$
MTT_Matrix_name := "MTTcTF"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNy$
Reduce_Matrix()$


SHUT "$1_ctf.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r ssk2ctf_r.log

Deleted mttroot/mtt/bin/trans/ssk_r2tex version [ef5e08d779].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ssk_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  2000/08/24 11:42:46  peterg
## Read subs file
##
## Revision 1.1  1998/01/22 13:16:30  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_ssk.tex

# Remove the old log file
rm -f ssk_r2tex.log

# Use reduce to accomplish the transformation
reduce >ssk_r2tex.log<< EOF

%Read the definitions file
in "$1_def.r";

%Read the smconical-form matrices file
in "$1_ssk.r";


%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;


OUT "$1_ssk.tex";

%Write out the canonical matrices
write "%Canonical-form  matrices $1";
write "%File: $1_ssk.tex";
write"";


write "%  - Gain matrix - controller form";
MTT_Matrix := MTTK_c$ 
MTT_Matrix_name := "MTTK_c"$
MTT_Matrix_n := 1$
MTT_Matrix_m := MTTNx$
Latex_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTK$ 
MTT_Matrix_name := "MTTK"$
MTT_Matrix_n := 1$
MTT_Matrix_m := MTTNx$
Latex_Matrix()$

SHUT "$1_ssk.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/ssl_r2tex version [81b2f09222].

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
68
69
70
71
72
73
74
75
76
77
78














































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ssl_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/01/22 13:16:30  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_ssl.tex

# Remove the old log file
rm -f ssl_r2tex.log

# Use reduce to accomplish the transformation
reduce >ssl_r2tex.log<< EOF

%Read the definitions file
in "$1_def.r";

%Read the obsever gains file
in "$1_ssl.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;


OUT "$1_ssl.tex";

%Write out the canonical matrices
write "%Canonical-form  matrices $1";
write "%File: $1_ssl.tex";
write"";


write "%  - Gain matrix - controller form";
MTT_Matrix := MTTL_o$ 
MTT_Matrix_name := "MTTL_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Latex_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTL$ 
MTT_Matrix_name := "MTTL"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Latex_Matrix()$

SHUT "$1_ssl.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/sspar2ss_r version [a39bc5aea4].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
















































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sspar2ss_r
# Reduce steady steady-state parameter file to reduce steady-state:
#	X0, and Y0 and U0;
# P.J.Gawthrop 10 July 1990, 22 April 1991, Dec 1993, April 1994
# Copyright (c) P.J.Gawthrop, 1990, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/11/18 11:42:55  peterg
## Added "IF MTTNx>0 THEN" to avoid error message when no states
##
## Revision 1.2  1998/07/22 15:47:28  peterg
## Now operates on ordinary differential equation file.
##
## Revision 1.1  1996/08/25 09:52:20  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_ss.r

# Remove the old log file
rm -f sspar2ss_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC >sspar2ss_r.log << EOF

%Read the definition file
in "$1_def.r";

%Read the constitutive relationships (May be used in rss file). 
%in "$1_cr.r";

%Read the steady-state values 
in "$1_sspar.r";

%Read in the constrained-state equation
%in "$1_cse.r";

%Read in the ode
in "$1_ode.r";

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

OFF Echo;
OFF Nat;
OUT "$1_ss.r";

IF MTTNx>0 THEN
  MTTdx:= MTTdx;

%Write out the steady-state values (if any)
write "%Steady-state values";


% State
MTT_Matrix := MTTX$ 
MTT_Matrix_name := "MTTx"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% State derivative
MTT_Matrix := MTTdX$ 
MTT_Matrix_name := "MTTdX"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Nonstate
MTT_Matrix := MTTZ$ 
MTT_Matrix_name := "MTTZ"$
MTT_Matrix_n := MTTNz$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Output
MTT_Matrix := MTTy$ 
MTT_Matrix_name := "MTTy"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Zero outputs
MTT_Matrix := MTTYz$ 
MTT_Matrix_name := "MTTYz"$
MTT_Matrix_n := MTTNyz$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Input
MTT_Matrix := MTTu$ 
MTT_Matrix_name := "MTTu"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := 1$
Reduce_Matrix()$


%Write them out by component - but only if values have been set
%(This assumes that if element 1 not set then the rest aren't either)
%ON Rounded; %Make numbers have dec. points-- nice for c
%
%clear MTTx1;
%IF MTTNx>0 THEN
%IF MTTX0(1,1) NEQ MTTX1 THEN
%FOR i := 1:MTTNx DO
%BEGIN
%  write "MTTx", i, " := ", MTTX0(i,1);
%END;
%
%clear MTTu1;
%IF MTTNu>0 THEN
%IF MTTu0(1,1) NEQ MTTu1 THEN
%FOR i := 1:MTTNu DO
%BEGIN
%  write "MTTu", i, " := ", MTTu0(i,1);
%END;
%
%%Derivatives are zero in the steady-state
%IF MTTNz>0 THEN
%FOR i := 1:MTTNz DO
%BEGIN
%  write "MTTdz", i, " := 0";
%END;

write "END;";

SHUT "$1_ss.r";
quit;
EOF

# Now invoke the standard error handling.
mtt_error_r sspar2ss_r.log

Deleted mttroot/mtt/bin/trans/strip_comments version [8b2e61fa07].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################


# Bourne shell script: strip_comments
# Strips comments from mtt text files
# P.J.Gawthrop July 1997
# Copyright (c) P.J.Gawthrop, 1997.

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


sed 's/%/#/' |\
awk --field-separator '#' '{if (length($1)>0) print $1}'  |\
awk '{if (NF>0) print $0}'

Deleted mttroot/mtt/bin/trans/strip_notvars.sh version [e9c68eb700].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

type=$1
name=$2
file=$3

notvar="[%|#]NOT[V|P]AR"
grep ${notvar} ${type}_lbl.txt |\
    awk '{ printf ("%s\t%s\n", $2, name) }' name=${name} \
    >> ${file}
 

Deleted mttroot/mtt/bin/trans/strip_pars.sh version [981c8a73a2].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#! /bin/sh
infile=$1
name=$2



var="[%|#][V|P]AR"
grep ${var} ${infile} |\
    awk '{ printf ("%s\t%s\n", $2, name) }' name=${name} \
 

Deleted mttroot/mtt/bin/trans/struc2gnuplot_txt2wish version [9db213a0b1].

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
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
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
173
174
175
176
177
178
179
180




















































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

sys=$1

out=${sys}_gnuplot.wish
tmp=${sys}_gnuplot.tmp

struc=${sys}_struc.txt
dat2=${sys}_odes.dat2

Nx=`mtt_getsize ${sys} x`
Ny=`mtt_getsize ${sys} y`


## write header
cat <<EOF > ${out}
#!/bin/sh
# Next line replaces shell with wish\\
exec wish "\$0" "\$@"

## main window
wm title . "MTT Viewer: ${sys}"

set parameter ""
button .print -text "Print" -command { 
    global parameter;
    if {"\$parameter"==""} {
	tk_dialog ".mtt_Print_Error" "Print Error" "Select a parameter!" "" "0" "Try Again"
    } else {
	print \$parameter
    }
}
button .quit  -text "Quit"  -command exit

## states canvas
canvas		.cx
listbox		.cx.l
scrollbar	.cx.sy	-orient v
checkbutton    	.cx.t	-text		"States"

## outputs canvas
canvas		.cy
listbox		.cy.l
scrollbar	.cy.sy	-orient v
checkbutton    	.cy.t	-text		"Outputs"

## configure scrollbars
.cx.sy configure -command ".cx.l yview"
.cy.sy configure -command ".cy.l yview"
.cx.l configure -yscrollcommand ".cx.sy set"
.cy.l configure -yscrollcommand ".cy.sy set"

## bind lists
bind .cx.l <<ListboxSelect>> { set parameter [ .cx.l get anchor ] ; plot \$parameter }
bind .cy.l <<ListboxSelect>> { set parameter [ .cy.l get anchor ] ; plot \$parameter }

proc "reverse_name" "name" {
    set delim "_"
    set split_name [split \$name \$delim]
    set reversed_name [lindex \$split_name 0]
    for {set i 1} {\$i<[llength \$split_name]} {incr i} {
        set reversed_name [lindex \$split_name \$i]\$delim\$reversed_name
    }
    return \$reversed_name
}

proc "reverse_sort" "list" {
    set temp_list {}
    set delim " "
    foreach name [split \$list \$delim] {
	set temp_list \$temp_list\$delim[reverse_name \$name]
    }
    set temp_list [lsort -ascii \$temp_list]
    set list {}
    foreach name [split \$temp_list \$delim] {
	set list \$list\$delim[reverse_name \$name]
    }
    return \$list
}

proc "sort_list" "list sortorder" {
    puts "sortorder: \$sortorder"
    if ("\$sortorder"=="normal") {
	return [lsort -ascii \$list]
    }
    if ("\$sortorder"=="reverse") {
	return [reverse_sort \$list]
    }
}

EOF

## create states and outputs lists
awk '
($1 == "state") {
    printf "lappend xl state:%s\n", $4
}
($1 == "output") {
    printf "lappend yl output:%s\n", $4
}' ${struc} >> ${out}

cat <<EOF >> ${out}
.cx.l configure -listvar xl
.cy.l configure -listvar yl

.cx.t configure -command { set xl [sort_list \$xl \$xsortorder] } -indicatoron false -onvalue "reverse" -offvalue "normal" -variable xsortorder
.cy.t configure -command { set yl [sort_list \$yl \$ysortorder] } -indicatoron false -onvalue "reverse" -offvalue "normal" -variable ysortorder

pack .cx.t -expand false -fill x -side top
pack .cy.t -expand false -fill x -side top

pack .cx.sy -expand false -fill y -side right
pack .cy.sy -expand false -fill y -side right

pack .cx.l -expand true -fill both -side left
pack .cy.l -expand true -fill both -side left

pack .cx -expand true -fill both
place .cy -in .cx -relx 0 -rely 0 -relwidth 1 -relheight 1 -anchor nw -bordermode outside

radiobutton .states  -text "States"  -value states  -variable view -command { raise .cx } -relief solid
radiobutton .outputs -text "Outputs" -value outputs -variable view -command { raise .cy } -relief solid

pack .states .outputs -side left

pack .quit   -expand false -fill x -side right
pack .print  -expand false -fill x -side right


## map names to column numbers
EOF

awk '
BEGIN {
    print "proc \"plot\" \"title\" {";
}
($1 == "state") {
    printf "if (\"%s\"==\"state:%s\") { plot_var \"%s\" %d }\n", Title, $4, $4, $2+2+Ny;
}
($1 == "output") {
    printf "if (\"%s\"==\"output:%s\") { plot_var \"%s\" %d }\n", Title, $4, $4, $2+1;
}    
END {
    print  "}"
}
' Title=\$title Ny=${Ny} ${struc} >> ${out}


cat <<EOF >> ${out}

## call gnuplot
proc "plot_var" "title column" {
    exec echo set grid\; > ${tmp}
    exec echo plot \"${dat2}\" using 1:\$column title \"\$title\" with lines\; >> ${tmp}
    exec echo exit\; >> ${tmp}
    exec gnuplot -geometry 400x300 -persist -title "\$title" ${tmp} &
}

## print output
proc "print" "parameter" {
    set filename [tk_getSaveFile\
	-initialdir ".."\
	-initialfile "\$parameter.ps"\
	-defaultextension ".ps"\
	-filetypes {
	    {{Postscript} {.ps}}
	    {{All files} {*}}
	}
    ]
    if {\$filename != ""} {
	exec echo set term postscript > ${tmp}.print
	exec echo set output \"\$filename\" >> ${tmp}.print
	exec grep -v pause ${tmp} >> ${tmp}.print
	exec gnuplot ${tmp}.print
	puts "Graph printed to \$filename"
    }
}

EOF
chmod +x ${out}

Deleted mttroot/mtt/bin/trans/struc2input_txt2txt version [280b194479].

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
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
123
124
125
126
127































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: struc2input_txt2txt
# Creates the deafault numerical parameters file for the system (txt)

# Copyright (c) P.J.Gawthrop 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.14  2000/10/16 08:28:56  peterg
## Tidied up:
## SS broken due to incorrect ss.r file
## Switches??
##
## Revision 1.13  2000/03/03 11:33:19  peterg
## *** empty log message ***
##
## Revision 1.12  1998/08/10 14:29:05  peterg
## Removed -s (switches) stuff
##
## Revision 1.11  1998/08/10 14:23:58  peterg
## Added -ss option
##
## Revision 1.10  1998/07/27 11:10:38  peterg
## Put in octave-mode line for Emacs
##
## Revision 1.9  1998/07/25 20:10:37  peterg
## lower case mttu
##
## Revision 1.8  1998/07/25 09:42:09  peterg
## Just sets finrst input to 1 - rest to zero
##
## Revision 1.7  1998/07/25 08:05:41  peterg
## Reverted to original default - not using SS mechanism
##
## Revision 1.6  1998/02/24 10:14:56  peterg
## Now defaults to the steady-state values
##
## Revision 1.5  1998/02/04 12:26:47  peterg
## Simplified output format
##
## Revision 1.4  1998/02/04 11:45:05  peterg
## Less verbose comments.
##
## Revision 1.3  1998/01/29 17:06:21  peterg
## Better annotation of each input
##
## Revision 1.2  1997/05/15 09:44:12  peterg
## Put switches into the input file.
##
# Revision 1.1  1997/05/03  14:55:17  peterg
# Initial revision
#
###############################################################

#Look for a command line argument
# By default, don't look for BG switches

while [ -n "`echo $1 | grep '-'`" ]; do
  case $1 in
	-ss )
		steadystate_computation=yes ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

# Default input
default='1.0'

#Create the input file complete with headers.
echo '# -*-octave-*- Put Emacs into octave-mode' > $1_input.txt
echo "# Input specification ($1_input.txt)" >> $1_input.txt
echo "# Generated by MTT at `date`" >> $1_input.txt
cat $MTTPATH/trans/rcs_header.sh  >> $1_input.txt
echo "# Set the inputs"  >> $1_input.txt

if [ -n "$steadystate_computation" ]; then 
# Compute inputs from ss.r file
# Inform user
echo Creating $1_input.txt - compute from steady-state information

cat $1_ss.r  $1_struc.txt | sed 's/\$//' |\
awk '{
  if(match($1,"MTTu")>0) {
    j++
    split($0,a,"=");
    u[j]=a[2];
  }
    
  if($1=="input") {
    i++; 
    if (length(u[i])==0) u[i]="0.0;";
    # print  "u(" i ") =\t", u[i], " \# " $4 " (" $3 ")"
    printf("%s =\t%s # MTT initial value from steady state\n", $4, u[i]);
  }
}'  >> $1_input.txt
else
#Write out the defaults -- unit inputs
echo Creating $1_input.txt - using defaults

awk '{
  if ($1=="input") {
      if ($2==1)
        printf("%s = \t%s; # MTT initial value\n", $4, default)
      else
        printf("%s = \t%s; # MTT initial value\n", $4, "0.0")
  }
}' Nu=$Nu  default=$default <$1_struc.txt >> $1_input.txt
fi

#Set some switches
#  echo  >> $1_input.txt
#  echo "# Set the switches"  >> $1_input.txt
#  strip_comments<$1_switch.txt |\
#  awk '{if (length($1)>0) print  tolower($1) "= (t>=0);"}'  >> $1_input.txt



Deleted mttroot/mtt/bin/trans/struc2sspar_txt2r version [64274bba4e].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: struc2sspar_txt2txt
# Creates the deafault numerical parameters file for the system (txt)

# Copyright (c) P.J.Gawthrop 1998


# Inform user
echo Creating $1_sspar.r


#Write out the default ss values (0)
#Create the sspar file complete with headers.
echo "% Steady-state parameter file ($1_sspar.r)" > $1_sspar.r
echo "% Generated by MTT at `date`" >> $1_sspar.r
cat $MTTPATH/trans/rcs_header.m  >> $1_sspar.r

echo  >> $1_sspar.r

echo "% Steady-state states" >> $1_sspar.r
awk '{
  if ($1=="state") 
    print "MTTX" $2 " := \t0; \% " $4 " (" $3 ")"
}' \
 $1_struc.txt >> $1_sspar.r


echo "% Steady-state inputs" >> $1_sspar.r
awk '{
  if ($1=="input") 
    print "MTTU" $2 " := \t0; \% " $4 " (" $3 ")"
}' \
 $1_struc.txt >> $1_sspar.r


echo ";;END;" >> $1_sspar.r


Deleted mttroot/mtt/bin/trans/struc2state_txt2txt version [fd9c2c8fdf].

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
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




































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: struc2state_txt2txt
# Creates the default state file for the system (txt)

# Copyright (c) P.J.Gawthrop 1998


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.9  2000/10/10 21:03:06  peterg
# %% *** empty log message ***
# %%
# %% Revision 1.8  1998/08/10 13:57:33  peterg
# %% Removed debugging lines
# %%
# %% Revision 1.7  1998/08/10 13:55:11  peterg
# %% Added option of computing from ss values
# %%
# %% Revision 1.6  1998/07/27 20:32:11  peterg
# %% Octave mode forced
# %%
# %% Revision 1.5  1998/07/25 20:10:01  peterg
# %% Lower case mttx
# %%
# %% Revision 1.4  1998/07/25 09:42:37  peterg
# %% Now writes out an array
# %%
# %% Revision 1.3  1998/07/25 08:11:35  peterg
# %% No longer used the SS method - just sets zero states
# %%
# %% Revision 1.2  1998/07/21 16:54:15  peterg
# %% Changed erroneous header
# %%
# %% Revision 1.1  1998/06/27 15:06:40  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


while [ -n "`echo $1 | grep '-'`" ]; do
  case $1 in
	-ss )
		steadystate_computation=yes ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

# Default state
default='0.0'

#Create the state file complete with headers.
echo '# -*-octave-*- Put Emacs into octave-mode' > $1_state.txt
echo "# Initial state  file ($1_state.txt)" >> $1_state.txt
echo "# Generated by MTT at `date`" >> $1_state.txt
cat $MTTPATH/trans/rcs_header.sh  >> $1_state.txt

#Write out the defaults -- states to steady-state values
echo "# Set the states"  >> $1_state.txt

if [ -n "$steadystate_computation" ]; then 
# Compute state from ss.r file
# Inform user
echo Creating $1_state.txt - compute from steady-state information

cat $1_ss.r  $1_struc.txt | sed 's/\$//' |\
awk '{
  if(match($1,"MTTx")>0) {
    j++
    split($0,a,"=");
    x[j]=a[2];
  }
    
  if($1=="state") {
    i++; 
    # print  "x(" i ") =\t", x[i], " \# " $4 " (" $3 ")"
    printf("%s =\t%s; # MTT initial value\n", $4, x[i]);
  }
}'  >> $1_state.txt
else
# Set states to zero
# Inform user
echo Creating $1_state.txt - default states to $default

awk '{
  if ($1=="state") printf("%s \t= %s; # MTT initial value\n", $4, default)
}' default=$default <$1_struc.txt >> $1_state.txt
    
fi


Deleted mttroot/mtt/bin/trans/struc2switch_txt version [178de24ab3].

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





























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: struc2switch_txt

# Structure file - generate a file for switching on states
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  2000/10/17 09:20:00  peterg
## *** empty log message ***
##
## Revision 1.4  1998/07/26 10:28:30  peterg
## Added a header line to avoid empty file and to trigger
## switch_txt2m to write initial stuff.
##
## Revision 1.3  1998/07/25 18:50:53  peterg
## Lower case names
##
## Revision 1.2  1997/06/03 15:17:09  peterg
## Changed label to MTT_SWITCH
##
# Revision 1.1  1997/05/13  16:58:59  peterg
# Initial revision
#
###############################################################




echo Creating  $1_switch.txt

rm -f $1_switch.txt
echo "# These are the switches deduced from ISW and CSW components"\
 > $1_switch.txt

# This is the main transformation using awk
awk '{ 
   if ($1=="state") {i++; if ($3=="MTT_SWITCH")  print tolower($4) "\t" i};
}
END{
}
' < $1_struc.txt| sort >> $1_switch.txt

strip_comments < $1_switch.txt | wc -l | awk '{print $1 " switches found"}'








Deleted mttroot/mtt/bin/trans/struc_txt2m version [8e5a3e29dd].

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
68
69
70
71
72
73
74
75
76
77
78














































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: struc_txt2m

# Structure file - txt to m conversion
# P.J.Gawthrop April 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  2001/03/19 02:28:52  geraint
## Branch merge: merging-ode2odes-exe back to MAIN.
##
## Revision 1.1.2.1  2001/03/06 03:52:15  geraint
## Put back struc_txt2m - required by mtt2sys.
##
###############################################################



# Inform user
echo "Creating $1_struc.m"

rm -f mtt_error

#Write some file headers
echo "function [input_name,output_name,state_name] = $1_struc" > $1_struc.m
echo "%% Structure file ($1_struc.m)" >> $1_struc.m
echo "%% Generated by MTT at `date`" >> $1_struc.m

cat  >> $1_struc.m <<EOF

## Default to null strings
 input_name = "";
 output_name = "";
 state_name  = "";
EOF



# This is the main transformation using awk
awk '
function header(what){
  print what "_name = [";
}

function footer(what){
  print "];";
}

BEGIN{
Which="";
apostrophe = "\047";
}
{
  if ($1!=Which) {
    if (Which!="") footer(Which);
    header($1);
  }
  print  apostrophe $4 "_" $3 apostrophe;
  Which = $1;
}
END{
  footer(Which)
}
'  SYSTEM=$1  < $1_struc.txt >> $1_struc.m 2>mtt_error.txt

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


Deleted mttroot/mtt/bin/trans/struc_txt2tex version [6003f8f14a].

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
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






























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: struc_txt2tex

# Structure file - text to TeX table conversion
# P.J.Gawthrop April 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.3  1997/12/06  19:10:41  peterg
# Reverted to tabular --- from supertabular
#
# Revision 1.2  1997/04/15  11:17:58  peterg
# Uses supertabular for long tables.
#
# Revision 1.1  1997/04/15  09:49:04  peterg
# Initial revision
#
###############################################################


# Inform user
echo "Creating $1_struc.tex"

rm -f mtt_error

#Write some file headers
echo "%% Structure file ($1_struc.txt)" > $1_struc.tex
echo "%% Generated by MTT at `date`" >> $1_struc.tex

# This is the main transformation using awk
sed 's/_/\\_/g' < $1_struc.txt |  awk '
function header(what){
  print "  \\centering";
 print "  \\tablefirsthead{\\hline %";
  print "    \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\";
  print "    \\hline";
  print "     & Component & System & Repetition \\\\";
  print "    \\hline}";

  print "  \\tablehead{\\hline %";
  print "    \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM " (continued)} \\\\";
  print "    \\hline";
  print "     & Component & System & Repetition \\\\";
  print "    \\hline}";

  print "  \\tabletail{\\hline}";
  print "  \\begin{supertabular}{|l|l|l|l|}";
}
#function header(what){
#  print "\\begin{table}[htbp]";
#  print "  \\centering";
#  print "  \\begin{tabular}{|l|l|l|l|}";  print "    \\hline";
#  print "     & Component & System & Repetition \\\\";
#  print "    \\hline";
#}
function footer(what){
  print "    \\hline";
  print "  \\end{supertabular}";
#  print "  \\end{tabular}";
#  print "  \\caption{" what "}";
#  print "\\end{table}";
  print "   \\bigskip";
  print "   \\bigskip";
}

BEGIN{
Which=""
}
{
  if ($1!=Which) {
    if (Which!="") footer(Which);
    header($1);
  }
  print $2, "&", $3,"&", $4, "&", $5, "\\\\";
  Which = $1;
}
END{
  footer(Which)
}
'  SYSTEM=$1  >> $1_struc.tex 2>mtt_error.txt

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


Deleted mttroot/mtt/bin/trans/sub2subs version [41189e212e].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sub2subs
# Generates a list of all subsystems associated with system $1

# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.

# echo the name of the subsystems one level down
sh $1\_sub.sh "echo  " 

# Create the corresponding subsystems --  quietly!
#(sh $1\_sub.sh "mtt -q  " " sub sh") #>/dev/null
(sh $1\_sub.sh " cmp2sub_m2sh  " " ") >/dev/null


# Recursively execute the subsystem files
sh $1\_sub.sh "sub2subs " 







Deleted mttroot/mtt/bin/trans/sub_sh2tex version [d032780a77].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139











































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sub_sh2tex
# Converts _sub_sh files to a latex itemized list.
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/02/04 10:59:37  peterg
## Tidied up.
##
# Revision 1.6  1997/09/08  19:42:37  peterg
# Replaced copy by compcopy
#
## Revision 1.5  1997/08/15 11:20:13  peterg
## Explicitly copies compound components (if not already there)
##
# Revision 1.4  1997/06/24  08:28:26  peterg
# Now takes %SUMMARY description from the label file
# Appends count of number of subsystems at that level
#
## Revision 1.3  1997/05/21 10:07:36  peterg
## Fixed \ probs for GNU sh/echo
##
## Revision 1.2  1997/05/19 16:46:17  peterg
## *** empty log message ***
##
# Revision 1.1  1997/05/19  11:29:44  peterg
# Initial revision
#
###############################################################


#Useful strings
quote="'";
listtype="itemize"

# Maximum list depth - maybe I should learn sh arithmetic!!
# Just go to two levels
maxlevel='0+1+1'; 

#Look for a command line argument
labels=''; arg='';
while [ -n "`echo $1 | grep '-'`" ]; do
  case $1 in
	-l )
		labels='yes'; arg='-l' ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done


system=$1
filename=$2 


if [ -z "$3" ]; then
    level=0;
else
    level=$4;
fi

#Top-level commands
if [ -z "$2" ]; then
  filename="$1_sub.tex"

  # Inform user
  echo "Creating $filename"

  #Write some file headers
  echo "% Subsystem file for system $system ($filename)"   > $filename
  echo "% Generated by MTT at `date`"  >> $filename
  echo  >> $filename
fi

# Write list item if not at the top level.
if [ -n "$2" ]; then
  #Set up some names
  filename=$2
  figfile=$3_abg.fig
  lblfile=$1_lbl.txt
  summary='%SUMMARY'

  #Get the system description, copying where necesary
  mtt -q -u compcopy $system $MTTPATH/lib/comp/compound
  # mtt -q -u $system lbl txt
  desc=`grep $summary $lblfile | sed "s/$summary//"`

  #Count the number of subsystems
  subs=`grep -c $system $figfile`

  if [ "$labels" = "yes" ]; then
    echo '  \item '$desc ' ('$subs') Section \Ref{sec:'$system'}' >> $filename
  else
    echo '  \item' $desc ' ('$subs')'   >> $filename
  fi
fi

# Create the subsystem sh files (if not too deep)
if [ "$level" != "$maxlevel" ]; then
    mtt -q -u  -l 1 $system sub sh

    # Write the list of subsystems (if they exist).
    n_subsystems=`grep -c '$1' $1_sub.sh`

    if [ "$n_subsystems" != "0" ]; then
	cat <<EOF >> $filename
	    \begin{$listtype}
EOF
	# Recursively generate the subsystems
        level1="$level+1"
	sh $system\_sub.sh "sub_sh2tex $arg " " $filename $system $level1" 
	cat <<EOF >> $filename
	    \end{$listtype}
EOF
else
    cat  <<EOF >> $filename
         No subsystems.
EOF
fi
fi








Deleted mttroot/mtt/bin/trans/switch_txt2m version [ac9707fae1].

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
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
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
























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: switch_txt2m

# Convert switch file from txt to m
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.14  2000/11/09 10:29:21  peterg
## open --> mtt_open
##
## Revision 1.13  2000/11/09 10:19:12  peterg
## Explicitly write out the open switches ....
##
## Revision 1.12  2000/11/09 09:52:07  peterg
## Removed [] from zero_state output
##
## Revision 1.11  2000/10/17 09:55:55  peterg
## Now writes to standard output
## Write the name, not the array
##
## Revision 1.10  2000/10/17 09:04:12  peterg
## *** empty log message ***
##
## Revision 1.9  1999/08/02 12:44:21  peterg
## zero_vector --> zero_state.
##
## Revision 1.8  1999/04/20 00:55:40  peterg
## Changed <= to < in switchopen.m
## Removed switch.m generation - redundant
##
## Revision 1.7  1999/04/02 06:30:37  peterg
## New _switchopen
## Removed switcha
##
## Revision 1.6  1998/10/01 18:20:50  peterg
## Split up the three if conditions on the switch and state value into
## three separate ifs. This is because p2c seems to generate incorrect
## code id just the one if is used (???).
##
## Revision 1.5  1998/10/01 16:05:34  peterg
## Separate switch.m file for euler and implicit integration
##
###############################################################


# Find system constants
Nx=`mtt_getsize $1 x` # States

#Write some file headers
#lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m

#echo Creating  $1_switch.m
# Set states to zero
# awk '{
#   if ($1=="#"){
#     printf("#== Switches set element of state vector to zero ==#\n")
#   }
#   else{
#   printf("\n#== Switch: %s ==#\n",$1)
#   printf("if (%s==0.0) \n", $1);
#   printf("  mttx(%s)=0.0;\n", $2);
#   printf("end;\n");
#   printf("if (%s<0.0)\n",$1);
#   printf("  if (mttx(%s)<=0.0)\n",$2);
#   printf("    mttx(%s)=0.0;\n", $2);
#   printf("  end;\n");
#   printf("end;\n");

#   }
# }' Nx=$Nx < $1_switch.txt >> $1_switch.m

## Set index version
#echo Creating  $1_switchopen.m

#Write some file headers
#lang_header $1 switchopen m 'mttx' '[open]' > $1_switchopen.m

## Add the switching logic
#cat  >> $1_switchopen.m <<EOF

## User defined logic (from $1_logic.m)

#EOF
#cat $1_logic.txt >> $1_switchopen.m

# Set states to zero
awk '{
  if ($1=="#"){
    printf("#== mttopen - boolean vector of open switches ==#\n")
    for (i=1;i<=Nx;i++)
     printf("mttopen(%i) = 0; # Default to not open\n", i);
  }
  else{
  printf("\n#== Switch: %s ==#\n",$1)
   printf("mttopen(%s) = (abs(%s_logic)<0.5)||((%s_logic<0.0)&&(%s<0.0));\n", $2, $1, $1, $1);
#   printf("if (%s_logic==0.0) \n", $1);
#   printf("  mttopen(%s) = 1;\n", $2);
#   printf("end;\n");
#   printf("if (%s_logic<0.0)\n",$1);
#   printf("  if (%s<0.0)\n",$1);
#   printf("    mttopen(%s) = 1;\n", $2);
#   printf("  end;\n");
#   printf("end;\n");

  }
}' Nx=$Nx < $1_switch.txt #>> $1_switchopen.m

#echo Creating  $1_switcha.m

# Implicit integration version
#Write some file headers
# lang_header $1 switcha m 'mttAA,mttx' '[mttAA]' > $1_switcha.m
# awk '{
#   if ($1=="#"){
#     printf("#== Switches set row and column of A matrix to zero ==#\n")
#   }
#   else{
#   printf("#== Switch: %s ==#\n",$1)
#   printf("if (%s==0.0) \n", $1);
#   printf("  for  MTTi=1:%s\n",Nx)
#   printf("    mttAA(MTTi,%s)=0.0;\n", $2)
#   printf("    mttAA(%s,MTTi)=0.0;\n", $2)
#   printf("  end;\n");
#   printf("  mttAA(%s,%s) = 1.0;\n", $2,$2);
#   printf("end;\n\n")
# 
#   printf("if (%s<0.0)\n",$1);
#   printf("  if (mttx(%s)<=0.0)\n",$2);
#   printf("    for  MTTi=1:%s\n",Nx)
#   printf("      mttAA(MTTi,%s)=0.0;\n", $2)
#   printf("      mttAA(%s,MTTi)=0.0;\n", $2)
#   printf("    end;\n");
#   printf("    mttAA(%s,%s) = 1.0;\n", $2,$2);
#   printf("  end;\n");
#   printf("end;\n");
# 
#   }
# }' Nx=$Nx < $1_switch.txt >> $1_switcha.m



Deleted mttroot/mtt/bin/trans/sympar2global_txt2lang version [bc073c2291].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91



























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2global_txt2lang

# Symbolic parameters to default paramers in computer language
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/07/26 11:00:18  peterg
## Put in exits-- this all needs a good clean
##
## Revision 1.4  1998/07/26 10:50:30  peterg
## Corrected bug.
##
## Revision 1.3  1998/07/26 10:48:18  peterg
## Now strips comments
##
## Revision 1.2  1998/07/25 18:49:00  peterg
## Now uses extended sympars -- sympar + switches
##
## Revision 1.1  1998/06/15 15:24:33  peterg
## Initial revision
##
###############################################################

# Set up language stuff.
language=$2

case $language in
    m)
	Lc='#';
	Rc='#';
	;;
    c)
	Lc='/*';
	Rc='*/';
	;;
    java)
	Lc='/*';
	Rc='*/';
	;;
    *)
	echo Language $2 not supported - sorry; exit 1
esac

cat <<EOF

$Lc====== Set up the global variables ======$Rc
EOF
# Matlab bit
#Write out the variables in matlab global format
if [ "$language" = "m" ]; then
  sympar2global_txt2m $1
exit
fi

if [ "$language" = "c" ]; then
  strip_comments <$1_sympars.txt  |\
    awk '{
      i++; print "extern double", tolower($1) ";";
    }'
exit
fi

if [ "$language" = "java" ]; then
cat <<EOF
    $1_numpar p;
    private p = new $1_numpar();
EOF 
  strip_comments <$1_sympars.txt  |\
      awk '{
        i++; print "  float " tolower($1) " = p." tolower($1) ";";
      }'
fi

echo

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


Deleted mttroot/mtt/bin/trans/sympar2global_txt2m version [cef2e8e876].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2global_txt2m

# Symbolic parameters to default paramers (m)
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/11/18 11:34:24  peterg
## Cleaned up to:
##   work properly for no globals
##   no need to repeat las global
##
## Revision 1.4  1998/07/26 10:44:08  peterg
## Now strips comment lines first
##
## Revision 1.3  1998/07/25 18:27:45  peterg
## now uses the (extended with switch) sympars.txt file
##
## Revision 1.2  1998/03/22 11:13:27  peterg
## Back under RCS
##
# Revision 1.1  1997/04/16  11:37:22  peterg
# Initial revision
#
###############################################################


#Write out the variables in matlab global format
strip_comments <$1_sympars.txt  |\
awk '
{i++; 
  if ((i==1)&&(NF>0)) {
    printf ("global");
    globals_exist=1
  }
  if (NF>0)
    printf (" ...\n     %s", tolower($1));
}
END{
  if (globals_exist)
    print " ;"
}' 

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


Deleted mttroot/mtt/bin/trans/sympar2numpar_r2c version [d052149f27].

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
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

































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2numpar_r2m
# Creates the deafault numerical parameters file for the system

# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1997/01/21 11:36:26  peterg
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_numpar.c

# Remove the old log file
rm -f sympar2numpar_r2c.log

# Use reduce to accomplish the transformation
reduce >sympar2numpar_r2c.log 2>mtt_error.txt << EOF

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the symbolic parameters file
IN "$1_sympar.r";

OUT "$1_numpar1.c";

IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
    IF numberp(MTTVar(i,1)) 
      THEN 
      BEGIN
      % Do nowt
      END
      ELSE  
      BEGIN
        write "extern float ", MTTVar(i,1)$
      END;
END; 


IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
    IF numberp(MTTVar(i,1)) 
    THEN 
    BEGIN
     write "/* Variable ", i, " has already been set to ",   MTTVar(i,1), "*/";
    END
    ELSE
    BEGIN
      write MTTVar(i,1), "  = 1;	/* Default value */";
    END;
END;


SHUT "$1_numpar1.c";

EOF

matlab_tidy $1_numpar1.c

#Create the numpar file complete with headers.
echo "/*" > $1_numpar.c
echo "%% Numerical parameter file ($1_numpar.c)" >> $1_numpar.c
echo "%% Generated by MTT at `date`" >> $1_numpar.c
echo "*/" >> $1_numpar.c

echo "$1_numpar()"  >> $1_numpar.c
echo "{" >> $1_numpar.c
echo "  extern $1_params();" >> $1_numpar.c

cat $1_numpar1.c >> $1_numpar.c

echo "/*" >> $1_numpar.c
echo '%% Input the user-defined parameters'  >> $1_numpar.c
echo "*/" >> $1_numpar.c

echo "$1_params;"   >> $1_numpar.c
echo "};" >> $1_numpar.c

rm $1_numpar1.c

# Now invoke the standard error handling.
mtt_error_r sympar2numpar_r2c.log

Deleted mttroot/mtt/bin/trans/sympar2numpar_r2m version [0368596f7d].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137









































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2numpar_r2m
# Creates the deafault numerical parameters file for the system

# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.9  1996/09/12 19:26:05  peter
## Input _params file.
##
## Revision 1.8  1996/08/30 19:37:43  peter
## Moved headers in shell script.
##
## Revision 1.7  1996/08/24 14:11:56  peter
## Global parameter passing.
##
## Revision 1.6  1996/08/20 08:21:24  peter
## *** empty log message ***
##
## Revision 1.5  1996/08/16 14:27:25  peter
## Make a dummy function when no parameters (MTTNVar=0).
##
## Revision 1.4  1996/08/15 12:46:59  peter
## Removed a spuriuos echo.
##
## Revision 1.3  1996/08/12 20:20:59  peter
## Explicit parameters via out put list.
## Parameter conversion stuff deleted.
##
## Revision 1.2  1996/08/11 10:41:52  peter
## Fixed various bugs.
##
## Revision 1.1  1996/08/11 08:48:07  peter
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_numpar.m

# Remove the old log file
rm -f sympar2numpar_r2m.log

# Use reduce to accomplish the transformation
reduce >sympar2numpar_r2m.log << EOF

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the symbolic parameters file
IN "$1_sympar.r";

OUT "$1_numpar1.m";

IF MTTNvar>0 THEN
BEGIN
  write "global ...;;";
  FOR i := 1:MTTNvar DO
    IF numberp(MTTVar(i,1)) 
      THEN 
      BEGIN
      % Do nowt
      END
      ELSE  
      BEGIN
       IF i<MTTNvar THEN write MTTVar(i,1), " ..."
                    ELSE write MTTVar(i,1), ";";
      END;
END; 


IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
    IF numberp(MTTVar(i,1)) 
    THEN 
    BEGIN
     write "% Variable ", i, " has already been set to ",   MTTVar(i,1);
    END
    ELSE
    BEGIN
      write MTTVar(i,1), "  = 1;	% Default value";
    END;
END;

if MTTNVar=0 THEN
  write "foo=0";

SHUT "$1_numpar1.m";

EOF

matlab_tidy $1_numpar1.m

#Create the numpar file complete with headers.
echo "%% Numerical parameter file ($1_numpar.m)" > $1_numpar.m
echo "%% Generated by MTT at `date`" >> $1_numpar.m
cat $MTTPATH/trans/m/rcs_header.txt  >> $1_numpar.m
cat $1_numpar1.m >> $1_numpar.m

echo '%% Input the user-defined parameters'  >> $1_numpar.m
echo "$1_params;"   >> $1_numpar.m


rm $1_numpar1.m


# Now invoke the standard error handling.
mtt_error_r sympar2numpar_r2m.log



















Deleted mttroot/mtt/bin/trans/sympar2numpar_txt2txt version [1cce4350bc].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85





















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2numpar_txt2txt
# Creates the deafault numerical parameters file for the system (txt)

# Copyright (c) P.J.Gawthrop 1996

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.12  1999/03/02 22:01:21  peterg
## *** empty log message ***
##
## Revision 1.11  1998/06/15 15:14:46  peterg
## Don't print if blank line
##
## Revision 1.10  1998/03/07 15:27:20  peterg
## Don't do initial states.
##
## Revision 1.9  1998/02/04 12:24:35  peterg
## Simplified output format
##
## Revision 1.8  1998/01/29 17:06:36  peterg
## Better annotation
##
## Revision 1.7  1997/09/18 17:10:18  peterg
## Changed comments pertaining to the parameters to use the new column 2
## of the sympar file (the system type).
## Added blank line to separate parmeters from states.
## (Done in the Chester Court Hotel).
##
## Revision 1.6  1997/06/13 09:34:39  peterg
## changed [] to ()
##
# Revision 1.5  1997/05/15  08:30:14  peterg
# Now write default states (using _struc file).
#
# Revision 1.4  1997/05/15  07:19:19  peterg
# Put back "tolower"
#
# Revision 1.3  1997/05/15  07:13:31  peterg
# Removed "tolower" function.
#
# Revision 1.2  1997/05/01  08:19:04  peterg
# # is now used as the comment symbol
#
# Revision 1.1  1997/05/01  07:35:48  peterg
# Initial revision
#
###############################################################

# Inform user
echo Creating $1_numpar.txt

#Create the numpar file complete with headers.
echo '# -*-octave-*- Put Emacs into octave-mode' > $1_numpar.txt
echo "# Numerical parameter file ($1_numpar.txt)" >> $1_numpar.txt
echo "# Generated by MTT at `date`" >> $1_numpar.txt
cat $MTTPATH/trans/rcs_header.txt  >> $1_numpar.txt

#Write out the variables
echo "# Parameters" >> $1_numpar.txt
strip_comments <$1_sympar.txt |\
awk '{i++; if (NF>0) print tolower($1) " = \t1.0; \# " $2}'\
  >> $1_numpar.txt

#Write out the initial states
#echo  >> $1_numpar.txt
#echo "# Initial states" >> $1_numpar.txt
#awk '{
#  if ($1=="state") 
#    print "x(" $2 ") = \t0.0; \# " $4 " (" $3 ")"
#}' \
# $1_struc.txt >> $1_numpar.txt





Deleted mttroot/mtt/bin/trans/sympar2par_txt2m version [62092b15cb].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2par_txt2m

# Symbolic parameters parameter conversion
# Used in lang_header
# Copyright (C) 2000 by Peter J. Gawthrop

case $2 in
    zero)
	  strip_comments <$1_sympar.txt  |\
          awk '{
          i++; printf("  %s %s = 0.0;\n",  tolower($1));
          }' 
	;;
    set)
	  strip_comments <$1_sympar.txt  |\
         awk '{
           i++; printf("  %s mttpar(%i) \t= %s;\n", i, tolower($1));
         }' 
        ;;
    *)
         strip_comments <$1_sympar.txt  |\
         awk '{
           i++; printf("  %s %s \t= mttpar(%i%s);\n", decl, tolower($1), i, minusone);
         }' decl="$3" minusone="$4"
	;;
esac




Deleted mttroot/mtt/bin/trans/sympar2params_txt2c version [ed3554c783].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2params_txt2c

# Symbolic parameters to default paramers (c)
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.1  1997/03/20  10:25:55  peterg
# Initial revision
#
###############################################################



# Inform user
echo "Creating $1_params.c"

rm -f mtt_error

#Write some file headers
echo '/*' > $1_params.c
echo "Parameter file for system $1 ($1_params.c)"   >> $1_params.c
echo "This file provides the system params for simulation:"  >> $1_params.c
echo "Generated by MTT at `date`"  >> $1_params.c
echo "These default parameters should be changed by the user"  >> $1_params.c
echo '*/' >> $1_params.c
echo  >> $1_params.c


cat $MTTPATH/trans/rcs_header.c >> $1_params.c
echo  >> $1_params.c


echo "#include \"$1_sympar.c\""  >> $1_params.c
echo "$1_params()" >> $1_params.c
echo '{' >> $1_params.c

#Write out the variables in c format.
awk '{i++; print tolower($1) " = \t1.0;"}' $1_sympar.txt  >> $1_params.c
echo '}' >> $1_params.c

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


Deleted mttroot/mtt/bin/trans/sympar2params_txt2m version [7416ea5275].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2params_txt2m

# Symbolic parameters to default paramers (m)
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2  1997/04/16  11:40:31  peterg
# Added global variables.
#
# Revision 1.1  1997/04/16  11:31:41  peterg
# Initial revision
#
###############################################################



# Inform user
echo "Creating $1_params.m"

rm -f mtt_error

#Write some file headers
echo "% Parameter file for system $1 ($1_params.m)"   > $1_params.m
echo "% This file provides the system params for simulation:"  >> $1_params.m
echo "% Generated by MTT at `date`"  >> $1_params.m
echo "% These default parameters should be changed by the user"  >> $1_params.m
echo  >> $1_params.m

cat $MTTPATH/trans/rcs_header.m >> $1_params.m
echo  >> $1_params.m


#Write out the global variables
sympar2global_txt2m $1 >> $1_params.m


#Write out the variables in c format.
awk '{i++; print tolower($1) " = \t1.0;"}' $1_sympar.txt  >> $1_params.m

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


Deleted mttroot/mtt/bin/trans/sympar_r2c version [4377d90700].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar_r2c
# Convert symbolic parameters to a c declaration list

# Copyright (c) P.J.Gawthrop 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.1  1997/03/01  11:20:36  peterg
# Initial revision
###############################################################

# Inform user
echo Creating $1_sympar.c

# Remove the old log file
rm -f sympar_r2c.log

# Use reduce to accomplish the transformation
reduce >sympar_r2c.log << EOF


%Read the symbolic parameters file
in "$1_sympar.r";


%Generate the global variable list.
OUT "$1_sympar.c";
%External (global) variable list

write "/* Symbolic paramaters for system $1 */ "$
write "/* Generated by MTT */ "$
write "/* External (global) variable list */ "$

IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
    IF numberp(MTTVar(i,1)) 
      THEN 
      BEGIN
      % Do nowt
      END
      ELSE
      BEGIN
         write "extern double ", MTTVar(i,1), ";"$
      END$
END$
SHUT "$1_sympar.c";


EOF

Deleted mttroot/mtt/bin/trans/sympar_txt2c version [8ba82ee2c5].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar_txt2c

# Label file to symbolic parameters conversion
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2  1997/05/15  07:10:56  peterg
# removed "tolower" function
#
# Revision 1.1  1997/05/15  07:10:09  peterg
# Initial revision
#
# Revision 1.3  1997/03/19  16:39:12  peterg
# Put in the correct date.
#
# Revision 1.2  1997/03/18  17:56:35  peterg
# Cosmetic changes.
#
###############################################################


# Inform user
echo "Creating $1_sympar.c"

rm -f mtt_error

#Write some file headers
echo '/*' > $1_sympar.c
echo "Symbolic parameter file ($1_sympar.c)" >> $1_sympar.c
echo "Generated by MTT at `date`"  >> $1_sympar.c
echo '*/' >> $1_sympar.c
echo  >> $1_sympar.c


#Write out the variables in c format.
awk '{i++; print "extern double", tolower($1) ";"}' $1_sympar.txt \
      >> $1_sympar.c


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


Deleted mttroot/mtt/bin/trans/sympar_txt2declare version [cca8092d6c].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar_txt2declare

# Symbolic parameters to variable declaration
# Copyright (C) 2000 by Peter J. Gawthrop

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

###############################################################

sys=$1
language=$2

case $language in
    p)
        first="VAR";
        delim=", ";
        last=': REAL;';
	;;
    *)
	echo Language $language not supported - sorry; exit 1
esac

# Start
cat<<EOF
$first
EOF
#Write out the variables 
strip_comments < $sys"_sympar.txt" |\
awk '{
  i++; 
  var[i] = tolower($1);
}
END{
  n = i;
  for (i=1; i<n; i++){
    printf("%s%s",var[i], delim);
    j++; 
    if (j>10){
    printf("\n"); j=0;
    }
  }
  printf("%s%s\n",var[n], last);

}' "delim=$delim" "last=$last" 


Deleted mttroot/mtt/bin/trans/sympar_txt2h version [7fc0d6f66f].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar_txt2h

# Label file to symbolic parameters conversion
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.5  1997/05/15  07:11:45  peterg
# Removed "tolower" function
#
# Revision 1.4  1997/05/01  13:51:37  peterg
# Replaced float by double.
#
# Revision 1.3  1997/05/01  13:42:43  peterg
# Chaged double to float
#
# Revision 1.2  1997/03/20  15:14:25  peterg
# Lower case conversion.
#
# Revision 1.1  1997/03/20  14:52:41  peterg
# Initial revision
#
###############################################################



# Inform user
echo "Creating $1_sympar.h"

rm -f mtt_error

#Write some file headers
echo '/*' > $1_sympar.h
echo "Symbolic parameter file ($1_sympar.h)" >> $1_sympar.h
echo "Generated by MTT at `date`"  >> $1_sympar.h
echo '*/' >> $1_sympar.h
echo  >> $1_sympar.h


#Write out the variables in c format.
awk '{i++; print "double", tolower($1) ";"}' $1_sympar.txt  >> $1_sympar.h

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


Deleted mttroot/mtt/bin/trans/sympar_txt2m version [edc3797ff8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
## Converts sympar.txt to an m file which provides indices in the form
##  sympar.name = i


     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Copyright (C) 2000 by Peter J. Gawthrop

echo Creating $1_sympar.m

lang_header -noglobals $1 sympar m "" sympar > $1_sympar.m

awk '{
  printf("  sympar.%s \t= %i; # %s\n", $1, ++i, $2); 
}' < $1_sympar.txt >> $1_sympar.m

Deleted mttroot/mtt/bin/trans/sympar_txt2r version [f66bff96e0].

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





























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar_txt2r

# Label file to symbolic parameters conversion
# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/02/16 12:14:21  peterg
## Corrected writing out of MTTVAR matrix - now does this id non-zero
## number of variables - not vv!
##
## Revision 1.4  1997/05/09 14:20:49  peterg
## Dont declare MTTVAR array when there are no variables.
##
# Revision 1.3  1997/03/19  16:39:12  peterg
# Put in the correct date.
#
# Revision 1.2  1997/03/18  17:56:35  peterg
# Cosmetic changes.
#
###############################################################


# Inform user
echo "Creating $1_sympar.r"

rm -f mtt_error

#Write some file headers
echo "%% Symbolic parameter file ($1_sympar.r)"  > $1_sympar.r
echo "%% Generated by MTT at `date`"  >> $1_sympar.r
echo  >> $1_sympar.r

#Count the lines in the file
lines=`grep -c  '.' $1_sympar.txt`

if [ "$lines" != "0" ]; then
    echo "MATRIX MTTVAR($lines,1);"   >> $1_sympar.r
fi
echo "MTTNVAR := $lines;"   >> $1_sympar.r
echo   >> $1_sympar.r

#Write out the variables in reduce format.
awk '{i++; print "MTTVAR(" i ",1) := " $1 ";"}' $1_sympar.txt  >> $1_sympar.r

echo 'END;'  >> $1_sympar.r

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


Deleted mttroot/mtt/bin/trans/sympar_txt2tex version [9ce2cbef3d].

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
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





























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar_txt2tex

# Sympar file - text to TeX table conversion
# P.J.Gawthrop April 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/01/19 14:17:26  peterg
## Modified struc_txt2tex to make this.
##
## Revision 1.1  1998/01/19 14:16:39  peterg
## Initial revision
##
# Revision 1.3  1997/12/06  19:10:41  peterg
# Reverted to tabular --- from supertabular
#
# Revision 1.2  1997/04/15  11:17:58  peterg
# Uses supertabular for long tables.
#
# Revision 1.1  1997/04/15  09:49:04  peterg
# Initial revision
#
###############################################################


# Inform user
echo "Creating $1_sympar.tex"

rm -f mtt_error

#Write some file headers
echo "%% Parameter file ($1_sympar.txt)" > $1_sympar.tex
echo "%% Generated by MTT at `date`" >> $1_sympar.tex

# This is the main transformation using awk
sed 's/_/\\_/g' < $1_sympar.txt |  awk '
#function header(what){
#  print "  \\centering";
# print "  \\tablefirsthead{\\hline %";
#  print "    \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\";
#  print "    \\hline";
#  print "     & Component & System & Repetition \\\\";
#  print "    \\hline}";
#
#  print "  \\tablehead{\\hline %";
#  print "    \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM " (continued)} \\\\";
#  print "    \\hline";
#  print "     & Component & System & Repetition \\\\";
#  print "    \\hline}";
#
#  print "  \\tabletail{\\hline}";
#  print "  \\begin{supertabular}{|l|l|l|l|}";
#}
function header(what){
  print "\\begin{table}[htbp]";
  print "  \\centering";
  print "  \\begin{tabular}{|l|l|}";  print "    \\hline";
  print "     Parameter & System\\\\";
  print "    \\hline";
}
function footer(what){
  print "    \\hline";
  print "  \\end{tabular}";
  print "  \\caption{" what "}";
  print "\\end{table}";
  print "   \\bigskip";
  print "   \\bigskip";
}
BEGIN{
  header($1);
}
{
  print $1, "&", $2, "\\\\";
}
END{
  footer("Parameters")
}
'  SYSTEM=$1  >> $1_sympar.tex 2>mtt_error.txt

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


Deleted mttroot/mtt/bin/trans/tex2doc version [1616bd5235].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: tex2doc
# Encapsulates a tex file in a document.

# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2  1996/08/30  10:19:11  peter
# New path for awk script.
#
## Revision 1.1  1996/08/18 20:00:20  peter
## Initial revision
##
###############################################################

# Inform user
echo "Creating $1_$2.doc"

# This is the main transformation using awk
awk -f $MTTPATH/trans/awk/tex2doc.awk \
system_name=$1 representation=$2  > $1_$2.doc

Deleted mttroot/mtt/bin/trans/tf_r2m version [443b4828f1].

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
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
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























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: tf_r2m
# Reduce transfer-function matrices to Matlab MV toolbox matrices.
# P.J.Gawthrop 9 June 1990, 8 July 1990, Dec 993
# Copyright (c) P.J.Gawthrop, 1990, 1993.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1996/09/18 14:05:31  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_tf.m

# Remove the old log file
rm -f tf_r2m.log

# Use reduce to accomplish the transformation
reduce >tf_r2m.log << EOF

%Read the definitions file
in "$1_def.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the parameter file
%%in "$1_sympar.r";

%Read the transfer-function matrices file
OFF Exp; ON GCD; 
in "$1_tf.r";

OFF Echo;
%OFF Nat;
OFF factor;

%Find the largest degree numerator polynomial
NnMax := 0;
  FOR Row := 1:MTTNy DO
  BEGIN
    FOR Col := 1:MTTNu DO
    BEGIN
    Nn := length(coeff(num(MTTtf(Row,Col)),s));
    IF Nn>NnMax THEN NnMax := Nn;
    END;
  END;

NnMax;

%Find the largest degree denominator polynomial, and corresp indices
NdMax := 0;
  FOR Row := 1:MTTNy DO
  BEGIN
    FOR Col := 1:MTTNu DO
    BEGIN
    Nd := length(coeff(den(MTTtf(Row,Col)),s));
    IF Nd>NdMax THEN 
                BEGIN
                  NdMax := Nd; MaxRow := Row; MaxCol := Col;
                END
    END;
  END;

NdMax; MaxRow; MaxCol;

IF NnMax>NdMax THEN NMax := NnMax ELSE NMax := NdMax;
Nmax;

%Use any denominator with maximum degree as the common denominator
MTTden := den(MTTtf(MaxRow,MaxCol));

%Find the corresponding numerator
matrix MTTnum(MTTNy,MTTNu);
  FOR Row := 1:MTTNy DO
  BEGIN
    FOR Col := 1:MTTNu DO
    MTTnum(Row,Col) := num(MTTtf(Row,Col))*(MTTden/den(MTTtf(Row,Col)));
  END;
MTTnum;

%Put coefficients into matrices
matrix MTTdenco(1,Nmax);
MTTCoeff := Coeff(MTTden,s);
FOR i := 1:Nmax DO
BEGIN
  j := Nmax-i+1;
  IF j>length(MTTCoeff) THEN MTTdenco(1,i) := 0 
                        ELSE MTTdenco(1,i) := part(MTTCoeff,j);
END; 

matrix MTTnumco(MTTNy,MTTNu*Nmax);
FOR MTTRow := 1:MTTNy DO
BEGIN
  FOR MTTCol := 1:MTTNu DO
  BEGIN
    MTTCoeff := Coeff(MTTnum(MTTRow,MTTCol),s);
    FOR MTTi := 1:Nmax DO
    BEGIN
      MTTj := Nmax-MTTi+1;
      MTTk := MTTi + (MTTCol-1)*Nmax;
      IF MTTj>length(MTTCoeff) THEN MTTnumco(MTTRow, MTTk) := 0 
                            ELSE MTTnumco(MTTRow, MTTk) := part(MTTCoeff,MTTj);
    END;
  END;
END;



OUT "$1_tf.m1";

write "mttden = zeros(1,", Nmax, ");";
write "mttnum =    zeros(", MTTNy, ",", Nmax*MTTNu, ");";

%Suppress zeros
ON NERO;

%Fortran switches - one line expressions
ON fort;
cardno!* := 1\$
fortwidth!* := 100\$
OFF period;

%Write out the matlab code
mttden := MTTdenco;
mttnum    := MTTnumco;
SHUT "$1_tf.m1";
quit;
EOF

#Headers
mtt_header $1 tf m > $1_tf.m

#Body
cat $1_tf.m1  >> $1_tf.m
echo '## END Code' >> $1_tf.m
rm -f $1_tf.m1




Deleted mttroot/mtt/bin/trans/tf_r2tex version [30ab1ef46d].

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
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
123
124
125
126
127
128
129

































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: tf_r2tex
# Reduce transfer-function matrices to LaTex transfer-function matrices.
# P.J.Gawthrop 9 June 1990, 8 July 1990, April 1994.
# Copyright (c) P.J.Gawthrop, 1990, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1996/12/20 08:59:40  peterg
## Now writes out mtti instead of mtt_{i} -- lets latex_tidy do the
## conversion.
##
## Revision 1.1  1996/11/05 11:01:51  peterg
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_tf.tex

# Remove the old log file
rm -f tf_r2tex.log

# Use reduce to accomplish the transformation
reduce >tf_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the parameter file
%%in "$1_sympar.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

%Read the transfer-function matrices file
in "$1_tf.r";

%Read the substitution file
IN "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

OFF Echo;
OFF Nat;

OUT "$1_tf.tex";
MTT_Matrix := MTTTF$ 
MTT_Matrix_name := "MTTG"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

%%  FOR Row := 1:MTTNy DO
%%  BEGIN
%%    FOR Col := 1:MTTNu DO
%%    BEGIN
%%      numerator := num(MTTtf(Row,Col));
%%      denominator := den(MTTtf(Row,Col));
%%      cnumerator := coeff(numerator, s);
%%      cdenominator := coeff(denominator, s);
%%      write "!begin{equation} !label{eq_$1_tf", Row, Col, "}";
%%      IF MTTNy=1 AND MTTNu=1 
%%                          THEN
%%                          write "MTTTF(s) =  {"
%%                          ELSE
%%                          write "MTTTF", Row, Col, "(s) =  {";
%%      IF numerator = 0
%%       THEN write "0"
%%       ELSE 
%%       BEGIN
%%           FOR i := 1:Length(cnumerator) DO
%%           BEGIN
%%             cof := part(cnumerator,i);
%%               IF cof NEQ 0 THEN 
%%               BEGIN
%%                IF i>1 THEN write " + ";
%%                IF cof NEQ 1 THEN 
%%                 BEGIN
%%                 IF Terms(cof)>1 THEN write "(", cof, ")"
%%                                 ELSE write cof; 
%%                 END
%%                 ELSE IF i=1 THEN Write "1";
%%
%%               IF i=2 THEN write "s";
%%               IF i>2 THEN write "s^", i-1;
%%               END;
%%           END;
%%       END;
%%
%%       IF denominator NEQ 1 THEN
%%       BEGIN
%%       Write "!over";
%%           FOR i := 1:Length(cdenominator) DO
%%           BEGIN
%%           cof := part(cdenominator,i);
%%               IF cof NEQ 0 THEN 
%%               BEGIN
%%               IF i>1 THEN write " + ";
%%               IF cof NEQ 1 THEN 
%%               BEGIN
%%                 IF Terms(cof)>1 THEN write "(", cof, ")"
%%                                 ELSE write cof; 
%%               END
%%               ELSE IF i=1 THEN Write "1";
%%
%%             IF i=2 THEN write "s";
%%             IF i>2 THEN write "s^", i-1;
%%             END;
%%           END;
%%       END;
%%       write "}";
%%       write "!end{equation}";
%%    END;
%%  END;
%%
SHUT "$1_tf.tex";
quit;
EOF

Deleted mttroot/mtt/bin/trans/tidy version [5d66b20135].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
mv $1 $1.old

cat $1.old |
#Clear out all (and extraneous) new lines
tr -d '\012'  |\

#Squash blanks
tr -s '\040' '\040' |\

#Put in new lines to replace $
tr '\044' '\012' |\

#Remove blanks after E
sed "s/E /E/g"  |\

#Put in $ at end of each line
sed "s/$/\$/" >$1

Deleted mttroot/mtt/bin/trans/txt2m version [f90e675ca6].

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
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
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
173
174
175
176
177
178
179
180
181
182
183























































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: txt2m
# Converts txt file to matlab file (for numpar and state)

# Copyright (c) P.J.Gawthrop 1998


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.18  1999/11/14 22:22:17  peterg
# %% Removed checks for implicit - now done at command-line level.
# %%
# %% Revision 1.17  1999/11/04 04:54:24  peterg
# %% Removed recreation of smx file.
# %%
# %% Revision 1.16  1999/03/06 02:18:10  peterg
# %% Changed argument list.
# %%
# %% Revision 1.15  1999/02/16 21:44:38  peterg
# %% Revised smx generation
# %%
# %% Revision 1.14  1999/02/16 04:38:22  peterg
# %% Now forces creation of _smx file if METHOD=IMPLICIT in simpar.txt
# %%
# %% Revision 1.13  1998/08/31 11:43:37  peterg
# %% Now lower cases globals in numpar files
# %%
# %% Revision 1.12  1998/08/14 10:47:31  peterg
# %% Put ImplicitS sub before Implicit!!
# %%
# %% Revision 1.11  1998/08/14 10:43:44  peterg
# %% Added ImplicitS - sparse integration
# %%
# %% Revision 1.10  1998/08/11 13:27:51  peterg
# %% Lowercase mttLAST etc
# %%
# %% Revision 1.9  1998/07/30 15:07:17  peterg
# %% Added _ to the disallowed chars around t
# %%
# %% Revision 1.8  1998/07/30 12:52:38  peterg
# %% Adds ; to end of statements
# %% Translates ' to " before removal
# %%
# %% Revision 1.7  1998/07/30 09:32:33  peterg
# %% Replaces:
# %% 	euler by 1
# %% 	implicitl by 1
# %% 	implicit  by 3
# %%
# %% Revision 1.6  1998/07/27 18:59:11  peterg
# %% Added WMIN etc
# %%
# %% Revision 1.5  1998/07/26 11:54:20  peterg
# %% Added  mtt to variables
# %%
# %% Revision 1.4  1998/07/26 09:50:12  peterg
# %% More forgiving of txt sytax.
# %%
# %% -- can use () or ()
# %% -- can use mttx() or x()
# %% -- can use mttu() or u()
# %%
# %% Revision 1.3  1998/07/25 20:40:35  peterg
# %% All vars in lower case now
# %%
# %% Revision 1.2  1998/07/25 09:48:31  peterg
# %% Tidied up for Pascal version
# %%
# %% Revision 1.1  1998/02/25 22:10:25  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

system=$1
representation=$2

if [ "$representation" = "state" ]; then
    name='mttx';
    arg='';
fi
if [ "$representation" = "input" ]; then
    name='mttu';
    arg='(mttt,mttx,mtty)'
fi

# Inform user
echo Creating $1_$2.m

#Create the $2 file complete with headers.
case $representation in
    simpar)
      echo "% Script file  $1_$2.m" > $1_$2.m
      echo "%% $2 file ($1_$2.m)" >> $1_$2.m
      echo "%% Generated by MTT at `date`" >> $1_$2.m
      echo '% Dummy globals' >>  $1_$2.m
      echo 'global ...' >>  $1_$2.m
      echo 'mtt_dummy_global;' >>  $1_$2.m
      ;;
    numpar)
      echo "% Script file  $1_$2.m" > $1_$2.m
      echo "%% $2 file ($1_$2.m)" >> $1_$2.m
      echo "%% Generated by MTT at `date`" >> $1_$2.m
      echo "% Global variable list" >>  $1_$2.m
      sympar2global_txt2m $1 >> $1_$2.m
      ;;
    *)
      echo "function $name = $1_$2$arg" > $1_$2.m
      echo "%% $2 file ($1_$2.m)" >> $1_$2.m
      echo "%% Generated by MTT at `date`" >> $1_$2.m
      echo "% Global variable list" >>  $1_$2.m
      sympar2global_txt2m $1 >> $1_$2.m
      ;;
esac

#Write out the variables in m format.
cat  $1_$2.txt | grep -v METHOD |\
awk -F#  'BEGIN{
quote = "\047";
doublequote = "\042";
}
{
  N=split($1,a,"=");
  if (N==2) {
    LHS = a[1];
    RHS = a[2];
    gsub(quote, doublequote, RHS);
    sub(/^[ 	]*LAST/, "mttLAST", LHS);
    sub(/^[ 	]*DT/, "mttDT", LHS);
    sub(/^[ 	]*STEPFACTOR/, "mttSTEPFACTOR", LHS);
    sub(/^[ 	]*METHOD/, "mttMETHOD", LHS);
    sub(/^[ 	]*WMIN/, "mttWMIN", LHS);
    sub(/^[ 	]*WMAX/, "mttWMAX", LHS);
    sub(/^[ 	]*WSTEPS/, "mttWSTEPS", LHS);
    sub(/^[ 	]*INPUT/, "mttinput", LHS);
    LHS = tolower(LHS);
    RHS = tolower(RHS);
    sub(/["]*euler["]*/, 1, RHS);   
    sub(/["]*implicit["]*/, 2, RHS);  
    statement = sprintf("%s= %s",LHS,RHS);
    if ( (match(statement,";")==0)&&\
         ((match(statement,"if ")==0))&&\
         ((match(statement,"for ")==0)) )
      statement = sprintf("%s;", statement);
  }
  else if (match($1,"global")==1) {
    statement = tolower($1); # Lower case globals as well
  }
  else
    statement = $1;

  if (NF<2) print statement
  if (NF>1)  print statement " # " $2
}' | sed\
     -e 's/\[\([0-9]*\)\]/(\1)/g' \
     -e 's/\([^a-zA-Z_]\)t\([^a-zA-Z_]\)/\1mttt\2/g' \
     -e 's/x(/mttx(/g' \
     -e 's/u(/mttu(/g' \
     -e 's/mttmtt/mtt/g' \
     -e 's/#/%/g' \
>> $1_$2.m


if [ "$2" = "numpar" ]; then
    awk '{
       printf("  MTTpar(%i) \t= %s;\n",++i, tolower($1));
     }'< $1_sympar.txt  >>$1_numpar.m
fi








Deleted mttroot/mtt/bin/trans/txt2tex version [18a439014a].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: txt2tex

# Generic textual inclusion as verbatim tex.

# P.J.Gawthrop March 1998
# Copyright (c) P.J.Gawthrop, 1998.

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

if [ -z "$3" ]; then
   echo Usage: txt2tex system representation language
   exit 1
fi
# Inform user
echo "Creating $1_$2.tex"

rm -f mtt_error

#Write some file headers
echo "%% Tex file ($1_$2.txt)" > $1_$2.tex
echo "%% Generated by MTT at `date`" >> $1_$2.tex

cat <<EOF        >> $1_$2.tex
\begin{verbatim}
EOF
cat $1_$2.$3     >> $1_$2.tex
cat<<EOF         >> $1_$2.tex
\end{verbatim}
EOF




Deleted mttroot/mtt/bin/trans/txt_matrix.r version [920388fb07].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     %%%%% Model Transformation Tools %%%%%
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Reduce function to write matrices in text form
% P.J.Gawthrop  Febrauary 1998
% Copyright (c) P.J.Gawthrop, 1998


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


PROCEDURE txt_Matrix;
BEGIN
  IF MTT_Matrix_n>0 THEN
    IF MTT_Matrix_m>0 THEN
    BEGIN
    FOR i := 1:MTT_Matrix_n DO
      IF MTT_Matrix_m>1 THEN
        BEGIN
        FOR j := 1:MTT_Matrix_m DO 
          write MTT_Matrix_name, "(", i, ",", j, ") = ",
                                            MTT_Matrix(i,j), ";";
        END
      ELSE
         write MTT_Matrix_name, "(", i, ") = ",
                                            MTT_Matrix(i,1), ";";
    END;
END;

END;;

Deleted mttroot/mtt/bin/xmtt version [3cdf36096b].

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





























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: xmtt
#
# x-window version of MTT

# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1999/10/19 00:34:10  peterg
## *** empty log message ***
##
## Revision 1.3  1999/08/18 06:17:55  peterg
## Modular form
##
## Revision 1.2  1999/03/09 00:03:55  peterg
## Major revisions for release 3.5
##
## Revision 1.1  1998/10/20 08:15:17  peterg
## Initial revision
##
###############################################################

#Look for a command line argument
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	--help )    echo xmtt
	            echo xmtt -update
		    exit;;
	-update )    echo Creating representation list for mtt;
		     mtt2reps_txt> $MTTPATH/REPS;
		     echo Creating examples list for mtt;
		     mtt -q help examples> $MTTPATH/EXAMPLES;;
        -example )    examples='examples';; 
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

if [ -n "$examples" ]; then
    mtt -q  copy $1; 
    cd $1; 
    xmtt
    exit
fi

## Create the menu
mtt_make_menu > .xmtt_menu

## Use tk shell (wish)
name=`basename $PWD`
wish .xmtt_menu  -name $name

Deleted mttroot/mtt/cc/Makefile version [873ef71cfa].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

.POSIX:

CC=g++

ifeq (0,1)
CFLAGS+=-static
OCTAVE_LIBS_PATH=-L/usr/local/lib/octave
OCTAVE_LIBRARIES=-loctave -lcruft -lm -lncurses -ldl -lstdc++ -lc -lkpathsea -lreadline -lf2c

%.exe: %.cc
	$(CC) $< $(CFLAGS) $(OCTAVE_LIBS_PATH) $(OCTAVE_LIBRARIES) -o $@

%.oct: %.cc
	mkoctfile $<
endif



all:	$(sys)_$(rep).cc

parser.exe: parse_m2cc.cc
	g++ $< $(CFLAGS) -o ${MTTPATH}/trans/parser.exe -I${MTTPATH}/../cc/include

ifeq ($(rep),ode2odes)
$(sys)_ode2odes.cc: ode2odes.cc
	cat ode2odes.cc | sed 's/\$$/$(sys)/' > $(sys)_ode2odes.cc
else
$(sys)_$(rep).cc: $(sys)_def.h $(sys)_sympar.h $(sys)_def.r $(sys)_$(rep).m
	mtt_m2cc.sh ${sys} ${rep} parser
endif

$(sys)_def.h: $(sys)_def.m $(sys)_sympar.txt
	def_m2h.sh $(sys)

$(sys)_sympar.h: $(sys)_sympar.txt
	sympar_txt2h.sh $(sys)

$(sys)_def.m:
	mtt $(sys) def m

# getsize needs def.r
$(sys)_def.r:
	mtt $(sys) def r

$(sys)_sympar.txt:
	mtt $(sys) sympar txt


# struc2gnuplot_txt.exe is used by gnuplot_rep.make to create gnuplot input file.
struc2gnuplot_txt.exe: $(MTT_CC)/struc2gnuplot_txt.cc
	$(CC) -O3 -Wall -ansi -pedantic -DMAIN $(MTT_CC)/struc2gnuplot_txt.cc -o $(MTTPATH)/trans/struc2gnuplot_txt.exe 

Deleted mttroot/mtt/cc/def_m2h.sh version [48a6557660].

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
68
69
70
71
72
73
74
75
76












































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh
# $Id$
# $Log$
# Revision 1.3  2000/12/05 12:13:52  peterg
# Changed function name to name()
#
# Revision 1.2  2000/12/04 12:04:46  peterg
# Changed $() to `` for sh compatibility -- geraint
#
# Revision 1.1  2000/12/04 12:02:23  peterg
# Initial revision
#
# Revision 1.1  2000/10/31 04:32:28  geraint
# Initial revision
#

SYS=$1
IN=${SYS}_def.m
SYM=${SYS}_sympar.txt
OUT=${SYS}_def.h

get_array_size ()
{
vec=$1
awk -v vec=${vec} '($1 == vec && $2 == "=") { print $3 }' | sed s/\;//
}

 echo "// ${SYS}_def.h, generated by MTT on `date`"			>  ${OUT}
 echo ""								>> ${OUT}
 echo "const int MTTNU   = `cat ${IN} | get_array_size nu`;"		>> ${OUT}
 echo "const int MTTNX   = `cat ${IN} | get_array_size nx`;"		>> ${OUT}
 echo "const int MTTNY   = `cat ${IN} | get_array_size ny`;"		>> ${OUT}
 echo "const int MTTNZ   = `cat ${IN} | get_array_size nz`;"		>> ${OUT}
 echo "const int MTTNYZ  = `cat ${IN} | get_array_size nyz`;"		>> ${OUT}
 echo "const int MTTNPAR = `wc -l ${SYM} | awk '{ print $1 }'`;"       	>> ${OUT}

cat <<EOF >> ${OUT}

// typedefs won't work because it is illegal to initialise ColumnVector in typedef
// use "ColumnVector mttx (MTTNX);" until the proper classes are ready


#if 0 // NB: These classes are not ready for use yet!
class InputVector : public ColumnVector
{
public:
  InputVector (void) : ColumnVector (MTTNU) { ; }
};
class StateVector : public ColumnVector
{
public:
  StateVector (void) : ColumnVector (MTTNX) { ; }
};
class OutputVector : public ColumnVector
{
public:
  OutputVector (void) : ColumnVector (MTTNY) { ; }
};
class ParameterVector : public ColumnVector
{
public:
  ParameterVector (void) : ColumnVector (MTTNPAR) { ; }
};
class StateMatrix : public Matrix
{
public:
  StateMatrix (void) : Matrix (MTTNX, MTTNX) { ; }
};
#endif

EOF





Deleted mttroot/mtt/cc/include/Bracket.hh version [5787729a17].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222






























































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/* $Id$
 * $Log$
 * Revision 1.1.4.1  2001/06/30 03:26:20  geraint
 * gcc-3.0 compatibility.
 *
 * Revision 1.1  2000/12/28 09:47:29  peterg
 * put under RCS
 *
 * Revision 1.1  2000/10/31 04:29:11  geraint
 * Initial revision
 *
 */



#include <iostream>
#include <string>


using namespace std;

class Bracket
{
public:
  friend ostream &operator<< (ostream &str, Bracket *b);
  friend string  &operator<< (string  &str, Bracket *b);
  friend string  &operator+= (string  &str, Bracket *b);
  friend string   operator+  (string  &str, Bracket *b);
  virtual int get_nesting_depth (void)		= 0;

protected:
  Bracket (char left, char right)	  	{ _l = left; _r = right; }
  ostream &open  (ostream &str)			{ this->increment_nesting (); return str << this->_l; }
  string  &open  (string  &str)			{ this->increment_nesting (); return str += this->_l; }
  ostream &close (ostream &str)			{ this->decrement_nesting (); return str << this->_r; }
  string  &close (string  &str)			{ this->decrement_nesting (); return str += this->_r; }

protected:
  virtual int increment_nesting (void)		= 0;
  virtual int decrement_nesting (void)		= 0;
  virtual ostream &display (ostream &str)	= 0;
  virtual string  &display (string  &str)	= 0;

private:
  char _l, _r;
};



class Brace : public Bracket
{
public:
  int get_nesting_depth (void)			{ return   (this->nesting_depth);}
  string indentation (int n = nesting_depth)
  {
    string s = "";
    int i;
    for (i = 0; i < n; i++)
      s += "   ";
    return s;
  }

protected:
  Brace () : Bracket ('{', '}')			{ ; }
  int increment_nesting (void)			{ return ++(this->nesting_depth); }
  int decrement_nesting (void)			{ return --(this->nesting_depth); }
  ostream &open (ostream &str)
  {
    str << endl << this->indentation ();
    this->Bracket::open (str);
    str << endl << this->indentation ();
    return str;
  }
  string &open (string &str)
  {
    str += '\n' + this->indentation ();
    this->Bracket::open (str);
    str += '\n' + this->indentation ();
    return str;
  }
  ostream &close (ostream &str)
  {
    str << endl << this->indentation (nesting_depth - 1);
    this->Bracket::close (str);
    str << endl << this->indentation ();
    return str;
  }
  string &close (string &str)
  {
    str += '\n' + this->indentation (nesting_depth - 1);
    this->Bracket::close (str);
    str += '\n' + this->indentation ();
    return str;
  }

private:
  static int nesting_depth;
};
int Brace::nesting_depth;



class Paren : public Bracket
{
public:
  int get_nesting_depth (void)			{ return   (this->nesting_depth);}

protected:
  Paren () : Bracket ('(', ')')			{ ; }
  int increment_nesting (void)			{ return ++(this->nesting_depth); }
  int decrement_nesting (void)			{ return --(this->nesting_depth); }

private:
  static int nesting_depth;
};
int Paren::nesting_depth;



class SquareBracket : public Bracket
{
public:
  int get_nesting_depth (void)			{ return   (this->nesting_depth);}

protected:
  SquareBracket () : Bracket ('[', ']')	       	{ ; }
  int increment_nesting (void)			{ return ++(this->nesting_depth); }
  int decrement_nesting (void)			{ return --(this->nesting_depth); }

private:
  static int nesting_depth;
};
int SquareBracket::nesting_depth;



class LeftBrace : public Brace
{
public:
  ostream &display (ostream &str)		{ return this->open  (str); }
  string  &display (string  &str)		{ return this->open  (str); }
};



class RightBrace : public Brace
{
public:
  ostream &display (ostream &str)		{ return this->close (str); }
  string  &display (string  &str)		{ return this->close (str); }
};



class LeftParen : public Paren
{
public:
  ostream &display (ostream &str)		{ return this->open  (str); }
  string  &display (string  &str)		{ return this->open  (str); }
};



class RightParen : public Paren
{
public:
  ostream &display (ostream &str)		{ return this->close (str); }
  string  &display (string  &str)		{ return this->close (str); }
};



class LeftSquareBracket : public SquareBracket
{
public:
  ostream &display (ostream &str)		{ return this->open  (str); }
  string  &display (string  &str)		{ return this->open  (str); }
};



class Rightbrace : public SquareBracket
{
public:
  ostream &display (ostream &str)		{ return this->close (str); }
  string  &display (string  &str)		{ return this->close (str); }
};



ostream &operator<< (ostream &str, Bracket *b)
{
  b->display (str);
  return str;
}



string  &operator<< (string  &str, Bracket *b)
{
  string s;
  b->display (s);
  str += s;
  return str;
}



string  &operator+= (string  &str, Bracket *b)
{
  b->display (str);
  return str;
}



string   operator+  (string  &str, Bracket *b)
{
  string s;
  b->display (s);
  return (str + s);
}

Deleted mttroot/mtt/cc/include/useful-functions.hh version [c2133a509b].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84




















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#define pi 3.14159 // Predefine pi

#ifndef HAVE_USEFUL_FUNCTIONS_HH
#define HAVE_USEFUL_FUNCTIONS_HH


#ifndef __cplusplus
#define inline			/* strip */
#endif // ! __cplusplus


static inline double
max (const double x1, const double x2)
{
  return static_cast<double>((x1 >= x2) ? x1 : (x1 < x2) ? x2 : 0);
}

static inline double
min (const double x1, const double x2)
{
  return static_cast<double>((x1 <= x2) ? x1 : (x1 > x2) ? x2 : 0);
}

static inline double
nonsingular (const double x)
{
  return static_cast<double>((x == 0) ? 1.0e-30 : x);
}

static inline double
sign (const double x)
{
  return static_cast<double>((x > 0) ? +1 : (x < 0) ? -1 : 0);
}


// Octave functions
#ifdef __cplusplus
static Matrix
ones (const int r = 1, const int c = 1)
{
  Matrix m (r, c, 1.0);
  return m;
}

static ColumnVector
nozeros (const ColumnVector v0, const double tol = 0.0)
{
  ColumnVector v (v0.length ());
  register int i, j;
  for (i = j = 0; i < v.length (); i++)
    if (tol < std::abs (v0 (i)))
      {
	v (j) = v0 (i);
	j++;
      }
  if (0 == j)
    {
      return *new ColumnVector ();
    }
  else
    {
      return (v.extract (0, --j));
    }
}

static ColumnVector
zeros (const int r)
{
  ColumnVector v (r, 0.0);
  return v;
}

static Matrix
zeros (const int r, const int c)
{
  Matrix m (r, c, 0.0);
  return m;
}
#endif // __cplusplus



#endif // HAVE_USEFUL_FUNCTIONS_HH

Deleted mttroot/mtt/cc/mtt_m2cc.sh version [235055c333].

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
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
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
173
174
175
176
177
178
179



















































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

SYS=$1
REP=$2
PARSER=${3:-indent}

IN=${SYS}_${REP}.m
OUT=${SYS}_${REP}.cc
TMP=${SYS}_${REP}_m2cc.tmp

rep_declarations ()
{
(case ${REP} in
    simpar)
	cat <<EOF
  struct {
    double first;
    double dt;
    double last;
    int    stepfactor;
    int    wmin;
    int    wmax;
    int    wsteps;
    int    input;
  } mttsimpar;

EOF
	;;
    *)
	;;
esac)
echo ""
};

rep_footer ()
{
(case ${REP} in
    simpar)
	cat <<EOF
  mttsimpar_map ["first"]      = (double) mttsimpar.first;
  mttsimpar_map ["dt"]         = (double) mttsimpar.dt;
  mttsimpar_map ["last"]       = (double) mttsimpar.last;
  mttsimpar_map ["stepfactor"] = (double) mttsimpar.stepfactor;
  mttsimpar_map ["wmin"]       = (double) mttsimpar.wmin;
  mttsimpar_map ["wmax"]       = (double) mttsimpar.wmax;
  mttsimpar_map ["wsteps"]     = (double) mttsimpar.wsteps;
  mttsimpar_map ["input"]      = (double) mttsimpar.input;
EOF
	;;
    *)
	;;
esac)
};

find_code ()
{
    file_in=${1:-${IN}}
    portion=${2:-"body"}
    head=`cat ${file_in} | awk '($2 == "BEGIN" && $3 == "Code") { print NR }'`
    foot=`cat ${file_in} | awk '($2 == "END"   && $3 == "Code") { print NR }'`
    case ${portion} in
	head)
	    start=0
	    end=${head}
	    ;;
	body)
	    start=${head}
	    end=${foot}
	    ;;
	foot)
	    start=${foot}
	    end=end
	    ;;
	*)
	    echo "Error in find_code: portion unknown"
	    return -1
	    ;;
    esac
    cat ${file_in} |\
    awk --assign start=${start} --assign end=${end} '
	(start < NR && NR < end) { print $0 }'
};


strip_junk ()
{
case ${REP} in
    numpar)
	grep -v "mttpar = \[\]"
	;;
    switchopen)
	grep -v "\[open\] = zero"
	;;
    *)
	cat
	;;
esac
};

fix_comment_delimiter ()
{
    # it would be preferable if we didn't use '%' as a delimiter
    # (a % b) gives the remainder of ((int)a / (int)b) in C/C++
    sed 's/[%#]/\/\//g' | sed 's/\/\/\/\//\/\//g'
    
};

decrement_indices ()
{    
    # first section appends '-1' to container indices
    # to convert from FORTRAN-type numbering to C-type numbering
    sed 's/mtta(\([0-9][0-9]*\),\([0-9][0-9]*\))/mtta(\1-1,\2-1)/g'	|\
    sed 's/mttax(\([0-9][0-9]*\))/mttax(\1-1)/g'			|\
    sed 's/mttdx(\([0-9][0-9]*\))/mttdx(\1-1)/g'			|\
    sed 's/mttedx(\([0-9][0-9]*\))/mttedx(\1-1)/g'			|\
    sed 's/mttpar(\([0-9][0-9]*\))/mttpar(\1-1)/g'			|\
    sed 's/mttu(\([0-9][0-9]*\))/mttu(\1-1)/g'				|\
    sed 's/mttx(\([0-9][0-9]*\))/mttx(\1-1)/g'				|\
    sed 's/mtty(\([0-9][0-9]*\))/mtty(\1-1)/g'				|\
    sed 's/mttyz(\([0-9][0-9]*\))/mttyz(\1-1)/g'			|\
    sed 's/mttz(\([0-9][0-9]*\))/mttz(\1-1)/g'				|\
    sed 's/mttopen(\([0-9][0-9]*\))/mttopen(\1-1)/g'				|\
									 \
    # next sections tidy the code up a bit, but are not necessary
    sed 's/1\-1\([\,\)]\)/0\1/g'       			       		|\
    sed 's/2\-1\([\,\)]\)/1\1/g'       			       		|\
    sed 's/3\-1\([\,\)]\)/2\1/g'       			       		|\
    sed 's/4\-1\([\,\)]\)/3\1/g'       			       		|\
    sed 's/5\-1\([\,\)]\)/4\1/g'       			       		|\
    sed 's/6\-1\([\,\)]\)/5\1/g'       			       		|\
    sed 's/7\-1\([\,\)]\)/6\1/g'       			       		|\
    sed 's/8\-1\([\,\)]\)/7\1/g'       			       		|\
    sed 's/9\-1\([\,\)]\)/8\1/g'       			       		|\
									 \
    sed 's/10\-1\([\,\)]\)/09\1/g'     			       		|\
    sed 's/20\-1\([\,\)]\)/19\1/g'	       		       		|\
    sed 's/30\-1\([\,\)]\)/29\1/g'		       	       		|\
    sed 's/40\-1\([\,\)]\)/39\1/g'			       		|\
    sed 's/50\-1\([\,\)]\)/49\1/g'		               		|\
    sed 's/60\-1\([\,\)]\)/59\1/g'		      	       		|\
    sed 's/70\-1\([\,\)]\)/69\1/g'		       	       		|\
    sed 's/80\-1\([\,\)]\)/79\1/g'		       	       		|\
    sed 's/90\-1\([\,\)]\)/89\1/g'		       	       		|\
									 \
    sed 's/100\-1\([\,\)]\)/099\1/g'   			       		|\
    sed 's/200\-1\([\,\)]\)/199\1/g'	       		       		|\
    sed 's/300\-1\([\,\)]\)/299\1/g'		       	       		|\
    sed 's/400\-1\([\,\)]\)/399\1/g'			       		|\
    sed 's/500\-1\([\,\)]\)/499\1/g'			       		|\
    sed 's/600\-1\([\,\)]\)/599\1/g'			       		|\
    sed 's/700\-1\([\,\)]\)/699\1/g'			       	       	|\
    sed 's/800\-1\([\,\)]\)/799\1/g'			       		|\
    sed 's/900\-1\([\,\)]\)/899\1/g'			       		|\
    sed 's/\([(,]\)0\([0-9]\)/\1\2/g'
};

fix_pow ()
{
    # matches number^number where number is one or more digits and one or zero decimal points
    # converts to pow (number, number)
    sed 's/\([0-9]*\)\(\.\)\{0,1\}\([0-9]*\)\^\([0-9]*\)\(\.\)\{0,1\}\([0-9]*\)/pow \(\1\2\3,\4\5\6\)/g'
};


echo Creating ${OUT}

mtt_header ${SYS} ${REP} "oct"	>  ${TMP}
find_code ${TMP} head		>  ${OUT}
rep_declarations		>> ${OUT}
find_code ${IN} body   		|\
        decrement_indices	|\
	fix_comment_delimiter	|\
	fix_pow			|\
	strip_junk		|\
	${PARSER}      		>> ${OUT}
rep_footer			>> ${OUT}
find_code ${TMP} foot		>> ${OUT}
rm ${TMP}

Deleted mttroot/mtt/cc/parse_m2cc.cc version [7241edf764].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357





































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/* $Id$
 * $Log$
 * Revision 1.2.2.1  2001/06/30 03:26:17  geraint
 * gcc-3.0 compatibility.
 *
 * Revision 1.2  2001/03/19 02:28:53  geraint
 * Branch merge: merging-ode2odes-exe back to MAIN.
 *
 * Revision 1.1.2.2  2001/03/09 04:01:20  geraint
 * \ escapes newline.
 *
 * Revision 1.1.2.1  2001/03/09 02:59:26  geraint
 * got_comment: (char)c no longer compared to (int)EOF.
 *
 * Revision 1.1  2000/12/28 09:46:05  peterg
 * put under RCS
 *
 * Revision 1.1  2000/10/31 04:29:50  geraint
 * Initial revision
 *
 */



#include <iostream>
#include <map>
#include <stack>
#include <string>



/*
 * Bracket.hh deals with nesting levels of parenthesis
 * just add Bracket pointer to string / stream
 */
#include "Bracket.hh"



using namespace std;

/*
 * use lbrace, etc. in expressions to automate nesting calculations
 */
LeftBrace	*lbrace = new LeftBrace;
RightBrace	*rbrace = new RightBrace;

LeftParen	*lparen = new LeftParen;
RightParen	*rparen = new RightParen;



/*
 * use brace nesting depth to determine indentation
 */
string indent (void) { return lbrace->indentation (); }



/*
 * map contains keyword to look for and function to call when found
 */
map <string, void (*)(void)> keyword;




/*
 * stack records current nest type
 * so that "end" can be handled correctly
 */
enum nest_type
{
  null,
  if_statement,
  switch_statement,
  while_statement
};

stack <enum nest_type> current_nest;



/*
 * assuming cin has '(' as next character
 * find the matching ')' and return the string contained within
 */
string get_test (void)
{
  const int entry_nesting = lparen->get_nesting_depth ();
  char c;
  string buf = "";
  cin.setf (ios::skipws);
  cin >> c;
  if ('(' != c)
    {
      cerr << "Sorry, test must be enclosed in ( )" << endl;
      cerr << "current character is " << c << endl;
      /*
       * replace this with a call to get_expression maybe?
       */
      exit (-1);
    }
  else
    {
      buf += lparen;
    }
  cin.unsetf (ios::skipws);
  while (entry_nesting != lparen->get_nesting_depth ()) {
    cin >> c;
    switch (c)
      {	
      case '(':
	buf += lparen;
	break;
      case ')':
	buf += rparen;
	break;
      case EOF:
	cerr << "Oops! EOF reached" << endl;
	exit (-1);
      default:
	buf += c;
	break;
      }
  }
  return buf;
}



/*
 * functions to be called upon detection of keyword
 */
void got_if (void)
{
  current_nest.push (if_statement);
  cout << "if ";
  cout << get_test ();
  cout << lbrace;
}

void got_else (void)
{
  cout << rbrace;
  cout << "else";
  cout << lbrace;
}

void got_elseif (void)
{
  cout << rbrace;
  got_if ();
} 

void got_switch (void)
{
  current_nest.push (switch_statement);
  cout << "switch ";
  cout << get_test ();
  cout << lbrace;
  /*
   * open a second brace so that each "case" can be enclosed
   */
  cout << lbrace;
}

void got_case (void)
{
  cout << rbrace;
  cout << "case ";
  cout << get_test ();
  cout << ':';
  cout << lbrace;
}

void got_otherwise (void)
{
  cout << rbrace;
  cout << "default:";
  cout << lbrace;
}

void got_while (void)
{
  current_nest.push (while_statement);
  cout << "while ";
  cout << get_test ();
  cout << lbrace;
}

void got_end (void)
{
  enum nest_type n = current_nest.top ();
  switch (n)
    {
    case if_statement:
    case while_statement:
      cout << rbrace;      
      break;
    case switch_statement:
      cout << rbrace
	   << rbrace;
      break;
    default:
      cerr << "Oops! Unmatched end ... aborting" << endl;
      exit (-1);
      break;
    }
  current_nest.pop ();
}

void got_comment (void)
{
  /*
   * get remainder of line in case there are any commented keywords
   */
  char c;
  cout << " // ";
  cin >> c;
  do {
    cout << c;
  } while (c != '\n' && cin >> c);
  cout << endl
       << indent () << ';' << endl
       << indent ();
}
  


/*
 * map contains keyword to look for and functions to call when found
 * functions must be of the form "void f (void) {...;}"
 * new structures should also be added to enum nest_type
 */
void set_keyword (void)
{
  // if
  keyword ["if"]		= got_if;
  keyword ["else"]		= got_else;
  keyword ["elseif"]		= got_elseif;
  keyword ["endif"]		= got_end;

  // switch
  keyword ["switch"]		= got_switch;
  keyword ["case"]		= got_case;
  keyword ["otherwise"] 	= got_otherwise;
  keyword ["endswitch"] 	= got_end;

  // while
  keyword ["while"]		= got_while;
  keyword ["endwhile"]		= got_end;

  // general
  keyword ["end"]		= got_end;

  /*
   * this won't work inside a string
   * or if there is no space around the delimiter
   */
  keyword ["#"]			= got_comment;
  keyword ["//"]		= got_comment;
  
/*
 * unimplemented keywords
 *
 keyword ["for"]		= got_for;
 keyword ["endfor"]		= got_end;
 keyword ["break"]		= got_break;
 keyword ["continue"]		= got_continue;
*/
}



/* read in one character at a time looking for tokens (delimited by whitespace)
 * if the token is a keyword, call the appropriate function
 */
int main (void)
{
  set_keyword ();
  string buf = "";
  char c;
  cin.unsetf (ios::skipws);
  while (cin >> c)
    {
      switch (c)
	{
	case EOF:
	  return 0;
	case ' ':
	case '\t':
	  if (keyword [buf])
	    {
	      keyword [buf]();
	    }
	  else
	    {
	      if (! lbrace->get_nesting_depth ())
		{
		  buf += c;
		}
	      cout << buf;
	    }
	  buf = "";
	  break;
	case '\n':
	  if (keyword [buf])
	    {
	      /*
	       * keyword found, call function
	       */
	      keyword [buf] ();
	    }
	  else
	    {
	      cout << buf
		/*
		 * keep newline in case this line has an EOL-comment
		 */
		   << endl
		/*
		 * EOL is end-of-statement in Octave, add ;
		 */
		   << indent () << ';' << endl
		   << indent ();
	    }
	  buf = "";
	  break;
	case '\\':
	  cin >> c;
	  if ('\n' == c)
	    {
	      buf += '\n';
	    }
	  else
	    {
	      buf += '\\';
	      buf += c;
	    }
	  break;
	default:
	  buf += c;
	}
      if (lbrace->get_nesting_depth ())
	{
	  cout.setf (ios::skipws);
	}
      else
	{
	  cout.unsetf (ios::skipws);
	}
    }
  return 0;
}


Deleted mttroot/mtt/cc/struc2gnuplot_txt.cc version [6bc7a67f34].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#include <iostream>
#include <list.h>
#include <string>

    
ostream &struc2gnuplot_txt(const string sys = "sim", istream &in = cin, ostream &out = cout)
{
  typedef struct record_ record_t;
  struct record_
  {
    string       	vec;
    unsigned int	num;
    string     		cmp;
    string     	 	mod;
    unsigned int       	rpt;
  };

  list<record_t>	Lx;
  list<record_t>	Ly;

  record_t		r;


  // read data from struc.txt

  while (in >> r.vec >> r.num >> r.cmp >> r.mod >> r.rpt)
    {
      if ("state" == r.vec)
	{
	  Lx.push_back(r);
	}
      else if ("output" == r.vec)
	{
	  Ly.push_back(r);
	}
    }

  // write header

  out << "wait=-1" << endl
      << "set data style lines" << endl
      << "set xlabel \"time\"" << endl
      << "set grid" << endl
      << "set term X11" << endl
      << endl;

  // write states (X11)

  for (list<record_t>::iterator i = Lx.begin(); i != Lx.end() ; i++)
    {
      out << "plot " << "\"" << sys << "_odes.dat2\" using 1:" << 2 + Ly.size() + i->num
	  << " axes x1y1 title \"" << i->mod << "_" << i->cmp << ";" << endl
	  << "pause(wait);" << endl;
    }

  // write outputs (X11)

  for (list<record_t>::iterator i = Ly.begin(); i != Ly.end() ; i++)
    {
      out << "plot " << "\"" << sys << "_odes.dat2\" using 1:" << 1 + i->num
	  << " axes x1y1 title \"" << i->mod << "_" << i->cmp << endl
	  << "; pause(wait);" << endl;
    }

  return out;
}

#ifdef MAIN
int main(int argc, char *argv[])
{
  if (--argc)
    {
      struc2gnuplot_txt(argv[1]);
    }
  else
    {
      struc2gnuplot_txt();
    }
  return 0;
}
#endif // MAIN

Deleted mttroot/mtt/cc/sympar_txt2h.sh version [f4dafd0a84].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh
# $Id$
# $Log$
# Revision 1.3  2001/03/19 02:28:53  geraint
# Branch merge: merging-ode2odes-exe back to MAIN.
#
# Revision 1.2.2.1  2001/03/16 03:56:54  geraint
# Convert variable names to lower case.
#
# Revision 1.2  2001/02/05 13:03:19  geraint
# Restrict scope of variables to file (static).
# Warn GCC that variables may be unused.
#
# Revision 1.7  2001/01/09 15:43:50  geraint
# Warn gcc that variables may be unused.
#
# Revision 1.6  2001/01/08 05:47:56  geraint
# Restrict scope of variables to file (static)
#
# Revision 1.5  2000/12/05 12:44:55  peterg
# Changed $() to ``
#
# Revision 1.4  2000/12/05 12:16:02  peterg
# Changed function name to name()
#
# Revision 1.3  2000/12/04 11:05:01  peterg
# Removed () -- geraint
#
# Revision 1.2  2000/11/07 17:29:27  peterg
# Changed echo
#
# Revision 1.1  2000/11/07 17:28:53  peterg
# Initial revision
#
# Revision 1.1  2000/10/31 04:32:02  geraint
# Initial revision
#

SYS=$1

if [ $# -gt 1 ]
then
  NUM_OF_TMP_VAR=$2;
  shift; shift;
else
  NUM_OF_TMP_VAR=500
  shift;
fi
TMP_VAR_NAMES="mtt_tmp mtt_o $*"

IN=${SYS}_sympar.txt
OUT=${SYS}_sympar.h

declare_sys_param ()
{
cat ${IN} | awk '(NF>0){printf ("static double %s MTT_UNUSED;\t// %s\n", tolower($1), $2)}'
}

declare_temp_vars ()
{
for name in ${TMP_VAR_NAMES}
do
    echo ""
    i=0
    while [ ${i} -le ${NUM_OF_TMP_VAR} ]
    do
	echo "static double ${name}${i} MTT_UNUSED;"
	i=`expr ${i} + 1`
    done
done
}

echo Creating ${OUT}
cat <<EOF > ${OUT}
#ifndef MTT_UNUSED
#ifdef __GNUC__
#define MTT_UNUSED __attribute__ ((__unused__))
#else
#define MTT_UNUSED
#endif
#endif

EOF

declare_sys_param	>> ${OUT}
declare_temp_vars	>> ${OUT}

Deleted mttroot/mtt/doc/Makefile version [bc1a16d4f1].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91



























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#Makefile for MTT documentation

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/07/02 18:40:07  peterg
## More on install option
##
## Revision 1.1  1998/05/14 09:19:52  peterg
## Initial revision
##
###############################################################


#MTTPATH = /home/peterg/mtt_new/mtt
#DOCPATH = /home/peterg/web-docs/software/MTT/doc
#INFOPATH = /usr/info

MTTPATH = /home/peterg/mtt_new/mtt
MTT_COMPONENTS = /home/eng4/peterg/mtt_new/mtt/lib/comp
MTT_EXAMPLES = /home/eng4/peterg/mtt_new/mtt/lib/examples
DOCPATH = /home/peterg/web-docs/software/MTT/doc
#INFOPATH = $(DOCPATH)
INFOPATH = /usr/info

all: mtt.info  mtt.html mtt.pdf mtt.ps.gz 

mtt.info: mtt.texi
	echo "Making info manual. Please wait ..."; makeinfo mtt.texi

mtt.dvi: mtt.texi
	echo "Making dvi manual. Please wait ..."; tex mtt.texi; tex mtt.texi

mtt.html: mtt.texi
	echo "Making html manual. Please wait ..."; texi2html -glossary  mtt.texi

mtt.ps.gz: mtt.dvi
	echo "Making ps manual. Please wait ..."; dvips -o mtt.ps mtt; gzip -f mtt.ps

mtt.pdf: mtt.texi
	echo "Making pdf manual. Please wait ..."; texi2pdf mtt.texi

Compound-Components_rep.ps: 
	(cd $(MTT_COMPONENTS); mtt Compound-Components rep ps)
	mv $(MTT_COMPONENTS)/Compound-Components_rep.ps .

Compound-Components_rep: 
	(cd $(MTT_COMPONENTS); mtt Compound-Components rep html)
	mv $(MTT_COMPONENTS)/Compound-Components_rep .

Examples_rep.ps: 
	(cd $(MTT_EXAMPLES); mtt Examples rep ps)
	mv $(MTT_EXAMPLES)/Examples_rep.ps .

Examples_rep: 
	(cd $(MTT_EXAMPLES); mtt Examples rep html)
	mv $(MTT_EXAMPLES)/Examples_rep .

clean:
	rm -f mtt.aux	    mtt.fns	  mtt.pg	mtt.tp
	rm -f mtt.cp	    mtt.pgs	  mtt.vr	mtt.ps
	rm -f mtt.cps	    mtt.vrs	  mtt.dvi       mtt.ps.gz
	rm -f mtt.ky	    mtt.fn	  mtt.log	mtt.toc	
	rm -f 		    mtt.ps        mtt.info-*    mtt.pdf
	rm -f mtt.html	    mtt_toc.html  mtt.info
	rm -f mtt.log       mtt.ky        mtt.toc

tidy:
	rm -f mtt.aux	    mtt.fns	  mtt.pg	mtt.tp
	rm -f mtt.cp	    mtt.pgs	  mtt.vr	
	rm -f mtt.cps	    mtt.vrs	  mtt.dvi       
	rm -f mtt.log       mtt.ky        mtt.toc


install-doc: mtt.html mtt.ps.gz  mtt.info
	cp mtt.info* $(INFOPATH)
	cp mtt.html mtt_toc.html mtt.ps.gz  $(DOCPATH)
	chmod -R a+r $(DOCPATH)
	chmod a+x  $(DOCPATH)

install-components:  Compound-Components_rep.ps Compound-Components_rep
	mv Compound-Components_rep.ps $(DOCPATH)/../components
	mv Compound-Components_rep    $(DOCPATH)/../components
	chmod -R a+r $(DOCPATH)/../components
	chmod -R a+x $(DOCPATH)/../components/Compound-Components_re




Modified mttroot/mtt/doc/mtt.texi from [95bf219a63] to [677998cd3f].

12
13
14
15
16
17
18









19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34







+
+
+
+
+
+
+
+
+









@comment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@comment  Version control history
@comment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@comment  $Id$
@comment  $Log$
@comment  Revision 1.9  2002/07/05 13:29:34  geraint
@comment  Added notes about generating dynamically linked functions for Octave and Matlab.
@comment
@comment  Revision 1.8  2002/07/04 21:34:12  geraint
@comment  Updated gnuplot view description to describe Tcl/Tk interface instead of obsolete txt method.
@comment
@comment  Revision 1.7  2002/04/23 09:51:54  gawthrop
@comment  Changed incorrect statement about searching for components.
@comment
@comment  Revision 1.6  2001/10/15 14:29:50  gawthrop
@comment  Added documentaton on  [1:N] style port labels
@comment
@comment  Revision 1.5  2001/07/23 03:35:29  geraint
@comment  Updated file structure (mtt/bin).
@comment
@comment  Revision 1.4  2001/07/23 03:25:02  geraint
431
432
433
434
435
436
437




438
439
440
441
442
443
444
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457







+
+
+
+







Simulation parameters

* Euler integration::           
* Implicit integration::        
* Runge Kutta IV integration::  
* Hybrd algebraic solver::      

Simulation code

* Dynamically linked functions::  

Simulation output

* Viewing results with gnuplot::  
* Exporting results to SciGraphica::  

Representations

658
659
660
661
662
663
664



665
666
667
668
669
670
671
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687







+
+
+







* Text editors::                
* Octave::                      
* LaTeX::                       

Octave

* Octave control system toolbox (OCST)::  
* Creating GNU Octave .oct files::  
* Creating Matlab .mex files::  
* Embedding MTT models in Simulink::  

Administration

* Software components::         
* REDUCE setup::                
* Octave setup::                
* Paths::                       
2313
2314
2315
2316
2317
2318
2319


































2320
2321
2322
2323
2324
2325
2326
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







@end example

To generate an executable based on the C++ representation:
@example
mtt -cc [options] sys ode2odes exe
@end example

@menu
* Dynamically linked functions::  
@end menu

@node Dynamically linked functions,  , Simulation code, Simulation code
@comment  node-name,  next,  previous,  up
@subsection Dynamically linked functions

Some model representations can be compiled into dynamically loaded
code (shared objects) which are compiled prior to use in other
modelling and simulation environments; in particular, .oct files can
be generated for use in GNU Octave (@pxref{Creating GNU Octave .oct
files}) and .mex files can be generated for use in Matlab
(@pxref{Creating Matlab .mex files}) or Simulink (@pxref{Embedding MTT
models in Simulink}).  The use of compiled (and possibly
compiler-optimised) code can offer significant processing speed
advantages over equivalent interpreted functions (e.g. .m files) for
computationally intensive procedures.

The C++ code generated by @strong{MTT} allows the same code to be
generated as standalone code, Octave .oct files or Matlab .mexglx
files. Although @strong{MTT} usually takes care of the compilation
options, if it is necessary to compile the code on a machine on which
@strong{MTT} is not installed, the appropriate flag should be passed
to the compiler pre-processor:
@itemize @bullet
@item
@code{-DCODEGENTARGET=STANDALONE}
@item
@code{-DCODEGENTARGET=OCTAVEDLD}
@item
@code{-DCODEGENTARGET=MATLABMEX}
@end itemize

@node Simulation output,  , Simulation code, Simulation
@comment  node-name,  next,  previous,  up
@section Simulation output
@cindex Simulation output
The view (@pxref{Views}) representation provides a graphical
representation of the results of a simulation; the postscript language
provides the same thing in a form that can be included in a document.
2357
2358
2359
2360
2361
2362
2363
2364
2365



2366
2367
2368
2369
2370
2371
2372

2373
2374
2375
2376
2377

2378
2379

2380
2381
2382
2383
2384
2385
2386
2387

2388
2389
2390
2391
2392
2393
2394
2395

2396
2397
2398
2399
2400
2401
2402
2407
2408
2409
2410
2411
2412
2413


2414
2415
2416
2417
2418
2419
2420
2421


2422

2423



2424
2425

2426
2427
2428






2429




2430
2431


2432
2433
2434
2435
2436
2437
2438
2439







-
-
+
+
+





-
-
+
-

-
-
-
+

-
+


-
-
-
-
-
-
+
-
-
-
-


-
-
+







@end menu

@node Viewing results with gnuplot, Exporting results to SciGraphica, Simulation output, Simulation output
@comment  node-name,  next,  previous,  up@subsection
@subsection Viewing results with gnuplot
@cindex gnuplot

Simulation results may be viewed in
@uref{http://www.gnuplot.org,gnuplot} with the command
Simulation plots may be conveniently selected, viewed with
@uref{http://www.gnuplot.org,gnuplot} 
and saved to file (in PostScript format) using the command

@example
mtt [options] rc gnuplot view
@end example

The plot format is controlled by the file @emph{sys_gnuplot.txt}. A default version
of this file, which will cause gnuplot to plot the time-history of each state
This will cause a menu to be displayed, from which states and outputs may be selected for viewing. Clicking on a @emph{parameter name} will cause a new window to be opened displaying the time history of the selected parameter. Selecting the @emph{print} option in the main window provides the option of saving to file a plot of the last selected parameter. Clicking on the @emph{title bar} of the main window (``Outputs'' or ``States'') will alter the order in which the parameter names are displayed.
and each output individually, may be created with the command

@example
mtt rc gnuplot txt
@end example
It should be noted that unlike other representations, if a simulation has been previously run in a directory, this command will @emph{not} cause @strong{MTT} to re-run a simulation, even if any of the input files have been changed.

resulting in
If it is desired to re-run a simulation, it is advisable to run the command 

@example
wait=-1
set data style lines
set xlabel "time"
set grid
set term X11

mtt [options] rc odeso view ; mtt [options] rc gnuplot view
plot "rc_odes.dat2" using 1:4 axes x1y1 title "rc_c_c;
pause(wait);
plot "rc_odes.dat2" using 1:2 axes x1y1 title "rc_e2_e2
; pause(wait);
@end example

The file is used as an input to the gnuplot program and may therefore be
edited to contain any valid gnuplot commands.
As with @strong{xMTT} (@pxref{Menu-driven interface}), the Wish Tcl/Tk interpreter must be installed to make use of this feature.

@node Exporting results to SciGraphica,  , Viewing results with gnuplot, Simulation output
@comment  node-name,  next,  previous,  up
@subsection Exporting results to SciGraphica
@cindex SciGraphica

Simulation results can be converted into an XML-format
3559
3560
3561
3562
3563
3564
3565
3566

3567
3568
3569
3570
3571
3572
3573
3596
3597
3598
3599
3600
3601
3602

3603
3604
3605
3606
3607
3608
3609
3610







-
+







%% ss1 is both a source and sensor
ss1     SS              external,external
%% ss1 acts as a flow sensor - it imposes zero effort.
ss2     SS              0,external
@end example


@node Other component labels , Component names, SS component labels , Labels (lbl)
@node Other component labels, Component names, SS component labels , Labels (lbl)
@comment  node-name,  next,  previous,  up
@subsection Other component labels 
@cindex Other component labels 

In addition to the label there are two information fields,
@pxref{Labels (lbl)}.
They correspond to the constitutive relationship 
4538
4539
4540
4541
4542
4543
4544









4545
4546
4547
4548
4549
4550
4551
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597







+
+
+
+
+
+
+
+
+







# Generated by MTT at Mon Jun 16 15:10:17 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.9  2002/07/05 13:29:34  geraint
# %% Added notes about generating dynamically linked functions for Octave and Matlab.
# %%
# %% Revision 1.8  2002/07/04 21:34:12  geraint
# %% Updated gnuplot view description to describe Tcl/Tk interface instead of obsolete txt method.
# %%
# %% Revision 1.7  2002/04/23 09:51:54  gawthrop
# %% Changed incorrect statement about searching for components.
# %%
# %% Revision 1.6  2001/10/15 14:29:50  gawthrop
# %% Added documentaton on  [1:N] style port labels
# %%
# %% Revision 1.5  2001/07/23 03:35:29  geraint
# %% Updated file structure (mtt/bin).
# %%
# %% Revision 1.4  2001/07/23 03:25:02  geraint
5812
5813
5814
5815
5816
5817
5818



5819
5820
5821

5822
5823
5824
5825
5826
5827
5828
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869

5870
5871
5872
5873
5874
5875
5876
5877







+
+
+


-
+







step(rc);
bode(rc);
@end example


@menu
* Octave control system toolbox (OCST)::  
* Creating GNU Octave .oct files::  
* Creating Matlab .mex files::  
* Embedding MTT models in Simulink::  
@end menu

@node Octave control system toolbox (OCST),  , Octave, Octave
@node Octave control system toolbox (OCST), Creating GNU Octave .oct files, Octave, Octave
@comment  node-name,  next,  previous,  up
@subsection Octave control system toolbox (OCST)
@cindex Octave
@cindex toolbox
@cindex OCST
@cindex control systems
@cindex mtt2sys
5852
5853
5854
5855
5856
5857
5858




5859

































































































































5860
5861
5862
5863
5864
5865
5866
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911

5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047







+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







The following octave commands then generate the step reponse and bode
diagram respectively:
@example
step(rc);
bode(rc);
@end example

@node Creating GNU Octave .oct files, Creating Matlab .mex files, Octave control system toolbox (OCST), Octave
@comment  node-name,  next,  previous,  up
@subsection Creating GNU Octave .oct files
@cindex Creating GNU Octave .oct files
 

GNU Octave dynamically loaded functions (.oct files) can be created by
instructing @strong{MTT} to create the ``oct'' representation:

@example
  mtt [options] sys ode oct
@end example

This will cause @strong{MTT} to create the C++ representation of the system
(sys_ode.cc) and to then compile it as a shared object suitable for
use within Octave. The resultant file may be used in an identical
manner to the equivalent, but generally slower, interpreted .m file.

Usage information for the function may be obtained within Octave in the usual manner:

@example
  octave:1> help rc_ode

  rc_ode is the dynamically-linked function from the file
  /home/mttuser/rc/rc_ode.oct

  Usage: [mttdx] = rc_ode(mttx,mttu,mttt,mttpar)
  Octave ode representation of system rc
  Generated by MTT on Fri Jul  5 11:23:08 BST 2002
@end example

Note that the first line of output from Octave identifies whether the
compiled or interpreted function is being used.

Alternatively, standard representations may be generated using the
Octave DLDs by use of the ``-oct'' switch:

@example
  mtt -oct rc odeso view
@end example

In order to successfully generate .oct files, Octave must be correctly
configured prior to compilation and certain headers and libraries must
be correctly installed on the system (@pxref{.oct file dependencies}).

@node  Creating Matlab .mex files, Embedding MTT models in Simulink, Creating GNU Octave .oct files, Octave
@comment  node-name,  next,  previous,  up
@subsection Creating Matlab .mex files
@cindex Creating Matlab .mex files

On GNU/Linux systems, Matlab dynamically linked executables (.mexglx
files) can created by instructing @strong{MTT} to create the
``mexglx'' representation:

@example
  mtt [options] sys ode mexglx
@end example

This will cause @strong{MTT} to create the C++ representation of the
system (sys_ode.cc) and to then compile it as a shared object suitable
for use within Matlab.

If it is necessary to compile mex files for another platform, then the
usual C++ representation (generated with the -cc flag) can be created
and the resultant file compiled with the -DCODEGENTARGET=MATLABMEX
flag on the target platform.

@example
  mtt_machine:
  mtt -cc rc ode cc

  matlab_machine:
  matlab> mex -DCODEGENTARGET=MATLABMEX rc_ode.cc
@end example

@node  Embedding MTT models in Simulink,  , Creating Matlab .mex files, Octave
@comment  node-name,  next,  previous,  up
@subsection Embedding MTT models in Simulink
@cindex Embedding MTT models in Simulink

It is possible to embed @strong{MTT} functions or entire @strong{MTT}
models within Simulink simulations as Sfun blocks. If the zip package
is installed on the system, the command

@example
  mtt sys sfun zip
@end example

will create a compressed archive containing sys.mdl, which may be
embedded into a larger Simulink model. Also contained within the
archive will be four sys_sfun*.c files,

@itemize @bullet
@item
sys_sfun.c
model state and output equations
@item
sys_sfun_ae.c
model algebraic equations
@item
sys_sfun_input.c
model inputs
@item
sys_sfun_interface.c
interface between MTT model and Simulink
@end itemize

The last of these files must be edited to correctly map the inputs and
outputs between the @strong{MTT} and Simulink models. The two sections
to edit are clearly marked with

@example
  @code{/* Start EDIT */}
  @code{....}
  @code{/* End EDIT */}
@end example

These four files should then be compiled with the Matlab ``mex''
compiler as described in the @emph{README} file in the archive.

If it is desired to compile the .mex files directly from within
@strong{MTT} on a machine which has the Matlab header files installed,
this may be done with the command

@example
  mtt sys sfun mexglx 
@end example

which will generated the four .mex files and the .mdl file. In this
case, the user must ensure that @emph{sys_sfun_interface.c} has been
correctly edited prior to compilation.

Note that solution of algebraic equations within Simulink is not
possible unless the @emph{Matlab Optimisation Toolbox} is installed.

@node LaTeX,  , Octave, Language tools
@comment  node-name,  next,  previous,  up
@section LaTeX
@cindex LaTeX

LaTeX is a powerful text processor which @strong{MTT} uses to provide
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992




5993
5994
5995
























5996
5997
5998
5999
6000
6001
6002
6163
6164
6165
6166
6167
6168
6169




6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207







-
-
-
-
+
+
+
+



+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







empty_list_elements_ok = 1;

@end example

@node .oct file dependencies,  , .octaverc, Octave setup
@comment  node-name,  next,  previous,  up Additionally, it is necessary to
@subsection .oct file dependencies
Successful compilation of .oct code requires that Octave has been configured
to use dynamically linked libraries and that the Octave library @code{liboctave}
and the Octave modified version of @code{libkpathsea} are available on the
 system.
Successful compilation of .oct code requires that Octave has been
configured to use dynamically linked libraries and that the Octave
libraries @code{liboctave}, @code{libcruft} and @code{liboctinterp}
are available on the system.

This can be acheived by compiling Octave from the source code, configured
with the options @code{--enable-shared} and @code{--enable-dl}.

A number of additional libraries and headers are also required to be
installed on a system. These include,
@itemize @bullet
@item
@emph{ncurses} and @emph{readline}
               terminal control routines
@item
@emph{blas} or @emph{altas}
            basic linear algebra subprograms, usually optimised for the specific processor
@item
@emph{fftw}
        fast Fourier transform routines
@item
@emph{g2c}
        GNU Fortran to C conversion routines
@item
@emph{kpathsea}
        TeX path search routines
@end itemize

Note that on many GNU/Linux distributions, the necessary headers are
contained in development packages which must be installed in addition
to the standard library package.

Further information on configuring and installing Octave to handle dynamic
libraries (DLDs) can be found in the
@uref{http://www.octave.org/docs.html,Octave documentation}.


@node Paths, File structure, Octave setup, Administration

Deleted mttroot/mtt/doc/mtt_banner.sh version [369093538c].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
  ###################################### 
  ##### Model Transformation Tools #####
  ######################################
  
  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ###############################################################

Deleted mttroot/mtt/doc/reduce_reserved.tex version [b5fa8cdbe2].

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
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






























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\documentclass[12pt,a4paper]{book}
\newcommand{\REDUCE}{REDUCE}
\begin{document}


\appendix
\chapter{Reserved Identifiers}

We list here all identifiers that are normally reserved in \REDUCE{}
including names of commands, operators and switches initially in the system.
Excluded are words that are reserved in specific implementations of the
system.

\vspace{13pt}
\begin{list}{}{\renewcommand{\makelabel}[1]{#1\hspace{\fill}}%
               \settowidth{\labelwidth}{Numerical Operators}%
               \setlength{\labelsep}{1em}%
               \settowidth{\leftmargin}{Numerical Operators\hspace*{\labelsep}}%
               \sloppy}

\item[Commands] {\tt ALGEBRAIC} {\tt ANTISYMMETRIC}
{\tt ARRAY} {\tt BYE} {\tt CLEAR} \linebreak
{\tt CLEARRULES} {\tt COMMENT} {\tt
CONT} {\tt DECOMPOSE} {\tt DEFINE} {\tt DEPEND} {\tt DISPLAY} {\tt ED}
{\tt EDITDEF} {\tt END} {\tt EVEN} {\tt FACTOR} {\tt FOR} {\tt FORALL}
{\tt FOREACH} {\tt GO} {\tt GOTO} {\tt IF} {\tt IN} {\tt INDEX} {\tt INFIX}
{\tt INPUT} {\tt INTEGER} {\tt KORDER} {\tt LET} {\tt LINEAR} {\tt LISP}
{\tt LISTARGP} {\tt LOAD} {\tt LOAD\_PACKAGE} {\tt MASS} {\tt MATCH} {\tt
MATRIX} {\tt MSHELL} {\tt NODEPEND} {\tt NONCOM} {\tt NONZERO} {\tt NOSPUR}
{\tt ODD} {\tt OFF}
{\tt ON} {\tt OPERATOR} {\tt ORDER} {\tt OUT} {\tt PAUSE} {\tt PRECEDENCE}
{\tt PRINT\_PRECISION} {\tt PROCEDURE} {\tt QUIT} {\tt REAL} {\tt REMFAC}
{\tt REMIND} {\tt RETRY} {\tt RETURN} {\tt SAVEAS} {\tt SCALAR} {\tt
SETMOD} {\tt SHARE} {\tt SHOWTIME} {\tt SHUT} {\tt SPUR} {\tt SYMBOLIC}
{\tt SYMMETRIC} {\tt VECDIM} {\tt VECTOR} {\tt WEIGHT} {\tt WRITE} {\tt
WTLEVEL}

\item[Boolean Operators] {\tt EVENP} {\tt FIXP}
{\tt FREEOF} {\tt NUMBERP} {\tt ORDP} {\tt PRIMEP}

\item[Infix Operators]
 \verb|:=| \verb|=| \verb|>=| \verb|>| \verb|<=| \verb|<| \verb|=>|
 \verb|+| \verb|*| \verb|/| \verb|^| \verb|**| \verb|.| {\tt WHERE}
{\tt SETQ} {\tt OR} {\tt AND} {\tt MEMBER} {\tt MEMQ} {\tt
EQUAL} {\tt NEQ} {\tt EQ} {\tt GEQ} {\tt GREATERP} {\tt LEQ} {\tt LESSP}
{\tt PLUS} {\tt DIFFERENCE} {\tt MINUS} {\tt TIMES} {\tt QUOTIENT} {\tt
EXPT} {\tt CONS}

\item[Numerical Operators] {\tt ABS} {\tt ACOS}
{\tt ACOSH} {\tt ACOT} {\tt ACOTH} {\tt ACSC} {\tt ACSCH} {\tt ASEC} {\tt
ASECH} {\tt ASIN} {\tt ASINH} {\tt ATAN} {\tt ATANH} {\tt ATAN2} {\tt COS}
{\tt COSH} {\tt COT} {\tt COTH} {\tt CSC} {\tt CSCH} {\tt EXP} {\tt
FACTORIAL} {\tt FIX} {\tt FLOOR} {\tt HYPOT} {\tt LN} {\tt LOG} {\tt LOGB}
{\tt LOG10} {\tt NEXTPRIME} {\tt ROUND} {\tt SEC} {\tt SECH} {\tt SIN}
{\tt SINH} {\tt SQRT} {\tt TAN} {\tt TANH}

\item[Prefix Operators] {\tt APPEND} {\tt
ARGLENGTH} {\tt CEILING} {\tt COEFF} {\tt COEFFN} {\tt COFACTOR} {\tt
CONJ} {\tt DEG} {\tt DEN} {\tt DET} {\tt DF} {\tt DILOG} {\tt EI}
{\tt EPS} {\tt ERF} {\tt FACTORIZE} {\tt FIRST} {\tt GCD} {\tt G} {\tt
IMPART} {\tt INT} {\tt INTERPOL} {\tt LCM} {\tt LCOF} {\tt LENGTH} {\tt
LHS} {\tt LINELENGTH} {\tt LTERM} {\tt MAINVAR} {\tt MAT} {\tt MATEIGEN}
{\tt MAX} {\tt MIN} {\tt MKID} {\tt NULLSPACE} {\tt NUM} {\tt PART} {\tt
PF} {\tt PRECISION} {\tt RANDOM} {\tt RANDOM\_NEW\_SEED} {\tt RANK} {\tt
REDERR} {\tt REDUCT} {\tt REMAINDER} {\tt REPART} {\tt REST} {\tt
RESULTANT} {\tt REVERSE} {\tt RHS} {\tt SECOND} {\tt SET} {\tt SHOWRULES}
{\tt SIGN} {\tt SOLVE} {\tt STRUCTR} {\tt SUB} {\tt SUM} {\tt THIRD} {\tt
TP} {\tt TRACE} {\tt VARNAME}

\item[Reserved Variables] {\tt CARD\_NO} {\tt E} {\tt EVAL\_MODE}
{\tt FORT\_WIDTH} {\tt HIGH\_POW} {\tt I} {\tt INFINITY} {\tt K!*} {\tt
LOW\_POW} {\tt NIL} {\tt PI} {\tt ROOT\_MULTIPLICITY} {\tt T}

\item[Switches] {\tt ADJPREC} {\tt ALGINT} {\tt ALLBRANCH} {\tt ALLFAC}
{\tt BFSPACE} {\tt COMBINEEXPT} {\tt COMBINELOGS}
{\tt COMP} {\tt COMPLEX} {\tt CRAMER} {\tt CREF} {\tt DEFN} {\tt DEMO}
{\tt DIV} {\tt ECHO} {\tt ERRCONT} {\tt EVALLHSEQP} {\tt EXP} {\tt
EXPANDLOGS} {\tt EZGCD} {\tt FACTOR} {\tt FORT} {\tt FULLROOTS} {\tt GCD}
{\tt IFACTOR} {\tt INT} {\tt INTSTR} {\tt LCM} {\tt LIST} {\tt LISTARGS}
{\tt MCD} {\tt MODULAR} {\tt MSG} {\tt MULTIPLICITIES} {\tt NAT} {\tt
NERO} {\tt NOSPLIT} {\tt OUTPUT} {\tt PERIOD} {\tt PRECISE} {\tt PRET}
{\tt PRI} {\tt RAT} {\tt RATARG} {\tt RATIONAL} {\tt RATIONALIZE} {\tt
RATPRI} {\tt REVPRI} {\tt RLISP88} {\tt ROUNDALL} {\tt ROUNDBF} {\tt
ROUNDED} {\tt SAVESTRUCTR} {\tt SOLVESINGULAR} {\tt TIME} {\tt TRA} {\tt
TRFAC} {\tt TRIGFORM} {\tt TRINT}

\item[Other Reserved Ids] {\tt BEGIN} {\tt DO} {\tt
EXPR} {\tt FEXPR} {\tt INPUT} {\tt LAMBDA} {\tt
LISP} {\tt MACRO} {\tt PRODUCT} {\tt REPEAT} {\tt SMACRO} {\tt
SUM} {\tt UNTIL} {\tt WHEN} {\tt WHILE} {\tt WS}

\end{list}

\end{document}

Deleted mttroot/mtt/lib/cc/mtt_AlgebraicSolver.cc version [ab49594ff5].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#include "mtt_AlgebraicSolver.hh"

ColumnVector
MTT::AlgebraicSolver::solve (const ColumnVector	&x,
			     const ColumnVector	&u,
			     const double	&t,
			     const ColumnVector	&par)
{
  if (_nyz > 0)
    {
      _x = x;
      _uui.insert(u,0);
      _t = t;
      _par = par;
      _ui = ColumnVector(_nyz,0.0);
      Solve();
      _uui.insert(_ui,_nu);
    }
  else
    {
      _uui = u;
    }
  return _uui;
}

ColumnVector
MTT::AlgebraicSolver::eval (const ColumnVector	&ui)
{
  if (_nyz > 0)
    _uui.insert(ui,_nu);
  return mtt_ae(_x,_uui,_t,_par);
}

Deleted mttroot/mtt/lib/cc/mtt_AlgebraicSolver.hh version [6b5fc39cda].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#ifndef MTT_ALGEBRAICSOLVER
#define MTT_ALGEBRAICSOLVER


#include "mtt_Solver.hh"


namespace MTT
{
  class AlgebraicSolver : public MTT::Solver
  {
  public:

    AlgebraicSolver (const int npar,
		     const int nu,
		     const int nx,
		     const int ny,
		     const int nyz)
      : MTT::Solver (npar,nu,nx,ny,nyz)
    {;}

    ColumnVector
    solve (const ColumnVector	&x,
	   const ColumnVector	&u,
	   const double		&t,
	   const ColumnVector	&par);

    ColumnVector
    eval (const ColumnVector	&ui);

    virtual ~AlgebraicSolver (void) {};

  protected:

    virtual void
    Solve (void) = 0;
  };
}


extern ColumnVector
mtt_ae(ColumnVector	&x,
       ColumnVector	&u,
       const double	&t,
       ColumnVector	&par);


#endif // MTT_ALGEBRAICSOLVER

Deleted mttroot/mtt/lib/cc/mtt_Dassl_Solver.cc version [d98f27dba0].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#include "mtt_Dassl_Solver.hh"


// used by "-ae dassl" NOT "-i dassl"


MTT::Dassl_Solver *MTT::Dassl_Solver::static_ptr;

ColumnVector
MTT::Dassl_Solver::f_dassl (const ColumnVector &tryUi,
			    const ColumnVector &tryUidot,
			    double t, int &ires)
{
  static MTT::Dassl_Solver *p = MTT::Dassl_Solver::static_ptr;

  ColumnVector residual = p->eval(tryUi);
  ColumnVector uidoterr = (tryUi - p->_ui) - tryUidot;  
  p->_yz = residual + uidoterr;
  return p->_yz;
}

void
MTT::Dassl_Solver::Solve (void)
{
  const double t0 = 0.0;
  const double t1 = 1.0;
  DAEFunc fcn(&MTT::Dassl_Solver::f_dassl);
  DASSL   eqn(AlgebraicSolver::_ui,t0,fcn);
  AlgebraicSolver::_ui = eqn.do_integrate (t1);
}

Deleted mttroot/mtt/lib/cc/mtt_Dassl_Solver.hh version [29e194ac39].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


#ifndef MTT_DASSLSOLVER
#define MTT_DASSLSOLVER


#include "mtt_AlgebraicSolver.hh"
#include <octave/DASSL.h>


#ifdef  OCTAVE_DEV
#include <octave/parse.h>
#define VECTOR_VALUE column_vector_value
#else   // !OCTAVE_DEV
#include <octave/toplev.h>
#define VECTOR_VALUE vector_value
#endif  // OCTAVE_DEV


// -ae dassl


namespace MTT
{
  class Dassl_Solver : public MTT::AlgebraicSolver {
    
    // used only when called because of "-ae dassl"
    // this is not used when called by "-i dassl"
    
  public:
    
    Dassl_Solver (const int npar,
		  const int nu,
		  const int nx,
		  const int ny,
		  const int nyz)
      : MTT::AlgebraicSolver (npar, nu, nx, ny, nyz)
    {
      static_ptr = this;
    }
    
    static ColumnVector
    f_dassl (const ColumnVector &tryUi,
	     const ColumnVector &tryUidot,
	     double t, int &ires);
    
    ~Dassl_Solver (void) {};
    
  protected:
    
    void
    Solve (void);
    
  public:
    
    static Dassl_Solver *static_ptr;
    
  };
}


#endif // MTT_DASSLSOLVER

Deleted mttroot/mtt/lib/cc/mtt_HJ_Solver.hh version [c5aaf93148].

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

































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#ifndef MTT_HJSOLVER
#define MTT_HJSOLVER


#include "mtt_AlgebraicSolver.hh"


namespace MTT
{
  class HJ_Solver : public MTT::AlgebraicSolver
  {
    // http://www.netlib.org/opt/hooke.c
    // Hooke and Jeeves solution

  public:
  
    HJ_Solver (const int npar,
	       const int nu,
	       const int nx,
	       const int ny,
	       const int nyz)
      : MTT::AlgebraicSolver (npar,nu,nx,ny,nyz)
    {
      static_ptr = this;
      VARS = nyz;
    }
  
    static double
    f (double tryUi[], int nyz);
  
    ~HJ_Solver (void) {};

  protected:

    void
    Solve (void);

    double
    best_nearby (double    	delta[],
		 double   	point[],
		 double   	prevbest,
		 int      	nvars);
  
    int
    hooke (int		nvars,			  // MTTNYZ
	   double	startpt[],		  // user's initial guess
	   double	endpt[],		  // result
	   double	rho		= 0.05,	  // geometric shrink factor
	   double	epsilon		= 1e-3,	  // end value stepsize
	   int		itermax		= 5000);  // max # iterations 

  private:

    int VARS;
    
  public:

    static HJ_Solver *static_ptr;
    
  };
}


#endif // MTT_HJSOLVER

Deleted mttroot/mtt/lib/cc/mtt_Hybrd_Solver.cc version [f1e519c135].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#include "mtt_Hybrd_Solver.hh"

// http://www.netlib.org/minpack/hybrd.f
// used by Octave's fsolve

MTT::Hybrd_Solver *MTT::Hybrd_Solver::static_ptr;

ColumnVector
MTT::Hybrd_Solver::f_hybrd (const ColumnVector &tryUi)
{
  MTT::Hybrd_Solver::static_ptr->_yz = MTT::Hybrd_Solver::static_ptr->eval(tryUi);
  return MTT::Hybrd_Solver::static_ptr->_yz;
}

void
MTT::Hybrd_Solver::Solve (void)
{    
  static std::fstream ferr ("MTT.Hybrd_messages", std::ios::out | std::ios::trunc | std::ios::app);
  int info;
  static int input_errors;
  static int user_errors;
  static int convergences;
  static int progress_errors;
  static int limit_errors;
  static int unknown_errors;
  
  NLFunc fcn(&Hybrd_Solver::f_hybrd);
  NLEqn	 eqn(Solver::_ui,fcn);
  eqn.set_tolerance(1.0e-3);
  Solver::_ui = eqn.solve(info);

  switch (info)
    {
    case 1:
      convergences++;
      break;
    case -2:
      input_errors++;
      break;
    case -1:
      user_errors++;
      break;
    case 3:
      progress_errors++;
      break;
    case 4:
      //      if (abs(eval(_ui).max()) > 1.0e-6)
      limit_errors++;
      //      else
      //	convergences++;
      break;
    default:
      unknown_errors++;
      break;
    }
  if (1 != info)
    {
      std::cerr
	<< " time " << _t << " \t"
	<< " converge (" << convergences << ") "
	<< " limit (" << limit_errors << ")"
	<< " (max error = " << std::abs (eval(_ui).max()) << ")"
	<< " other (" << input_errors + user_errors + progress_errors + unknown_errors << ") "
	<< std::endl;
    }
  ferr << info << " ";
}

Deleted mttroot/mtt/lib/cc/mtt_Hybrd_Solver.hh version [7dad372c91].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#ifndef MTT_HYBRDSOLVER
#define MTT_HYBRDSOLVER

#include <fstream>

#include <octave/NLEqn.h>
#include "mtt_AlgebraicSolver.hh"


namespace MTT
{
  class Hybrd_Solver : public MTT::AlgebraicSolver
  {
    // http://www.netlib.org/minpack/hybrd.f
    // used by Octave's fsolve
    
  public:

    Hybrd_Solver (const int npar,
		  const int nu,
		  const int nx,
		  const int ny,
		  const int nyz)
      : MTT::AlgebraicSolver (npar,nu,nx,ny,nyz)
    {
      static_ptr = this;
    }

    static ColumnVector
    f_hybrd (const ColumnVector &tryUi);

    ~Hybrd_Solver (void) {};

  protected:

    void
    Solve (void);
    
  public:
    
    static Hybrd_Solver *static_ptr;
  };
}


#endif // MTT_HYBRDSOLVER

Deleted mttroot/mtt/lib/cc/mtt_Reduce_Solver.cc version [b7f38e13b6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#include "mtt_Reduce_Solver.hh"

void
MTT::Reduce_Solver::Solve (void)
{
  ;
}

ColumnVector
MTT::Reduce_Solver::solve (const ColumnVector	&x,
			   const ColumnVector	&u,
			   const double		&t,
			   const ColumnVector	&par)
{
  return u;
}

Deleted mttroot/mtt/lib/cc/mtt_Reduce_Solver.hh version [635ef51478].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#ifndef MTT_REDUCESOLVER
#define MTT_REDUCESOLVER


#include "mtt_AlgebraicSolver.hh"


namespace MTT
{
  class Reduce_Solver : public MTT::AlgebraicSolver
  {
    // Dummy class
    // This will not be used unless the Reduce solver has failed earlier
    // in the model build process

  public:
    
    Reduce_Solver (const int npar,
		   const int nu,
		   const int nx,
		   const int ny,
		   const int nyz)
      : AlgebraicSolver (npar,nu,nx,ny,nyz)
    {;}
	
    void
    Solve (void);
    
    ColumnVector
    solve (const ColumnVector	&x,
	   const ColumnVector	&u,
	   const double		&t,
	   const ColumnVector	&par);
    
    ~Reduce_Solver (void) {};
  };
}


#endif // MTT_REDUCESOLVER 

Deleted mttroot/mtt/lib/cc/mtt_Solver.cc version [effe0746c4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#include "mtt_Solver.hh"

MTT::Solver::Solver (const int npar,
		     const int nu,
		     const int nx,
		     const int ny,
		     const int nyz)
{
  _np  = npar; 
  _nu  = nu;
  _nx  = nx;
  _ny  = ny;
  _nyz = nyz;
  _uui = ColumnVector (_nu+_nyz);
};

Deleted mttroot/mtt/lib/cc/mtt_Solver.hh version [2a39ed71ca].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#ifndef MTT_SOLVER
#define MTT_SOLVER


#include <cmath>
#include <cstdlib>
#include <iostream>

#include <octave/oct.h>


namespace MTT
{
  class Solver
  {
  public:

    Solver (const int npar,
	    const int nu,
	    const int nx,
	    const int ny,
	    const int nyz);

    virtual ~Solver (void) {};
  
  protected:
    
    ColumnVector       		_x;
    ColumnVector	       	_uui;
    double			_t;
    ColumnVector	       	_par;
    
    ColumnVector  		_ui;
    ColumnVector          	_yz;
    
    int   			_nu;
    int				_np;
    int				_nx;
    int				_ny;
    int				_nyz;
  };
}

  
#endif // MTT_SOLVER

Deleted mttroot/mtt/lib/cc/mtt_dassl.cc version [b9b24f4791].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#include <octave/oct.h>
#include <octave/DASSL.h>


#ifdef  OCTAVE_DEV
#include <octave/parse.h>
#define VECTOR_VALUE column_vector_value
#else   // !OCTAVE_DEV
#include <octave/toplev.h>
#define VECTOR_VALUE vector_value
#endif  // OCTAVE_DEV


#ifdef STANDALONE
extern ColumnVector
Fmtt_residual (const ColumnVector &X, const ColumnVector &DX, double t, int &ires);
#endif // STANDALONE


ColumnVector
mtt_residual (const ColumnVector &X, const ColumnVector &DX, double t, int &ires)
{
#ifdef STANDALONE
  return Fmtt_residual (X, DX, t, ires);
#else // !STANDALONE
  static octave_value_list args, f;
  args(0) = octave_value (X);
  args(1) = octave_value (DX);
  args(2) = octave_value (t);
  args(3) = octave_value (ires);
  f = feval ("mtt_residual", args, 1);
  return f(0).VECTOR_VALUE ();
#endif // STANDALONE
}


#ifdef STANDALONE
ColumnVector
Fmtt_dassl (	  ColumnVector	&x,
	    const ColumnVector	&u,
	    const double	&t,
	    const ColumnVector	&par,
	    const ColumnVector	&dx,
	    const double	&ddt,
	    const int		Nx,
	    const int		Nyz,
	    const ColumnVector	&openx)
{
#else // !STANDALONE
DEFUN_DLD (mtt_dassl, args, ,
	   "dassl integration method")
{
  ColumnVector		x	= args(0).VECTOR_VALUE();
  const ColumnVector   	u	= args(1).VECTOR_VALUE();
  const double		t	= args(2).double_value();
  const ColumnVector	par	= args(3).VECTOR_VALUE();
  const ColumnVector	dx	= args(4).VECTOR_VALUE();
  const double		ddt	= args(5).double_value();
  const int		Nx	= static_cast<int> (args(6).double_value());
  const int		Nyz	= static_cast<int> (args(7).double_value());
  const ColumnVector	openx	= args(8).VECTOR_VALUE();
#endif // STANDALONE

  static DAEFunc fdae(mtt_residual);
  static ColumnVector XX (Nx+Nyz);
  XX.insert (x,0);

  for (register int i = Nx; i < Nx+Nyz; i++)
    XX(i) = 0.0;

  double tout = t + ddt;

  DASSL fdassl (XX, t, fdae);
  x = fdassl.do_integrate (tout).extract (0,Nx-1);

  for (register int i = 0; i < Nx; i++)
    if (openx (i) > 0.5)
      x (i) = 0.0;
      

#ifdef STANDALONE
  return x;
#else
  return octave_value (x);
#endif
}

Deleted mttroot/mtt/lib/cc/mtt_euler.cc version [43d68034de].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#include <octave/oct.h>

#ifdef	OCTAVE_DEV
#define VECTOR_VALUE column_vector_value
#else // !OCTAVE_DEV
#define	VECTOR_VALUE vector_value
#endif // OCTAVE_DEV

#ifdef STANDALONE
ColumnVector Fmtt_euler (      ColumnVector	&x,
			 const ColumnVector	&dx,
			 const double		&ddt,
			 const int		&Nx,
			 const ColumnVector	&openx)
{
#else // !STANDALONE
DEFUN_DLD (mtt_euler, args, ,
	   "euler integration method")
{
  ColumnVector  	x	= args(0).VECTOR_VALUE ();
  const ColumnVector	dx	= args(1).VECTOR_VALUE ();
  const double		ddt	= args(2).double_value ();
  const int		Nx	= static_cast<int> (args(3).double_value ());
  const ColumnVector   	openx	= args(4).VECTOR_VALUE ();
#endif // STANDALONE

  register int i, n;
  
  n = Nx;
  for (i = 0; i < Nx; i++)
    {
      if (0 != openx (i))
	{
	  x (i) = 0.0;
	}
      else
	{
	  x (i) += dx (i) * ddt;
	}
    }
#ifdef STANDALONE
  return x;
#else // !STANDALONE  
  return octave_value (x);
#endif // STANDALONE
}

Deleted mttroot/mtt/lib/cc/mtt_implicit.cc version [99ad6e1348].

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
68
69
70
71







































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#include <octave/oct.h>
#include <octave/xdiv.h>

#ifdef	OCTAVE_DEV
#define VECTOR_VALUE column_vector_value
#else // !OCTAVE_DEV
#define	VECTOR_VALUE vector_value
#endif // OCTAVE_DEV

#ifdef STANDALONE
ColumnVector Fmtt_implicit (      ColumnVector	&x,
				  ColumnVector	&dx,
			          Matrix	&AA,
				  ColumnVector	&AAx,
			    const double	&t,
			    const int		&Nx,
			    const ColumnVector	&openx)
{
#else // !STANDALONE
DEFUN_DLD (mtt_implicit, args, ,
	   "implicit integration method")
{
  ColumnVector  	x	= args(0).VECTOR_VALUE ();
  ColumnVector		dx	= args(1).VECTOR_VALUE ();
  Matrix		AA	= args(2).matrix_value ();
  ColumnVector		AAx	= args(3).VECTOR_VALUE ();
  const  double		t	= args(4).double_value ();
  const  int		Nx	= (int) (args(5).double_value ());
  const  ColumnVector	openx	= args(6).VECTOR_VALUE ();
#endif // STANDALONE

  register int row, col;

  for (row = 0; row < Nx; row++)
    {
      if (openx (row) > 0.5)
	{
	  AAx (row) = 0.0;
          dx (row) = 0.0;
	  for (col = 0; col < Nx; col++)
	    {
	      AA (row,col) = 0.0;
	      AA (col,row) = 0.0;
	    }
	}
    }

#ifdef OCTAVE_DEV
  x = static_cast<ColumnVector> (xleftdiv (AA, static_cast<Matrix>(AAx + dx * t)));
#else // !OCTAVE_DEV
  Matrix tmp = xleftdiv (AA, static_cast<Matrix>(static_cast<ColumnVector>(AAx + dx * t)));
  for (row = 0; row < Nx; row++)
    {
      x (row) = tmp (row,0);
    }
#endif // OCTAVE_DEV
  
  for (row = 0; row < Nx; row++)
    {
      if (openx (row) > 0.5)
	{
	  x (row) = 0.0;
	}
    }

#ifdef STANDALONE
  return x;
#else // !STANDALONE
  return octave_value (x);
#endif // STANDALONE
}

Deleted mttroot/mtt/lib/cc/mtt_kpathsea.cc version [0b0240614b].

1
2
3
4




-
-
-
-

extern "C" {
  int kpse_clear_dir_cache (void) {return 0;}
}

Deleted mttroot/mtt/lib/comp/compound/Chemical/Rate/Rate_abg.fig version [1a050baaf5].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3780 2880 5220 3195
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 2925 5175 2925 4950 3150
-6
6 1755 2880 3195 3195
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2925 3150 2925 2925 3150
-6
6 3105 2655 3195 3195
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3150 2700 3150 3150
-6
6 3780 2655 3870 3195
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 2700 3825 3150
-6
4 1 0 100 0 18 26 0.0000 4 300 525 3510 3060 R:r\001
4 1 4 100 0 18 14 0.0000 4 210 270 3015 2655 [1]\001
4 1 4 100 0 18 14 0.0000 4 210 270 3960 2655 [2]\001
4 1 4 100 0 18 18 0.0000 4 270 1275 1080 3015 SS:[conc]\001
4 1 4 100 0 18 18 0.0000 4 270 1605 6120 3015 SS:[thermal]\001

Deleted mttroot/mtt/lib/comp/compound/Chemical/Rate/Rate_cr.r version [1c605288a8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% CR file for rate-of reaction component RATE

OPERATOR Rate;

% Reaction rate
FOR ALL k,q,h,n,Conc,Temp LET
    Rate(k,q,h,n,flow,1,
         Conc,effort,1,
	 Temp,effort,2
	 ) 
	 = k*Conc^n*e^(-q/Temp);

% Heat
FOR ALL k,q,h,n,Conc,Temp LET
    Rate(k,q,h,n,flow,2,
         Conc,effort,1,
	 Temp,effort,2
	 ) 
	 = k*Conc^n*h*e^(-q/Temp);

END;

Deleted mttroot/mtt/lib/comp/compound/Chemical/Rate/Rate_desc.tex version [bc57a1e96d].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Rate (Rate_desc.tex)
% Generated by MTT on Tue Mar 14 17:54:06 GMT 2000.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Rate} is
   displayed in Figure \Ref{fig:Rate_abg.ps} and its label
   file is listed in Section \Ref{sec:Rate_lbl}.
   The subsystems are listed in Section \Ref{sec:Rate_sub}.


This component represents rate of reaction equations corresponding to
the chemical reaction:
\begin{equation}
  \text{nA} \rightarrow \text{B}
\end{equation}
The relevant equations are
\begin{equation}
  \begin{align}
     \frac{dc_a}{dt} &= k_a c_a^n e^{-\frac{q_a}{T}} \tag{Rate of reaction}\\
     Q &= h_a k_a c_a^n e^{-\frac{q_a}{T}} \tag{Heat of reaction}
  \end{align}
\end{equation}
where $\frac{dc_a}{dt}$ is the rate of change of concentration of
species A and $Q$ is the corresponding heat generated.

Deleted mttroot/mtt/lib/comp/compound/Chemical/Rate/Rate_lbl.txt version [2898cd6073].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Rate (Rate_lbl.txt)
%SUMMARY Rate
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	conc
%ALIAS	out	thermal

% Argument aliases
%ALIAS	$1	k,q,h,n

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	r	 Rate	k,q,h,n

% Component type SS
	[conc]		SS		external,external
	[thermal]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Control/Collocated/PDe/PDe_abg.fig version [2d2d27440d].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1575 3375 2925 3375 2700 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 3375 4725 3375 4500 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 3150 4950 1800 5175 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5175 3375 6525 3375 6300 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 3150 3150 1800 3375 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6525 3150 6525 3600
2 4 0 2 31 7 51 0 -1 0.000 0 0 7 0 0 5
	 7875 4275 7875 900 450 900 450 4275 7875 4275
4 1 0 100 0 18 18 0.0000 4 195 150 3150 3465 0\001
4 1 0 100 0 18 18 0.0000 4 195 150 4950 3465 1\001
4 2 4 100 0 18 18 0.0000 4 270 870 1530 3465 SS:[in]\001
4 0 4 100 0 18 18 0.0000 4 270 1065 6660 3465 SS:[out]\001
4 1 0 100 0 18 18 0.0000 4 270 780 3150 1665 C:k_p\001
4 1 0 100 0 18 18 0.0000 4 270 765 4950 1665 R:k_d\001

Deleted mttroot/mtt/lib/comp/compound/Control/Collocated/PDe/PDe_desc.tex version [69137e29ad].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system PDe (PDe_desc.tex)
% Generated by MTT on Tue May 1 09:26:33 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{PDe} is
   displayed in Figure \Ref{fig:PDe_abg.ps} and its label
   file is listed in Section \Ref{sec:PDe_lbl}.
   The subsystems are listed in Section \Ref{sec:PDe_sub}.

   This is a proportional + derivative (PD) controller for a
   collocated sutuation where the control signal is an effort and the
   measured signal is a (collocated) flow.

   The controller can be thought of as controlling \emph{integated
   flow}, and it is with respect to this that the P and D terms are defined.

 The setpoint is a \emph{flow}; and must be generated to give the
 desired \emph{integrated} flow.

 Physically, the controller is a \textbf{C} and an \textbf{R}
 component - for mechanical systems a mass and a spring.
 
 Mathematically, in integral causality, the equations are:
%file: pde_{dae}.tex
%differential-algebraic equations
 \begin{equation}
   \begin{aligned}
     \dot x_{1} &=
     {
       f_d - f
       }
   \end{aligned}
 \end{equation}
 \begin{equation}
   \begin{aligned}
     u &=
     {
       - k_{d} f + k_{p} x_{1}
       }
   \end{aligned}
 \end{equation}

 The state $x_1$ is the the integrated difference between 
 \emph{desired} flow $f_d$ and the actual flow  $f$. Thus the control
 signal $u$ is $k_p$ multiplied by the position error minus $k_d$ time
 the flow.

Deleted mttroot/mtt/lib/comp/compound/Control/Collocated/PDe/PDe_lbl.txt version [39ef22df22].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system PDe (PDe_lbl.txt)
%SUMMARY PDe: Proportional + Derivative controller with effort output
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	out	out

% Argument aliases
%ALIAS	$1	k_p
%ALIAS	$2	k_d

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	k_p	lin		state,k_p

% Component type R
	k_d	lin		flow,k_d

% Component type SS
	[in]	SS		internal,external
	[out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Electrical/RC/RC_abg.fig version [cd120e33ca].

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

































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 4277 4052 4277 3827 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4502 4277 5402 4277 5177 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 4051 4276 3151 4501 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 4051 5626 3151 5851 3376
2 2 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 3825 585 4725 585 4725 765 3825 765 3825 585
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5400 1215 5850 1215
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3150 675 3825 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4725 675 6750 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5625 675 5625 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5625 1215 5625 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3150 1575 6750 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 4277 6752 4277 6527 4502
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9225 5625 9225 225 900 225 900 5625 9225 5625
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5400 1080 5850 1080
2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 2
	 4050 4050 4050 4500
4 2 4 0 0 0 20 0.0000 4 255 2040 3105 4365 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 4277 4367 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5627 4367 0\001
4 1 -1 0 0 0 20 0.0000 4 195 375 4276 2926 R:r\001
4 1 -1 0 0 0 20 0.0000 4 195 390 5626 2926 C:c\001
4 0 1 1 0 0 20 0.0000 4 135 105 4230 450 r\001
4 0 1 1 0 0 20 0.0000 4 135 120 6030 1215 c\001
4 1 1 1 0 0 20 0.0000 4 255 1350 4950 4995 Bond graph\001
4 1 1 1 0 0 20 0.0000 4 195 1200 4950 2025 Schematic\001
4 0 4 0 0 0 20 0.0000 4 255 2190 6887 4367 SS:[out]\001
4 0 1 1 0 0 20 0.0000 4 135 135 3375 4005 v\001
4 0 1 1 0 0 20 0.0000 4 195 135 3465 4140 1\001
4 0 1 1 0 0 20 0.0000 4 195 75 3375 4590 i\001
4 0 1 1 0 0 20 0.0000 4 195 135 3465 4725 1\001
4 0 1 1 0 0 20 0.0000 4 195 75 6165 4590 i\001
4 0 1 1 0 0 20 0.0000 4 195 135 6255 4725 2\001
4 0 1 1 0 0 20 0.0000 4 135 135 6165 4005 v\001
4 0 1 1 0 0 20 0.0000 4 195 135 6255 4140 2\001
4 0 1 1 0 0 20 0.0000 4 135 135 6660 1170 v\001
4 0 1 1 0 0 20 0.0000 4 195 135 6750 1305 2\001
4 0 1 1 0 0 20 0.0000 4 195 75 6300 450 i\001
4 0 1 1 0 0 20 0.0000 4 195 135 6390 585 2\001
4 0 1 1 0 0 20 0.0000 4 195 75 3375 450 i\001
4 0 1 1 0 0 20 0.0000 4 195 135 3465 585 1\001
4 0 1 1 0 0 20 0.0000 4 135 135 3060 1170 v\001
4 0 1 1 0 0 20 0.0000 4 195 135 3150 1305 1\001

Deleted mttroot/mtt/lib/comp/compound/Electrical/RC/RC_desc.tex version [9f62e42e0f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system RC (RC_desc.tex)
% Generated by MTT on Tue Aug 26 09:43:25 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\textbf{RC} is a Simple two-port RC circuit.  The two ports are [in]
and [out] and the two parameters are c and r respectively

   The acausal bond graph of system \textbf{RC} is
   displayed in Figure \Ref{RC_abg} and its label
   file is listed in Section \Ref{sec:RC_lbl}.
   The subsystems are listed in Section \Ref{sec:RC_sub}.

Deleted mttroot/mtt/lib/comp/compound/Electrical/RC/RC_lbl.txt version [335a38c4b3].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system RC (RC_lbl.txt)
%SUMMARY RC A Simple two-port RC circuit
%DESCRIPTION This simple example is used in the manual.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  2000/09/14 15:13:02  peterg
% %% Changed port CRs to give SISO system when used in isolation
% %%
% %% Revision 1.2  1998/07/27 11:09:36  peterg
% %% Commented the aliases.
% %%
% %% Revision 1.1  1998/07/16 20:16:30  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in	# The left-hand port
%ALIAS	out	out	# The right-hand port

% Argument aliases
%ALIAS	$1	c		# Capacitance
%ALIAS	$2	r		# Resistance

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	c		lin	effort,c

% Component type R
	r		lin	flow,r

% Component type SS
	[in]		SS		external,internal
	[out]	SS		external,0

Deleted mttroot/mtt/lib/comp/compound/Electrical/Tee/Tee_abg.fig version [5395f8e35a].

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
68
69
70
71
72
73
74
75
76
77
78
79















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 2250 765 3375 765 3375 1035 2250 1035 2250 765
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4275 1575 5175 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4275 1800 5175 1800
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	2 1 2.00 120.00 240.00
	 1350 900 2250 900
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	2 1 2.00 120.00 240.00
	 4725 900 4725 1575
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 5850 765 6975 765 6975 1035 5850 1035 5850 765
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	2 1 2.00 120.00 240.00
	 3375 900 4725 900
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	2 1 2.00 120.00 240.00
	 5805 900 4725 900
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	2 1 2.00 120.00 240.00
	 8100 900 6975 900
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 3
	 4725 1800 4725 2475 1350 2475
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 3
	 4725 2475 8100 2475 8100 2430
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 6076 4501 6076 4276 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 5851 2926 4501 3151 4726
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8100 6077 6750 6077 6975 6302
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 6077 4950 6077 5175 6302
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 5852 6525 4502 6750 4727
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 4501 4951 4726
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9226 6976 226 6976 226 3826 9226 3826 9226 6976
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9225 3375 225 3375 225 225 9225 225 9225 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 6075 2700 6075 2475 6300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 5850 2700 6300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6750 5850 6750 6300
4 1 1 1 0 3 20 0.0000 4 270 465 1350 1710 u_1\001
4 1 1 1 0 3 20 0.0000 4 270 465 8145 1710 u_2\001
4 1 1 1 0 3 20 0.0000 4 285 420 1800 675 y_1\001
4 1 1 1 0 3 20 0.0000 4 285 420 7830 720 y_2\001
4 1 1 1 0 3 20 0.0000 4 285 420 7695 6345 y_2\001
4 1 1 1 0 3 20 0.0000 4 270 465 7650 5940 u_2\001
4 1 -1 0 0 2 20 0.0000 4 210 150 4726 6166 0\001
4 1 -1 0 0 2 20 0.0000 4 210 150 2926 6166 1\001
4 1 -1 0 0 2 20 0.0000 4 285 720 2926 4366 R:r_1\001
4 1 -1 0 0 2 20 0.0000 4 210 150 6525 6167 1\001
4 1 -1 0 0 2 20 0.0000 4 285 720 6525 4367 R:r_2\001
4 1 -1 0 0 2 20 0.0000 4 210 420 4726 4366 C:c\001
4 1 1 1 0 3 20 0.0000 4 210 1335 4680 3060 Schematic\001
4 1 1 1 0 3 20 0.0000 4 285 1470 4725 6705 Bond graph\001
4 1 1 1 0 3 20 0.0000 4 270 390 2835 1350 r_1\001
4 1 1 1 0 3 20 0.0000 4 270 390 6345 1350 r_2\001
4 1 1 1 0 3 20 0.0000 4 135 135 3870 1800 c\001
4 1 1 1 0 3 20 0.0000 4 270 465 1980 5940 u_1\001
4 1 1 1 0 3 20 0.0000 4 285 420 1980 6390 y_1\001
4 1 4 0 0 2 20 0.0000 4 285 1050 765 6165 SS:[e_1]\001
4 1 4 0 0 2 20 0.0000 4 285 1050 8640 6165 SS:[e_2]\001

Deleted mttroot/mtt/lib/comp/compound/Electrical/Tee/Tee_desc.tex version [296908f279].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Tee (Tee_desc.tex)
% Generated by MTT on Fri Mar 13 16:28:54 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Tee} is
   displayed in Figure \Ref{Tee_abg} and its label
   file is listed in Section \Ref{sec:Tee_lbl}.

This simple ``tee'' RC circuit has two ports:
\begin{itemize}
\item Port [1] carrying $v_1$ and $i_1$ and
\item Port [2] carrying $v_2$ and $i_2$.
\end{itemize}


%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Electrical/Tee/Tee_lbl.txt version [f80b44db39].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Tee	Electrical T circuit
%DESCRIPTION A two port circuit composed of 2 resistors and one
%DESCRIPTION capacitor in a T form,

%% Label file for system Tee (Tee_lbl.txt)

%ALIAS	$1	r_1
%ALIAS	$2	r_2
%ALIAS	$3	c

%ALIAS	in	e_1
%ALIAS	out	e_2

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1999/12/16 22:21:09  peterg
% %% Changed port names
% %%
% %% Revision 1.1  1998/07/16 16:30:41  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c		lin	effort,c

% Component type R
	r_1		lin	flow,r_1
	r_2		lin	flow,r_2

% Component type SS
	[e_1]		SS	external,external
	[e_2]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Electromechanical/CM/CM_abg.fig version [6ad47bab15].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 4050 5175 2700 5400 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 2250 5175 900 5400 1125
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 2475 6750 2475 6525 2700
2 2 0 3 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 7650 2025 2700 2025 2700 2925 7650 2925 7650 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 5850 5175 4500 5400 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 7680 5175 6330 5400 6555
2 2 0 3 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 7650 5625 2700 5625 2700 6525 7650 6525 7650 5625
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6750 2250 6750 2700
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 2700 5400 2700
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 5850 5400 5850
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 8325 8325 450 2025 450 2025 8325 8325 8325
4 1 4 0 0 0 20 0.0000 4 240 960 5175 810 SS:[out]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 2565 1\001
4 1 -1 0 0 0 20 0.0000 4 195 1485 5175 4365 C:transducer\001
4 0 -1 0 0 0 20 0.0000 4 195 735 6840 2565 I:mass\001
4 0 1 1 0 0 20 0.0000 4 255 885 2880 2340 Moving\001
4 0 1 1 0 0 20 0.0000 4 195 585 2880 2670 Plate\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 6165 1\001
4 1 4 0 0 0 20 0.0000 4 240 810 5175 8055 SS:[in]\001
4 0 1 1 0 0 20 0.0000 4 195 585 2880 6315 Plate\001
4 0 1 1 0 0 20 0.0000 4 195 630 2880 5940 Fixed\001

Deleted mttroot/mtt/lib/comp/compound/Electromechanical/CM/CM_desc.tex version [0b7d49b6d5].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system CM (CM_desc.tex)
% Generated by MTT on Fri Sep 19 18:07:12 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{CM} is
   displayed in Figure \Ref{CM_abg} and its label
   file is listed in Section \Ref{sec:CM_lbl}.
   The subsystems are listed in Section \Ref{sec:CM_sub}.

{\bf CM} is an electromechanical moving-plate  capacitor with linear
electrical capacitance $c$ of the form
\begin{equation}
  c = c_0 \frac{x_0}{x}
\end{equation}
where $x_0$ is the plate separation corresponding to a capacitance of
$c_0$.
The corresponding electrical constitutive relationship (which gives an
energy-conserving two-port \textbf{C}) is
\begin{equation}
  F = Q c_0 \frac{x_0}{x^2}
\end{equation}
where $F$ is the force between the plates and $Q$ the charge on the
capacitor.
This is implemented in the \emph{cm.cr} Constitutive Relationship.

Deleted mttroot/mtt/lib/comp/compound/Electromechanical/CM/CM_lbl.txt version [3db80c8bb3].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CM: Mechanical (moving-plate) capacitor
%DESCRIPTION Parameter 1: Capacitance at plate separation of x_0
%DESCRIPTION Parameter 2: x_0
%DESCRIPTION Parameter 3: mass of moving-plate

%% Label file for system CM (CM_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	transducer	cm		$1,$2

% Component type I
	mass		lin		flow,$3

% Component type SS
	[in]		SS	external,external
	[out]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Electromechanical/DC/DC_abg.fig version [3c7bbadd09].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 4860 4730 4860 494 2293 494 2293 4730 4860 4730
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2036 2724 3371 2724 3063 2947
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3576 2501 3576 1342 3833 1609
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3782 2724 5116 2724 4808 2947
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3576 2947 3576 4106 3833 3839
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6656 2724 7991 2724 7683 2947
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8196 2546 8196 1386 8453 1654
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8196 2947 8196 4106 8453 3839
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8453 2724 9788 2724 9480 2947
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9480 4730 9480 494 6913 494 6913 4730 9480 4730
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 12150 5175 45 5175 45 316 12150 316 12150 5175
4 2 4 0 0 0 20 0.0000000 4 240 1815 1980 2790 SS:[Electrical]\001
4 1 -1 0 0 0 23 0.0000000 4 240 171 3525 2858 1\001
4 1 -1 0 0 0 23 0.0000000 4 274 1198 5938 2813 GY:k_m\001
4 1 -1 0 0 0 23 0.0000000 4 240 171 8196 2813 1\001
4 1 -1 0 0 0 23 0.0000000 4 274 650 3525 1252 I:l_a\001
4 1 -1 0 0 0 23 0.0000000 4 308 770 8299 1252 I:j_m\001
4 1 -1 0 0 0 23 0.0000000 4 274 770 3628 4463 R:r_a\001
4 1 -1 0 0 0 23 0.0000000 4 274 941 8248 4463 R:b_m\001
4 1 1 1 0 0 23 0.0000000 4 240 1352 3576 5043 Electrical\001
4 1 1 1 0 0 23 0.0000000 4 240 1626 8196 5043 Mechanical\001
4 1 1 1 0 0 23 0.0000000 4 240 736 10404 3170 Shaft\001
4 1 1 1 0 0 23 0.0000000 4 240 1420 1472 3170 Terminals\001
4 0 4 0 0 0 20 0.0000000 4 240 2055 9945 2835 SS:[Mechanical]\001

Deleted mttroot/mtt/lib/comp/compound/Electromechanical/DC/DC_desc.tex version [77c4d38d75].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system DC (DC_desc.tex)
% Generated by MTT on Thu Sep 11 10:09:58 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{DC} is
   displayed in Figure \Ref{DC_abg} and its label
   file is listed in Section \Ref{sec:DC_lbl}.
   The subsystems are listed in Section \Ref{sec:DC_sub}.

   \begin{table}[htbp]
     \begin{center}
       \leavevmode
       \begin{tabular}{|l|l|}
        \hline
        Index & Parameter\\
        \hline
         1 & Motor gain ($k_m$) \\
         2 & Armature inductance ($l_a$) \\
         3 & Armature resistance ($r_a$) \\
         4 & Inertia ($j_m$) \\
         5 & Friction coefficient ($b_m$) \\
        \hline
       \end{tabular}
       \caption{DC motor parameters}
       \label{tab:DC_components}
     \end{center}
   \end{table}
{\bf DC} is a two-port component representing a DC motor. It has the 5
parameters listed in Table \Ref{tab:DC_components}.


Deleted mttroot/mtt/lib/comp/compound/Electromechanical/DC/DC_lbl.txt version [16aaf3fedc].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY DC: DC motor (or generator)

%% Port Alias
%ALIAS in	Electrical
%ALIAS out	Mechanical

%% Unit definition
%UNITS Electrical electrical volt amp
%UNITS Mechanical rotational N*m radians/s

%ALIAS $1	k_m
%ALIAS $2	l_a
%ALIAS $3	r_a
%ALIAS $4	j_m
%ALIAS $5	b_m


%% Label file for system DC (DC_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.6  2000/11/16 09:45:51  peterg
% %% Added unit definitions
% %%
% %% Revision 1.5  1998/07/26 12:49:24  peterg
% %% Corrected some errors
% %%
% %% Revision 1.4  1998/07/26 12:45:33  peterg
% %% Added ports
% %%
% %% Revision 1.3  1998/07/22 12:01:17  peterg
% %% Aliased ports and parameters.
% %%
% %% Revision 1.2  1996/12/04  16:01:42  peterg
% %% Documantation added.
% %%
% %% Revision 1.1  1996/12/04  16:00:56  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Motor gain
k_m	lin	flow,k_m

% Electrical components
%Inductance
l_a	lin	effort,l_a

%Resistance
r_a	lin	flow,r_a

% Mechanical components
%Inertia
j_m	lin	flow,j_m

%Friction
b_m	lin	flow,b_m

% Ports
	[Electrical]	SS	external,external
	[Mechanical]	SS	external,external

Deleted mttroot/mtt/lib/comp/compound/GasDynamics/CG/CG_abg.fig version [302cfd2048].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3600 2700 3600 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2025 4950 2025 4725 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2925 4950 2925 4725 3150
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9675 2250 9675 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1800 2025 3150 2025 2925 2250
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 1800 1800 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
	 7875 2250 7875 900 3375 900 3375 1800 3600 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7425 2475 6075 2475 6300 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9630 2475 8280 2475 8505 2700
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4500 3600 6525 3600
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4725 4500 4725 4500 1350 6525 1350 6525 4725
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 9315 540 8055 900
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8910 4725 8910 1800 6975 1800 6975 4725 8910 4725
4 2 4 0 0 0 20 0.0000 4 240 1185 3510 3015 SS:[mass]\001
4 1 4 0 0 0 20 0.0000 4 240 315 4860 1800 [1]\001
4 1 4 0 0 0 20 0.0000 4 240 315 4860 2745 [2]\001
4 1 -1 0 0 2 30 0.0000 4 405 885 5445 2610 C:cg\001
4 1 -1 0 0 0 20 0.0000 4 255 645 7830 2565 PS:ps\001
4 0 4 0 0 0 20 0.0000 4 240 1920 9855 2565 SS:[mechanical]\001
4 1 4 0 0 0 20 0.0000 4 240 315 6120 2205 [3]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3375 2115 0\001
4 2 4 0 0 0 20 0.0000 4 240 1575 1755 2115 SS:[thermal]\001
4 1 4 0 0 0 20 0.0000 4 240 405 7245 2295 [in]\001
4 0 4 0 0 0 20 0.0000 4 255 885 7965 2160 [power]\001
4 0 4 0 0 0 20 0.0000 4 240 555 8325 2790 [out]\001
4 1 1 1 0 0 20 0.0000 4 255 1050 5490 3915 Enthalpy\001
4 1 1 1 0 0 20 0.0000 4 195 600 5490 4245 Mass\001
4 1 1 1 0 0 20 0.0000 4 195 915 5490 4575 Volume\001
4 1 1 1 0 0 20 0.0000 4 195 135 9405 2295 p\001
4 1 1 1 0 0 20 0.0000 4 255 645 9270 2745 dV/dt\001
4 1 1 1 0 0 20 0.0000 4 255 915 7380 1440 p*dV/dt\001
4 1 1 1 0 0 20 0.0000 4 255 3885 9360 450 Joule's work-enthalpy conversion\001
4 1 1 1 0 0 20 0.0000 4 195 1590 7920 3960 Power Sensor\001
4 1 1 1 0 0 20 0.0000 4 255 1800 7920 4380 Work-enthalpy\001

Deleted mttroot/mtt/lib/comp/compound/GasDynamics/CG/CG_cr.r version [277d0d5c65].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CG	CR two-port C thermal pseudo Bond Graph for gas dynamics


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



OPERATOR CG;

% Port 1 : temperature
FOR ALL c_v,r,Enthalpy,Stored_Mass,Volume
LET CG(c_v,r, effort, 1,
		Enthalpy,state,1,
		Stored_Mass,state,2,
		Volume,state,3)
	 = Enthalpy/(c_v*Stored_Mass);

% Port 2 : Pressure
FOR ALL c_v,r,Enthalpy,Stored_Mass,Volume
LET CG(c_v,r, effort, 2,
		Enthalpy,state,1,
		Stored_Mass,state,2,
		Volume,state,3)
	 = (R/c_v)*(Enthalpy/Volume);

% Port 3 : (Also) Pressure
FOR ALL c_v,r,Enthalpy,Stored_Mass,Volume
LET CG(c_v,r, effort, 3,
		Enthalpy,state,1,
		Stored_Mass,state,2,
		Volume,state,3)
	 = (R/c_v)*(Enthalpy/Volume);

END;;

Deleted mttroot/mtt/lib/comp/compound/GasDynamics/CG/CG_lbl.txt version [ef7e187124].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CG: C component for compressible gas dynamics
%DESCRIPTION Port [Thermal]: Temperature/Enthalpy pseudo bond
%DESCRIPTION Port [Mass]: Pressure/mass-flow pseudo bond
%DESCRIPTION Port [Mechanical]: Pressure/volume flow energy bond
%DESCRIPTION 
%DESCRIPTION Parameter 1: c_v (specific heat at constant volume)
%DESCRIPTION Parameter 2: R   (universal gas constant)
%DESCRIPTION Based on Karnopp, Margolis and Rosenberg: Section 12.4.


%% Label file for system CG (CG_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/03/04 12:06:06  peterg
% %% Renamed CR from GasAccumulator to CG
% %%
% %% Revision 1.1  1997/11/21  17:06:34  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	cg		CG		$1,$2

% Component type PS
	ps		lin		effort,1

% Component type SS
	[mass]			SS	external,external
	[mechanical]		SS	external,external
	[thermal]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/GasDynamics/RG/RG_abg.fig version [9e11c46244].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2925 4950 2925 4725 3150
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4500 3600 6525 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2025 4950 2025 4725 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 2925 7425 2925 7200 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 2025 7425 2025 7200 2250
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4500 4500 4500 4500 1350 6525 1350 6525 4500
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 1800 4950 2250
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 2700 4950 3150
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6075 1800 6075 2250
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6075 2700 6075 3150
4 2 4 0 0 0 20 0.0000 4 255 1545 3510 3015 SS:[mass_in]\001
4 1 1 1 0 0 20 0.0000 4 255 1125 5490 3915 Isentropic\001
4 1 1 1 0 0 20 0.0000 4 195 780 5490 4245 Nozzle\001
4 1 -1 0 0 2 30 0.0000 4 405 885 5535 2520 R:rg\001
4 2 4 0 0 0 20 0.0000 4 255 1935 3510 2115 SS:[thermal_in]\001
4 0 4 0 0 0 20 0.0000 4 255 2085 7515 2115 SS:[thermal_out]\001
4 0 4 0 0 0 20 0.0000 4 255 1695 7515 2970 SS:[mass_out]\001
4 1 4 0 0 0 20 0.0000 4 240 315 4725 1935 [1]\001
4 1 4 0 0 0 20 0.0000 4 240 315 4725 2835 [2]\001
4 1 4 0 0 0 20 0.0000 4 240 315 6300 1935 [3]\001
4 1 4 0 0 0 20 0.0000 4 240 315 6300 2835 [4]\001

Deleted mttroot/mtt/lib/comp/compound/GasDynamics/RG/RG_cr.r version [2b2ce5b134].

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































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY RG	CR for 2 port gas dymanics R: isentropic nozzle


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



OPERATOR RG;

% Port 1 : Enthalpy flow
FOR ALL gamma,R,A,T_u,P_u,T_d,P_d
LET RG(gamma,R,A, flow, 1,
		T_u,effort,1,
		P_u,effort,2,
		T_d,effort,3,
		P_d,effort,4)
	 = A*( P_u/sqrt(T_u) )
           *sqrt( (2*gamma)/(R*(gamma-1)) )
           *sqrt( (P_d/P_u)^(2/gamma) - (P_d/P_u)^((1+gamma)/gamma) )
           *(gamma/(gamma-1))*R*T_u;

% Port 2 : Mass flow
FOR ALL gamma,R,A,T_u,P_u,T_d,P_d
LET RG(gamma,R,A, flow, 2,
		T_u,effort,1,
		P_u,effort,2,
		T_d,effort,3,
		P_d,effort,4)
	 = A*( P_u/sqrt(T_u) )
           *sqrt( (2*gamma)/(R*(gamma-1)) )
           *sqrt( (P_d/P_u)^(2/gamma) - (P_d/P_u)^((1+gamma)/gamma) );

% Port 3 : Enthalpy flow
FOR ALL gamma,R,A,T_u,P_u,T_d,P_d
LET RG(gamma,R,A, flow, 3,
		T_u,effort,1,
		P_u,effort,2,
		T_d,effort,3,
		P_d,effort,4)
	 = A*( P_u/sqrt(T_u) )
           *sqrt( (2*gamma)/(R*(gamma-1)) )
           *sqrt( (P_d/P_u)^(2/gamma) - (P_d/P_u)^((1+gamma)/gamma) )
           *(gamma/(gamma-1))*R*T_u;

% Port 4 : Mass flow
FOR ALL gamma,R,A,T_u,P_u,T_d,P_d
LET RG(gamma,R,A, flow, 4,
		T_u,effort,1,
		P_u,effort,2,
		T_d,effort,3,
		P_d,effort,4)
	 = A*( P_u/sqrt(T_u) )
           *sqrt( (2*gamma)/(R*(gamma-1)) )
           *sqrt( (P_d/P_u)^(2/gamma) - (P_d/P_u)^((1+gamma)/gamma) );


END;;

Deleted mttroot/mtt/lib/comp/compound/GasDynamics/RG/RG_lbl.txt version [4f6435da35].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY RG: R component for compressible gas dynamics: isentropic nozzle
%DESCRIPTION Port [Thermal_in]: Temperature/Enthalpy pseudo bond
%DESCRIPTION Port [Thermal_out]: Temperature/Enthalpy pseudo bond
%DESCRIPTION Port [Mass_in]: Pressure/mass-flow pseudo bond
%DESCRIPTION Port [Mass_out]: Pressure/mass-flow pseudo bond
%DESCRIPTION 
%DESCRIPTION Parameter 1: gamma (c_p/c_v)
%DESCRIPTION Parameter 2: R   (universal gas constant)
%DESCRIPTION Parameter 3: A   (nozzle cross-section)
%DESCRIPTION Based on Karnopp, Margolis and Rosenberg: Section 12.4.



%% Label file for system RG (RG_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/03/04 12:07:37  peterg
% %% Renamed CR from Isentropic nozzle to RG
% %%
% %% Revision 1.1  1997/11/21 19:18:28  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type RG
	rg			RG		$1,$2,$3

% Component type SS
	[mass_in]		SS	external,external
	[mass_out]		SS	external,external
	[thermal_in]		SS	external,external
	[thermal_out]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/General/AEf/AEf_abg.fig version [2bb474d90c].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1350 2475 2475 2475 2250 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3397 2497 4522 2497 4297 2722
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5197 2475 6322 2475 6097 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2475 2250 2475 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4500 2250 4500 2745
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5175 2250 5175 2700
4 1 0 100 0 18 20 0.0000 4 225 675 2880 2610 AE:a\001
4 1 0 100 0 18 20 0.0000 4 225 435 4860 2610 GY\001
4 1 4 100 0 18 20 0.0000 4 285 975 810 2565 SS:[in]\001
4 1 4 100 0 18 20 0.0000 4 285 1170 6975 2610 SS:[out]\001

Deleted mttroot/mtt/lib/comp/compound/General/AEf/AEf_lbl.txt version [bbe1afca10].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system AEf (AEf_lbl.txt)
%SUMMARY AEf  Flow input amplifier with effort output
%DESCRIPTION Made from AE with GY on output

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1999/03/05 08:25:11  peterg
% %% Changed default to lin.
% %%
% %% Revision 1.1  1999/03/04 06:05:46  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	out	out

% Argument aliases
%ALIAS $1	g

% CR aliases
%ALIAS $1	lin


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AF
	a	 lin	g

% Component type SS
	[in]	SS		external,external
	[out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/General/AFe/AFe_abg.fig version [29c3db9edf].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1350 2475 2475 2475 2250 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3397 2497 4522 2497 4297 2722
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5197 2475 6322 2475 6097 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 1350 2250 1350 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3375 2250 3375 2745
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6300 2250 6300 2700
4 1 0 100 0 18 20 0.0000 4 225 660 2880 2610 AF:a\001
4 1 0 100 0 18 20 0.0000 4 225 435 4860 2610 GY\001
4 1 4 100 0 18 20 0.0000 4 285 975 810 2565 SS:[in]\001
4 1 4 100 0 18 20 0.0000 4 285 1170 6975 2610 SS:[out]\001

Deleted mttroot/mtt/lib/comp/compound/General/AFe/AFe_lbl.txt version [b70ba3967b].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system AFe (AFe_lbl.txt)
%SUMMARY AFe  Flow input amplifier with effort output
%DESCRIPTION Made from AF with GY on output

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/03/04 06:05:46  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	out	out

% Argument aliases
%ALIAS $1	g

% CR aliases
%ALIAS $1	lin


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AF
	a	 lin	g

% Component type SS
	[in]	SS		external,external
	[out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/General/CDx/CDx_abg.fig version [94a4ce7f04].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 3150 3150 3150 2925 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 2925 3375 1575 3600 1800
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 3375 3375 4725 3150 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 4950 5175 4950 4950 5175
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 6750 5850 675 5850 675 900 6750 900 6750 5850
4 1 0 100 0 18 18 0.0000 4 210 450 3375 1440 C:c\001
4 1 0 100 0 18 18 0.0000 4 195 150 3375 3240 0\001
4 2 4 100 0 18 18 0.0000 4 270 870 1755 3240 SS:[in]\001
4 1 0 100 0 18 18 0.0000 4 210 615 3330 5085 AE:a\001
4 0 4 100 0 18 18 0.0000 4 270 1065 5310 5040 SS:[out]\001

Deleted mttroot/mtt/lib/comp/compound/General/CDx/CDx_desc.tex version [17fa742049].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system CDx (CDx_desc.tex)
% Generated by MTT on Thu Apr 19 10:28:34 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{CDx} is
   displayed in Figure \Ref{fig:CDx_abg.ps} and its label
   file is listed in Section \Ref{sec:CDx_lbl}.

   This component is a standard compliance except that:
   \begin{itemize}
   \item There is an additional output equal to the integrated flow
     variable
   \item the re is a single parameter $c$ -- the compliance.
   \end{itemize}

Deleted mttroot/mtt/lib/comp/compound/General/CDx/CDx_lbl.txt version [284818d0c6].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system CDx (CDx_lbl.txt)
%SUMMARY CDx: C component with state output
%DESCRIPTION Parameter 1: compliance

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	out	out

% Argument aliases
%ALIAS	$1	c

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AE
	a	lin		c

% Component type C
	c	lin		effort,c

% Component type SS
	[in]	SS		external,external
	[out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/General/CS/CS_abg.fig version [fd0075bfee].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2340 3915 2610 4185
4 1 0 100 0 18 20 0.0000 4 270 195 2475 4185 1\001
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3825 2475 2475 2700 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 5625 2475 4275 2700 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4050 4050 4050 3825 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2700 3825 2700 4275
4 1 0 100 0 18 20 0.0000 4 285 570 2475 2295 C:c\001
4 0 0 100 0 18 20 0.0000 4 360 1185 4185 4185 Se:e_0\001
4 1 4 100 0 18 20 0.0000 4 360 1185 2475 6030 SS:[in]\001

Deleted mttroot/mtt/lib/comp/compound/General/CS/CS_lbl.txt version [831d1fc9fc].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system CS (CS_lbl.txt)
%SUMMARY CS C component with initial state


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in

% Argument aliases
%ALIAS	$1	effort,c
%ALIAS	$2	e_0

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	c		lin	effort,c

% Component type SS
	[in]	 SS	external,external

% Component type Se
	e_0		SS	e_0


Deleted mttroot/mtt/lib/comp/compound/General/CSW/CSW_abg.fig version [06cb19839f].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 2925 2475 1575 2700 1800
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 4770 3600 4770 900 225 900 225 3600 4770 3600
4 1 4 0 0 0 20 0.0000 4 240 810 2475 3240 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 2130 2520 1440 C:MTT_SWITCH\001

Deleted mttroot/mtt/lib/comp/compound/General/CSW/CSW_lbl.txt version [68ae2c8631].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CSW: Switched C component
%DESCRIPTION CSW acts as an C component except when the -s -c option is used.
%DESCRIPTION When the -s -c option is used:
%DESCRIPTION   The component label is used as a variable name (eg Name)
%DESCRIPTION   In the ode simulation:
%DESCRIPTION     Name = 1 implies normal C (closed switch)
%DESCRIPTION     Name = 0 implies state=0 (open switch)
%DESCRIPTION     Name = -1 implies state>0 (Diode)

%ALIAS out	in
%ALIAS $1	lin
%ALIAS $1	effort,c_s

%% Label file for system CSW (CSW_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1997/09/11 09:00:52  peterg
% %% More documentation.
% %%
% %% Revision 1.1  1997/06/16  10:55:20  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1997/06/03 15:26:09  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	MTT_SWITCH		lin	effort,c_s

% Component type SS
	[in]			SS	external,external
  

Deleted mttroot/mtt/lib/comp/compound/General/CX/CX_abg.fig version [64f8bb8a87].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1800 2700 3150 2700 2925 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2700 4950 2700 4725 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 1125 3375 2475 3600 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 3600 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3600 2475 3600 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 2475 1800 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3600 1125 3150 1125
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6075 3600 6075 450 225 450 225 3600 6075 3600
4 1 -1 0 0 22 20 0.0000 4 195 150 3375 2835 0\001
4 1 -1 0 0 22 20 0.0000 4 210 465 5355 2790 C:c\001
4 2 4 0 0 22 20 0.0000 4 270 900 1665 2790 SS:[in]\001
4 1 -1 0 0 22 20 0.0000 4 210 660 3375 990 SS:X\001

Deleted mttroot/mtt/lib/comp/compound/General/CX/CX_lbl.txt version [033763981d].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CX	C component with state i/o
%DESCRIPTION Port [X]: state i/o
%% Label file for system CX (CX_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/04/14 17:06:44  peterg
% %% Input only to SS
% %%
% %% Revision 1.1  1998/04/12 15:21:11  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c		$1	$1

% Component type SS
	X		SS	internal,external


Deleted mttroot/mtt/lib/comp/compound/General/De/De_abg.fig version [19922bcba7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 4 0 2 31 7 99 0 -1 0.000 0 0 7 0 0 5
	 4950 3600 4950 1800 675 1800 675 3600 4950 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3150 2475 3150 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2700 3150 2700 2925 2925
4 0 0 100 0 18 20 0.0000 4 285 660 3285 2790 SS:y\001
4 2 4 100 0 18 20 0.0000 4 285 975 1755 2790 SS:[in]\001

Deleted mttroot/mtt/lib/comp/compound/General/De/De_lbl.txt version [a76762cfae].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system De (De_lbl.txt)
%SUMMARY De Simple effort detector
%DESCRIPTION Simple effort detector constructed from SS with fixed causality

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1999/09/07 03:21:02  peterg
% %% Aliased to out as well as in
% %%
% %% Revision 1.1  1999/03/03 22:02:04  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in|out	in

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[in]	SS		external,external
	y	SS		external,0

Deleted mttroot/mtt/lib/comp/compound/General/Df/Df_abg.fig version [3f6b2d808a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 4 0 2 31 7 99 0 -1 0.000 0 0 7 0 0 5
	 4950 3600 4950 1800 675 1800 675 3600 4950 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2700 3150 2700 2925 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 1800 2475 1800 2925
4 0 0 100 0 18 20 0.0000 4 285 660 3285 2790 SS:y\001
4 2 4 100 0 18 20 0.0000 4 285 975 1755 2790 SS:[port]\001

Deleted mttroot/mtt/lib/comp/compound/General/Df/Df_lbl.txt version [c61ccc3dd4].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Df (Df_lbl.txt)
%SUMMARY Df Simple flow detector
%DESCRIPTION Simple flow detector constructed from SS with fixed causality


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1999/09/07 03:20:34  peterg
% %% Aliased to out as well as in
% %%
% %% Revision 1.1  1999/03/03 22:05:16  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in|out	port

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[port]	SS		external,external
	y	SS		0,external

Deleted mttroot/mtt/lib/comp/compound/General/EMAF/EMAF_abg.fig version [aa727f2728].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1575 3150 2970 3150 2700 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3150 4995 3150 4725 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 3150 8145 3150 7875 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 1080 5850 2475 5580 2205
2 4 0 2 31 7 0 0 -1 0.000 0 0 7 0 0 5
	 10125 4275 10125 225 225 225 225 4275 10125 4275
4 1 -1 0 0 22 20 0.0000 4 210 390 3330 3240 AF\001
4 1 -1 0 0 22 20 0.0000 4 270 1455 5895 3240 EMTF:gain\001
4 2 4 0 0 22 20 0.0000 4 270 900 1485 3240 SS:[in]\001
4 0 4 0 0 22 20 0.0000 4 270 1095 8370 3240 SS:[out]\001
4 1 4 0 0 22 20 0.0000 4 270 1275 5805 945 SS:[mod]\001
4 1 4 0 0 22 20 0.0000 4 270 795 5850 2925 [mod]\001
4 2 4 0 0 22 20 0.0000 4 270 420 4995 2925 [in]\001
4 0 4 0 0 22 20 0.0000 4 270 615 6705 2925 [out]\001

Deleted mttroot/mtt/lib/comp/compound/General/EMAF/EMAF_lbl.txt version [87238e5bdf].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY EMAF Effort-modulated AF component
%DESCRIPTION Ports: [in], [out] and [mod]


%% Label file for system EMAF (EMAF_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type EMTF
	gain		lin		flow

% Component type SS
	[in]	SS	external,external
	[mod]	SS	external,external
	[out]	SS	external,external


Deleted mttroot/mtt/lib/comp/compound/General/INTF/INTF_abg.fig version [e2d23cbb77].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1801 3151 2701 3151 2476 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3376 3151 4276 3151 4051 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 2926 4501 2026 4726 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3151 5626 3151 5401 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6301 3150 7201 3150 6976 3375
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9900 4050 450 4050 450 1350 9900 1350 9900 4050
4 2 4 0 0 0 20 0.0000 4 240 1170 1711 3241 SS:[Flow]\001
4 1 -1 0 0 0 20 0.0000 4 195 375 3016 3241 AF\001
4 1 -1 0 0 0 20 0.0000 4 195 135 4501 3241 0\001
4 1 -1 0 0 0 20 0.0000 4 195 195 4501 1891 C\001
4 1 -1 0 0 0 20 0.0000 4 195 390 5986 3241 AE\001
4 0 4 0 0 0 20 0.0000 4 255 2400 7336 3241 SS:[Integrated_flow]\001

Deleted mttroot/mtt/lib/comp/compound/General/INTF/INTF_desc.tex version [e32749d11c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system INTF (INTF_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:16 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{INTF} is
   displayed in Figure \Ref{INTF_abg} and its label
   file is listed in Section \Ref{sec:INTF_lbl}.
   The subsystems are listed in Section \Ref{sec:INTF_sub}.

\textbf{INTF} is a two-port component where the effort on port [out]
   is the integral of the flow on port [in].

Deleted mttroot/mtt/lib/comp/compound/General/INTF/INTF_lbl.txt version [0fd0a897ef].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system INTF (INTF_lbl.txt)
%SUMMARY	INTF: flow integrator
%DESCRIPTION	Port [in]:	Flow to be integrated
%DESCRIPTION	Port [out]:	Effort = integral of flow on port [in]


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Flow
%ALIAS	out	Integrated_flow

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[Flow]			SS		external,external
	[Integrated_flow]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/General/INTFS/INTFS_abg.fig version [5f89579557].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1801 3151 2701 3151 2476 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3376 3151 4276 3151 4051 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 2926 4501 2026 4726 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3151 5626 3151 5401 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6301 3150 7201 3150 6976 3375
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9900 4050 450 4050 450 1350 9900 1350 9900 4050
4 2 4 0 0 0 20 0.0000 4 240 1170 1711 3241 SS:[Flow]\001
4 1 -1 0 0 0 20 0.0000 4 195 375 3016 3241 AF\001
4 1 -1 0 0 0 20 0.0000 4 195 135 4501 3241 0\001
4 1 -1 0 0 0 20 0.0000 4 195 195 4501 1891 CS:unit\001
4 1 -1 0 0 0 20 0.0000 4 195 390 5986 3241 AE\001
4 0 4 0 0 0 20 0.0000 4 255 2400 7336 3241 SS:[Integrated_flow]\001

Deleted mttroot/mtt/lib/comp/compound/General/INTFS/INTFS_desc.tex version [90ae597362].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system INTF (INTF_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:16 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/08/24 11:20:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{INTFS} is
   displayed in Figure \Ref{INTFS_abg} and its label
   file is listed in Section \Ref{sec:INTFS_lbl}.
   The subsystems are listed in Section \Ref{sec:INTFS_sub}.

\textbf{INTFS} is a two-port component where the effort on port [out]
   is the integral of the flow on port [in]. The single parameter e_0
   is the initial value of the integral.

Deleted mttroot/mtt/lib/comp/compound/General/INTFS/INTFS_lbl.txt version [ec296d4ba1].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system INTF (INTF_lbl.txt)
%SUMMARY	INTFS: flow integrator with explicit initial state
%DESCRIPTION	Port [in]:	Flow to be integrated
%DESCRIPTION	Port [out]:	Effort = integral of flow on port [in]


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/07/16 07:35:10  peterg
% %% Aliased version
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Flow
%ALIAS	out	Integrated_flow

% Argument aliases
%ALIAS	$1	e_0

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type CS
         unit                   lin             effort,1;e_0

% Component type SS
	[Flow]			SS		external,external
	[Integrated_flow]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/General/IS/IS_abg.fig version [308e9156fe].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3825 2475 2475 2700 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 5625 2475 4275 2700 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4050 4050 4050 3825 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 3825 4050 4275
2 4 0 2 31 7 52 0 -1 0.000 0 0 7 0 0 5
	 5625 6570 5625 1575 1350 1575 1350 6570 5625 6570
4 1 0 100 0 18 20 0.0000 4 210 240 2475 2295 I:i\001
4 0 0 100 0 18 20 0.0000 4 270 795 4185 4185 Sf:f_0\001
4 1 4 100 0 18 20 0.0000 4 270 900 2475 6030 SS:[in]\001
4 1 0 100 0 18 20 0.0000 4 195 150 2475 4185 0\001

Deleted mttroot/mtt/lib/comp/compound/General/IS/IS_abg.fig.bak version [833b9d0b1e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2340 3915 2610 4185
4 1 0 100 0 18 20 0.0000 4 270 195 2475 4185 0\001
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3825 2475 2475 2700 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 5625 2475 4275 2700 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4050 4050 4050 3825 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 3825 4050 4275
4 1 0 100 0 18 20 0.0000 4 285 315 2475 2295 I:i\001
4 0 0 100 0 18 20 0.0000 4 360 1035 4185 4185 Sf:f_0\001
4 1 4 100 0 18 20 0.0000 4 360 1185 2475 6030 SS:[in]\001

Deleted mttroot/mtt/lib/comp/compound/General/IS/IS_lbl.txt version [84a7ba47e4].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system IS (IS_lbl.txt)
%SUMMARY IS I component with initial state


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 17:29:11  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in

% Argument aliases
%ALIAS	$1	flow,i
%ALIAS	$2	f_0

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type I
	i		lin	flow,i

% Component type SS
	[in]	 SS	external,external

% Component type Sf
	f_0		SS	f_0


Deleted mttroot/mtt/lib/comp/compound/General/ISW/ISW_abg.fig version [8d8c607b4f].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 2925 2475 1575 2700 1800
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 4770 3600 4770 900 225 900 225 3600 4770 3600
4 1 4 0 0 0 20 0.0000 4 240 810 2475 3240 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 2025 2520 1440 I:MTT_SWITCH\001

Deleted mttroot/mtt/lib/comp/compound/General/ISW/ISW_lbl.txt version [edf1b1d098].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY ISW: Switched I component
%DESCRIPTION ISW acts as an I component except when the -s -c option is used.
%DESCRIPTION When the -s -c option is used:
%DESCRIPTION   The component label is used as a variable name (eg Name)
%DESCRIPTION   In the ode simulation:
%DESCRIPTION     Name = 1 implies normal I (closed switch)
%DESCRIPTION     Name = 0 implies state=0 (open switch)
%DESCRIPTION     Name = -1 implies state>0 (Diode)

%ALIAS out	in
%ALIAS $1	lin
%ALIAS $1	flow,i_s



%% Label file for system ISW (ISW_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/26 12:57:00  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1997/06/03 15:26:09  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	MTT_SWITCH		lin	flow,i_s

% Component type SS
	[in]			SS	external,external

Deleted mttroot/mtt/lib/comp/compound/General/IX/IX_abg.fig version [54cd06823d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1800 2700 3150 2700 2925 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2700 4950 2700 4725 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 1125 3375 2475 3600 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 2475 4950 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 2475 3150 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3555 2475 3105 2475
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 5850 3825 5850 450 225 450 225 3825 5850 3825
4 1 -1 0 0 22 20 0.0000 4 195 150 3375 2835 1\001
4 1 -1 0 0 22 20 0.0000 4 210 240 5355 2790 I:i\001
4 2 4 0 0 22 20 0.0000 4 270 900 1665 2790 SS:[in]\001
4 1 -1 0 0 22 20 0.0000 4 210 660 3375 990 SS:X\001

Deleted mttroot/mtt/lib/comp/compound/General/IX/IX_lbl.txt version [bfe95bf5cf].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY IX   I component with state i/o
%DESCRIPTION Port [X]: state i/o

%% Label file for system IX (IX_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/04/14 17:08:50  peterg
% %% Input only on SS
% %%
% %% Revision 1.1  1998/04/12 15:20:11  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	i		$1	$1

% Component type SS
	X   SS		external,internal

Deleted mttroot/mtt/lib/comp/compound/General/Se/Se_abg.fig version [e603fdc7c3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2700 3150 2700 2925 2925
2 4 0 2 31 7 99 0 -1 0.000 0 0 7 0 0 5
	 4950 3600 4950 1800 675 1800 675 3600 4950 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3150 2475 3150 2925
4 2 0 100 0 18 20 0.0000 4 225 675 1710 2790 SS:u\001
4 0 4 100 0 18 20 0.0000 4 285 1170 3330 2790 SS:[out]\001

Deleted mttroot/mtt/lib/comp/compound/General/Se/Se_lbl.txt version [5203896aa0].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Se (Se_lbl.txt)
%SUMMARY Se Simple effort source
%DESCRIPTION Simple effort source constructed from SS with fixed causality


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1999/03/12 04:04:27  peterg
% %% Single argument - the effort value e_s
% %%
% %% Revision 1.1  1999/03/03 21:55:46  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	out|in	out

% Argument aliases
%ALIAS $1	e_s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[out]	SS		external,external
	u	SS		e_s,internal

Deleted mttroot/mtt/lib/comp/compound/General/Sf/Sf_abg.fig version [94941a3101].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2700 3150 2700 2925 2925
2 4 0 2 31 7 99 0 -1 0.000 0 0 7 0 0 5
	 4950 3600 4950 1800 675 1800 675 3600 4950 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 1800 2475 1800 2925
4 2 0 100 0 18 20 0.0000 4 225 675 1710 2790 SS:u\001
4 0 4 100 0 18 20 0.0000 4 285 1170 3330 2790 SS:[out]\001

Deleted mttroot/mtt/lib/comp/compound/General/Sf/Sf_lbl.txt version [d53eaa0484].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Sf (Sf_lbl.txt)
%SUMMARY Sf Simple flow source
%DESCRIPTION  Simple flow source constructed from SS with fixed causality

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1999/03/12 04:03:09  peterg
% %% Single argument - the value of the flow
% %%
% %% Revision 1.1  1999/03/03 21:50:15  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	out|in	out

% Argument aliases
%ALIAS	   $1	f_s
%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[out]	SS		external,external
	u	SS		internal,f_s

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-1D/BernoulliEuler/BernoulliEuler_abg.fig version [cd07ad3054].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 2250 3825 2250 3600 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 2250 5400 2250 5175 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5850 2250 6975 2250 6750 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 2025 4050 900 4275 1125
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6975 2025 6975 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5625 2475 4950 3150 5175 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4500 3825 4500 3600 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5850 4500 6975 4500 6750 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4500 5400 4500 5175 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 3600 4050 4275 4275 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 4275 3825 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6975 4275 6975 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 2025 3825 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5625 4725 5625 5850 5850 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5850 6075 6975 6075 6750 6300
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5400 6075 4275 6075 4500 6300
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 5850 5400 6300
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 675 225 675 6975 9225 6975 9225 225 675 225
4 2 4 100 0 18 20 0.0000 4 360 1605 2655 4590 SS:[a_in]\001
4 1 0 100 0 18 20 0.0000 4 270 195 4050 2340 1\001
4 1 0 100 0 18 20 0.0000 4 270 195 5625 2340 0\001
4 1 0 100 0 18 20 0.0000 4 285 750 4050 765 I:dm\001
4 0 4 100 0 18 20 0.0000 4 360 1860 7110 2340 SS:[y_out]\001
4 2 4 100 0 18 20 0.0000 4 360 1620 2565 2340 SS:[y_in]\001
4 0 4 100 0 18 20 0.0000 4 360 1845 7065 4590 SS:[a_out]\001
4 1 0 100 0 18 20 0.0000 4 270 195 4050 4590 1\001
4 1 0 100 0 18 20 0.0000 4 270 195 5625 4590 0\001
4 1 0 100 0 18 20 0.0000 4 285 975 4815 3510 TF:dz\001
4 1 1 101 0 32 20 0.0000 4 255 270 4635 4095 W\001
4 1 1 101 0 32 20 0.0000 4 255 945 6345 4950 W+DW\001
4 1 1 101 0 32 20 0.0000 4 255 270 4680 4950 W\001
4 1 1 101 0 32 20 0.0000 4 255 270 3150 4950 W\001
4 1 1 101 0 18 20 0.0000 4 210 210 3150 2610 v\001
4 1 1 101 0 18 20 0.0000 4 210 210 4725 2610 v\001
4 1 1 101 0 18 20 0.0000 4 210 825 6255 2610 v+  v\001
4 1 1 101 0 32 20 0.0000 4 255 225 6390 2610 D\001
4 1 1 101 0 32 20 0.0000 4 255 225 5400 3015 D\001
4 1 1 101 0 18 20 0.0000 4 210 210 5625 3015 v\001
4 1 0 100 0 18 20 0.0000 4 270 195 5625 6210 1\001
4 1 0 100 0 18 20 0.0000 4 285 810 7425 6165 C:dk\001
4 1 0 100 0 18 20 0.0000 4 285 735 3915 6165 R:dr\001

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-1D/BernoulliEuler/BernoulliEuler_desc.tex version [3b42829dc1].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system BernoulliEuler (BernoulliEuler_desc.tex)
% Generated by MTT on Mon Apr 19 06:43:36 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{BernoulliEuler} is
   displayed in Figure \Ref{fig:BernoulliEuler_abg.ps} and its label
   file is listed in Section \Ref{sec:BernoulliEuler_lbl}.
   The subsystems are listed in Section \Ref{sec:BernoulliEuler_sub}.

This component represents one lump of a lumped model of a uniform beam
modelled using the the Bernoulli-Euler assumptions:
\begin{enumerate}
\item The shear forces can be neglected.
\item Rotational inertia can be neglected.
\end{enumerate}

\begin{itemize}
\item The \textbf{I} component represents the inertial properties of
  the lump in the perpendicular direction. In particular the velocity
  of the lump $v$ is:
  \begin{equation}
    \dot v = \frac{\Delta f}{\Delta m}
  \end{equation}
  where $\Delta m$ is the lump mass and $\Delta f$ is the net vertical
  force.
\item The \textbf{C} component represents the angular stiffness of the
  lump. In particular the torque acting on the lump is:
  \begin{equation}
    \dot \tau =  \Delta k \Delta \Omega
  \end{equation}
  where $\Delta k$ is the lump (angular) stiffness and $\Delta \Omega$
  is the net angular velocity.
\item The \textbf{TF} component represents the relation between the
  angular domains
  \begin{equation}
    \begin{align}
      \tau &= \Delta x \Delta f \\
      \Delta v &= \Delta x \Omega 
    \end{align}
  \end{equation}
\end{itemize}

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-1D/BernoulliEuler/BernoulliEuler_lbl.txt version [feefcf8c9f].

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

































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system BernoulliEuler (BernoulliEuler_lbl.txt)
%SUMMARY BernoulliEuler
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.4  1999/10/13 07:01:58  peterg
% %% Added aliases:
% %% 	a_in	theta_in
% %% 	a_out	theta_out
% %%
% %% Revision 1.3  1999/09/02 03:07:16  peterg
% %% r_d --> dr
% %%
% %% Revision 1.2  1999/05/17 21:27:05  peterg
% %% Added damping
% %%
% %% Revision 1.1  1999/05/16 07:12:40  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	theta_in        a_in
%ALIAS	theta_out	a_out
%ALIAS	in	y_in,a_in
%ALIAS	out	y_out,a_out

% Argument aliases
%ALIAS	$1	dk
%ALIAS	$2	dm
%ALIAS	$3	dz
%ALIAS	$4	dr

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type I
	dm		lin	flow,dm

% Component type C
	dk		lin	state,dk

% Component type R
	dr		lin	flow,dr

% Component type SS
	[y_in]	SS			external,external
	[y_out]	SS			external,external
	[a_in]	SS			external,external
	[a_out]	SS			external,external

% Component type TF
	dz		lin	effort,dz



Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-1D/pBernoulliEuler/pBernoulliEuler_abg.fig version [46ea19b5b6].

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



































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 2250 3825 2250 3600 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 2250 5400 2250 5175 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5850 2250 6975 2250 6750 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 2025 4050 900 4275 1125
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6975 2025 6975 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5625 2475 4950 3150 5175 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4500 3825 4500 3600 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5850 4500 6975 4500 6750 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4500 5400 4500 5175 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5625 4725 5625 5850 5850 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 3600 4050 4275 4275 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 4275 3825 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6975 4275 6975 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 2025 3825 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 6075 5400 6075 5175 6300
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5850 6075 6975 6075 6750 6300
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5625 6300 5625 7425 5850 7200
4 2 4 100 0 18 20 0.0000 4 285 1860 2655 4590 SS:[theta_in]\001
4 1 0 100 0 18 20 0.0000 4 210 165 4050 2340 1\001
4 1 0 100 0 18 20 0.0000 4 210 165 5625 2340 0\001
4 1 0 100 0 18 20 0.0000 4 225 645 4050 765 I:dm\001
4 0 4 100 0 18 20 0.0000 4 285 1500 7110 2340 SS:[y_out]\001
4 2 4 100 0 18 20 0.0000 4 285 1305 2565 2340 SS:[y_in]\001
4 0 4 100 0 18 20 0.0000 4 285 2055 7065 4590 SS:[theta_out]\001
4 1 0 100 0 18 20 0.0000 4 210 165 4050 4590 1\001
4 1 0 100 0 18 20 0.0000 4 210 165 5625 4590 0\001
4 1 0 100 0 18 20 0.0000 4 225 795 4815 3510 TF:dz\001
4 1 1 101 0 32 20 0.0000 4 210 225 4635 4095 W\001
4 1 1 101 0 32 20 0.0000 4 210 795 6345 4950 W+DW\001
4 1 1 101 0 32 20 0.0000 4 210 225 4680 4950 W\001
4 1 1 101 0 32 20 0.0000 4 210 225 3150 4950 W\001
4 1 1 101 0 18 20 0.0000 4 165 165 3150 2610 v\001
4 1 1 101 0 18 20 0.0000 4 165 165 4725 2610 v\001
4 1 1 101 0 18 20 0.0000 4 165 690 6255 2610 v+  v\001
4 1 1 101 0 32 20 0.0000 4 210 180 6390 2610 D\001
4 1 1 101 0 32 20 0.0000 4 210 180 5400 3015 D\001
4 1 1 101 0 18 20 0.0000 4 165 165 5625 3015 v\001
4 1 0 100 0 18 20 0.0000 4 210 165 5625 6165 1\001
4 1 0 100 0 18 20 0.0000 4 225 660 7380 6165 C:dk\001
4 2 4 100 0 18 20 0.0000 4 300 1500 4230 6165 SS:[patch]\001
4 1 0 100 0 18 20 0.0000 4 285 780 5625 7785 R:dr\001

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-1D/pBernoulliEuler/pBernoulliEuler_desc.tex version [57ba85e4c4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system pBernoulliEuler (pBernoulliEuler_desc.tex)
% Generated by MTT on Mon Apr 19 06:43:36 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{pBernoulliEuler} is
   displayed in Figure \Ref{fig:pBernoulliEuler_abg.ps} and its label
   file is listed in Section \Ref{sec:pBernoulliEuler_lbl}.
   The subsystems are listed in Section \Ref{sec:pBernoulliEuler_sub}.

This is identical to component  \textbf{pBernoulliEuler} except that a
\emph{piezoelectric patch} is included. This provides:
\begin{enumerate}
\item an moment-generating \emph{actuator} and
\item a curvature \emph{sensor}.
\end{enumerate}

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-1D/pBernoulliEuler/pBernoulliEuler_lbl.txt version [41b616876c].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system pBernoulliEuler (pBernoulliEuler_lbl.txt)
%SUMMARY pBernoulliEuler
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1999/05/17 21:27:39  peterg
% %% Added damping
% %%
% %% Revision 1.2  1999/05/16 21:31:48  peterg
% %% Renamed SS to patch
% %%
% %% Revision 1.1  1999/05/16 21:08:13  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in		y_in,theta_in
%ALIAS	out		y_out,theta_out
%ALIAS	torque		patch
%ALIAS	curvature	patch


% Argument aliases
%ALIAS	$1	dk
%ALIAS	$2	dm
%ALIAS	$3	dz
%ALIAS	$4	dr

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type I
	dm		lin	flow,dm

% Component type C
	dk		lin	state,dk

% Component type R
	dr		lin	flow,dr

% Component type SS
	[y_in]		SS		external,external
	[y_out]		SS		external,external
	[theta_in]	SS		external,external
	[theta_out]	SS		external,external
	[patch]		SS		external,external

% Component type TF
	dz		lin	effort,dz

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/ACCEL/ACCEL_abg.fig version [dd7f638975].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2027 2252 3377 2252 3152 2477
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3827 2252 5177 2252 4952 2477
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 2026 3601 676 3826 901
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 2250 7200 2250 6975 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3375 2025 3375 2475
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 3375 9450 45 225 45 225 3375 9450 3375
4 1 -1 0 0 0 20 0.0000 4 195 135 3602 2387 1\001
4 1 -1 0 0 0 20 0.0000 4 195 90 3601 541 I\001
4 1 -1 0 0 0 20 0.0000 4 195 375 5535 2340 AF\001
4 1 24 0 0 0 20 0.0000 4 195 1050 1440 2340 SS:Force\001
4 0 24 0 0 0 20 0.0000 4 240 2040 7290 2340 SS:[Acceleration]\001

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/ACCEL/ACCEL_lbl.txt version [b37dd224aa].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY ACCEL: Provides a acceleration (useful for simulating gravity. 
%DESCRIPTION Useful for simulating gravity as explaned in Section 10.9
%DESCRIPTION of "Metamodelling".

%ALIAS in|out	Acceleration

%% Label file for system ACCEL (ACCEL_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/07/27 06:50:41  peterg
% %% *** empty log message ***
% %%
% %% Revision 1.2  1998/07/27 06:49:57  peterg
% %% Added blank line at end
% %%
% %% Revision 1.1  1998/07/27 06:47:32  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

% SS components
	Force		SS	external,internal
	[Acceleration]	SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/ROD/ROD_abg.fig version [d3f04d99de].

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
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

























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
4 1 -1 0 0 0 20 0.0000 4 195 135 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000 4 195 270 6933 5268 I:J\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000 4 255 660 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000 4 255 660 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000 4 195 135 3603 5313 0\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 585 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000 4 195 960 4681 5266 INTF:th\001
4 1 1 1 0 0 20 0.0000 4 195 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000 4 135 180 5580 9990 a\001
4 1 1 1 0 0 20 0.0000 4 195 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 345 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000 4 210 345 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000 4 255 1950 2971 1216 SS:[xTip_a]\001
4 1 4 0 0 0 20 0.0000 4 255 1950 2971 9361 SS:[xTip_b]\001
4 1 4 0 0 0 20 0.0000 4 255 1950 8372 1217 SS:[yTip_a]\001
4 1 4 0 0 0 20 0.0000 4 255 1950 8417 9362 SS:[yTip_b]\001
4 1 4 0 0 0 20 0.0000 4 255 2700 5671 1216 SS:[angularTip_a]\001
4 1 4 0 0 0 20 0.0000 4 255 2700 5671 9361 SS:[angularTip_b]\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000 4 195 1380 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 9855 Tip b\001

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/ROD/ROD_desc.tex version [740b974979].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system ROD (ROD_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ROD} is
   displayed in Figure \Ref{ROD_abg} and its label
   file is listed in Section \Ref{sec:ROD_lbl}.
   The subsystems are listed in Section \Ref{sec:ROD_sub}.

{\bf ROD} is essentially as described in Figure 10.2 of
``Metamodelling''.

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/ROD/ROD_lbl.txt version [15096289b5].

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
68
69
70
71







































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	ROD: rigid rod in two dimensions
%DESCRIPTION	See Section 10.2 of "Metamodelling"

%ALIAS $1	l_a	# length from end a to mass centre
%ALIAS $2	l_b	# length from end b to mass centre
%ALIAS $3	j_m	# inertia about mass centre
%ALIAS $4	m	# mass

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS x_a	xTip_a # Force/velocity at tip a in x direction
%ALIAS y_a	yTip_a # Force/velocity at tip a in y direction
%ALIAS alpha_a	angularTip_a # Torque/angular velocity at tip a

%ALIAS x_b	xTip_b # Force/velocity at tip b in x direction
%ALIAS y_b	yTip_b # Force/velocity at tip b in y direction
%ALIAS alpha_b	angularTip_b # Torque/angular velocity at tip b

%ALIAS INTF	General/INTF # The flow integration component.

%% Label file for system ROD (ROD_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.4  1998/07/27 10:51:20  peterg
% %% Aliased INTF as well.
% %%
% %% Revision 1.3  1998/07/27 10:49:10  peterg
% %% Major revision to include aliases etc
% %%
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,j_m
m_x	lin	flow,m
m_y	lin	flow,m

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,l_a
s2	lsin	flow,l_b
c1	lcos	flow,l_a
c2	lcos	flow,l_b

% Component type SS
	[angularTip_a]		SS		external,external
	[angularTip_b]		SS		external,external
	[xTip_a]		SS		external,external
	[xTip_b]		SS		external,external
	[yTip_a]		SS		external,external
	[yTip_b]		SS		external,external


	

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/RODa/RODa_abg.fig version [c92944a808].

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
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
123
124




























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 4950 1800 3375 1800 3600
4 1 -1 0 0 0 20 0.0000 4 195 135 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000 4 195 270 6933 5268 I:J\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000 4 255 660 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000 4 255 660 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000 4 195 135 3603 5313 0\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 585 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000 4 195 960 4681 5266 INTF:th\001
4 1 1 1 0 0 20 0.0000 4 195 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000 4 135 180 5580 9990 a\001
4 1 1 1 0 0 20 0.0000 4 195 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 345 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000 4 210 345 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000 4 255 990 2971 1216 SS:[x_a]\001
4 1 4 0 0 0 20 0.0000 4 255 990 2971 9361 SS:[x_b]\001
4 1 4 0 0 0 20 0.0000 4 255 990 8372 1217 SS:[y_a]\001
4 1 4 0 0 0 20 0.0000 4 255 990 8417 9362 SS:[y_b]\001
4 1 4 0 0 0 20 0.0000 4 255 1485 5671 1216 SS:[alpha_a]\001
4 1 4 0 0 0 20 0.0000 4 255 1485 5671 9361 SS:[alpha_b]\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000 4 195 1380 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 9855 Tip b\001
4 1 4 0 0 0 20 0.0000 4 255 1215 1756 3286 SS:[alpha]\001

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/RODa/RODa_desc.tex version [7d0c260ed2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system RODa (RODa_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/08/15  09:41:19  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{RODa} is
   displayed in Figure \Ref{RODa_abg} and its label
   file is listed in Section \Ref{sec:RODa_lbl}.
   The subsystems are listed in Section \Ref{sec:RODa_sub}.

{\bf RODa} is essentially as described in Figure 10.2 of
``Metamodelling''. It has an additional port ``[angle]'' to provide
access to the rod angle.

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/RODa/RODa_lbl.txt version [b8547d981b].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	RODa: rigid rod in two dimensions - angle port.
%DESCRIPTION	Port [alpha_a]:	Angular torque/velocity - end a
%DESCRIPTION	Port [alpha_b]:	Angular torque/velocity - end b
%DESCRIPTION	Port [x_a]:	x force/velocity - end a
%DESCRIPTION	Port [x_b]:	x force/velocity - end b
%DESCRIPTION	Port [y_a]:	y force/velocity - end a
%DESCRIPTION	Port [y_b]:	y force/velocity - end b
%DESCRIPTION	Port [alpha]:	rod angle
%DESCRIPTION
%DESCRIPTION	Parameter 1:	length from end 1 to mass centre
%DESCRIPTION	Parameter 2:	length from end 2 to mass centre
%DESCRIPTION	Parameter 3:	inertia about mass centre
%DESCRIPTION	Parameter 4:	mass
%DESCRIPTION	See Section 10.2 of "Metamodelling"


%% Label file for system RODa (RODa_lbl.txt)




% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,$3
m_x	lin	flow,$4
m_y	lin	flow,$4

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,$1
s2	lsin	flow,$2
c1	lcos	flow,$1
c2	lcos	flow,$2



	

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/ROT2/ROT2_abg.fig version [c633f9abaa].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 4905 4500 5805 4275 5805
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3376 7379 4501 6479 4276 6479
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1801 7604 2926 7604 2701 7829
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3376 7604 4501 7604 4276 7829
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 6030 4950 4905 4950 5130
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4950 7155
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 6255 4950 7425 4950 7155
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1800 4680 2925 4680 2700 4905
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1800 6165 2925 6165 2700 6390
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 4680 4500 4680 4275 4905
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5895 4680 7020 4680 6795 4905
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 6255 7200 4905 7200 5130
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 5805 7200 7380 7200 7155
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 7605 6975 7605 6750 7830
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7425 4680 8550 4680 8325 4905
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7425 7605 8550 7605 8325 7830
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 6030 4950 6030 4815 5895
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 6255 4950 6255 4815 6390
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 2554 3028 1317 885
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 2554 3028 4698 1791
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 2566 3016 2566 541
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 2566 3016 5041 3016
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9675 8550 9675 225 225 225 225 8550 9675 8550
4 0 1 1 0 0 20 0.0000 4 135 135 5220 3105 x\001
4 0 1 1 0 0 20 0.0000 4 195 135 2700 585 y\001
4 0 1 1 0 0 20 0.0000 4 195 210 1485 855 Y\001
4 0 1 1 0 0 20 0.0000 4 195 210 4590 1710 X\001
4 0 1 1 0 32 20 0.0000 4 195 150 3420 2880 q\001
4 0 -1 0 0 2 20 0.0000 4 195 135 3060 4770 1\001
4 0 -1 0 0 2 20 0.0000 4 195 135 3060 7695 1\001
4 0 -1 0 0 2 20 0.0000 4 195 135 3015 6255 0\001
4 1 4 0 0 2 16 0.0000 4 210 390 4635 4455 [in]\001
4 1 4 0 0 2 16 0.0000 4 210 390 4635 7965 [in]\001
4 0 -1 0 0 2 20 0.0000 4 195 135 7155 4770 0\001
4 0 -1 0 0 2 20 0.0000 4 195 135 7110 7740 0\001
4 1 -1 0 0 2 20 0.0000 4 195 1260 5175 4770 EMTF:xX\001
4 1 -1 0 0 2 20 0.0000 4 195 1260 5175 5850 EMTF:xY\001
4 1 -1 0 0 2 20 0.0000 4 255 1260 5220 6615 EMTF:yX\001
4 1 -1 0 0 2 20 0.0000 4 255 1260 5175 7695 EMTF:yY\001
4 1 4 0 0 2 16 0.0000 4 210 525 5760 4455 [out]\001
4 1 4 0 0 2 16 0.0000 4 210 525 5760 7965 [out]\001
4 1 4 0 0 2 16 0.0000 4 210 390 4635 6795 [in]\001
4 1 4 0 0 2 16 0.0000 4 210 390 4545 5625 [in]\001
4 1 4 0 0 2 16 0.0000 4 210 525 5940 5625 [out]\001
4 1 4 0 0 2 16 0.0000 4 210 525 5985 6795 [out]\001
4 0 4 0 0 2 16 0.0000 4 210 630 5040 7335 [mod]\001
4 0 4 0 0 2 16 0.0000 4 210 630 5085 6075 [mod]\001
4 0 4 0 0 2 16 0.0000 4 210 630 5085 6300 [mod]\001
4 0 4 0 0 2 16 0.0000 4 210 630 5040 5040 [mod]\001
4 2 4 0 0 2 20 0.0000 4 240 1215 1710 6255 SS:[theta]\001
4 2 4 0 0 2 20 0.0000 4 240 795 1665 4770 SS:[X]\001
4 2 4 0 0 2 20 0.0000 4 240 795 1710 7695 SS:[Y]\001
4 0 4 0 0 2 20 0.0000 4 240 720 8640 4770 SS:[x]\001
4 0 4 0 0 2 20 0.0000 4 255 720 8685 7695 SS:[y]\001

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/ROT2/ROT2_desc.tex version [0a474d35c1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system ROT2 (ROT2_desc.tex)
% Generated by MTT on Fri Aug 15 21:09:17 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ROT2} is
   displayed in Figure \Ref{ROT2_abg} and its label
   file is listed in Section \Ref{sec:ROT2_lbl}.
   The subsystems are listed in Section \Ref{sec:ROT2_sub}.

\textbf{ROT2} implements a 2D rotational {\em transformation\/} in
terms of a set of {\em transformers}. A flow expressed in the $XY$
coordinates of Figure \Ref{ROT2_abg} is transformed by \textbf{ROT2}
into the coordinates of $xy$. The corresponding (energy conserving)
effort transformation is implied by \textbf{ROT2}.

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/ROT2/ROT2_lbl.txt version [46532336fd].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY ROT2: 2D rotational transformer
%DESCRIPTION {ROT2} implements a 2D rotational transformation in terms
%DESCRIPTION of a set of transformers. A flow expressed in the X-Y
%DESCRIPTION coordinates is transformed by ROT2 into the coordinates
%DESCRIPTION of x-y. The corresponding (energy conserving) effort
%DESCRIPTION transformation is implied.
%DESCRIPTION Ports X and Y correspond to the old coordinate system
%DESCRIPTION Ports x and y correspond to the new coordinate system
%DESCRIPTION Port theta is the angle of XY with respect to xy.

%% Label file for system ROT2 (ROT2_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type EMTF
	xX		lcos	flow,1
	xY		lsin	flow,1
	yX		lsin	flow,-1
	yY		lcos	flow,1

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gROD/ROD_desc.tex version [740b974979].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system ROD (ROD_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ROD} is
   displayed in Figure \Ref{ROD_abg} and its label
   file is listed in Section \Ref{sec:ROD_lbl}.
   The subsystems are listed in Section \Ref{sec:ROD_sub}.

{\bf ROD} is essentially as described in Figure 10.2 of
``Metamodelling''.

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gROD/ROD_lbl.txt version [15096289b5].

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
68
69
70
71







































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	ROD: rigid rod in two dimensions
%DESCRIPTION	See Section 10.2 of "Metamodelling"

%ALIAS $1	l_a	# length from end a to mass centre
%ALIAS $2	l_b	# length from end b to mass centre
%ALIAS $3	j_m	# inertia about mass centre
%ALIAS $4	m	# mass

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS x_a	xTip_a # Force/velocity at tip a in x direction
%ALIAS y_a	yTip_a # Force/velocity at tip a in y direction
%ALIAS alpha_a	angularTip_a # Torque/angular velocity at tip a

%ALIAS x_b	xTip_b # Force/velocity at tip b in x direction
%ALIAS y_b	yTip_b # Force/velocity at tip b in y direction
%ALIAS alpha_b	angularTip_b # Torque/angular velocity at tip b

%ALIAS INTF	General/INTF # The flow integration component.

%% Label file for system ROD (ROD_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.4  1998/07/27 10:51:20  peterg
% %% Aliased INTF as well.
% %%
% %% Revision 1.3  1998/07/27 10:49:10  peterg
% %% Major revision to include aliases etc
% %%
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,j_m
m_x	lin	flow,m
m_y	lin	flow,m

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,l_a
s2	lsin	flow,l_b
c1	lcos	flow,l_a
c2	lcos	flow,l_b

% Component type SS
	[angularTip_a]		SS		external,external
	[angularTip_b]		SS		external,external
	[xTip_a]		SS		external,external
	[xTip_b]		SS		external,external
	[yTip_a]		SS		external,external
	[yTip_b]		SS		external,external


	

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gROD/gROD_abg.fig version [923d9d522e].

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
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
123
124
125
126






























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8550 5400 9225 6075 8955 6075
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8685 5265 8415 5535
4 1 -1 0 0 0 20 0.0000000 4 210 150 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 315 6933 5268 I:J\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000000 4 270 735 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000000 4 240 735 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000000 4 210 1170 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1170 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000000 4 210 1155 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1155 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000000 4 210 150 3603 5313 0\001
4 1 26 0 0 0 16 0.0000000 4 195 330 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 330 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 570 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000000 4 210 990 4681 5266 INTF:th\001
4 1 1 1 0 0 20 0.0000000 4 210 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000000 4 135 195 5580 9990 a\001
4 1 1 1 0 0 20 0.0000000 4 210 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000000 4 195 570 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000000 4 195 570 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000000 4 195 570 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000000 4 195 330 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000000 4 195 330 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000000 4 270 1485 2971 1216 SS:[xTip_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 1500 2971 9361 SS:[xTip_b]\001
4 1 4 0 0 0 20 0.0000000 4 270 1485 8372 1217 SS:[yTip_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 1500 8417 9362 SS:[yTip_b]\001
4 1 4 0 0 0 20 0.0000000 4 270 2250 5671 1216 SS:[angularTip_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 2265 5671 9361 SS:[angularTip_b]\001
4 1 1 1 0 0 20 0.0000000 4 270 630 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000000 4 240 1470 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000000 4 270 645 1350 9855 Tip b\001
4 1 -1 0 0 0 20 0.0000000 4 270 810 9360 6345 SS:mg\001

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gROD/gROD_desc.tex version [eeabba39d0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system gROD (gROD_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/08/15  09:41:19  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{gROD} is
   displayed in Figure \Ref{gROD_abg} and its label
   file is listed in Section \Ref{sec:gROD_lbl}.
   The subsystems are listed in Section \Ref{sec:gROD_sub}.

{\bf gROD} is essentially as described in Figure 10.2 of
``Metamodelling''.

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gROD/gROD_lbl.txt version [f6f0b2a4c3].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	gROD: rigid rod in two dimensions - with gravity
%DESCRIPTION	See Section 10.2 of "Metamodelling"
%DESCRIPTION	Gravity term added at centre

%ALIAS $1	l_a	# length from end a to mass centre
%ALIAS $2	l_b	# length from end b to mass centre
%ALIAS $3	j_m	# inertia about mass centre
%ALIAS $4	m	# mass
%ALIAS $5	g	# gravity

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS x_a		xTip_a # Force/velocity at tip a in x direction
%ALIAS y_a		yTip_a # Force/velocity at tip a in y direction
%ALIAS alpha_a|a_a	angularTip_a # Torque/angular velocity at tip a

%ALIAS x_b		xTip_b # Force/velocity at tip b in x direction
%ALIAS y_b		yTip_b # Force/velocity at tip b in y direction
%ALIAS alpha_b|a_b	angularTip_b # Torque/angular velocity at tip b

%ALIAS INTF	General/INTF # The flow integration component.

%% Label file for system gROD (gROD_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/11/25 13:55:42  peterg
% %% Added missig attribute field m*g,internal
% %%
% %% Revision 1.1  1998/11/25 10:48:34  peterg
% %% Initial revision
% %%
% %% Revision 1.5  1998/07/27 12:27:27  peterg
% %% Added vector port aliases
% %%
% %% Revision 1.4  1998/07/27 10:51:20  peterg
% %% Aliased INTF as well.
% %%
% %% Revision 1.3  1998/07/27 10:49:10  peterg
% %% Major revision to include aliases etc
% %%
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,j_m
m_x	lin	flow,m
m_y	lin	flow,m

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,l_a
s2	lsin	flow,l_b
c1	lcos	flow,l_a
c2	lcos	flow,l_b

% Component type SS
	mg			SS		m*g,internal
	[angularTip_a]		SS		external,external
	[angularTip_b]		SS		external,external
	[xTip_a]		SS		external,external
	[xTip_b]		SS		external,external
	[yTip_a]		SS		external,external
	[yTip_b]		SS		external,external


	

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gRODa/ROD_desc.tex version [740b974979].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system ROD (ROD_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ROD} is
   displayed in Figure \Ref{ROD_abg} and its label
   file is listed in Section \Ref{sec:ROD_lbl}.
   The subsystems are listed in Section \Ref{sec:ROD_sub}.

{\bf ROD} is essentially as described in Figure 10.2 of
``Metamodelling''.

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gRODa/ROD_lbl.txt version [15096289b5].

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
68
69
70
71







































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	ROD: rigid rod in two dimensions
%DESCRIPTION	See Section 10.2 of "Metamodelling"

%ALIAS $1	l_a	# length from end a to mass centre
%ALIAS $2	l_b	# length from end b to mass centre
%ALIAS $3	j_m	# inertia about mass centre
%ALIAS $4	m	# mass

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS x_a	xTip_a # Force/velocity at tip a in x direction
%ALIAS y_a	yTip_a # Force/velocity at tip a in y direction
%ALIAS alpha_a	angularTip_a # Torque/angular velocity at tip a

%ALIAS x_b	xTip_b # Force/velocity at tip b in x direction
%ALIAS y_b	yTip_b # Force/velocity at tip b in y direction
%ALIAS alpha_b	angularTip_b # Torque/angular velocity at tip b

%ALIAS INTF	General/INTF # The flow integration component.

%% Label file for system ROD (ROD_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.4  1998/07/27 10:51:20  peterg
% %% Aliased INTF as well.
% %%
% %% Revision 1.3  1998/07/27 10:49:10  peterg
% %% Major revision to include aliases etc
% %%
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,j_m
m_x	lin	flow,m
m_y	lin	flow,m

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,l_a
s2	lsin	flow,l_b
c1	lcos	flow,l_a
c2	lcos	flow,l_b

% Component type SS
	[angularTip_a]		SS		external,external
	[angularTip_b]		SS		external,external
	[xTip_a]		SS		external,external
	[xTip_b]		SS		external,external
	[yTip_a]		SS		external,external
	[yTip_b]		SS		external,external


	

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gRODa/gROD_lbl.txt version [f6f0b2a4c3].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	gROD: rigid rod in two dimensions - with gravity
%DESCRIPTION	See Section 10.2 of "Metamodelling"
%DESCRIPTION	Gravity term added at centre

%ALIAS $1	l_a	# length from end a to mass centre
%ALIAS $2	l_b	# length from end b to mass centre
%ALIAS $3	j_m	# inertia about mass centre
%ALIAS $4	m	# mass
%ALIAS $5	g	# gravity

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS x_a		xTip_a # Force/velocity at tip a in x direction
%ALIAS y_a		yTip_a # Force/velocity at tip a in y direction
%ALIAS alpha_a|a_a	angularTip_a # Torque/angular velocity at tip a

%ALIAS x_b		xTip_b # Force/velocity at tip b in x direction
%ALIAS y_b		yTip_b # Force/velocity at tip b in y direction
%ALIAS alpha_b|a_b	angularTip_b # Torque/angular velocity at tip b

%ALIAS INTF	General/INTF # The flow integration component.

%% Label file for system gROD (gROD_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/11/25 13:55:42  peterg
% %% Added missig attribute field m*g,internal
% %%
% %% Revision 1.1  1998/11/25 10:48:34  peterg
% %% Initial revision
% %%
% %% Revision 1.5  1998/07/27 12:27:27  peterg
% %% Added vector port aliases
% %%
% %% Revision 1.4  1998/07/27 10:51:20  peterg
% %% Aliased INTF as well.
% %%
% %% Revision 1.3  1998/07/27 10:49:10  peterg
% %% Major revision to include aliases etc
% %%
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,j_m
m_x	lin	flow,m
m_y	lin	flow,m

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,l_a
s2	lsin	flow,l_b
c1	lcos	flow,l_a
c2	lcos	flow,l_b

% Component type SS
	mg			SS		m*g,internal
	[angularTip_a]		SS		external,external
	[angularTip_b]		SS		external,external
	[xTip_a]		SS		external,external
	[xTip_b]		SS		external,external
	[yTip_a]		SS		external,external
	[yTip_b]		SS		external,external


	

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gRODa/gRODa_abg.fig version [38a3b778aa].

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
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
123
124
125
126
127
128
129
130
131
132
133





































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8550 5400 9225 6075 8955 6075
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8685 5265 8415 5535
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 5175 2025 3825 2250 3825
4 1 -1 0 0 0 20 0.0000 4 195 135 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000 4 195 270 6933 5268 I:J\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000 4 255 660 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000 4 255 660 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000 4 195 135 3603 5313 0\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 585 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000 4 195 960 4681 5266 INTF:th\001
4 1 1 1 0 0 20 0.0000 4 195 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000 4 135 180 5580 9990 a\001
4 1 1 1 0 0 20 0.0000 4 195 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 345 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000 4 210 345 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000 4 255 1380 2971 1216 SS:[xTip_a]\001
4 1 4 0 0 0 20 0.0000 4 255 1380 2971 9361 SS:[xTip_b]\001
4 1 4 0 0 0 20 0.0000 4 255 1380 8372 1217 SS:[yTip_a]\001
4 1 4 0 0 0 20 0.0000 4 255 1380 8417 9362 SS:[yTip_b]\001
4 1 4 0 0 0 20 0.0000 4 255 2130 5671 1216 SS:[angularTip_a]\001
4 1 4 0 0 0 20 0.0000 4 255 2130 5671 9361 SS:[angularTip_b]\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000 4 195 1380 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 9855 Tip b\001
4 1 -1 0 0 0 20 0.0000 4 255 720 9360 6345 Se:mg\001
4 2 4 0 0 0 20 0.0000 4 255 1200 1935 3735 SS:[angle]\001

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gRODa/gRODa_desc.tex version [02934dec4e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system gRODa (gRODa_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/08/15  09:41:19  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{gRODa} is
   displayed in Figure \Ref{gRODa_abg} and its label
   file is listed in Section \Ref{sec:gRODa_lbl}.
   The subsystems are listed in Section \Ref{sec:gRODa_sub}.

{\bf gRODa} is essentially as described in Figure 10.2 of
``Metamodelling''.

Deleted mttroot/mtt/lib/comp/compound/Mechanical/Mechanical-2D/gRODa/gRODa_lbl.txt version [66ade3ce45].

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
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


































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	gRODa: rigid rod in two dimensions - with gravity and angle port
%DESCRIPTION	See Section 10.2 of "Metamodelling"
%DESCRIPTION	Gravity term added at centre

%ALIAS $1	l_a	# length from end a to mass centre
%ALIAS $2	l_b	# length from end b to mass centre
%ALIAS $3	j_m	# inertia about mass centre
%ALIAS $4	m	# mass
%ALIAS $5	g	# gravity

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS x_a		xTip_a # Force/velocity at tip a in x direction
%ALIAS y_a		yTip_a # Force/velocity at tip a in y direction
%ALIAS alpha_a|a_a	angularTip_a # Torque/angular velocity at tip a

%ALIAS x_b		xTip_b # Force/velocity at tip b in x direction
%ALIAS y_b		yTip_b # Force/velocity at tip b in y direction
%ALIAS alpha_b|a_b	angularTip_b # Torque/angular velocity at tip b

%ALIAS angle|a		angle	# Angle port

%ALIAS INTF	General/INTF # The flow integration component.

%% Label file for system gRODa (gRODa_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/08/05 08:04:40  peterg
% %% Initial revision
% %%
% %% Revision 1.3  1998/11/30 10:47:53  peterg
% %% Added extra a_a and a_b aliases
% %%
% %% Revision 1.2  1998/11/25 13:55:42  peterg
% %% Added missig attribute field m*g,internal
% %%
% %% Revision 1.1  1998/11/25 10:48:34  peterg
% %% Initial revision
% %%
% %% Revision 1.5  1998/07/27 12:27:27  peterg
% %% Added vector port aliases
% %%
% %% Revision 1.4  1998/07/27 10:51:20  peterg
% %% Aliased INTF as well.
% %%
% %% Revision 1.3  1998/07/27 10:49:10  peterg
% %% Major revision to include aliases etc
% %%
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,j_m
m_x	lin	flow,m
m_y	lin	flow,m

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,l_a
s2	lsin	flow,l_b
c1	lcos	flow,l_a
c2	lcos	flow,l_b


% Component type Se
	mg			SS		m*g


	[angularTip_a]		SS		external,external
	[angularTip_b]		SS		external,external
	[xTip_a]		SS		external,external
	[xTip_b]		SS		external,external
	[yTip_a]		SS		external,external
	[yTip_b]		SS		external,external
	[angle]			SS		external,external


	

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_abg.fig version [ae5896bc2b].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 1800 3825 1800 3600 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 5400 6300 5400 6075 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 9000 3825 9000 3600 9225
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5625 1800 6975 1800 6750 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 5625 4725 6975 4950 6750
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 7425 4725 8775 4950 8550
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5625 9000 6975 9000 6750 9225
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 1575 3825 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6975 1575 6975 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4500 5175 4500 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 8775 3825 9225
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6975 8775 6975 9225
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 8550 9450 1350 9450 1350 1125 8550 1125 8550 9450
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 5175 5905 4220 5905 4539
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 3375 4725 2025 4950 2250
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 5175 4725 3825 4950 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4500 5400 3150 5400 3375 5625
4 1 4 100 0 18 18 0.0000 4 270 1110 1935 1890 SS:[F_1]\001
4 1 0 100 0 18 18 0.0000 4 270 1710 4770 1890 Muscle1:m_1\001
4 1 0 100 0 18 18 0.0000 4 270 840 4770 3690 TF:r_1\001
4 1 0 100 0 18 18 0.0000 4 210 390 6615 5490 I:m\001
4 1 0 100 0 18 18 0.0000 4 270 840 4815 7290 TF:r_2\001
4 1 0 100 0 18 18 0.0000 4 270 1710 4725 9090 Muscle1:m_2\001
4 1 0 100 0 18 18 0.0000 4 270 840 2610 5490 Se:mg\001
4 1 4 100 0 18 14 0.0000 4 210 285 3510 8775 [F]\001
4 1 4 100 0 18 14 0.0000 4 210 285 3510 1530 [F]\001
4 1 0 100 0 18 18 0.0000 4 270 900 7515 1890 De:x_1\001
4 1 0 100 0 18 18 0.0000 4 270 900 7515 9090 De:x_2\001
4 1 0 100 0 18 18 0.0000 4 195 150 4725 5490 1\001
4 1 0 100 0 18 18 0.0000 4 270 915 6075 4140 Df:v_m\001
4 1 4 100 0 18 18 0.0000 4 270 1110 1890 9045 SS:[F_2]\001

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_desc.tex version [1bc6190828].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system LowerLeg1 (LowerLeg1_desc.tex)
% Generated by MTT on Thu Apr 19 10:39:20 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\fig{LowerLeg1_pic}
    {LowerLeg1_pic}
    {0.9}
    {Simple lower-leg model}
   
    A schematic of a simple muscle model with skeleton appears in
    Figure \Ref{fig:LowerLeg1_pic} and the acausal bond graph is
    displayed in Figure \Ref{fig:LowerLeg1_abg.ps} and its label file
    is listed in Section \Ref{sec:LowerLeg1_lbl.txt}.  The subsystems
    are listed in Section \Ref{sec:LowerLeg1_sub}.  The model is a
    rough approximation of the lower leg, knee joint and thigh muscles
    with the lower leg horizontal.

    The components are:
    \begin{description}
    \item[F\_1 and F\_2] the force inputs to the upper and lower muscles
    \item[m\_1 and m\_2] the upper and lower muscles
    \item[r\_1 and r\_2] the transformers reflecting the geometry of the
      muscle attachments
    \item[m] load mass
    \item[mg] force due to gravity.
    \end{description}

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_input.txt version [2ccecdb207].

1
2
3
4
5
6
7
8
9









-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System LowerLeg1, representation input, language txt; 
## File Example2_input.txt; 
## Generated by MTT on Mon Apr 30 10:08:54 BST 2001; 

example2_f_1	= 1.0*((t>2.0)&&(t<4.0)); # On for 2<t<4
example2_f_2	= 1.0*((t>6.0)&&(t<8.0)); # On for 6<t<8

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_lbl.txt version [f4355e21a6].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system LowerLeg1 (LowerLeg1_lbl.txt)
%SUMMARY LowerLeg1: Simple model of lower leg
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type De
	x_1	SS		external
	x_2	SS		external

% Component type Df
	v_m	SS		external

% Component type I
	m	lin		flow,m

% Component type Muscle1
	m_1	lin	        c_1;d_1		
	m_2	lin	        c_2;d_2					

% Component type Se
	mg	SS		m*g

	[F_1]	SS		external,internal
	[F_2]	SS		external,internal

% Component type TF
	r_1	lin		flow,r_1
	r_2	lin		flow,-r_2

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_numpar.txt version [a16fa9b957].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System LowerLeg1, representation numpar, language txt; 
## File Example2_numpar.txt; 
## Generated by MTT on Mon Apr 30 10:18:55 BST 2001; 



c_1	= 1.0; # Default
c_2	= 1.0; # Default
d_1	= 1.0; # Default
d_2	= 1.0; # Default
g	= 0.0; #9.81; # Gravity
m	= 1.0; # kg
r_1	= 1.0; # Default
r_2	= 1.0; # Default

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_pic.fig version [3da360fbf9].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
5 1 0 2 0 7 50 0 -1 0.000 0 1 0 0 1800.000 -821.000 1125 1665 1800 1755 2475 1665
5 1 0 2 0 7 50 0 -1 0.000 0 0 0 0 1800.000 4151.000 1125 1665 1800 1575 2475 1665
5 1 0 2 0 7 50 0 -1 0.000 0 1 0 0 1800.000 349.000 1125 2835 1800 2925 2475 2835
5 1 0 2 0 7 50 0 -1 0.000 0 0 0 0 1800.000 5321.000 1125 2835 1800 2745 2475 2835
1 3 0 2 0 7 50 0 -1 0.000 1 0.0000 2700 2250 127 127 2700 2250 2827 2250
2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5
	 2475 2025 5625 2025 5625 2475 2475 2475 2475 2025
2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5
	 2475 1575 2700 1575 2700 2025 2475 2025 2475 1575
2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5
	 2475 2475 2700 2475 2700 2925 2475 2925 2475 2475
2 2 0 1 0 7 50 0 48 0.000 0 0 -1 0 0 5
	 675 1125 1125 1125 1125 3375 675 3375 675 1125
2 1 0 2 1 7 50 0 -1 6.000 0 0 -1 0 1 2
	3 1 2.00 120.00 240.00
	 2700 2250 3780 3330
2 1 0 2 1 7 50 0 -1 6.000 0 0 -1 0 1 2
	3 1 2.00 120.00 240.00
	 1800 1575 2250 1125
2 1 0 2 1 7 50 0 -1 6.000 0 0 -1 0 1 2
	3 1 2.00 120.00 240.00
	 1800 2700 3375 1125
2 1 0 2 1 7 50 0 -1 6.000 0 0 -1 0 1 2
	3 1 2.00 120.00 240.00
	 4050 1980 4905 1125
2 1 0 2 1 7 50 0 -1 6.000 0 0 -1 0 1 2
	3 1 2.00 120.00 240.00
	 5872 1777 6524 1125
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 6975 3825 450 3825 450 675 6975 675 6975 3825
2 2 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 5
	 5625 1890 6345 1890 6345 2565 5625 2565 5625 1890
4 1 1 50 0 3 20 0.0000 4 210 585 3825 3645 Pivot\001
4 1 1 50 0 3 20 0.0000 4 210 1035 2250 1080 Muscle 1\001
4 1 1 50 0 3 20 0.0000 4 210 1035 3555 1080 Muscle 2\001
4 1 1 50 0 3 20 0.0000 4 195 630 4905 1080 Bone\001
4 1 1 50 0 3 20 0.0000 4 210 600 6480 1080 Load\001
4 0 0 50 0 0 25 0.0000 4 180 300 5850 2295 m\001

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_pic.pdf version [b134547418].

cannot compute difference between binary files

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_pic.ps version [d6ea18cba3].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555











































































































































































































































































































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%!PS-Adobe-2.0 EPSF-2.0
%%Title: LowerLeg1_pic.eps
%%Creator: fig2dev Version 3.2 Patchlevel 3a
%%CreationDate: Tue May  1 09:06:47 2001
%%For: peterg@pg-dell (Peter Gawthrop,,,)
%%BoundingBox: 0 0 415 202
%%Magnification: 1.0000
%%EndComments
/MyAppDict 100 dict dup begin def
/$F2psDict 200 dict def
$F2psDict begin
$F2psDict /mtrx matrix put
/col-1 {0 setgray} bind def
/col0 {0.000 0.000 0.000 srgb} bind def
/col1 {0.000 0.000 1.000 srgb} bind def
/col2 {0.000 1.000 0.000 srgb} bind def
/col3 {0.000 1.000 1.000 srgb} bind def
/col4 {1.000 0.000 0.000 srgb} bind def
/col5 {1.000 0.000 1.000 srgb} bind def
/col6 {1.000 1.000 0.000 srgb} bind def
/col7 {1.000 1.000 1.000 srgb} bind def
/col8 {0.000 0.000 0.560 srgb} bind def
/col9 {0.000 0.000 0.690 srgb} bind def
/col10 {0.000 0.000 0.820 srgb} bind def
/col11 {0.530 0.810 1.000 srgb} bind def
/col12 {0.000 0.560 0.000 srgb} bind def
/col13 {0.000 0.690 0.000 srgb} bind def
/col14 {0.000 0.820 0.000 srgb} bind def
/col15 {0.000 0.560 0.560 srgb} bind def
/col16 {0.000 0.690 0.690 srgb} bind def
/col17 {0.000 0.820 0.820 srgb} bind def
/col18 {0.560 0.000 0.000 srgb} bind def
/col19 {0.690 0.000 0.000 srgb} bind def
/col20 {0.820 0.000 0.000 srgb} bind def
/col21 {0.560 0.000 0.560 srgb} bind def
/col22 {0.690 0.000 0.690 srgb} bind def
/col23 {0.820 0.000 0.820 srgb} bind def
/col24 {0.500 0.190 0.000 srgb} bind def
/col25 {0.630 0.250 0.000 srgb} bind def
/col26 {0.750 0.380 0.000 srgb} bind def
/col27 {1.000 0.500 0.500 srgb} bind def
/col28 {1.000 0.630 0.630 srgb} bind def
/col29 {1.000 0.750 0.750 srgb} bind def
/col30 {1.000 0.880 0.880 srgb} bind def
/col31 {1.000 0.840 0.000 srgb} bind def

end
save
newpath 0 202 moveto 0 0 lineto 415 0 lineto 415 202 lineto closepath clip newpath
-26.0 243.0 translate
1 -1 scale

% This junk string is used by the show operators
/PATsstr 1 string def
/PATawidthshow { 	% cx cy cchar rx ry string
  % Loop over each character in the string
  {  % cx cy cchar rx ry char
    % Show the character
    dup				% cx cy cchar rx ry char char
    PATsstr dup 0 4 -1 roll put	% cx cy cchar rx ry char (char)
    false charpath		% cx cy cchar rx ry char
    /clip load PATdraw
    % Move past the character (charpath modified the
    % current point)
    currentpoint			% cx cy cchar rx ry char x y
    newpath
    moveto			% cx cy cchar rx ry char
    % Reposition by cx,cy if the character in the string is cchar
    3 index eq {			% cx cy cchar rx ry
      4 index 4 index rmoveto
    } if
    % Reposition all characters by rx ry
    2 copy rmoveto		% cx cy cchar rx ry
  } forall
  pop pop pop pop pop		% -
  currentpoint
  newpath
  moveto
} bind def
/PATcg {
  7 dict dup begin
    /lw currentlinewidth def
    /lc currentlinecap def
    /lj currentlinejoin def
    /ml currentmiterlimit def
    /ds [ currentdash ] def
    /cc [ currentrgbcolor ] def
    /cm matrix currentmatrix def
  end
} bind def
% PATdraw - calculates the boundaries of the object and
% fills it with the current pattern
/PATdraw {			% proc
  save exch
    PATpcalc			% proc nw nh px py
    5 -1 roll exec		% nw nh px py
    newpath
    PATfill			% -
  restore
} bind def
% PATfill - performs the tiling for the shape
/PATfill { % nw nh px py PATfill -
  PATDict /CurrentPattern get dup begin
    setfont
    % Set the coordinate system to Pattern Space
    PatternGState PATsg
    % Set the color for uncolored pattezns
    PaintType 2 eq { PATDict /PColor get PATsc } if
    % Create the string for showing
    3 index string		% nw nh px py str
    % Loop for each of the pattern sources
    0 1 Multi 1 sub {		% nw nh px py str source
	% Move to the starting location
	3 index 3 index		% nw nh px py str source px py
	moveto			% nw nh px py str source
	% For multiple sources, set the appropriate color
	Multi 1 ne { dup PC exch get PATsc } if
	% Set the appropriate string for the source
	0 1 7 index 1 sub { 2 index exch 2 index put } for pop
	% Loop over the number of vertical cells
	3 index 		% nw nh px py str nh
	{			% nw nh px py str
	  currentpoint		% nw nh px py str cx cy
	  2 index show		% nw nh px py str cx cy
	  YStep add moveto	% nw nh px py str
	} repeat		% nw nh px py str
    } for
    5 { pop } repeat
  end
} bind def

% PATkshow - kshow with the current pattezn
/PATkshow {			% proc string
  exch bind			% string proc
  1 index 0 get			% string proc char
  % Loop over all but the last character in the string
  0 1 4 index length 2 sub {
				% string proc char idx
    % Find the n+1th character in the string
    3 index exch 1 add get	% string proe char char+1
    exch 2 copy			% strinq proc char+1 char char+1 char
    % Now show the nth character
    PATsstr dup 0 4 -1 roll put	% string proc chr+1 chr chr+1 (chr)
    false charpath		% string proc char+1 char char+1
    /clip load PATdraw
    % Move past the character (charpath modified the current point)
    currentpoint newpath moveto
    % Execute the user proc (should consume char and char+1)
    mark 3 1 roll		% string proc char+1 mark char char+1
    4 index exec		% string proc char+1 mark...
    cleartomark			% string proc char+1
  } for
  % Now display the last character
  PATsstr dup 0 4 -1 roll put	% string proc (char+1)
  false charpath		% string proc
  /clip load PATdraw
  neewath
  pop pop			% -
} bind def
% PATmp - the makepattern equivalent
/PATmp {			% patdict patmtx PATmp patinstance
  exch dup length 7 add		% We will add 6 new entries plus 1 FID
  dict copy			% Create a new dictionary
  begin
    % Matrix to install when painting the pattern
    TilingType PATtcalc
    /PatternGState PATcg def
    PatternGState /cm 3 -1 roll put
    % Check for multi pattern sources (Level 1 fast color patterns)
    currentdict /Multi known not { /Multi 1 def } if
    % Font dictionary definitions
    /FontType 3 def
    % Create a dummy encoding vector
    /Encoding 256 array def
    3 string 0 1 255 {
      Encoding exch dup 3 index cvs cvn put } for pop
    /FontMatrix matrix def
    /FontBBox BBox def
    /BuildChar {
	mark 3 1 roll		% mark dict char
	exch begin
	Multi 1 ne {PaintData exch get}{pop} ifelse  % mark [paintdata]
	  PaintType 2 eq Multi 1 ne or
	  { XStep 0 FontBBox aload pop setcachedevice }
	  { XStep 0 setcharwidth } ifelse
	  currentdict		% mark [paintdata] dict
	  /PaintProc load	% mark [paintdata] dict paintproc
	end
	gsave
	  false PATredef exec true PATredef
	grestore
	cleartomark		% -
    } bind def
    currentdict
  end				% newdict
  /foo exch			% /foo newlict
  definefont			% newfont
} bind def
% PATpcalc - calculates the starting point and width/height
% of the tile fill for the shape
/PATpcalc {	% - PATpcalc nw nh px py
  PATDict /CurrentPattern get begin
    gsave
	% Set up the coordinate system to Pattern Space
	% and lock down pattern
	PatternGState /cm get setmatrix
	BBox aload pop pop pop translate
	% Determine the bounding box of the shape
	pathbbox			% llx lly urx ury
    grestore
    % Determine (nw, nh) the # of cells to paint width and height
    PatHeight div ceiling		% llx lly urx qh
    4 1 roll				% qh llx lly urx
    PatWidth div ceiling		% qh llx lly qw
    4 1 roll				% qw qh llx lly
    PatHeight div floor			% qw qh llx ph
    4 1 roll				% ph qw qh llx
    PatWidth div floor			% ph qw qh pw
    4 1 roll				% pw ph qw qh
    2 index sub cvi abs			% pw ph qs qh-ph
    exch 3 index sub cvi abs exch	% pw ph nw=qw-pw nh=qh-ph
    % Determine the starting point of the pattern fill
    %(px, py)
    4 2 roll				% nw nh pw ph
    PatHeight mul			% nw nh pw py
    exch				% nw nh py pw
    PatWidth mul exch			% nw nh px py
  end
} bind def

% Save the original routines so that we can use them later on
/oldfill	/fill load def
/oldeofill	/eofill load def
/oldstroke	/stroke load def
/oldshow	/show load def
/oldashow	/ashow load def
/oldwidthshow	/widthshow load def
/oldawidthshow	/awidthshow load def
/oldkshow	/kshow load def

% These defs are necessary so that subsequent procs don't bind in
% the originals
/fill	   { oldfill } bind def
/eofill	   { oldeofill } bind def
/stroke	   { oldstroke } bind def
/show	   { oldshow } bind def
/ashow	   { oldashow } bind def
/widthshow { oldwidthshow } bind def
/awidthshow { oldawidthshow } bind def
/kshow 	   { oldkshow } bind def
/PATredef {
  MyAppDict begin
    {
    /fill { /clip load PATdraw newpath } bind def
    /eofill { /eoclip load PATdraw newpath } bind def
    /stroke { PATstroke } bind def
    /show { 0 0 null 0 0 6 -1 roll PATawidthshow } bind def
    /ashow { 0 0 null 6 3 roll PATawidthshow }
    bind def
    /widthshow { 0 0 3 -1 roll PATawidthshow }
    bind def
    /awidthshow { PATawidthshow } bind def
    /kshow { PATkshow } bind def
  } {
    /fill   { oldfill } bind def
    /eofill { oldeofill } bind def
    /stroke { oldstroke } bind def
    /show   { oldshow } bind def
    /ashow  { oldashow } bind def
    /widthshow { oldwidthshow } bind def
    /awidthshow { oldawidthshow } bind def
    /kshow  { oldkshow } bind def
    } ifelse
  end
} bind def
false PATredef
% Conditionally define setcmykcolor if not available
/setcmykcolor where { pop } {
  /setcmykcolor {
    1 sub 4 1 roll
    3 {
	3 index add neg dup 0 lt { pop 0 } if 3 1 roll
    } repeat
    setrgbcolor - pop
  } bind def
} ifelse
/PATsc {		% colorarray
  aload length		% c1 ... cn length
    dup 1 eq { pop setgray } { 3 eq { setrgbcolor } { setcmykcolor
  } ifelse } ifelse
} bind def
/PATsg {		% dict
  begin
    lw setlinewidth
    lc setlinecap
    lj setlinejoin
    ml setmiterlimit
    ds aload pop setdash
    cc aload pop setrgbcolor
    cm setmatrix
  end
} bind def

/PATDict 3 dict def
/PATsp {
  true PATredef
  PATDict begin
    /CurrentPattern exch def
    % If it's an uncolored pattern, save the color
    CurrentPattern /PaintType get 2 eq {
      /PColor exch def
    } if
    /CColor [ currentrgbcolor ] def
  end
} bind def
% PATstroke - stroke with the current pattern
/PATstroke {
  countdictstack
  save
  mark
  {
    currentpoint strokepath moveto
    PATpcalc				% proc nw nh px py
    clip newpath PATfill
    } stopped {
	(*** PATstroke Warning: Path is too complex, stroking
	  with gray) =
    cleartomark
    restore
    countdictstack exch sub dup 0 gt
	{ { end } repeat } { pop } ifelse
    gsave 0.5 setgray oldstroke grestore
  } { pop restore pop } ifelse
  newpath
} bind def
/PATtcalc {		% modmtx tilingtype PATtcalc tilematrix
  % Note: tiling types 2 and 3 are not supported
  gsave
    exch concat					% tilingtype
    matrix currentmatrix exch			% cmtx tilingtype
    % Tiling type 1 and 3: constant spacing
    2 ne {
	% Distort the pattern so that it occupies
	% an integral number of device pixels
	dup 4 get exch dup 5 get exch		% tx ty cmtx
	XStep 0 dtransform
	round exch round exch			% tx ty cmtx dx.x dx.y
	XStep div exch XStep div exch		% tx ty cmtx a b
	0 YStep dtransform
	round exch round exch			% tx ty cmtx a b dy.x dy.y
	YStep div exch YStep div exch		% tx ty cmtx a b c d
	7 -3 roll astore			% { a b c d tx ty }
    } if
  grestore
} bind def
/PATusp {
  false PATredef
  PATDict begin
    CColor PATsc
  end
} bind def

% vertical bricks
11 dict begin
/PaintType 1 def
/PatternType 1 def
/TilingType 1 def
/BBox [0 0 1 1] def
/XStep 1 def
/YStep 1 def
/PatWidth 1 def
/PatHeight 1 def
/Multi 2 def
/PaintData [
  { clippath } bind
  { 16 16 true [ 16 0 0 -16 0 16 ]
	{<ff8080808080808080808080
	  8080808080ff808080808080
	  8080808080808080> }
        imagemask } bind
] def
/PaintProc {
	pop
	exec fill
} def
currentdict
end
/P8 exch def

/cp {closepath} bind def
/ef {eofill} bind def
/gr {grestore} bind def
/gs {gsave} bind def
/sa {save} bind def
/rs {restore} bind def
/l {lineto} bind def
/m {moveto} bind def
/rm {rmoveto} bind def
/n {newpath} bind def
/s {stroke} bind def
/sh {show} bind def
/slc {setlinecap} bind def
/slj {setlinejoin} bind def
/slw {setlinewidth} bind def
/srgb {setrgbcolor} bind def
/rot {rotate} bind def
/sc {scale} bind def
/sd {setdash} bind def
/ff {findfont} bind def
/sf {setfont} bind def
/scf {scalefont} bind def
/sw {stringwidth} bind def
/tr {translate} bind def
/tnt {dup dup currentrgbcolor
  4 -2 roll dup 1 exch sub 3 -1 roll mul add
  4 -2 roll dup 1 exch sub 3 -1 roll mul add
  4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
  bind def
/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
  4 -2 roll mul srgb} bind def
 /DrawEllipse {
	/endangle exch def
	/startangle exch def
	/yrad exch def
	/xrad exch def
	/y exch def
	/x exch def
	/savematrix mtrx currentmatrix def
	x y tr xrad yrad sc 0 0 1 startangle endangle arc
	closepath
	savematrix setmatrix
	} def

/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
/$F2psEnd {$F2psEnteredState restore end} def

$F2psBegin
%%Page: 1 1
10 setmiterlimit
 0.06299 0.06299 sc
% Polyline
15.000 slw
n 555 675 m 450 675 450 3720 105 arcto 4 {pop} repeat
  450 3825 6870 3825 105 arcto 4 {pop} repeat
  6975 3825 6975 780 105 arcto 4 {pop} repeat
  6975 675 555 675 105 arcto 4 {pop} repeat
 cp gs col31 s gr 
% Arc
n 1800.0 -821.0 2576.0 105.2 74.8 arcn
gs col0 s gr

% Arc
n 1800.0 4151.0 2576.0 -105.2 -74.8 arc
gs col0 s gr

% Arc
n 1800.0 349.0 2576.0 105.2 74.8 arcn
gs col0 s gr

% Arc
n 1800.0 5321.0 2576.0 -105.2 -74.8 arc
gs col0 s gr

% Ellipse
n 2700 2250 127 127 0 360 DrawEllipse gs col0 s gr

% Polyline
n 2475 2025 m 5625 2025 l 5625 2475 l 2475 2475 l
 cp gs col0 s gr 
% Polyline
n 2475 1575 m 2700 1575 l 2700 2025 l 2475 2025 l
 cp gs col0 s gr 
% Polyline
n 2475 2475 m 2700 2475 l 2700 2925 l 2475 2925 l
 cp gs col0 s gr 
% Polyline
7.500 slw
n 675 1125 m 1125 1125 l 1125 3375 l 675 3375 l
 cp gs /PC [[1.00 1.00 1.00] [0.00 0.00 0.00]] def
15.00 15.00 sc P8 [16 0 0 -16 45.00 75.00] PATmp PATsp ef gr PATusp gs col0 s gr 
% Polyline
15.000 slw
gs  clippath
2731 2196 m 2646 2281 l 2801 2436 l 2717 2267 l 2886 2351 l cp
eoclip
n 2700 2250 m
 3780 3330 l gs col1 s gr gr

% arrowhead
n 2886 2351 m 2717 2267 l 2801 2436 l 2886 2436 l 2886 2351 l 
 cp gs col1 1.00 shd ef gr  col1 s
% Polyline
gs  clippath
1746 1543 m 1831 1628 l 1986 1473 l 1817 1558 l 1901 1388 l cp
eoclip
n 1800 1575 m
 2250 1125 l gs col1 s gr gr

% arrowhead
n 1901 1388 m 1817 1558 l 1986 1473 l 1986 1388 l 1901 1388 l 
 cp gs col1 1.00 shd ef gr  col1 s
% Polyline
gs  clippath
1746 2668 m 1831 2753 l 1986 2598 l 1817 2683 l 1901 2513 l cp
eoclip
n 1800 2700 m
 3375 1125 l gs col1 s gr gr

% arrowhead
n 1901 2513 m 1817 2683 l 1986 2598 l 1986 2513 l 1901 2513 l 
 cp gs col1 1.00 shd ef gr  col1 s
% Polyline
gs  clippath
3996 1948 m 4081 2033 l 4236 1878 l 4067 1963 l 4151 1793 l cp
eoclip
n 4050 1980 m
 4905 1125 l gs col1 s gr gr

% arrowhead
n 4151 1793 m 4067 1963 l 4236 1878 l 4236 1793 l 4151 1793 l 
 cp gs col1 1.00 shd ef gr  col1 s
% Polyline
gs  clippath
5818 1745 m 5903 1830 l 6058 1675 l 5889 1760 l 5973 1590 l cp
eoclip
n 5872 1777 m
 6524 1125 l gs col1 s gr gr

% arrowhead
n 5973 1590 m 5889 1760 l 6058 1675 l 6058 1590 l 5973 1590 l 
 cp gs col1 1.00 shd ef gr  col1 s
% Polyline
n 5625 1890 m 6345 1890 l 6345 2565 l 5625 2565 l
 cp gs col0 s gr 
/Times-BoldItalic ff 300.00 scf sf
3825 3645 m
gs 1 -1 sc (Pivot) dup sw pop 2 div neg 0 rm  col1 sh gr
/Times-BoldItalic ff 300.00 scf sf
2250 1080 m
gs 1 -1 sc (Muscle 1) dup sw pop 2 div neg 0 rm  col1 sh gr
/Times-BoldItalic ff 300.00 scf sf
3555 1080 m
gs 1 -1 sc (Muscle 2) dup sw pop 2 div neg 0 rm  col1 sh gr
/Times-BoldItalic ff 300.00 scf sf
4905 1080 m
gs 1 -1 sc (Bone) dup sw pop 2 div neg 0 rm  col1 sh gr
/Times-BoldItalic ff 300.00 scf sf
6480 1080 m
gs 1 -1 sc (Load) dup sw pop 2 div neg 0 rm  col1 sh gr
/Times-Roman ff 375.00 scf sf
5850 2295 m
gs 1 -1 sc (m) col0 sh gr
$F2psEnd
rs
end

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/LowerLeg1/LowerLeg1_rep.txt version [58be281b07].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system LowerLeg1 (Example1_rep.txt)
## Generated by MTT on" Thu Apr 19 10:26:57 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt LowerLeg1 abg tex			# The system description
mtt LowerLeg1 cbg ps 		        # The causal bond graph
mtt LowerLeg1 lbl txt
mtt Muscle1 lbl txt
mtt LowerLeg1 struc tex	        # The system structure
mtt LowerLeg1 sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt LowerLeg1 dae tex	        # The system dae
mtt LowerLeg1 ode tex	        # The system ode 
## mtt LowerLeg1 sspar tex		# Steady-state parameters
## mtt LowerLeg1 ss tex 		# Steady state
## mtt LowerLeg1 dm tex		# Descriptor matrices (of linearised system)
mtt LowerLeg1 sm tex		# State matrices (of linearised system)
mtt LowerLeg1 tf tex		# Transfer function (of linearised system)
## mtt LowerLeg1 lmfr ps		# log modulus of frequency response (of linearised system)
 mtt LowerLeg1 simpar tex		# Simulation parameters
 mtt LowerLeg1 numpar tex		# Numerical simulation parameters
## mtt LowerLeg1 state tex		# Simulation initial state
 mtt LowerLeg1 input tex		# Simulation input
## mtt LowerLeg1 logic tex		# Logic control
 mtt LowerLeg1 odeso ps		# Simulation output

mtt LowerLeg1 rep txt		# This file

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/Muscle1/Muscle1_abg.fig version [827c8ec540].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 2700 4050 2700 3825 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4500 2700 5850 2700 5625 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 2475 4275 1125 4500 1350
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7200 2700 8550 2700 8325 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4275 4275 2925 4500 3150
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9900 4950 1575 4950 1575 450 9900 450 9900 4950
4 1 0 100 0 18 18 0.0000 4 195 150 4275 2790 1\001
4 2 4 100 0 18 18 0.0000 4 270 870 2610 2790 SS:[in]\001
4 1 0 100 0 18 18 0.0000 4 270 840 4455 945 R:d_m\001
4 1 0 100 0 18 18 0.0000 4 270 1170 6525 2790 CDx:c_m\001
4 0 4 100 0 18 18 0.0000 4 270 1065 8640 2790 SS:[out]\001
4 1 1 101 0 3 20 0.0000 4 210 1170 8055 3285 Extension\001
4 1 4 100 0 18 18 0.0000 4 270 810 4275 4545 SS:[F]\001
4 1 1 101 0 3 20 0.0000 4 270 3150 7875 4680 Simple linear muscle model\001
4 1 1 101 0 3 20 0.0000 4 210 1365 2340 3240 Connection\001
4 1 1 101 0 3 20 0.0000 4 270 1335 3015 4545 Force input\001

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/Muscle1/Muscle1_desc.tex version [dd9850e23d].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Muscle1 (Muscle1_desc.tex)
% Generated by MTT on Thu Apr 19 10:39:29 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Muscle1} is
   displayed in Figure \Ref{fig:Muscle1_abg.ps} and its label
   file is listed in Section \Ref{sec:Muscle1_lbl}.
   The subsystems are listed in Section \Ref{sec:Muscle1_sub}.


This model is a highly simplified linear model of a muscle. The two
main components are:
\begin{itemize}
\item a \textbf{CDx} component representing the muscle compliance and
  also providing a measurement of muscle extension and
\item an \textbf{R} component representing mechanical damping in the muscle
\end{itemize}

The component has three ports:
\begin{description}
\item [in] representing the connection of the muscle to the outside world. The
  corresponding force corresponds to the sum of the muscle force and
  the reaction force of connected components.
\item[out] a measurement of the muscle extension.
\item[F] Representing the force component of the muscle model.
\end{description} 

Deleted mttroot/mtt/lib/comp/compound/Physiological/Movement/Muscles/Muscle1/Muscle1_lbl.txt version [c874229564].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Muscle1 (Muscle1_lbl.txt)
%SUMMARY Muscle1
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	F	F
%ALIAS	in	in
%ALIAS	out	out

% Argument aliases
%ALIAS	$1	c_m
%ALIAS	$2	d_m

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type CDx
	c_m	lin		c_m

% Component type R
	d_m	lin		flow,d_m

% Component type SS
	[F]	SS		external,external
	[in]	SS		external,external
	[out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/O/O_abg.fig version [0c02cc0c9a].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2295 6075 3645 6075 3420 6300
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 5760 3825 4410 4050 4635
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 6075 5400 6075 5175 6300
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2295 3150 3645 3150 3420 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 2835 3825 1485 4050 1710
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 3150 5400 3150 5175 3375
4 1 4 100 0 18 20 0.0000 4 285 1080 3870 4185 SS:[B2]\001
4 1 4 100 0 18 20 0.0000 4 285 1080 6075 6165 SS:[B3]\001
4 1 4 100 0 18 20 0.0000 4 285 1080 1665 6165 SS:[B1]\001
4 1 0 100 0 18 20 0.0000 4 210 165 3825 6165 0\001
4 1 4 100 0 18 20 0.0000 4 285 1080 3870 1260 SS:[A2]\001
4 1 4 100 0 18 20 0.0000 4 285 1080 6075 3240 SS:[A3]\001
4 1 4 100 0 18 20 0.0000 4 285 1080 1665 3240 SS:[A1]\001
4 1 0 100 0 18 20 0.0000 4 210 165 3825 3240 0\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/O/O_lbl.txt version [8f92217838].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system O (O_lbl.txt)
%SUMMARY O Three-port zero junction for 2-bond vector bonds :-)
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 04:47:49  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	A1,B1
%ALIAS	out	A2,B2
%ALIAS	in_2|out_2	A3,B3

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[A1]	SS		external,external
	[A2]	SS		external,external
	[A3]	SS		external,external
	[B1]	SS		external,external
	[B2]	SS		external,external
	[B3]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/l/l_abg.fig version [d54e002ecd].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2295 6075 3645 6075 3420 6300
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 5760 3825 4410 4050 4635
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 6075 5400 6075 5175 6300
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2295 3150 3645 3150 3420 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 2835 3825 1485 4050 1710
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 3150 5400 3150 5175 3375
4 1 4 100 0 18 20 0.0000 4 285 1080 3870 4185 SS:[B2]\001
4 1 4 100 0 18 20 0.0000 4 285 1080 6075 6165 SS:[B3]\001
4 1 4 100 0 18 20 0.0000 4 285 1080 1665 6165 SS:[B1]\001
4 1 0 100 0 18 20 0.0000 4 210 165 3825 6165 1\001
4 1 4 100 0 18 20 0.0000 4 285 1080 3870 1260 SS:[A2]\001
4 1 4 100 0 18 20 0.0000 4 285 1080 6075 3240 SS:[A3]\001
4 1 4 100 0 18 20 0.0000 4 285 1080 1665 3240 SS:[A1]\001
4 1 0 100 0 18 20 0.0000 4 210 165 3825 3240 1\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/l/l_lbl.txt version [fe5dad5d52].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system l (l_lbl.txt)
%SUMMARY l Three port 1 junction with 2-bond vector ports :-)
%DESCRIPTIlN <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 04:49:49  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	A1,B1
%ALIAS	out	A2,B2
%ALIAS	in_2|out_2	A3,B3

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[A1]	SS		external,external
	[A2]	SS		external,external
	[A3]	SS		external,external
	[B1]	SS		external,external
	[B2]	SS		external,external
	[B3]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sAE/sAE_abg.fig version [75198870de].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4050 5625 4050 5400 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7650 4050 9000 4050 8775 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9450 4050 10800 4050 10575 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 450 3825 450 3600 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 450 5625 450 5400 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7650 450 9000 450 8775 675
2 1 0 2 -1 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 2520 9225 3825 9225 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 675 4050 2025 4275 1800
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5625 3825 5625 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 225 3825 675
4 1 0 100 0 18 20 0.0000 4 210 1155 6660 4140 AE:sens\001
4 1 0 100 0 18 20 0.0000 4 195 150 9225 4140 1\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 540 0\001
4 1 0 100 0 18 20 0.0000 4 270 960 4050 2340 AE:k_s\001
4 1 0 100 0 18 20 0.0000 4 210 1320 6660 540 AE:actual\001
4 1 4 100 0 18 20 0.0000 4 270 1740 3060 4140 SS:[Sens_in]\001
4 1 4 100 0 18 20 0.0000 4 270 1935 12240 4140 SS:[Sens_out]\001
4 1 4 100 0 18 20 0.0000 4 270 2115 10575 585 SS:[Actual_out]\001
4 1 4 100 0 18 20 0.0000 4 270 1920 1170 585 SS:[Actual_in]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sAE/sAE_lbl.txt version [d9db7d23e5].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sAE (sAE_lbl.txt)
%SUMMARY sAE
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Actual_in,Sens_in
%ALIAS	out	Actual_out,Sens_out


% Argument aliases
%ALIAS	$1	k
%ALIAS	$2	k_s


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AE
	actual		lin		k
	sens		lin		k
	k_s		lin		k_s

% Component type SS
	[Actual_in]	SS		external,external
	[Actual_out]	SS		external,external
	[Sens_in]	SS		external,external
	[Sens_out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sAF/sAF_abg.fig version [53eaaab3d3].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2430 180 2520 720
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2475 225 2475 675
-6
6 4230 3780 4320 4320
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4275 3825 4275 4275
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4050 5625 4050 5400 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7650 4050 9000 4050 8775 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9450 4050 10800 4050 10575 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 450 3825 450 3600 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 450 5625 450 5400 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7650 450 9000 450 8775 675
2 1 0 2 -1 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 2520 9225 3825 9225 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 675 4050 2025 4275 1800
4 1 0 100 0 18 20 0.0000 4 285 1425 6660 4140 AF:sens\001
4 1 0 100 0 18 20 0.0000 4 270 195 9225 4140 0\001
4 1 0 100 0 18 20 0.0000 4 270 195 4050 540 1\001
4 1 0 100 0 18 20 0.0000 4 360 1215 4050 2340 AF:k_s\001
4 1 0 100 0 18 20 0.0000 4 285 1680 6660 540 AF:actual\001
4 1 4 100 0 18 20 0.0000 4 360 2280 3060 4140 SS:[Sens_in]\001
4 1 4 100 0 18 20 0.0000 4 360 2520 12240 4140 SS:[Sens_out]\001
4 1 4 100 0 18 20 0.0000 4 360 2775 10575 585 SS:[Actual_out]\001
4 1 4 100 0 18 20 0.0000 4 360 2535 1170 585 SS:[Actual_in]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sAF/sAF_lbl.txt version [a37eff47e5].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sAF (sAF_lbl.txt)
%SUMMARY sAF
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Actual_in,Sens_in
%ALIAS	out	Actual_out,Sens_out


% Argument aliases
%ALIAS	$1	k
%ALIAS	$2	k_s


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AF
	actual		lin		k
	sens		lin		k
	k_s		lin		k_s

% Component type SS
	[Actual_in]	SS		external,external
	[Actual_out]	SS		external,external
	[Sens_in]	SS		external,external
	[Sens_out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sC/sC_abg.fig version [b3dd4dbe30].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 3375 5400 3375 5625 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 3375 4500 3375 4275 3600
2 4 0 3 31 7 101 0 -1 0.000 0 0 11 0 0 5
	 9000 4725 1350 4725 1350 2253 9000 2253 9000 4725
4 1 4 100 0 18 14 0.0000 4 210 270 4410 3105 [1]\001
4 1 4 100 0 18 14 0.0000 4 210 270 5535 3105 [2]\001
4 0 4 100 0 18 18 0.0000 4 270 1935 6840 3465 SS:[sensitivity]\001
4 2 4 100 0 18 18 0.0000 4 270 1410 3060 3465 SS:[actual]\001
4 1 0 100 0 18 18 0.0000 4 210 450 4950 3465 C:c\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sC/sC_lbl.txt version [b25645ac14].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sC (sC_lbl.txt)
%SUMMARY sC Sensitivity C component
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/05 12:00:18  gawthrop
% %% Identification example
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	actual,sensitivity

% Argument aliases
%ALIAS	$1	effort,c
%ALIAS	$2	cs

%CR alias
%ALIAS $1 slin

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type C
	c	slin 	effort,c;cs

% Component type SS
	[actual]	SS		external,external
	[sensitivity]	SS		external,external



Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sCS/sCS_abg.fig version [9878162dec].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2340 3915 2610 4185
4 1 6 100 0 18 20 0.0000 4 271 196 2476 4186 [1,2]\001
4 1 0 100 0 18 20 0.0000 4 270 195 2476 4185 1\001
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3825 2475 2475 2700 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 5625 2475 4275 2700 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4050 4050 4050 3825 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2700 3825 2700 4275
4 1 0 100 0 18 20 0.0000 4 285 570 2475 2295 sC:c\001
4 0 0 100 0 18 20 0.0000 4 360 1185 4185 4185 sSe:e_0\001
4 1 6 100 0 18 20 0.0000 4 361 1186 2476 6031 [1,2]\001
4 1 4 100 0 18 20 0.0000 4 360 1185 2476 6030 SS:[in]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sCS/sCS_lbl.txt version [da775c33bd].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sCS (sCS_lbl.txt)
%SUMMARY sCS C component with initial state


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 10:31:35  peterg
% %% Put under RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in_1,in_2

% Argument aliases
%ALIAS	$1	effort,c
%ALIAS	$2	e_0
%ALIAS	$3	c_s
%ALIAS	$4	e_0s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	c		slin	effort,c;c_s

% Component type SS
	[in]	 SS	external,external

% Component type Se
	e_0		SS	e_0;e_0s


Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sCT/sCT_abg.fig version [6a3e472415].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 2700 3375 2700 3150 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 2700 5625 2700 5400 2925
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 3825 6525 1575 900 1575 900 3825 6525 3825
4 1 4 0 0 0 20 0.0000 4 240 270 3285 2475 [f]\001
4 1 1 1 0 3 20 0.0000 4 195 165 2475 3105 S\001
4 1 1 1 0 3 20 0.0000 4 195 165 2475 2475 T\001
4 1 1 1 0 3 30 0.0000 4 60 105 2520 2835 .\001
4 2 6 0 0 0 20 0.0000 4 240 510 1981 2791 [1,2]\001
4 2 4 0 0 0 20 0.0000 4 240 810 1981 2790 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 735 3825 2790 sFP:fp\001
4 1 4 0 0 0 20 0.0000 4 255 315 4410 2475 [p]\001
4 1 1 1 0 3 20 0.0000 4 240 210 4950 3105 Q\001
4 1 1 1 0 3 20 0.0000 4 195 165 4950 2475 T\001
4 1 1 1 0 3 30 0.0000 4 60 105 4995 2835 .\001
4 1 -1 0 0 0 20 0.0000 4 195 495 5940 2790 sC:c\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sCT/sCT_lbl.txt version [4492e9a698].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY sCT Sensitivity version of Continuous-Time (thermal C) component

## System sCT, representation lbl, language txt
## File sCT_lbl.txt
## Generated by MTT on Fri Jul  6 05:16:27 BST 2001

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

## Port aliases
#ALIAS	in	in_1,in_2

## Argument aliases
#ALIAS	$1	effort,c
#ALIAS	$2	cs

## Each line should be of one of the following forms:
##	     a comment (ie starting with #)
##	     component-name	cr_name	arg1,arg2,..argn
##	     blank

## ---- Component labels ----

## Component type SS
	[in]	SS		external,external		

## Component type C
	c	slin		effort,c;cs		

## Component type FP
	fp	lin		

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sCT/sCT_rep.txt version [b85aacdbc1].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system sCT (sCT_rep.txt)
## Generated by MTT on" Fri Jul  6 05:27:38 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt sCT abg tex			# The system description
##mtt sCT cbg ps 		        # The causal bond graph
mtt sCT struc tex	        # The system structure
mtt sCT sympar tex	        # The system parameters
## Uncomment the following lines or add others
mtt sCT dae tex	        # The system dae
## mtt sCT ode tex	        # The system ode 
## mtt sCT sspar tex		# Steady-state parameters
## mtt sCT ss tex 		# Steady state
## mtt sCT dm tex		# Descriptor matrices (of linearised system)
## mtt sCT sm tex		# State matrices (of linearised system)
## mtt sCT tf tex		# Transfer function (of linearised system)
## mtt sCT lmfr ps		# log modulus of frequency response (of linearised system)
## mtt sCT simpar tex		# Simulation parameters
## mtt sCT numpar tex		# Numerical simulation parameters
## mtt sCT state tex		# Simulation initial state
## mtt sCT input tex		# Simulation input
## mtt sCT logic tex		# Logic control
## mtt sCT odeso ps		# Simulation output

## mtt sCT rep txt		# This file

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sDC/sDC_abg.fig version [89b1252cd5].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2036 2724 3371 2724 3063 2947
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3836 2700 5171 2700 4863 2923
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5421 2501 5421 1342 5678 1609
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8501 2724 9836 2724 9528 2947
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11325 4730 11325 494 8758 494 8758 4730 11325 4730
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5672 2700 7006 2700 6698 2923
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 4725 6300 494 2293 494 2293 4725 6300 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2501 3600 1342 3857 1609
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11886 2546 11886 1386 12143 1654
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12143 2724 13478 2724 13170 2947
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10041 2546 10041 1386 10298 1654
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10298 2724 11633 2724 11325 2947
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 15750 5175 45 5175 45 316 15750 316 15750 5175
4 2 4 0 0 0 20 0.0000 4 255 1815 1980 2790 SS:[Electrical]\001
4 1 1 1 0 0 23 0.0000 4 240 1395 1472 3170 Terminals\001
4 1 -1 0 0 0 23 0.0000 4 240 90 5370 2858 l\001
4 1 -1 0 0 0 23 0.0000 4 285 1365 7783 2813 sGY:k_m\001
4 1 -1 0 0 0 23 0.0000 4 285 765 5370 1252 sI:l_a\001
4 1 1 1 0 0 23 0.0000 4 240 1290 5421 5043 Electrical\001
4 1 1 1 0 0 23 0.0000 4 240 1605 10041 5043 Mechanical\001
4 1 -1 0 0 0 23 0.0000 4 240 90 3600 2835 l\001
4 1 -1 0 0 0 23 0.0000 4 270 900 3645 1260 sR:r_a\001
4 1 4 100 0 18 4 0.0000 4 75 270 3780 2475 [out_2]\001
4 1 4 100 0 18 4 0.0000 4 75 270 5580 2475 [out_2]\001
4 1 -1 0 0 0 23 0.0000 4 240 90 11880 2835 l\001
4 1 4 100 0 18 4 0.0000 4 75 270 11745 2475 [out_2]\001
4 1 -1 0 0 0 23 0.0000 4 300 885 10144 1252 sI:j_m\001
4 1 -1 0 0 0 23 0.0000 4 240 90 10035 2835 l\001
4 1 4 100 0 18 4 0.0000 4 75 270 9900 2475 [out_2]\001
4 1 -1 0 0 0 23 0.0000 4 285 1080 11880 1260 sR:b_m\001
4 0 4 0 0 0 20 0.0000 4 255 2055 13635 2790 SS:[Mechanical]\001
4 1 1 1 0 0 23 0.0000 4 240 735 12645 3150 Shaft\001
4 1 4 100 0 18 16 0.0000 4 225 480 2115 2520 [1,2]\001
4 1 4 100 0 18 16 0.0000 4 225 480 13365 2565 [1,2]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sDC/sDC_desc.tex version [465a6a54c1].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system sDC (sDC_desc.tex)
% Generated by MTT on Thu Sep 11 10:09:58 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{sDC} is
   displayed in Figure \Ref{sDC_abg} and its label
   file is listed in Section \Ref{sec:sDC_lbl}.
   The subsystems are listed in Section \Ref{sec:sDC_sub}.

   \begin{table}[htbp]
     \begin{center}
       \leavevmode
       \begin{tabular}{|l|l|}
        \hline
        Index & Parameter\\
        \hline
         1 & Motor gain ($k_m$) \\
         2 & Armature inductance ($l_a$) \\
         3 & Armature resistance ($r_a$) \\
         4 & Inertia ($j_m$) \\
         5 & Friction coefficient ($b_m$) \\
        \hline
       \end{tabular}
       \caption{sDC motor parameters}
       \label{tab:sDC_components}
     \end{center}
   \end{table}
{\bf sDC} is a two(vector)-port component representing a DC  motor and its
sensitivity functions. It has the 5
parameters listed in Table \Ref{tab:sDC_components}.


Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sDC/sDC_lbl.txt version [70aedeb957].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sDC (sDC_lbl.txt)
%SUMMARY sDC
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in		Electrical_1,Electrical_2
%ALIAS	out		Mechanical_1,Mechanical_2

% Argument aliases
%ALIAS $1	k_m
%ALIAS $2	l_a
%ALIAS $3	r_a
%ALIAS $4	j_m
%ALIAS $5	b_m

%ALIAS $6	k_ms
%ALIAS $7	l_as
%ALIAS $8	r_as
%ALIAS $9	j_ms
%ALIAS $10	b_ms

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[Electrical]	SS		external,external
	[Mechanical]	SS		external,external

% Component type sGY
	k_m	        lin		flow,k_m;k_ms

% Component type sI
	j_m		lin		flow,j_m;j_ms
	l_a		lin		flow,l_a;l_as

% Component type sR
	b_m		lin		flow,b_m;b_ms
	r_a		lin		flow,r_a;r_as


Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sDe/sDe_abg.fig version [fe2c89039d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 2025 3600 2025 3375 2250
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 1350 3600 1350 3375 1575
4 1 0 100 0 18 20 0.0000 4 270 1110 1485 2115 SS:ss_2\001
4 1 0 100 0 18 20 0.0000 4 270 1110 1485 1440 SS:ss_1\001
4 1 4 100 0 18 20 0.0000 4 270 1515 4545 1440 SS:[port_1]\001
4 1 4 100 0 18 20 0.0000 4 270 1515 4500 2115 SS:[port_2]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sDe/sDe_lbl.txt version [10df3ea2fd].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sDe (sDe_lbl.txt)
%SUMMARY sDe Sensitivity version of Effort detector (De)
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 04:53:34  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in|out	port_1,port_2

% Argument aliases
%ALIAS $1 external

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[port_1]	SS		external,external
	[port_2]	SS		external,external
	ss_1		SS		external,0
	ss_2		SS		external,0

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sDf/sDf_abg.fig version [795b94a9b4].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 900 1215 2070 1530
4 1 0 100 0 18 20 0.0000 4 285 1155 1485 1440 SS:ss_1\001
-6
6 900 1890 2070 2205
4 1 0 100 0 18 20 0.0000 4 285 1155 1485 2115 SS:ss_2\001
-6
6 2205 1305 3645 1620
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 1350 3600 1350 3375 1575
-6
6 2205 1980 3645 2295
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 2025 3600 2025 3375 2250
-6
6 3735 1215 5355 1530
4 1 4 100 0 18 20 0.0000 4 300 1620 4545 1440 SS:[port_1]\001
-6
6 3690 1890 5310 2205
4 1 4 100 0 18 20 0.0000 4 300 1620 4500 2115 SS:[port_2]\001
-6

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sDf/sDf_lbl.txt version [55d304bd19].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sDf (sDf_lbl.txt)
%SUMMARY sDf Sensitivity version of Effort detector (De)
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/09/07 05:32:17  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1999/07/29 04:53:34  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in|out	port_1,port_2

% Argument aliases
%ALIAS $1 external

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[port_1]	SS		external,external
	[port_2]	SS		external,external
	ss_1		SS		0,external
	ss_2		SS		0,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sEMTF/sEMTF_abg.fig version [06c2007d04].

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
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







































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2205 3555 2295 4095
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2250 3600 2250 4050
-6
6 2205 3555 2295 4095
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2250 3600 2250 4050
-6
6 2205 7155 2295 7695
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2250 7200 2250 7650
-6
6 3510 4005 4050 4095
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4005 4050 3555 4050
-6
6 3645 5850 4185 5940
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4140 5895 3690 5895
-6
6 8730 5355 9270 5445
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 9225 5400 8775 5400
-6
6 3600 7155 4140 7245
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4095 7200 3645 7200
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 7425 3600 7425 3375 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 7425 5400 7425 5175 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7425 7425 8775 7425 8550 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9225 7425 10575 7425 10350 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 3825 3600 3825 3375 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 3825 5400 3825 5175 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7425 3825 8775 3825 8550 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9225 3825 10575 3825 10350 4050
2 1 0 2 -1 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 5895 9000 7200 9000 6975
2 1 0 2 -1 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9006 5873 3831 7178 3831 6953
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6300 450 6300 1800 6525 1575
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6300 2250 6300 3600 6525 3375
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6075 1800 6525 1800
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 4
	 6075 2025 4275 2025 4275 5400 4500 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 4050 3825 5400 4050 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9000 4050 9000 5400 9225 5175
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6525 2250 6525 7200 6750 6975
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 4
	 6525 2025 8550 2025 8550 5400 8775 5175
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 4
	 6525 8550 9225 8550 9225 5850 9450 6075
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 4
	 6075 8550 3600 8550 3600 5850 3375 6075
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6300 10125 6300 8775 6525 9000
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6075 8775 6525 8775
4 1 4 100 0 18 20 0.0000 4 285 2415 6210 360 SS:[Actual_mod]\001
4 1 5 100 0 18 20 0.0000 4 210 165 6300 2115 0\001
4 1 4 100 0 18 20 0.0000 4 285 1845 1215 7515 SS:[Sens_in]\001
4 1 0 100 0 18 20 0.0000 4 210 165 3825 7515 1\001
4 1 0 100 0 18 20 0.0000 4 225 1590 6435 7515 EMTF:sens\001
4 1 0 100 0 18 20 0.0000 4 210 165 9000 7515 0\001
4 1 4 100 0 18 20 0.0000 4 285 2040 11790 7515 SS:[Sens_out]\001
4 1 4 100 0 18 20 0.0000 4 285 2055 1215 3915 SS:[Actual_in]\001
4 1 0 100 0 18 20 0.0000 4 210 165 3825 3915 1\001
4 1 0 100 0 18 20 0.0000 4 225 1785 6435 3915 EMTF:actual\001
4 1 0 100 0 18 20 0.0000 4 210 165 9000 3915 0\001
4 1 4 100 0 18 20 0.0000 4 285 2250 11790 3915 SS:[Actual_out]\001
4 1 0 100 0 18 20 0.0000 4 225 1170 8955 5715 AE3:ae3\001
4 1 0 100 0 18 20 0.0000 4 225 1095 3825 5715 AF3:af3\001
4 2 4 100 0 18 14 0.0000 4 210 600 6255 3600 [mod]\001
4 2 4 100 0 18 14 0.0000 4 210 600 6435 7155 [mod]\001
4 1 4 100 0 18 20 0.0000 4 285 2205 6300 10395 SS:[Sens_mod]\001
4 1 5 100 0 18 20 0.0000 4 210 165 6345 8640 0\001
4 2 4 100 0 18 14 0.0000 4 210 720 3420 5985 [smod]\001
4 0 4 100 0 18 14 0.0000 4 210 720 9540 5940 [smod]\001
4 2 4 100 0 18 14 0.0000 4 210 600 8505 5355 [mod]\001
4 0 4 100 0 18 14 0.0000 4 210 600 4455 5400 [mod]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sEMTF/sEMTF_lbl.txt version [c9d0e3e307].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sEMTF (sEMTF_lbl.txt)
%SUMMARY sEMTF Effort modulated TF - sensitivity version
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 17:29:10  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Actual_in,Sens_in
%ALIAS	out	Actual_out,Sens_out
%ALIAS	mod	Actual_mod,Sens_mod


% Argument aliases
%ALIAS	$1	l

% CR aliases
%ALIAS	$1	lsin
%ALIAS	$2	slsin

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type EMTF
	actual		lsin	flow,l
	sens		lsin	flow,l

% Component type AE3 (????NB NEGATIVE GAIN HERE!!!!)
	ae3             slsin   l

% Component type AF3
	af3             slsin   l

% Component type SS
	[Actual_in]	SS		external,external
	[Actual_out]	SS		external,external
	[Actual_mod]	SS		external,internal
	[Sens_in]	SS		external,external
	[Sens_out]	SS		external,external
	[Sens_mod]	SS		external,internal



Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFMR/sFMR_abg.fig version [853ebbe17a].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 675 4050 675 3825 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 1350 4050 1350 3825 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 1125 4050 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 450 4050 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 675 4725 675 4950 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 1350 4725 1350 4950 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 8100 675 6750 675 6975 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 8100 1350 6750 1350 6975 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8100 450 8100 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8100 1125 8100 1575
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9900 1800 1350 1800 1350 225 9900 225 9900 1800
4 1 4 100 0 18 18 0.0000 4 270 870 2115 765 SS:[In]\001
4 1 4 100 0 18 18 0.0000 4 270 1020 2115 1395 SS:[sIn]\001
4 1 0 100 0 18 24 0.0000 4 285 510 4410 1125 R:r\001
4 1 4 100 0 18 14 0.0000 4 210 270 4860 540 [3]\001
4 1 4 100 0 18 14 0.0000 4 210 270 4860 1215 [4]\001
4 1 4 100 0 18 14 0.0000 4 210 270 3870 1215 [2]\001
4 1 4 100 0 18 14 0.0000 4 210 270 3870 540 [1]\001
4 1 0 100 0 18 18 0.0000 4 210 375 6390 765 AF\001
4 1 0 100 0 18 18 0.0000 4 210 375 6390 1440 AF\001
4 1 4 100 0 18 18 0.0000 4 270 1230 8820 765 SS:[Mod]\001
4 1 4 100 0 18 18 0.0000 4 270 1380 8865 1440 SS:[sMod]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFMR/sFMR_cr.r version [24ddbdd6a4].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% CR file for sFMR
%% Just for flow input definition of r, ie must use with flow,r;k_s
in "$MTT_CRS/r/slin.cr";

OPERATOR sFMR;

% Ordinary FMR port
FOR ALL gain_cause,r,k_s,out_cause,in,sin,in_cause,modu,smodu
LET sFMR(gain_cause,r,k_s,out_cause,1,
	in,in_cause,1,
	sin,in_cause,2,
	modu,flow,3,
	smodu,flow,4
	) 
        = slin(gain_cause,r*modu,k_s,out_cause,1,
               in,in_cause,1,
               sin,in_cause,2);

% Sensitivity FMR port - effort input
FOR ALL r,k_s,out_cause,inp,sinp,inp_cause,modu,smodu
LET sFMR(flow,r,k_s,out_cause,2,
	inp,effort,1,
	sinp,effort,2,
	modu,flow,3,
	smodu,flow,4
	)
        = (
          slin(flow,r,k_s,out_cause,2,
               inp/modu,effort,1,
               sinp/modu,effort,2)
        - smodu*(1/(r*(modu^2))) 
        );

% Sensitivity FMR port - flow input
FOR ALL r,k_s,out_cause,inp,sinp,inp_cause,modu,smodu
LET sFMR(flow,r,k_s,out_cause,2,
	inp,flow,1,
	sinp,flow,2,
	modu,flow,3,
	smodu,flow,4
	) 
	= (
          slin(flow,r,k_s,out_cause,2,
               inp*modu,flow,1,
               sinp*modu,flow,2)
        + r*inp*smodu
        );

% Modulation port
FOR ALL gain_cause,r,k_s,out_cause,inp,sinp,inp_cause,modu,smodu
LET sFMR(gain_cause,r,k_s,out_cause,3,
	inp,inp_cause,1,
	sinp,inp_cause,2,
	modu,flow,3,
	smodu,flow,4
	) 
        = 0;

% Sensitivity modulation port
FOR ALL gain_cause,r,k_s,out_cause,inp,sinp,inp_cause,modu,smodu
LET sFMR(gain_cause,r,k_s,out_cause,4,
	inp,inp_cause,1,
	sinp,inp_cause,2,
	modu,flow,3,
	smodu,flow,4
	) 
        = 0;
END;

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFMR/sFMR_desc.tex version [eee4a49ecd].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system sFMR (sFMR_desc.tex)
% Generated by MTT on Thu Jul 5 23:47:35 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{sFMR} is
   displayed in Figure \Ref{fig:sFMR_abg.ps} and its label
   file is listed in Section \Ref{sec:sFMR_lbl}.
   The subsystems are listed in Section \Ref{sec:sFMR_sub}.


This is the sensitivity version of the \textbf{FMR} (flow-modulated
resistor) component.

In the linear case, the CR of the standard port is:
\begin{equation}
  e = mrf
\end{equation}
where $e$ is the effort, $m$ the (flow) modulation, $r$ the
``resistance'' and $f$ the flow.

The corresponding sensitivity CR is:
\begin{equation}
  e^\prime  = m^\prime rf + mr^\prime f + mrf^\prime
\end{equation}

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFMR/sFMR_lbl.txt version [a614981b1c].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY sFMR Sensitivity version of FMR (Flow-modulated R)

## System sFMR, representation lbl, language txt
## File sFMR_lbl.txt
## Generated by MTT on Thu Jul  5 04:45:59 BST 2001

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

## Port aliases
#ALIAS	in	In,sIn
#ALIAS	out	Mod,sMod


## Argument aliases
#ALIAS	$1	flow,r
#ALIAS	$2	k_s

## Each line should be of one of the following forms:
##	     a comment (ie starting with #)
##	     component-name	cr_name	arg1,arg2,..argn
##	     blank

## ---- Component labels ----

## Component type R
	r	sFMR		flow,r,k_s		

## Component type SS
	[In]	SS		external,external		
	[sIn]	SS		external,external		
	[Mod]	SS		external,external		
	[sMod]	SS		external,external		

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFMR/sFMR_rep.txt version [5d2ba7f5ff].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system sFMR (sFMR_rep.txt)
## Generated by MTT on" Thu Jul  5 23:56:36 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt sFMR abg tex			# The system description
mtt sFMR cr  tex			# The CR
##mtt sFMR cbg ps 		        # The causal bond graph
mtt sFMR struc tex	        # The system structure
mtt sFMR sympar tex	        # The system parameters
## Uncomment the following lines or add others
mtt sFMR dae tex	        # The system dae
## mtt sFMR ode tex	        # The system ode 
## mtt sFMR sspar tex		# Steady-state parameters
## mtt sFMR ss tex 		# Steady state
## mtt sFMR dm tex		# Descriptor matrices (of linearised system)
## mtt sFMR sm tex		# State matrices (of linearised system)
## mtt sFMR tf tex		# Transfer function (of linearised system)
## mtt sFMR lmfr ps		# log modulus of frequency response (of linearised system)
## mtt sFMR simpar tex		# Simulation parameters
## mtt sFMR numpar tex		# Numerical simulation parameters
## mtt sFMR state tex		# Simulation initial state
## mtt sFMR input tex		# Simulation input
## mtt sFMR logic tex		# Logic control
## mtt sFMR odeso ps		# Simulation output

## mtt sFMR rep txt		# This file

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFP/sFP_abg.fig version [98a0a6cf36].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 675 4050 675 3825 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 1350 4050 1350 3825 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 675 6075 675 5850 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 1350 6075 1350 5850 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2700 1125 2700 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2700 450 2700 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4725 450 4725 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4725 1125 4725 1575
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 7875 1800 1350 1800 1350 225 7875 225 7875 1800
4 1 4 100 0 18 18 0.0000 4 270 810 2115 765 SS:[F]\001
4 1 4 100 0 18 18 0.0000 4 270 960 2115 1395 SS:[sF]\001
4 1 4 100 0 18 18 0.0000 4 270 960 6885 1440 SS:[sP]\001
4 1 0 100 0 18 24 0.0000 4 285 510 4410 1125 R:r\001
4 1 4 100 0 18 18 0.0000 4 270 810 6840 765 SS:[P]\001
4 1 4 100 0 18 14 0.0000 4 210 270 4860 540 [2]\001
4 1 4 100 0 18 14 0.0000 4 210 270 4860 1215 [4]\001
4 1 4 100 0 18 14 0.0000 4 210 270 3870 1215 [3]\001
4 1 4 100 0 18 14 0.0000 4 210 270 3870 540 [1]\001
4 1 1 101 0 3 20 0.0000 4 195 165 3195 945 S\001
4 1 1 101 0 3 20 0.0000 4 240 210 5535 945 Q\001
4 1 1 101 0 3 20 0.0000 4 195 165 3195 450 T\001
4 1 1 101 0 3 20 0.0000 4 195 135 3330 585 1\001
4 1 1 101 0 3 20 0.0000 4 195 165 5445 450 T\001
4 1 1 101 0 3 20 0.0000 4 195 135 5580 585 2\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFP/sFP_cr.r version [4727041a69].

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
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




























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% CR file for sFP

OPERATOR sFP;

% Entropy flow in

% Ordinary FP port
% Temperature
FOR ALL Entropy,Temperature,sEntropy,sTemperature
LET sFP(effort,1,
	Entropy,flow,1,
	Temperature,effort,2,
	sEntropy,flow,3,
	sTemperature,effort,4
	) 
        = Temperature;

% Heat
FOR ALL Entropy,Temperature,sEntropy,sTemperature
LET sFP(flow,2,
	Entropy,flow,1,
	Temperature,effort,2,
	sEntropy,flow,3,
	sTemperature,effort,4
	)
        = Entropy*Temperature;

% Temperature sensitivity
% Sensitivity  FP port
FOR ALL Entropy,Temperature,sEntropy,sTemperature
LET sFP(effort,3,
	Entropy,flow,1,
	Temperature,effort,2,
	sEntropy,flow,3,
	sTemperature,effort,4
	) 
        = sTemperature;

% Heat sensitivity
FOR ALL Entropy,Temperature,sEntropy,sTemperature
LET sFP(flow,4,
	Entropy,flow,1,
	Temperature,effort,2,
	sEntropy,flow,3,
	sTemperature,effort,4
	) 
        = (Entropy*sTemperature + sEntropy*Temperature);

% Heat flow in

% Ordinary FP port
% Temperature
FOR ALL Heat,Temperature,sHeat,sTemperature
LET sFP(effort,2,
	Temperature,effort,1,
	Heat,flow,2,
	sTemperature,effort,3,
	sHeat,flow,4
	) 
        = Temperature;

% Heat
FOR ALL Heat,Temperature,sHeat,sTemperature
LET sFP(flow,1,
	Temperature,effort,1,
	Heat,flow,2,
	sTemperature,effort,3,
	sHeat,flow,4
	) 
        = Heat/Temperature;

% Temperature sensitivity
% Sensitivity  FP port
FOR ALL Heat,Temperature,sHeat,sTemperature
LET sFP(effort,4,
	Temperature,effort,1,
	Heat,flow,2,
	sTemperature,effort,3,
	sHeat,flow,4
	) 
        = sTemperature;

% Heat sensitivity
FOR ALL Heat,Temperature,sHeat,sTemperature
LET sFP(flow,3,
	Temperature,effort,1,
	Heat,flow,2,
	sTemperature,effort,3,
	sHeat,flow,4
	) 
        = (sHeat*Temperature - Heat*sTemperature)/Temperature^2;
END;

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFP/sFP_desc.tex version [5a88ca8029].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system sFP (sFP_desc.tex)
% Generated by MTT on Fri Jul 6 01:55:23 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{sFP} is
   displayed in Figure \Ref{fig:sFP_abg.ps} and its label
   file is listed in Section \Ref{sec:sFP_lbl}.
   The subsystems are listed in Section \Ref{sec:sFP_sub}.

This is the sensitivity version of the \textbf{FP} (flow/power
real-pseuso component).

The standard ports implement the CR:
\begin{align}
  T_1 &= T_2 \\
  Q &= S*T_2
\end{align}

The \emph{sensitivity} ports implement the CR:
\begin{align}
  T_1^\prime &= T_2^\prime \\
  Q^\prime &= S^\prime *T_2 + S*T_2^\prime
\end{align}

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFP/sFP_lbl.txt version [0db9ba715f].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY sFP Sensitivity version of FP - real-pseudo conversion

## System sFP, representation lbl, language txt
## File sFP_lbl.txt
## Generated by MTT on Thu Jul  5 08:03:02 BST 2001

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

## Port aliases
#ALIAS	in|f    F,sF
#ALIAS	out|p   P,sP


## Each line should be of one of the following forms:
##	     a comment (ie starting with #)
##	     component-name	cr_name	arg1,arg2,..argn
##	     blank

## ---- Component labels ----

## Component type R
	r       sFP

## Component type SS
	[F]	SS		external,external		
	[P]	SS		external,external		
	[sF]	SS		external,external		
	[sP]	SS		external,external		

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sFP/sFP_rep.txt version [6d67192426].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system sFP (sFP_rep.txt)
## Generated by MTT on" Fri Jul  6 02:04:19 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt sFP abg tex			# The system description
mtt sFP cr tex			# The system description
##mtt sFP cbg ps 		        # The causal bond graph
mtt sFP struc tex	        # The system structure
mtt sFP sympar tex	        # The system parameters
## Uncomment the following lines or add others
mtt sFP dae tex	        # The system dae
## mtt sFP ode tex	        # The system ode 
## mtt sFP sspar tex		# Steady-state parameters
## mtt sFP ss tex 		# Steady state
## mtt sFP dm tex		# Descriptor matrices (of linearised system)
## mtt sFP sm tex		# State matrices (of linearised system)
## mtt sFP tf tex		# Transfer function (of linearised system)
## mtt sFP lmfr ps		# log modulus of frequency response (of linearised system)
## mtt sFP simpar tex		# Simulation parameters
## mtt sFP numpar tex		# Numerical simulation parameters
## mtt sFP state tex		# Simulation initial state
## mtt sFP input tex		# Simulation input
## mtt sFP logic tex		# Logic control
## mtt sFP odeso ps		# Simulation output

## mtt sFP rep txt		# This file

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sGY/sGY_abg.fig version [45c2af76d2].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 450 3825 450 3600 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 1125 3825 1125 3600 1350
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5175 450 6525 450 6300 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5175 1125 6525 1125 6300 1350
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7200 450 8550 450 8325 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7200 1125 8550 1125 8325 1350
4 1 4 100 0 18 20 0.0000 4 270 1920 1440 540 SS:[Actual_in]\001
4 1 0 100 0 18 20 0.0000 4 210 960 4545 855 sTF:stf\001
4 1 4 100 0 18 20 0.0000 4 270 1740 1440 1215 SS:[Sens_in]\001
4 1 0 100 0 18 20 0.0000 4 210 420 6840 540 GY\001
4 1 0 100 0 18 20 0.0000 4 210 420 6840 1215 GY\001
4 1 4 100 0 18 20 0.0000 4 270 2115 9765 540 SS:[Actual_out]\001
4 1 4 100 0 18 20 0.0000 4 270 1935 9765 1215 SS:[Sens_out]\001
4 1 4 100 0 18 14 0.0000 4 210 1125 3825 315 [Actual_in]\001
4 1 4 100 0 18 14 0.0000 4 210 1275 5175 315 [Actual_out]\001
4 1 4 100 0 18 14 0.0000 4 210 1140 5175 1575 [Sens_out]\001
4 1 4 100 0 18 14 0.0000 4 210 990 3870 1575 [Sens_in]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sGY/sGY_lbl.txt version [2cd97b9fb4].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sGY (sGY_lbl.txt)
%SUMMARY sGY GY component with sensitivity ports
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Actual_in,Sens_in
%ALIAS	out	Actual_out,Sens_out


% Argument aliases
%ALIAS	$1	flow,k
%ALIAS	$2	k_s

%ALIAS	$1	lin

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type sTF
        stf		lin		flow,k;k_s

% Component type SS
	[Actual_in]	SS		external,external
	[Actual_out]	SS		external,external
	[Sens_in]	SS		external,external
	[Sens_out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sI/sC_lbl.txt version [d2c544e0d3].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sC (sC_lbl.txt)
%SUMMARY sC
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Actual,Sensitivity

% Argument aliases
%ALIAS	$1	effort,c
%ALIAS	$2	k_s

% CR aliases
%ALIAS	$1	lin
%ALIAS	$2	slin

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AEf
	aef		lin	-1*k_s

% Component type C
	c_1		lin	effort,c
	c_2		slin	effort,c

% Component type SS
	[Actual]	SS		external,external
	[Sensitivity]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sI/sI_abg.fig version [0b170eafdf].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 3375 5400 3375 5625 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 3375 4500 3375 4275 3600
2 4 0 3 31 7 101 0 -1 0.000 0 0 11 0 0 5
	 9000 4725 1350 4725 1350 2253 9000 2253 9000 4725
4 1 4 100 0 18 14 0.0000 4 210 270 4410 3105 [1]\001
4 1 4 100 0 18 14 0.0000 4 210 270 5535 3105 [2]\001
4 0 4 100 0 18 18 0.0000 4 270 1935 6840 3465 SS:[sensitivity]\001
4 2 4 100 0 18 18 0.0000 4 270 1410 3060 3465 SS:[actual]\001
4 1 0 100 0 18 18 0.0000 4 210 390 4950 3465 I:m\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sI/sI_lbl.txt version [c893be13e2].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sI (sI_lbl.txt)
%SUMMARY sI Sensitivity I component
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/05 12:00:18  gawthrop
% %% Identification example
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	actual,sensitivity

% Argument aliases
%ALIAS	$1	flow,m
%ALIAS	$2	ms

%CR alias
%ALIAS $1 slin

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type C
	m	slin 	flow,m;ms

% Component type SS
	[actual]	SS		external,external
	[sensitivity]	SS		external,external



Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sINTF/sINTF_abg.fig version [2b8dc82992].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2925 3150 2925 2925 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2250 3150 2250 2925 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 2925 6300 2925 6075 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 2250 6300 2250 6075 2475
4 1 4 100 0 18 20 0.0000 4 270 1200 990 3015 SS:[in_2]\001
4 1 4 100 0 18 20 0.0000 4 270 1200 990 2340 SS:[in_1]\001
4 1 0 100 0 18 20 0.0000 4 270 1455 4050 3015 INTF:intf_2\001
4 1 0 100 0 18 20 0.0000 4 270 1455 4050 2340 INTF:intf_1\001
4 1 4 100 0 18 20 0.0000 4 270 1395 7245 3015 SS:[out_2]\001
4 1 4 100 0 18 20 0.0000 4 270 1395 7245 2340 SS:[out_1]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sINTF/sINTF_lbl.txt version [123e35cee2].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sINTF (sINTF_lbl.txt)
%SUMMARY sINTF Sensitivity version of INTF
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 10:32:30  peterg
% %% Put under RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in_1,in_2
%ALIAS	out	out_1,out_2

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type INTF
	intf_1
	intf_2

% Component type SS
	[in_1]	SS		external,external
	[in_2]	SS		external,external
	[out_1]	SS		external,external
	[out_2]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sINTFS/sINTFS_abg.fig version [3245e72115].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2925 3150 2925 2925 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1800 2250 3150 2250 2925 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 2925 6300 2925 6075 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 2250 6300 2250 6075 2475
4 1 4 100 0 18 20 0.0000 4 270 1200 990 3015 SS:[in_2]\001
4 1 4 100 0 18 20 0.0000 4 270 1200 990 2340 SS:[in_1]\001
4 1 0 100 0 18 20 0.0000 4 270 1650 4050 3015 INTFS:intf_2\001
4 1 4 100 0 18 20 0.0000 4 270 1395 7245 3015 SS:[out_2]\001
4 1 4 100 0 18 20 0.0000 4 270 1395 7245 2340 SS:[out_1]\001
4 1 0 100 0 18 20 0.0000 4 270 1650 4095 2340 INTFS:intf_1\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sINTFS/sINTFS_lbl.txt version [f58d20ad1f].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sINTFS (sINTFS_lbl.txt)
%SUMMARY sINTFS Sensitivity version of INTF with initial state
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 10:32:30  peterg
% %% Put under RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in_1,in_2
%ALIAS	out	out_1,out_2

% Argument aliases
%ALIAS	$1      e_0
%ALIAS	$2      k_s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type INTFS
	intf_1    none	e_0
	intf_2    none  k_s

% Component type SS
	[in_1]	SS		external,external
	[in_2]	SS		external,external
	[out_1]	SS		external,external
	[out_2]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sIS/sIS_abg.fig version [afb2e2fe02].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3825 2475 2475 2700 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 5625 2475 4275 2700 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4050 4050 4050 3825 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 3825 4050 4275
2 4 0 2 31 7 52 0 -1 0.000 0 0 7 0 0 5
	 6075 6300 6075 1350 1125 1350 1125 6300 6075 6300
4 1 0 100 0 18 20 0.0000 4 210 405 2475 2295 sI:i\001
4 0 0 100 0 18 20 0.0000 4 270 960 4185 4185 sSf:f_0\001
4 1 6 100 0 18 20 0.0000 4 270 555 2476 6031 [1,2]\001
4 1 4 100 0 18 20 0.0000 4 270 900 2476 6030 SS:[in]\001
4 1 6 100 0 18 20 0.0000 4 270 555 2476 4186 [1,2]\001
4 1 0 100 0 18 20 0.0000 4 195 150 2476 4185 0\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sIS/sIS_lbl.txt version [f0aeba0ddf].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sIS (sIS_lbl.txt)
%SUMMARY sIS
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 17:29:10  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Port aliases
%ALIAS	in	in_1,in_2

% Argument aliases
%ALIAS	$1	flow,i
%ALIAS	$2	f_0
%ALIAS	$3	i_s
%ALIAS	$4	f_0s

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[in]	SS		external,external

% Component type sI
	i       slin             flow,i;i_s

% Component type sSf
	f_0     SS	        f_0;f_0s

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sR/sR_abg.fig version [1cfa4eb3a3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 3375 5400 3375 5625 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 3375 4500 3375 4275 3600
2 4 0 3 31 7 101 0 -1 0.000 0 0 11 0 0 5
	 9000 4725 1350 4725 1350 2253 9000 2253 9000 4725
4 1 4 100 0 18 14 0.0000 4 210 270 4410 3105 [1]\001
4 1 4 100 0 18 14 0.0000 4 210 270 5535 3105 [2]\001
4 0 4 100 0 18 18 0.0000 4 270 1935 6840 3465 SS:[sensitivity]\001
4 2 4 100 0 18 18 0.0000 4 270 1410 3060 3465 SS:[actual]\001
4 1 0 100 0 18 18 0.0000 4 210 390 4950 3465 R:r\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sR/sR_lbl.txt version [e03a82f71c].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sR (sR_lbl.txt)
%SUMMARY sR Sensitivity R component
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/05 12:00:18  gawthrop
% %% Identification example
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	actual,sensitivity

% Argument aliases
%ALIAS	$1	flow,r
%ALIAS	$2	rs

%CR alias
%ALIAS $1 slin

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	r	slin 	flow,r;rs

% Component type SS
	[actual]	SS		external,external
	[sensitivity]	SS		external,external



Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sRS/sRS_abg.fig version [530171f10a].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 675 4050 675 3825 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 1350 4050 1350 3825 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 1125 4050 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 450 4050 900
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9900 1800 1350 1800 1350 225 9900 225 9900 1800
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 675 6075 675 5850 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 1350 6075 1350 5850 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4725 1125 4725 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4725 450 4725 900
4 1 4 100 0 18 18 0.0000 4 270 870 2115 765 SS:[In]\001
4 1 4 100 0 18 18 0.0000 4 270 1020 2115 1395 SS:[sIn]\001
4 1 0 100 0 18 24 0.0000 4 285 510 4410 1125 R:r\001
4 1 4 100 0 18 14 0.0000 4 210 270 4860 540 [2]\001
4 1 4 100 0 18 14 0.0000 4 210 270 4860 1215 [4]\001
4 1 4 100 0 18 14 0.0000 4 210 270 3870 1215 [3]\001
4 1 4 100 0 18 14 0.0000 4 210 270 3870 540 [1]\001
4 1 4 100 0 18 18 0.0000 4 270 1230 6795 765 SS:[Out]\001
4 1 4 100 0 18 18 0.0000 4 270 1380 6885 1440 SS:[sOut]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sRS/sRS_cr.r version [5c21ad435b].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% CR file for sFMR
%% Just for flow input definition of r, ie must use with flow,r;k_s

in "$MTT_CRS/r/slin.cr"; %% make sure CR slin is there

OPERATOR sRS;

% Ordinary RS port
% R component
FOR ALL gain_cause,r,rs,out_cause,inp,sinp,in_cause,temp,stemp
LET sRS(gain_cause,r,rs,out_cause,1,
	inp,in_cause,1,
	temp,effort,2,
	sinp,in_cause,3,
	stemp,effort,4
	) 
        = lin(gain_cause,r,temp_cause,1,
               inp,in_cause,1);
% Entropy flow 
FOR ALL gain_cause,r,rs,out_cause,inp,sinp,in_cause,temp,stemp
LET sRS(gain_cause,r,rs,out_cause,2,
	inp,in_cause,1,
	temp,effort,2,
	sinp,in_cause,3,
	stemp,effort,4
	) 
        = inp*lin(gain_cause,r,temp_cause,1,
               inp,in_cause,1)/temp;

% Sensitivity ports
FOR ALL gain_cause,r,rs,out_cause,inp,sinp,in_cause,temp,stemp
LET sRS(gain_cause,r,rs,out_cause,3,
	inp,in_cause,1,
	temp,effort,2,
	sinp,in_cause,3,
	stemp,effort,4
	) 
        = slin(gain_cause,r,rs,temp_cause,2,
               inp,in_cause,1,
               sinp,in_cause,2
        );

%% Sensitivity entropy flow
%% - flow in
FOR ALL gain_cause,r,rs,out_cause,inp,sinp,in_cause,temp,stemp
LET sRS(gain_cause,r,rs,out_cause,4,
	inp,flow,1,
	temp,effort,2,
	sinp,flow,3,
	stemp,effort,4
	) 
        = 2*inp*sinp*r/temp
        + (inp^2)*rs/temp
        - (inp^2)*r*stemp/(temp^2);

%% - effort in
FOR ALL gain_cause,r,rs,out_cause,inp,sinp,in_cause,temp,stemp
LET sRS(gain_cause,r,rs,out_cause,4,
	inp,effort,1,
	temp,effort,2,
	sinp,effort,3,
	stemp,effort,4
	) 
        = 2*inp*sinp/(r*temp)
        - (inp^2)*rs/((r^2)*temp)
        - (inp^2)*stemp/(r*temp^2);

END;

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sRS/sRS_desc.tex version [891b367d21].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system sRS (sFMR_desc.tex)
% Generated by MTT on Thu Jul 5 23:47:35 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/07/06 01:17:14  gawthrop
% %% New sensitivity components (for extruder model)
% %%
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{sRS} is
   displayed in Figure \Ref{fig:sFMR_abg.ps} and its label
   file is listed in Section \Ref{sec:sFMR_lbl}.
   The subsystems are listed in Section \Ref{sec:sFMR_sub}.


This is the sensitivity version of the \textbf{FMR} (flow-modulated
resistor) component.

In the linear case, the CR of the standard port is:
\begin{equation}
  e = mrf
\end{equation}
where $e$ is the effort, $m$ the (flow) modulation, $r$ the
``resistance'' and $f$ the flow.

The corresponding sensitivity CR is:
\begin{equation}
  e^\prime  = m^\prime rf + mr^\prime f + mrf^\prime
\end{equation}

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sRS/sRS_lbl.txt version [fbf7e22063].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY sRS Sensitivity version of RS

## System sRS, representation lbl, language txt

## Port aliases
#ALIAS	in	In,sIn
#ALIAS	out	Out,sOut


## Argument aliases
#ALIAS	$1	flow,r
#ALIAS	$2	rs

## Each line should be of one of the following forms:
##	     a comment (ie starting with #)
##	     component-name	cr_name	arg1,arg2,..argn
##	     blank

## ---- Component labels ----

## Component type R
	r	sRS		flow,r;rs		

## Component type SS
	[In]	SS		external,external		
	[sIn]	SS		external,external		
	[Out]	SS		external,external		
	[sOut]	SS		external,external		

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sRS/sRS_rep.txt version [a8fe94a22d].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system sRS (sFMR_rep.txt)
## Generated by MTT on" Thu Jul  5 23:56:36 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2001/07/06 01:18:24  gawthrop
## New sensitivity components - documentation
##
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt sRS abg tex			# The system description
mtt sRS cr  tex			# The CR
##mtt sRS cbg ps 		        # The causal bond graph
mtt sRS struc tex	        # The system structure
mtt sRS sympar tex	        # The system parameters
## Uncomment the following lines or add others
mtt sRS dae tex	        # The system dae
## mtt sRS ode tex	        # The system ode 
## mtt sRS sspar tex		# Steady-state parameters
## mtt sRS ss tex 		# Steady state
## mtt sRS dm tex		# Descriptor matrices (of linearised system)
## mtt sRS sm tex		# State matrices (of linearised system)
## mtt sRS tf tex		# Transfer function (of linearised system)
## mtt sRS lmfr ps		# log modulus of frequency response (of linearised system)
## mtt sRS simpar tex		# Simulation parameters
## mtt sRS numpar tex		# Numerical simulation parameters
## mtt sRS state tex		# Simulation initial state
## mtt sRS input tex		# Simulation input
## mtt sRS logic tex		# Logic control
## mtt sRS odeso ps		# Simulation output

## mtt sRS rep txt		# This file

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sRT/sRT_abg.fig version [f43a08790f].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 2701 5625 2701 5400 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 2701 7425 2701 7200 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 2476 5850 1126 6075 1351
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11475 3600 450 3600 450 451 11475 451 11475 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 2701 3375 2701 3150 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8325 2701 9675 2701 9450 2926
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3375 2520 3375 2970
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8325 2475 8325 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5625 2475 5625 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6075 2475 6075 2925
4 1 6 0 0 0 20 0.0000 4 240 510 5851 2792 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5851 2791 1\001
4 1 -1 0 0 0 20 0.0000 4 195 480 5850 991 sR:r\001
4 1 4 0 0 0 20 0.0000 4 255 315 4410 2476 [p]\001
4 1 4 0 0 0 20 0.0000 4 255 315 7290 2476 [p]\001
4 1 1 1 0 3 20 0.0000 4 240 210 5040 3106 Q\001
4 1 1 1 0 3 30 0.0000 4 60 105 5085 2836 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 5040 2521 T\001
4 1 1 1 0 3 20 0.0000 4 240 210 6615 3106 Q\001
4 1 1 1 0 3 30 0.0000 4 60 105 6660 2836 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 6615 2521 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 6795 2611 2\001
4 1 1 1 0 3 20 0.0000 4 195 135 5220 2611 1\001
4 1 -1 0 0 0 20 0.0000 4 255 870 3825 2790 sFP:fp1\001
4 2 6 0 0 0 20 0.0000 4 240 510 1981 2791 [1,2]\001
4 2 4 0 0 0 20 0.0000 4 240 810 1981 2790 SS:[in]\001
4 1 4 0 0 0 20 0.0000 4 240 270 3285 2476 [f]\001
4 1 1 1 0 3 20 0.0000 4 195 165 2475 3106 S\001
4 1 1 1 0 3 30 0.0000 4 60 105 2520 2836 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 2475 2521 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 2610 2611 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 2610 3241 1\001
4 1 -1 0 0 0 20 0.0000 4 255 870 7920 2790 sFP:fp2\001
4 1 4 0 0 0 20 0.0000 4 240 270 8505 2476 [f]\001
4 1 1 1 0 3 20 0.0000 4 195 165 9090 3106 S\001
4 1 1 1 0 3 30 0.0000 4 60 105 9135 2836 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 9090 2521 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 9270 3241 2\001
4 1 1 1 0 3 20 0.0000 4 195 135 9270 2611 2\001
4 0 6 0 0 0 20 0.0000 4 240 510 9811 2792 [1,2]\001
4 0 4 0 0 0 20 0.0000 4 240 960 9811 2791 SS:[out]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sRT/sRT_lbl.txt version [c50752cef2].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY sRT Sensitivity version of RT

## System sRT, representation lbl, language txt
## File sRT_lbl.txt
## Generated by MTT on Fri Jul  6 05:51:50 BST 2001

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

## Port aliases
#ALIAS	in	in_1,in_2
#ALIAS	out	out_1,out_2

## Argument aliases
#ALIAS	$1	flow,r
#ALIAS	$2	rs

## Each line should be of one of the following forms:
##	     a comment (ie starting with #)
##	     component-name	cr_name	arg1,arg2,..argn
##	     blank

## ---- Component labels ----

## Component type SS
	[in]	SS		external,external		
	[out]	SS		external,external		

## Component type FP
	fp1	lin
	fp2	lin		

## Component type R
	r	slin		flow,r;rs		

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sSe/sSe_abg.fig version [31113ead72].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 2025 3600 2025 3375 2250
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 1350 3600 1350 3375 1575
4 1 0 100 0 18 20 0.0000 4 270 1080 1485 2115 Se:se_2\001
4 1 4 100 0 18 20 0.0000 4 270 1515 4500 2115 SS:[port_2]\001
4 1 4 100 0 18 20 0.0000 4 270 1515 4545 1440 SS:[port_1]\001
4 1 0 100 0 18 20 0.0000 4 270 1080 1485 1440 Se:se_1\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sSe/sSe_lbl.txt version [e9246e3267].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sSe (sSe_lbl.txt)
%SUMMARY sSe Sensitivity version of effort source (Se)
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 04:54:41  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in|out	port_1,port_2

% Argument aliases
%ALIAS	$1 e_s
%ALIAS	$2 k_s


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[port_1]	SS		external,external
	[port_2]	SS		external,external

% Component type Se
	se_1		SS		e_s
	se_2		SS		k_s

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sSe/sSe_sSe_abg.fig version [8738ce32fa].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 900 1215 2070 1530
4 1 0 100 0 18 20 0.0000 4 285 1155 1485 1440 Sf:sf_1\001
-6
6 900 1890 2070 2205
4 1 0 100 0 18 20 0.0000 4 285 1155 1485 2115 Sf:sf_2\001
-6
6 2205 1305 3645 1620
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 1350 3600 1350 3375 1575
-6
6 2205 1980 3645 2295
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 2025 3600 2025 3375 2250
-6
6 3735 1215 5355 1530
4 1 4 100 0 18 20 0.0000 4 300 1620 4545 1440 SS:[port_1]\001
-6
6 3690 1890 5310 2205
4 1 4 100 0 18 20 0.0000 4 300 1620 4500 2115 SS:[port_2]\001
-6

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sSf/sSf_abg.fig version [8738ce32fa].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 900 1215 2070 1530
4 1 0 100 0 18 20 0.0000 4 285 1155 1485 1440 Sf:sf_1\001
-6
6 900 1890 2070 2205
4 1 0 100 0 18 20 0.0000 4 285 1155 1485 2115 Sf:sf_2\001
-6
6 2205 1305 3645 1620
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 1350 3600 1350 3375 1575
-6
6 2205 1980 3645 2295
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 2025 3600 2025 3375 2250
-6
6 3735 1215 5355 1530
4 1 4 100 0 18 20 0.0000 4 300 1620 4545 1440 SS:[port_1]\001
-6
6 3690 1890 5310 2205
4 1 4 100 0 18 20 0.0000 4 300 1620 4500 2115 SS:[port_2]\001
-6

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sSf/sSf_lbl.txt version [7503578c13].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sSf (sSf_lbl.txt)
%SUMMARY sSf Sensitivity version of flow source (Sf)
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 04:54:41  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in|out	port_1,port_2

% Argument aliases
%ALIAS	$1 f_s
%ALIAS	$2 k_s


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[port_1]	SS		external,external
	[port_2]	SS		external,external

% Component type Sf
	sf_1		SS		f_s
	sf_2		SS		k_s

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sTF/sTF_abg.fig version [d3bd4652b1].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 4050 3825 4050 3600 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4050 5625 4050 5400 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7650 4050 9000 4050 8775 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9450 4050 10800 4050 10575 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 450 3825 450 3600 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 450 5625 450 5400 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7650 450 9000 450 8775 675
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9450 450 10800 450 10575 675
2 1 0 2 -1 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 2520 9225 3825 9225 3600
2 1 0 2 -1 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9231 2498 4056 3803 4056 3578
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 675 4050 2025 4275 1800
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9225 675 9225 2025 9450 1800
2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 2
	 3825 675 4275 675
2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 2
	 9000 2025 9450 2025
4 1 4 100 0 18 20 0.0000 4 270 1740 1440 4140 SS:[Sens_in]\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 4140 1\001
4 1 0 100 0 18 20 0.0000 4 210 1095 6660 4140 TF:sens\001
4 1 0 100 0 18 20 0.0000 4 195 150 9225 4140 0\001
4 1 4 100 0 18 20 0.0000 4 270 1935 12015 4140 SS:[Sens_out]\001
4 1 4 100 0 18 20 0.0000 4 270 1920 1440 540 SS:[Actual_in]\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 540 1\001
4 1 0 100 0 18 20 0.0000 4 195 150 9225 540 0\001
4 1 4 100 0 18 20 0.0000 4 270 2115 12015 540 SS:[Actual_out]\001
4 1 0 100 0 18 20 0.0000 4 210 825 9180 2340 AE:ae\001
4 1 0 100 0 18 20 0.0000 4 210 750 4050 2340 AF:af\001
4 1 0 100 0 18 20 0.0000 4 210 1260 6660 540 TF:actual\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sTF/sTF_lbl.txt version [6977eeb4be].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sTF (sTF_lbl.txt)
%SUMMARY sTF TF component with sensitivity ports
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1999/08/26 01:34:59  peterg
% %% Summary line added
% %%
% %% Revision 1.2  1999/08/26 01:22:25  peterg
% %% New alias $1 flow,k
% %%
% %% Revision 1.1  1999/08/26 00:15:58  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Actual_in,Sens_in
%ALIAS	out	Actual_out,Sens_out


% Argument aliases
%ALIAS	$1	flow,k
%ALIAS	$2	k_s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AE
	ae		lin		effort,-k_s

% Component type AF
	af		lin		flow,k_s

% Component type SS
	[Actual_in]	SS		external,external
	[Actual_out]	SS		external,external
	[Sens_in]	SS		external,external
	[Sens_out]	SS		external,external

% Component type TF
	actual		lin	flow,k
	sens		lin	flow,k

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sTF/testsTF_abg.fig version [136b338a92].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 2925 6075 2925 5850 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2250 2700 2250 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 2925 3600 2925 3375 3150
4 1 0 100 0 18 18 0.0000 4 210 930 4185 3060 sTF:stf\001
4 1 0 100 0 18 18 0.0000 4 270 1050 1620 3015 SS:ss_1\001
4 1 0 100 0 18 18 0.0000 4 270 1050 6750 3015 SS:ss_2\001
4 1 4 100 0 18 14 0.0000 4 210 450 2385 2700 [1,2]\001
4 1 4 100 0 18 14 0.0000 4 210 450 6030 2790 [1,2]\001

Deleted mttroot/mtt/lib/comp/compound/Sensitivity/sTF/testsTF_lbl.txt version [11d70877b9].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY testsTF
#DESCRIPTION Detailed description here

## System testsTF, representation lbl, language txt
## File testsTF_lbl.txt
## Generated by MTT on Thu Aug  9 12:38:50 BST 2001

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

## Port aliases

## Argument aliases
#ALIAS	$1	k
#ALIAS	$2	k_s

## Each line should be of one of the following forms:
##	     a comment (ie starting with #)
##	     component-name	cr_name	arg1,arg2,..argn
##	     blank

## ---- Component labels ----

## Component type 
	ss_1	SS		external,external		
	ss_2	SS		external,external		

## Component type sTF
	stf	slin		flow,n;n_s

Deleted mttroot/mtt/lib/comp/compound/Thermal/CT/CT_abg.fig version [2a418d3ee2].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 2700 3375 2700 3150 2925
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 5850 3825 5850 1575 225 1575 225 3825 5850 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 2700 5625 2700 5400 2925
4 1 4 0 0 0 20 0.0000 4 240 270 3285 2475 [f]\001
4 1 1 1 0 3 20 0.0000 4 195 165 2475 3105 S\001
4 1 1 1 0 3 20 0.0000 4 195 165 2475 2475 T\001
4 1 1 1 0 3 30 0.0000 4 60 105 2520 2835 .\001
4 2 4 0 0 0 20 0.0000 4 240 810 1980 2790 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 630 3825 2790 FP:fp\001
4 1 4 0 0 0 20 0.0000 4 255 315 4410 2475 [p]\001
4 1 1 1 0 3 20 0.0000 4 240 210 4950 3105 Q\001
4 1 1 1 0 3 20 0.0000 4 195 165 4950 2475 T\001
4 1 1 1 0 3 30 0.0000 4 60 105 4995 2835 .\001
4 1 -1 0 0 0 20 0.0000 4 195 390 5940 2790 C:c\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CT/CT_desc.tex version [7676ba8d58].

1
2
3
4
5
6
7







-
-
-
-
-
-
-

Component \textbf{CT} is a two port thermal resistor with true power
bonds. Internally, it has a pseudo Bond Graph representation, and the
corresponding thermal resistance just acts as an ordinary one-port
\textbf{C} component.

 

Deleted mttroot/mtt/lib/comp/compound/Thermal/CT/CT_lbl.txt version [ee5a8364ff].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CT: One-port thermal C component with T/Sdot bond
%DESCRIPTION CR and parameters as for a one-port C component
%DESCRIPTION Internally pseudo
%DESCRIPTION Example label file entry:
%DESCRIPTION % Component type CT
%DESCRIPTION 	c		lin	effort,c

%Port aliases
%ALIAS		Thermal|out	in

%CR aliases
%ALIAS          $1		effort,c_t
%ALIAS          $a1		lin

%% Label file for system CT (CT_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.7  2001/07/03 22:59:10  gawthrop
% %% Fixed problems with argument passing for CRs
% %%
% %% Revision 1.6  2001/06/13 17:10:26  gawthrop
% %% Alias for the cr (ie ALIAS	$1	lin)
% %%
% %% Revision 1.5  2001/06/11 15:09:18  gawthrop
% %% Removed spurious parameter
% %%
% %% Revision 1.4  1998/07/22 11:28:15  peterg
% %% Out as port alias
% %%
% %% Revision 1.3  1998/07/22 11:27:41  peterg
% %% Changed port name
% %%
% %% Revision 1.2  1998/06/29 10:12:58  peterg
% %% Converted to FP component
% %% Removed FP label
% %%
% %% Revision 1.1  1997/09/04  09:49:19  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c		lin		effort,c_t

% Component type FP
        fp

% Component type SS
	[in]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/CT2/CT2.cr version [46957c5ad0].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CT2    Constitutive Relationship for a two port thermo C
%DESCRIPTION Parameter 1: c_v (specific heat at constant volume)
%DESCRIPTION Parameter 2: gamma = c_p/c_v
%DESCRIPTION Parameter 3: mass of (ideal) gas within component.
%DESCRIPTION Parameter 4: t_0 -- the temperature at which internal
%DESCRIPTION energy is zero.

%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/12/07 20:45:21  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/02  10:21:19  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/09/12 11:18:26  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


OPERATOR CT2;
Port 1 - Thermal
FOR ALL c_v,gamma,m,t_0,InternalEnergy,Volume
LET CT2(c_v,gamma,m,t_0,effort,1,
	InternalEnergy, state, 1,
	Volume, state, 2)
         = InternalEnergy/(m*c_v);

Port 2 - Mechanical
FOR ALL c_v,gamma,m,t_0,InternalEnergy,Volume
LET CT2(c_v,gamma,m,t_0,effort,2,
	InternalEnergy, state, 1,
	Volume, state, 2)
         = (gamma-1)*(InternalEnergy+c_v*m*t_0)/Volume;

END;

Deleted mttroot/mtt/lib/comp/compound/Thermal/CT2/CT2_abg.fig version [4aa81090a9].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2700 5400 4050 5400 3825 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 5400 4725 5400 4950 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 3825 2475 5175 2700 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 2025 2475 3375 2700 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 3825 6525 5175 6750 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 3375 6525 2025 6750 2250
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 5085 5895 5085 4950 3690 4950 3690 5895 5085 5895
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 2024 6750 3262 5512
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 5175 2700 5625
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6075 5175 6075 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 6525 5625 6525 6750 4500 6750 4725 6975
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 2475 5625 2475 6750 4050 6750 3825 6975
4 1 4 0 0 0 20 0.0000000 4 240 345 2250 4005 [e]\001
4 1 4 0 0 0 20 0.0000000 4 240 330 2250 3375 [s]\001
4 0 -1 0 0 0 20 0.0000000 4 210 150 2430 5490 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 420 4410 5490 C:c\001
4 1 -1 0 0 0 20 0.0000000 4 270 690 6525 5490 PS:ps\001
4 0 4 0 0 0 20 0.0000000 4 270 960 6660 5850 [power]\001
4 1 -1 0 0 0 20 0.0000000 4 210 690 2430 3690 ES:es\001
4 1 4 0 0 0 20 0.0000000 4 240 870 2475 1845 SS:[in]\001
4 2 4 0 0 0 20 0.0000000 4 240 600 5985 5265 [out]\001
4 0 4 0 0 0 20 0.0000000 4 240 450 6750 5175 [in]\001
4 0 -1 0 0 0 20 0.0000000 4 210 150 6435 3690 0\001
4 1 4 0 0 0 20 0.0000000 4 240 1020 6480 1890 SS:[out]\001
4 1 1 1 0 3 20 0.0000000 4 240 2340 6480 1530 Mechanical Power\001
4 1 1 1 0 3 20 0.0000000 4 210 180 2160 2700 T\001
4 1 1 1 0 3 20 0.0000000 4 210 180 6300 2700 P\001
4 0 1 1 0 3 20 0.0000000 4 210 675 6660 2700 dV/dt\001
4 1 1 1 0 3 20 0.0000000 4 240 1935 2475 1530 Thermal Power\001
4 0 1 1 0 3 20 0.0000000 4 210 720 2610 4365 dH/dt\001
4 1 1 1 0 3 20 0.0000000 4 255 840 1935 4365 T-T_0\001
4 1 1 1 0 3 20 0.0000000 4 210 180 6300 4365 P\001
4 0 1 1 0 3 20 0.0000000 4 210 855 6705 4365 -dV/dt\001
4 2 1 1 0 3 20 0.0000000 4 210 1755 2025 6660 dH/dt-PdV/dt\001
4 1 1 1 0 3 20 0.0000000 4 270 1485 4365 4770 Two-port C\001
4 1 4 0 0 0 20 0.0000000 4 240 450 4050 5265 [in]\001
4 1 4 0 0 0 20 0.0000000 4 240 600 4770 5265 [out]\001
4 0 1 1 0 3 20 0.0000000 4 210 855 4005 7335 PdV/dt\001
4 0 -1 0 0 0 20 0.0000000 4 210 150 4230 6840 1\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CT2/CT2_desc.tex version [2ac31e428a].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system CT2 (CT2_desc.tex)
% Generated by MTT on Thu Dec 4 16:00:14 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/12/07 20:29:56  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{CT2} is
   displayed in Figure \Ref{CT2_abg} and its label
   file is listed in Section \Ref{sec:CT2_lbl}.
   The subsystems are listed in Section \Ref{sec:CT2_sub}.

\textbf{CT2} is a two port thermal capacitor representing an ideal
heat engine converting heat to work without energy loss. There are two
ports {\bf [in]} (with covariables Temperature (absolute) and
entropy flow) and {\bf [out]} with covariables Pressure and rate of
change of volume. 

Rather than using the corresponding (nonlinear) Constitutive
Relationship (with entropy and volume as states) directly, the
component is built up from a {\em linear\/} two-port capacitor with
internal energy and volume as states. The {\bf ES} component provides
the conversion from the pseudo Bond Graph with temperature (relative)
and enthalpy flow as covariables to the true Bond Graph with with
covariables Temperature (absolute) and entropy flow.

The power-sensor {\bf PS} component is used to subtract the work enrgy
from the internal energy.







Deleted mttroot/mtt/lib/comp/compound/Thermal/CT2/CT2_lbl.txt version [db65e0d0b3].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CT2: Two-port thermal C component - a heat engine.
%DESCRIPTION Port [in]: a (true) thermal bond 
%DESCRIPTION Port [out]: a mechanical (P, dV/dT) bond.
%DESCRIPTION Parameter 1: c_v (specific heat at constant volume)
%DESCRIPTION Parameter 2: gamma = c_p/c_v
%DESCRIPTION Parameter 3: mass of (ideal) gas within component.
%DESCRIPTION Parameter 4: t_0 -- the temperature at which internal
%DESCRIPTION energy is zero.

%% Label file for system CT2 (CT2_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C	c_v,gamma,m,t_0
	c	CT2	$1,$2,$3,$4

% Component type ES
	es

% Component type PS
	ps

% Component type SS
	[in]		SS	external,external
	[out]		SS	external,external

	
	

Deleted mttroot/mtt/lib/comp/compound/Thermal/CU/CU_abg.fig version [1ce5cce7a3].

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

































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1125 3375 2250 3375 2025 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2700 3375 3825 3375 3600 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 3375 5400 3375 5175 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 5175 4725 4050 4725 4050 3600 4275 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 3375 7200 3375 6975 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7650 3375 8775 3375 8550 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9225 3375 10350 3375 10125 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10800 3375 11925 3375 11700 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 9000 3600 9000 4725 6075 4725 6300 4950
4 1 -1 0 0 2 20 0.0000 4 195 360 2475 3465 FP\001
4 1 -1 0 0 2 20 0.0000 4 195 135 4050 3465 0\001
4 1 4 0 0 2 16 0.0000 4 210 270 2160 3105 [f]\001
4 1 4 0 0 2 16 0.0000 4 225 315 2835 3105 [p]\001
4 1 1 1 0 3 22 0.0000 4 225 195 1440 3150 T\001
4 1 1 1 0 3 22 0.0000 4 225 195 3240 3150 T\001
4 1 1 1 0 3 22 0.0000 4 225 195 4815 3150 T\001
4 1 1 1 0 3 22 0.0000 4 285 720 4815 3825 Q-W\001
4 1 1 1 0 3 22 0.0000 4 285 240 3240 3825 Q\001
4 1 1 1 0 3 30 0.0000 4 60 120 3285 3555 .\001
4 1 1 1 0 3 22 0.0000 4 225 195 1440 3825 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 1485 3555 .\001
4 1 1 1 0 3 30 0.0000 4 60 120 4590 3555 .\001
4 1 1 1 0 3 30 0.0000 4 60 120 5040 3555 .\001
4 1 -1 0 0 2 20 0.0000 4 195 360 7425 3465 FP\001
4 1 -1 0 0 2 20 0.0000 4 195 360 10575 3465 FP\001
4 1 -1 0 0 2 20 0.0000 4 195 135 9000 3465 1\001
4 0 4 0 0 2 20 0.0000 4 240 990 12060 3465 SS:[out]\001
4 1 4 0 0 2 16 0.0000 4 210 270 10935 3105 [f]\001
4 1 4 0 0 2 16 0.0000 4 210 270 7110 3105 [f]\001
4 1 4 0 0 2 16 0.0000 4 225 315 7785 3105 [p]\001
4 1 4 0 0 2 16 0.0000 4 225 315 10260 3105 [p]\001
4 1 1 1 0 3 22 0.0000 4 225 195 6615 3150 P\001
4 1 1 1 0 3 22 0.0000 4 225 195 9765 3150 P\001
4 1 1 1 0 3 22 0.0000 4 225 195 11385 3150 P\001
4 1 1 1 0 3 22 0.0000 4 225 225 11385 3825 V\001
4 1 1 1 0 3 30 0.0000 4 60 120 11430 3555 .\001
4 1 1 1 0 3 22 0.0000 4 225 285 9765 3825 W\001
4 1 1 1 0 3 30 0.0000 4 60 120 9810 3555 .\001
4 1 1 1 0 3 22 0.0000 4 225 225 6615 3825 V\001
4 1 1 1 0 3 30 0.0000 4 60 120 6660 3555 .\001
4 1 -1 0 0 2 20 0.0000 4 195 405 5715 3465 C:c\001
4 1 1 1 0 3 22 0.0000 4 225 195 8190 3150 P\001
4 1 1 1 0 3 22 0.0000 4 225 285 8190 3825 W\001
4 1 1 1 0 3 30 0.0000 4 60 120 8235 3555 .\001
4 1 1 1 0 3 22 0.0000 4 225 195 8190 4500 P\001
4 1 1 1 0 3 22 0.0000 4 225 285 8190 5175 W\001
4 1 1 1 0 3 30 0.0000 4 60 120 8235 4905 .\001
4 2 4 0 0 2 20 0.0000 4 240 825 990 3465 SS:[in]\001
4 1 -1 0 0 2 20 0.0000 4 195 690 5625 4815 AF:af\001
4 1 1 1 0 3 22 0.0000 4 300 1275 900 4275 Heat port\001
4 1 1 1 0 3 22 0.0000 4 315 1305 11295 4275 Work port\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CU/CU_cr.r version [d23d96eb5a].

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
68
69
70
71
72
73
74
75
76












































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CU    Constitutive Relationship for a two port thermo C
%DESCRIPTION Parameter 1: c_v (specific heat at constant volume)
%DESCRIPTION Parameter 2: gamma = c_p/c_v
%DESCRIPTION Parameter 3: mass of (ideal) gas within component.


%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/12/07 20:45:21  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/02  10:21:19  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/09/12 11:18:26  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


OPERATOR CU;

%% Integral/Integral causality
Port 1 - Thermal
FOR ALL c_v,gamma,m,InternalEnergy,Volume
LET CU(ideal_gas,c_v,gamma,m,effort,1,
	InternalEnergy, state, 1,
	Volume, state, 2)
         = InternalEnergy/(m*c_v);

Port 2 - Mechanical
FOR ALL c_v,gamma,m,InternalEnergy,Volume
LET CU(ideal_gas,c_v,gamma,m,effort,2,
	InternalEnergy, state, 1,
	Volume, state, 2)
         = (gamma-1)*(InternalEnergy)/Volume;

%% Derivative/Integral causality
Port 1 - Thermal
FOR ALL c_v,gamma,m,Temperature,Volume
LET CU(ideal_gas,c_v,gamma,m,state,1,
	Temperature, effort, 1,
	Volume, state, 2)
         = Temperature*(m*c_v);

Port 2 - Mechanical
FOR ALL c_v,gamma,m,Temperature,Volume
LET CU(ideal_gas,c_v,gamma,m,effort,2,
	Temperature, effort, 1,
	Volume, state, 2)
         = (gamma-1)*(m*c_v)*(Temperature)/Volume;

%% Integral/Derivative causality
Port 1 - Thermal
FOR ALL c_v,gamma,m,InternalEnergy,Pressure
LET CU(ideal_gas,c_v,gamma,m,effort,1,
	InternalEnergy, state, 1,
	Pressure, effort, 2)
         = InternalEnergy/(m*c_v);

Port 2 - Mechanical
FOR ALL c_v,gamma,m,InternalEnergy,Pressure
LET CU(ideal_gas,c_v,gamma,m,state,2,
	InternalEnergy, state, 1,
	Pressure, effort, 2)
         = (gamma-1)*(InternalEnergy)/Pressure;


END;

Deleted mttroot/mtt/lib/comp/compound/Thermal/CU/CU_lbl.txt version [d81160e763].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CU
%DESCRIPTION <Detailed description here>
%% Label file for system CU (CU_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

% Component type AF (gain of -1)
	af		lin		-1

% Component type C
	c		CU		$1

% Component type SS
	[in]		SS	external,external
	[out]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Comb/Comb_abg.fig version [61d53b3fc6].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4953 2928 6528 2928 6303 3153
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2476 2926 4051 2926 3826 3151
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2476 4051 4051 4051 3826 4276
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 4051 6526 4051 6301 4276
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 5618 4501 4493 4726 4718
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6978 2925 8553 2925 8328 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6978 4050 8553 4050 8328 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 2693 6750 1568 6975 1793
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 4268 6750 5393 6975 5168
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6480 1575 6975 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6480 5400 6975 5400
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 6300 11025 675 225 675 225 6300 11025 6300
4 2 4 0 0 0 20 0.0000 4 255 2085 2436 4101 SS:[Hydraulic_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1935 2438 3023 SS:[Thermal_in]\001
4 2 4 0 0 0 12 0.0000 4 180 540 4102 3337 [Th_in]\001
4 2 4 0 0 0 12 0.0000 4 180 570 4147 3922 [Hy_in]\001
4 0 4 0 0 0 12 0.0000 4 180 675 5002 3922 [Hy_out]\001
4 0 4 0 0 0 12 0.0000 4 180 645 5002 3337 [Th_out]\001
4 1 -1 0 0 22 20 0.0000 4 270 1470 4504 3649 hPipe:pipe\001
4 1 1 1 0 3 20 0.0000 4 195 135 2933 3968 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 2798 4238 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 2798 3878 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 2798 4508 V\001
4 1 1 1 0 3 20 0.0000 4 195 165 2842 2752 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 2977 2842 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 2977 3517 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 2842 3382 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 2842 3112 .\001
4 1 4 0 0 0 20 0.0000 4 240 1140 4501 5986 SS:[Heat]\001
4 1 1 1 0 3 30 0.0000 4 60 120 7933 4244 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 7933 3884 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 7933 4514 V\001
4 1 1 1 0 3 20 0.0000 4 195 135 8068 3974 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 7933 2713 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 8068 2803 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 7933 3343 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 7933 3073 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 8068 3478 2\001
4 0 4 0 0 0 20 0.0000 4 255 2235 8696 4197 SS:[Hydraulic_out]\001
4 0 4 0 0 0 20 0.0000 4 255 2085 8651 3026 SS:[Thermal_out]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6750 3060 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6750 4140 0\001
4 1 -1 0 0 22 20 0.0000 4 210 675 6705 5715 SS:P\001
4 1 -1 0 0 22 20 0.0000 4 210 645 6705 1440 SS:T\001
4 1 4 0 0 0 12 0.0000 4 180 495 4501 4366 [Heat]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Comb/Comb_desc.tex version [67dab7f8b9].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Comb (Comb_desc.tex)
% Generated by MTT on Tue Mar 31 15:58:34 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Comb} is
   displayed in Figure \Ref{Comb_abg} and its label
   file is listed in Section \Ref{sec:Comb_lbl}.
   The subsystems are listed in Section \Ref{sec:Comb_sub}.
   
   This thermal tank model has been developed to represent an ideal
   (and non-dynamic) combustion chamber for a gas turbine. The major
   simplification is that the mass contained in the tank is assumed
   constant -- this is consistent with using an ideal compressor and an
   ideal turbine with identical mass flows. Energy conservatioin is
   ensured by using true bonds and \textbf{TF} components.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Comb/Comb_lbl.txt version [cfaa583e32].

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
68
69
70
71
72
73









































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Comb: Combustion chamber model

%DESCRIPTION   This thermal tank model has been developed to represent an ideal
%DESCRIPTION   (and non-dynamic) combustion chamber for a gas turbine. The major
%DESCRIPTION   simplification is that the mass contained in the tank is assumed
%DESCRIPTION   constant -- this is consistent with using an ideal compressor and an
%DESCRIPTION   ideal turbine with identical mass flows. Energy conservation is
%DESCRIPTION   ensured by using true bonds and components.
 
%ALIAS	in Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out

%ALIAS	$1	m_c
%ALIAS	$2	v_c
%ALIAS	$3	r

%ALIAS	hPipe	CompressibleFlow/hPipe

%% Label file for system Comb (Comb_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.6  1998/07/04 08:24:25  peterg
% %% New-style SS
% %%
% %% Revision 1.5  1998/07/03 14:55:33  peterg
% %% Aliased parameters.
% %% Removed _c from parameters,
% %%
% %% Revision 1.4  1998/07/02 19:46:34  peterg
% %% New aliases
% %%
% %% Revision 1.3  1998/07/02 10:54:42  peterg
% %% Lower case in out
% %%
% %% Revision 1.2  1998/07/02 10:49:32  peterg
% %% Added port aliases
% %%
% %% Revision 1.1  1998/05/19 09:11:29  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type SS
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Heat]		SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external
	P		SS	external,0
	T		SS	external,0

% Component type hPipe
	pipe	none	m_c;v_c;r



Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Density/Density_abg.fig version [3e14bcdbdd].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 2476 5626 2476 5401 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 3376 5626 3376 5401 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5626 2251 5626 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5626 3151 5626 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6752 2927 7877 2927 7652 3152
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7877 2702 7877 3152
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 2475 3826 2475 3601 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 3375 3826 3375 3601 3600
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 4725 10125 1350 90 1350 90 4725 10125 4725
4 2 4 0 0 22 20 0.0000 4 270 1890 2610 2565 SS:[Pressure]\001
4 2 4 0 0 22 20 0.0000 4 270 2385 2655 3465 SS:[Temperature]\001
4 1 1 1 0 3 20 0.0000 4 195 165 5041 2251 P\001
4 1 1 1 0 3 20 0.0000 4 195 165 4996 3241 T\001
4 1 4 0 0 22 20 0.0000 4 270 330 5895 2520 [1]\001
4 1 4 0 0 22 20 0.0000 4 270 330 5895 3465 [2]\001
4 1 -1 0 0 18 30 0.0000 4 345 600 6030 3060 R:r\001
4 1 4 0 0 22 20 0.0000 4 270 330 6570 3015 [3]\001
4 1 1 1 0 32 30 0.0000 4 345 210 7337 2792 r\001
4 0 4 0 0 22 20 0.0000 4 270 1695 8146 3016 SS:[Density]\001
4 1 -1 0 0 18 20 0.0000 4 210 405 4140 2610 AE\001
4 1 -1 0 0 18 20 0.0000 4 210 405 4140 3465 AE\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Density/Density_cr.r version [5fd3e01e3d].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Constitutive relation file for Density (Density_cr.r)
% Generated by MTT at Wed Mar 11 11:01:28 GMT 1998

OPERATOR Density;

% Ideal gas
FOR ALL R,Temperature,Pressure,Nothing
LET Density(density,ideal_gas,R,effort,3,
	Pressure,effort,1,
	Temperature,effort,2,
	Nothing,flow,3
	) = Pressure/(R*Temperature);

FOR ALL R,Temperature,Pressure,Nothing
LET Density(specific_volume,ideal_gas,R,effort,3,
	Pressure,effort,1,
	Temperature,effort,2,
	Nothing,flow,3
	) = (R*Temperature)/Pressure;

% Incompressible
FOR ALL rho,Temperature,Pressure,Nothing
LET Density(density,incompressible,rho,effort,3,
	Pressure,effort,1,
	Temperature,effort,2,
	Nothing,flow,3
	) = rho;

FOR ALL rho,Temperature,Pressure,Nothing
LET Density(specific_volume,incompressible,rho,effort,3,
	Pressure,effort,1,
	Temperature,effort,2,
	Nothing,flow,3
	) = 1/rho;

END;

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Density/Density_desc.tex version [f12aa62d5f].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Density (Density_desc.tex)
% Generated by MTT on Thu Mar 19 13:24:59 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Density} is
   displayed in Figure \Ref{Density_abg} and its label
   file is listed in Section \Ref{sec:Density_lbl}.

This three port component computes the density $\rho$ of substance in
terms of the temperature $T$ and the pressure $P$. At the moment,
there are four forms dependent on the four forms of the component parameter:
\begin{enumerate}
\item \emph{density,incompressible,rho}
\item \emph{specific\_volume,incompressible,rho}
\item \emph{density,ideal\_gas,R}
\item \emph{specific\_volume,ideal\_gas,R}
\end{enumerate}

\begin{equation}
  y = 
  \begin{cases}
    \rho & \text{if the parameter is
      \emph{density,incompressible,rho}}\\
    \frac{1}{\rho} & \text{if the parameter is
      \emph{specific\_volume,incompressible,rho}}\\
    \frac{P}{RT} & \text{if the parameter is \emph{density,ideal\_gas,R}}\\
    \frac{RT}{P} & \text{if the parameter is
      \emph{specific\_volume,ideal\_gas,R}}
  \end{cases}
\end{equation}
where $\rho$ is the density of the incompressible fluid and $R$ the
universal gas constant of the ideal gas.

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Density/Density_lbl.txt version [9d2703c643].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Density - Computes  P and T.

%DESCRIPTION Parameter: density,ideal_gas,gas_constant
%DESCRIPTION OR       : specific_volume,ideal_gas,gas_constant
%DESCRIPTION OR       : density,incompressible,gas_constant
%DESCRIPTION OR       : specific_volume,incompressible,gas_constant
%DESCRIPTION Port [P]: Pressure
%DESCRIPTION Port [T]: Temperature
%DESCRIPTION Port [rho]: Density

%ALIAS	P	Pressure
%ALIAS	T	Temperature
%ALIAS	rho|out	Density

%ALIAS	$1	density,ideal_gas,r



%% Label file for system Density (Density_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type R
	r		Density		density,ideal_gas,r

% Component type SS
	[Pressure]	SS		external,external
	[Temperature]	SS		external,external
	[Density]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/ICV/ICV_abg.fig version [3ae1de99d6].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4503 2928 6078 2928 5853 3153
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 2926 3601 2926 3376 3151
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 4051 3601 4051 3376 4276
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 4051 6076 4051 5851 4276
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6528 2925 8103 2925 7878 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6528 4050 8103 4050 7878 4275
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9900 6300 9900 675 225 675 225 6300 9900 6300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 2693 6300 1568 6525 1793
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 4268 6300 5393 6525 5168
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6030 1575 6525 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6030 5400 6525 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3825 4500 4320 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 4507 4050 5632 4275 5407
4 2 4 0 0 0 12 0.0000 4 180 540 3652 3337 [Th_in]\001
4 2 4 0 0 0 12 0.0000 4 180 570 3697 3922 [Hy_in]\001
4 0 4 0 0 0 12 0.0000 4 180 675 4552 3922 [Hy_out]\001
4 0 4 0 0 0 12 0.0000 4 180 645 4552 3337 [Th_out]\001
4 1 -1 0 0 22 20 0.0000 4 270 1470 4054 3649 hPipe:pipe\001
4 1 1 1 0 3 20 0.0000 4 195 135 2483 3968 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 2348 4238 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 2348 3878 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 2348 4508 V\001
4 1 1 1 0 3 20 0.0000 4 195 165 2392 2752 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 2527 2842 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 2527 3517 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 2392 3382 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 2392 3112 .\001
4 2 4 0 0 0 20 0.0000 4 255 1290 1896 4191 SS:[Hy_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1275 1943 3023 SS:[Th_in]\001
4 1 4 0 0 22 12 0.0000 4 180 540 4051 4366 [Heat]\001
4 1 -1 0 0 0 20 0.0000 4 195 570 4051 5986 CT:c\001
4 1 1 1 0 3 30 0.0000 4 60 120 7483 4244 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 7483 3884 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 7483 4514 V\001
4 1 1 1 0 3 20 0.0000 4 195 135 7618 3974 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 7483 2713 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 7618 2803 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 7483 3343 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 7483 3073 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 7618 3478 2\001
4 0 4 0 0 0 20 0.0000 4 255 1440 8246 4197 SS:[Hy_out]\001
4 0 4 0 0 0 20 0.0000 4 255 1425 8201 3026 SS:[Th_out]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6300 3060 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6300 4140 0\001
4 1 -1 0 0 22 20 0.0000 4 210 675 6255 5715 SS:P\001
4 1 -1 0 0 22 20 0.0000 4 210 645 6255 1440 SS:T\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/ICV/ICV_desc.tex version [b0103a1ae6].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system ICV (ICV_desc.tex)
% Generated by MTT on Tue Mar 31 15:58:34 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ICV} is
   displayed in Figure \Ref{ICV_abg} and its label
   file is listed in Section \Ref{sec:ICV_lbl}.
   The subsystems are listed in Section \Ref{sec:ICV_sub}.
   
   This thermal tank model has been developed to represent an
   inter-volume component (ICV) for a gas turbine. The major
   simplification is that the mass contained in the ICV is assumed
   constant -- this is consistent with using an ideal compressor and an
   ideal turbine with identical mass flows. Energy conservation is
   ensured by using true bonds and \textbf{TF} components.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/ICV/ICV_lbl.txt version [65e966e572].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY ICV Inter-component volume for a gas turbine.
%DESCRIPTION Parameter 1 Thermal capacity (c)

%% Label file for system ICV (ICV_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type CT
	c		lin		effort,$1

% Component type SS
	[Hy_in]		external	external
	[Hy_out]	external	external
	[T]		external	external
	[Th_in]		external	external
	[Th_out]	external	external
	P		external	0
	T		external	0

% Component type hPipe
	pipe	none	m_c;v_c;r

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/NozzleFlow/NozzleFlow_abg.fig version [de507d7428].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 2927 6977 2927 6752 3152
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 2926 4051 2926 3826 3151
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4051 2701 4051 3151
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1126 2925 2251 2925 2026 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 2026 4051 2026 3826 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4051 1801 4051 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1126 2025 2251 2025 2026 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 3826 4051 3826 3826 4051
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4051 3601 4051 4051
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1126 3825 2251 3825 2026 4050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 4949 4951 3824 5176 4049
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4726 3824 5176 3824
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4950 6749 4950 5624 5175 5849
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5850 2700 5850 3150
4 1 4 0 0 22 20 0.0000 4 270 330 5670 3015 [5]\001
4 1 1 1 0 22 20 0.0000 4 150 255 6437 2792 m\001
4 0 4 0 0 22 20 0.0000 4 270 2055 7246 3016 SS:[MassFlow]\001
4 1 -1 0 0 18 30 0.0000 4 345 600 5040 3060 R:r\001
4 1 1 1 0 3 20 0.0000 4 195 165 3466 2701 P\001
4 1 4 0 0 22 20 0.0000 4 270 330 4320 2970 [2]\001
4 1 -1 0 0 18 20 0.0000 4 210 405 2565 3060 AE\001
4 2 4 0 0 22 20 0.0000 4 270 1005 1080 3015 SS:[P2]\001
4 1 1 1 0 3 20 0.0000 4 195 165 3466 1801 P\001
4 1 4 0 0 22 20 0.0000 4 270 330 4320 2070 [1]\001
4 1 -1 0 0 18 20 0.0000 4 210 405 2565 2160 AE\001
4 2 4 0 0 22 20 0.0000 4 270 1005 1080 2115 SS:[P1]\001
4 1 1 1 0 3 20 0.0000 4 195 135 3601 1981 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 3601 2881 2\001
4 1 1 1 0 3 30 0.0000 4 60 120 6436 2566 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 3421 3691 T\001
4 1 4 0 0 22 20 0.0000 4 270 330 4320 3915 [3]\001
4 1 -1 0 0 18 20 0.0000 4 210 405 2565 3915 AE\001
4 2 4 0 0 22 20 0.0000 4 270 975 1080 3915 SS:[T1]\001
4 1 1 1 0 3 20 0.0000 4 195 135 3601 3781 1\001
4 1 4 0 0 22 20 1.5708 4 270 330 5040 3555 [4]\001
4 1 -1 0 0 18 20 1.5708 4 210 405 5040 5310 AE\001
4 2 4 0 0 22 20 1.5708 4 270 1305 5040 6795 SS:[Area]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/NozzleFlow/NozzleFlow_cr.r version [d6639e6e67].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Constitutive relation file for NozzleFlow (NozzleFlow_cr.r)
% Generated by PJG at Wed Apr 8 09:30 GMT 1998


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



OPERATOR NozzleFlow;
% Ideal gas - but polytropic expansion
FOR ALL R, n, p1, p2, T1, A, Nothing
LET NozzleFlow(R,n,flow,5,
	p1,effort,1,
	p2,effort,2,
	T1,effort,3,
	A,effort,4,
	Nothing,effort,5
	) = A*p1*( (2*n/(n-1)) * (1/(R*T1)) * 
                ((p2/p1)^(2/n)) * (1 - (p2/p1)^(n-1/n) ) ^(1/2)
                );

END;

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/NozzleFlow/NozzleFlow_desc.tex version [d6b48465a1].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system NozzleFlow (NozzleFlow_desc.tex)
% Generated by MTT on Thu Mar 19 13:24:59 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{NozzleFlow} is
   displayed in Figure \Ref{NozzleFlow_abg} and its label
   file is listed in Section \Ref{sec:NozzleFlow_lbl}.

This 5 port component computes the mass flow in a polytropic
convergent nozzle from the formula:
\begin{equation}
  \dot m = A p_1 \sqrt{\frac{2n}{n-1}\frac{1}{RT_1} 
   \left ( \frac{p_2}{p_1} \right )^\frac{2}{n}
    \left [ 1- \left ( \frac{p_2}{p_1} \right )^\frac{n-1}{n} \right ]  }
\end{equation}

where:
\begin{itemize}
\item $n$ is the coefficient of polytropic expansion and
\item $R$ is the universal gas constant.
\end{itemize}

If the expansion is isentropic
\begin{equation}
  n=\gamma=\frac{c_p}{c_v}
\end{equation}
whre $c_p$ and $c_v$ are the spesicfic heats at constant pressure and volume.

Typical values for air are 
\begin{equation}
  \begin{align}
    R &= 287 \text{Nm}\text{kg}^{-1}{K}^{-1}\\
    \gamma &= 1.4
  \end{align}
\end{equation}

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/NozzleFlow/NozzleFlow_lbl.txt version [c51871a280].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY NozzleFlow Subsonic ideal gas nozzle flow with polytropic expansion
%DESCRIPTION Polytropic expansion coefficient n=gamma=c_p/c_v for isentropic expansion.
 

%ALIAS $1	R	Ideal gas constant
%ALIAS $2	n	Index of polytropic expansion

%% Label file for system NozzleFlow (NozzleFlow_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type R
	r		NozzleFlow	R,n

% Component type SS
	[Area]		SS	external,external
	[MassFlow]	SS	external,external
	[P1]		SS	external,external
	[P2]		SS	external,external
	[T1]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/NozzleFlow/NozzleFlow_rep.txt version [14692cdf88].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system NozzleFlow (NozzleFlow_rep.txt)
# Generated by MTT on" Thursday September 24 09:49:01 BST 1998.

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

mtt NozzleFlow abg tex			# The system description

# Uncomment the following lines or add others
mtt NozzleFlow ode tex	        # The system ode 
# mtt NozzleFlow sspar tex		# Steady-state parameters
# mtt NozzleFlow ss tex 		# Steady state
# mtt NozzleFlow sm tex			# State matrices (of linearised system)
# mtt NozzleFlow lmfr ps		# log modulus of frequency response (of linearised system)
# mtt NozzleFlow simpar tex		# Simulation parameters
# mtt NozzleFlow numpar tex		# Numerical simulation parameters
# mtt NozzleFlow input tex		# Simulation input
# mtt NozzleFlow odeso ps		# Simulation output

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Poly/Poly_abg.fig version [af2780bc2d].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4727 2027 5852 2027 5627 2252
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5852 1802 5852 2252
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2026 4052 2026 3827 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4727 2702 5852 2702 5627 2927
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2701 4052 2701 3827 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4727 3377 5852 3377 5627 3602
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5852 3152 5852 3602
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 3376 4052 3376 3827 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7428 2703 8553 2703 8328 2928
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5850 2478 5850 2928
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9003 2700 10128 2700 9903 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8778 4050 8778 2925 9003 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 2925 8775 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8775 4050 9000 4050
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 13050 5625 135 5625 135 1125 13050 1125 13050 5625
4 1 -1 0 0 18 20 0.0000 4 210 405 4366 2161 AE\001
4 1 -1 0 0 18 20 0.0000 4 210 405 4366 2836 AE\001
4 1 -1 0 0 18 20 0.0000 4 210 405 4366 3466 AE\001
4 2 4 0 0 22 20 0.0000 4 270 2190 2881 2116 SS:[Pressure_1]\001
4 2 4 0 0 22 20 0.0000 4 270 2190 2881 2791 SS:[Pressure_2]\001
4 2 4 0 0 22 20 0.0000 4 270 2685 2881 3466 SS:[Temperature_1]\001
4 1 -1 0 0 18 30 0.0000 4 345 600 6706 2836 R:r\001
4 1 4 0 0 22 20 0.0000 4 270 330 6120 2790 [2]\001
4 1 4 0 0 22 20 0.0000 4 270 330 6120 3465 [3]\001
4 1 4 0 0 22 20 0.0000 4 270 330 6120 2115 [1]\001
4 1 4 0 0 22 20 0.0000 4 270 330 7245 2790 [4]\001
4 0 4 0 0 22 20 0.0000 4 270 2685 10260 2790 SS:[Temperature_2]\001
4 1 -1 0 0 18 20 0.0000 4 210 1080 8775 4410 SS:zero\001
4 1 -1 0 0 18 20 0.0000 4 195 150 8820 2790 1\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Poly/Poly_cr.r version [ad1eaacee8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Constitutive relation file for Poly (Poly_cr.r)
% Generated by MTT at Wed Mar 11 11:01:28 GMT 1998

OPERATOR Poly;

% Ideal gas

% Temperature output on port [T2]
FOR ALL alpha,P1,P2,T1,Nothing
LET Poly(alpha,effort,4,
	P1,effort,1,
	P2,effort,2,
	T1,effort,3,
	Nothing,flow,4
	) = T1*(P2/P1)^alpha;



END;

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Poly/Poly_desc.tex version [0fc0fe1509].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Poly (Poly_desc.tex)
% Generated by MTT on Thu Mar 19 13:24:59 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/03/31 15:05:33  peterg
% %% Spell checked
% %%
% %% Revision 1.2  1998/03/27 10:56:14  peterg
% %% Added bicausal bit
% %%
% %% Revision 1.1  1998/03/26 15:13:35  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Poly} is
   displayed in Figure \Ref{Poly_abg} and its label
   file is listed in Section \Ref{sec:Poly_lbl}.

This four-port component computes the temperature following a
polytropic expansion using:
\begin{equation}
  T_2 = T_1 \left ( \frac{P_2}{P_1} \right )^\alpha
\end{equation}
where $\alpha = \frac{n-1}{n}$ and $n$ is the coefficient of
polytropic expansion.  This component imposes zero flow at all its
ports and therefore does not affect energy balance.

The output is \emph{bicausal} as it imposes both $T_2$ and a zero flow.
This is implemented using the bicausal \textbf{SS} component labeled
``zero''.

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Poly/Poly_lbl.txt version [5420451ef5].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Poly - computes polytropic expansion temperature.
%DESCRIPTION Parameter: alpha = (n-1)/n (n = polytropic index)

%DESCRIPTION This four-port component computes the temperature following
%DESCRIPTION a polytropic expansion using where alpha = (n-1)/n and n is
%DESCRIPTION the coefficient of polytropic expansion.  This component
%DESCRIPTION imposes zero flow at all its ports and therefore does not
%DESCRIPTION affect energy balance.  The output is bicausal as it
%DESCRIPTION imposes both T_2 and a zero flow.  This is implemented using
%DESCRIPTION the bicausal SS component labeled ``zero''.

%ALIAS	P1	Pressure_1
%ALIAS	P2	Pressure_2
%ALIAS	T1	Temperature_1
%ALIAS	T2|out	Temperature_2

%ALIAS $1	alpha

%% Label file for system Poly (Poly_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/03/27 10:48:50  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type R
	r		Poly		alpha

% Component type SS
	zero		SS		0,0
	[Pressure_1]	SS		external,external
	[Temperature_1]	SS		external,external
	[Pressure_2]	SS		external,external
	[Temperature_2]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Pump/Pump_abg.fig version [dbddf488a0].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7203 2028 8778 2028 8553 2253
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 2026 6301 2026 6076 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5176 3151 6301 3151 6076 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2703 2028 4278 2028 4053 2253
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2656 3151 4683 3151 4458 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8776 3151 10803 3151 10578 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7201 3151 8326 3151 8101 3376
2 1 0 2 5 7 0 0 -1 0.000 0 0 -1 0 0 4
	 4501 1801 4501 901 6076 901 5851 1126
2 1 0 2 5 7 0 0 -1 0.000 0 0 -1 0 0 4
	 4951 2926 4951 1351 6076 1351 5851 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 7426 901 9001 901 9001 1801 9226 1576
2 1 0 2 5 -1 0 0 -1 0.000 0 0 -1 0 0 4
	 8551 2926 8551 1351 7426 1351 7651 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6755 7969 6755 6844 6980 7069
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6754 6371 6754 5246 6979 5471
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6752 4751 6752 3626 6977 3851
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9228 2025 10803 2025 10578 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11704 2028 13279 2028 13054 2253
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9225 1800 10125 900 10125 1125
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 10013 788 10238 1013
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 15705 8550 15705 225 225 225 225 8550 15705 8550
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6525 7965 6975 7965
4 2 4 0 0 0 20 0.0000 4 255 1935 2617 2122 SS:[Thermal_in]\001
4 2 4 0 0 0 20 0.0000 4 255 2085 2615 3245 SS:[Hydraulic_in]\001
4 2 4 0 0 0 12 0.0000 4 180 540 6352 2437 [Th_in]\001
4 2 4 0 0 0 12 0.0000 4 180 570 6397 3022 [Hy_in]\001
4 0 4 0 0 0 12 0.0000 4 180 675 7252 3022 [Hy_out]\001
4 0 4 0 0 0 12 0.0000 4 180 645 7252 2437 [Th_out]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 9047 2117 0\001
4 1 1 1 0 3 30 0.0000 4 60 120 10181 3297 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 10181 2937 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 10181 3567 V\001
4 1 1 1 0 3 20 0.0000 4 195 135 10316 3027 2\001
4 0 4 0 0 0 20 0.0000 4 255 2235 10944 3250 SS:[Hydraulic_out]\001
4 1 -1 0 0 22 20 0.0000 4 270 1305 6796 1261 Poly:poly\001
4 2 4 0 0 22 12 0.0000 4 180 345 7291 856 [T2]\001
4 2 4 0 0 22 12 0.0000 4 180 345 7336 1531 [P2]\001
4 0 4 0 0 22 12 0.0000 4 180 345 6211 856 [T1]\001
4 0 4 0 0 22 12 0.0000 4 180 345 6211 1531 [P1]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 8596 3286 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 4951 3286 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 4501 2161 0\001
4 1 4 0 0 0 20 0.0000 4 240 1215 6755 8330 SS:[Shaft]\001
4 1 1 1 0 32 30 0.0000 4 240 195 6530 7610 t\001
4 1 1 1 0 32 30 0.0000 4 240 285 6980 7610 w\001
4 1 4 0 0 0 12 0.0000 4 180 540 6751 3421 [Work]\001
4 1 -1 0 0 22 20 0.0000 4 210 750 11250 2115 EBTF\001
4 1 1 1 0 3 20 0.0000 4 195 165 12657 1767 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 12792 1857 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 12657 2397 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 12657 2127 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 12792 2532 2\001
4 0 4 0 0 0 20 0.0000 4 255 2085 13375 2080 SS:[Thermal_out]\001
4 1 -1 0 0 22 20 0.0000 4 270 1530 6754 2749 wPipe:pipe\001
4 1 -1 0 0 22 20 0.0000 4 210 645 10305 765 SS:T\001
4 1 1 1 0 3 20 0.0000 4 195 135 3157 3022 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 3022 3292 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 3022 2932 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 3022 3562 V\001
4 1 1 1 0 3 20 0.0000 4 195 165 3066 1806 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 3201 1896 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 3201 2571 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 3066 2436 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 3066 2166 .\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6755 6710 1\001
4 1 -1 0 0 22 20 0.0000 4 270 915 6800 5090 TF:k_p\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Pump/Pump_desc.tex version [ec8169ffc6].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Pump (Pump_desc.tex)
% Generated by MTT on Fri Mar 20 15:53:12 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/04/01 08:09:06  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Pump} is
   displayed in Figure \Ref{Pump_abg} and its label
   file is listed in Section \Ref{sec:Pump_lbl}.
   The subsystems are listed in Section \Ref{sec:Pump_sub}.

\textbf{Pump} represents an ideal pumping component for compressible
or incompressible flow though a pipe, it may also be used as a turbine.

The pump is ideal in the sense that the mass flow rate $\dot m$
depends only on the shaft speed $\omega$:
\begin{equation}
  \dot m = k_p \omega
\end{equation}

It is implemented using three components:
\begin{itemize}
\item the ideal isentropic \textbf{wPipe} component which gives the
  correct energy flows
\item the polytropic expansion \textbf{Poly} component which imposes
  the correct temperature at the output of the pump. This component
  imposes zero flow at all its ports and therefore does not affect
  energy balance. It has a bicausal output imposing both the
  temperature measured by the \textbf{SS} component ``T'' and a zero
  flow.
\item the \emph{effort-bicausal transformer} \textbf{EBTF}
  component. This component is an energy-conserving \textbf{TF}
  component with non-standard causality. The modulus is determined by
  the two imposed efforts ($T$ and $T_2$), and this modulus determines
  the flows in the usual way. In particular, it makes sure that the
  internal energy flowing from the pump to the following components
  (imposing $T_2$) is correct.
\end{itemize}

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Pump/Pump_lbl.txt version [968ba1a760].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Pump Ideal pump component for compressible flow

%DESCRIPTION Pump represents an ideal pumping component for compressible
%DESCRIPTION or incompressible flow though a pipe, it may also be used as a turbine.
%DESCRIPTION The pump is ideal in the sense that the mass flow rate
%DESCRIPTION depends only on the shaft speed.

%DESCRIPTION Parameter 1: c_v - specific heat of fluid
%DESCRIPTION Parameter 2: Parameter passed to Density component
%DESCRIPTION Parameter 3: alpha = (n-1)/n, n coefficient of polytropic
%DESCRIPTION expansion.
%DESCRIPTION Parameter 4: k_p pump constant: mass flow = k_p*shaft speed

%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out

%ALIAS	Work	Shaft

%ALIAS  $1		c_v
%ALIAS  $2		density,ideal_gas,r
%ALIAS  $3		alpha
%ALIAS  $4		flow,k_p

%ALIAS	wPipe	CompressibleFlow/wPipe
%ALIAS	Poly	CompressibleFlow/Poly

%% Label file for system Pump (Pump_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.7  1998/07/04 08:39:58  peterg
% %% New-style SS
% %%
% %% Revision 1.6  1998/07/03 15:02:25  peterg
% %% Work alias added
% %%
% %% Revision 1.5  1998/07/03 14:43:24  peterg
% %% Added parameter aliases
% %%
% %% Revision 1.4  1998/07/02 19:46:19  peterg
% %% New aliases
% %%
% %% Revision 1.3  1998/07/02 10:55:54  peterg
% %% Lower case in out
% %%
% %% Revision 1.2  1998/07/02 10:52:33  peterg
% %% Added port aliases
% %%
% %% Revision 1.1  1998/04/07 15:23:30  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type wPipe
	pipe	none			c_v;density,ideal_gas,r

% Component type Poly
	poly		Poly		alpha

% Component type SS
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Shaft]		SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external
	T		SS	external,0

% Component type TF
	k_p		lin	flow,k_p

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Tank/Tank_abg.fig version [49b9e2e5c7].

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
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














































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7650 3600 9680 3602 9455 3827
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9900 3825 9900 5850 10125 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1575 6300 4725 6300 4500 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6077 6301 7202 6301 6977 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7650 6299 9230 6302 9005 6527
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10575 6300 13725 6300 13500 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10125 3600 11700 3600 11475 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12150 3600 13725 3600 13500 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7425 3825 7425 4725 7650 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7425 6075 7425 5175 7650 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7425 2228 7425 3353 7650 3128
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 9675 9000 5625 9000 5625 1350 9675 1350 9675 9000
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 15525 9450 15525 675 90 675 90 9450 15525 9450
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
	 7650 6525 8775 7650 9945 7650 9945 6750 10170 6975
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
	 7200 6525 6030 7695 5400 7695 5400 6750 5625 6975
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7425 7657 7425 6532 7650 6757
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 3600 6300 3600 6075 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 3600 7200 3600 6975 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 3600 5175 3600 4950 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1575 3600 2925 3600 2700 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 3825 5400 4725 5625 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 5175 5400 5850 5625 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 4950 4275 4950 4500 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4275 4725 4275 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5175 4950 5175 5175
4 1 1 1 0 3 20 0.0000000 4 210 150 2073 4143 1\001
4 1 1 1 0 3 20 0.0000000 4 210 165 1938 4008 S\001
4 1 1 1 0 3 30 0.0000000 4 60 105 1938 3738 .\001
4 1 -1 0 0 22 20 0.0000000 4 225 135 7426 3691 0\001
4 1 1 1 0 3 20 0.0000000 4 210 165 13102 4012 S\001
4 1 1 1 0 3 30 0.0000000 4 60 105 13102 3742 .\001
4 1 1 1 0 3 20 0.0000000 4 210 150 13237 4147 2\001
4 0 4 0 0 0 20 0.0000000 4 240 1500 13820 3695 SS:[Th_out]\001
4 1 -1 0 0 22 20 0.0000000 4 225 135 9901 3691 0\001
4 1 1 1 0 3 20 0.0000000 4 210 150 2029 6169 1\001
4 1 1 1 0 3 30 0.0000000 4 60 105 1894 6439 .\001
4 1 1 1 0 3 20 0.0000000 4 210 180 1894 6079 P\001
4 1 1 1 0 3 20 0.0000000 4 210 195 1894 6709 V\001
4 2 4 0 0 0 20 0.0000000 4 270 1380 1442 6392 SS:[Hy_in]\001
4 2 4 0 0 0 12 0.0000000 4 180 570 4680 6165 [Hy_in]\001
4 1 -1 0 0 22 20 0.0000000 4 225 135 7427 6437 0\001
4 2 4 0 0 0 12 0.0000000 4 180 570 9225 6165 [Hy_in]\001
4 0 4 0 0 0 12 0.0000000 4 180 660 6076 6166 [Hy_out]\001
4 1 -1 0 0 22 20 0.0000000 4 225 945 5401 6391 VM:v2m\001
4 1 1 1 0 3 30 0.0000000 4 60 105 13102 6488 .\001
4 1 1 1 0 3 20 0.0000000 4 210 180 13102 6128 P\001
4 1 1 1 0 3 20 0.0000000 4 210 195 13102 6758 V\001
4 1 1 1 0 3 20 0.0000000 4 210 150 13237 6218 2\001
4 0 4 0 0 0 20 0.0000000 4 270 1530 13865 6441 SS:[Hy_out]\001
4 0 4 0 0 0 12 0.0000000 4 180 660 10531 6166 [Hy_out]\001
4 1 -1 0 0 22 20 0.0000000 4 225 945 9901 6391 VM:m2v\001
4 1 4 0 0 0 12 0.0000000 4 165 225 5402 6077 [T]\001
4 1 4 0 0 0 12 0.0000000 4 165 225 5402 6617 [P]\001
4 1 4 0 0 0 12 0.0000000 4 165 225 9902 6077 [T]\001
4 1 4 0 0 0 12 0.0000000 4 165 225 9902 6617 [P]\001
4 2 4 0 0 0 20 0.0000000 4 240 1350 1534 3694 SS:[Th_in]\001
4 1 -1 0 0 22 20 0.0000000 4 225 330 11926 3691 ES\001
4 1 4 0 0 0 12 0.0000000 4 165 195 11567 3332 [e]\001
4 1 4 0 0 0 12 0.0000000 4 165 195 12242 3332 [s]\001
4 1 -1 0 0 22 20 0.0000000 4 285 1290 7471 5041 Tankp:tank\001
4 2 4 0 0 0 12 0.0000000 4 165 315 7200 4680 [Th]\001
4 2 4 0 0 0 12 0.0000000 4 180 345 7245 5265 [Hy]\001
4 1 1 1 0 3 20 0.0000000 4 270 2400 7425 8685 Pseudo bond graph\001
4 1 4 0 0 0 20 0.0000000 4 270 1110 7426 2116 SS:[pTh]\001
4 1 4 0 0 0 20 0.0000000 4 270 1140 7426 7966 SS:[pHy]\001
4 1 -1 0 0 22 20 0.0000000 4 225 330 6570 3690 AF\001
4 1 1 1 0 3 20 0.0000000 4 210 180 13102 3382 T\001
4 1 1 1 0 3 20 0.0000000 4 210 150 13237 3472 2\001
4 1 4 0 0 0 12 0.0000000 4 165 195 2793 3378 [s]\001
4 1 4 0 0 0 12 0.0000000 4 165 195 3423 3378 [e]\001
4 1 -1 0 0 22 20 0.0000000 4 225 330 3150 3735 ES\001
4 1 -1 0 0 22 20 0.0000000 4 225 135 5401 3691 1\001
4 1 -1 0 0 22 20 0.0000000 4 225 135 5400 5085 0\001
4 1 -1 0 0 22 20 0.0000000 4 225 900 3735 5040 SS:zero\001
4 1 1 1 0 3 20 0.0000000 4 210 180 4999 5674 T\001
4 1 1 1 0 3 20 0.0000000 4 210 150 5134 5764 1\001
4 1 1 1 0 3 20 0.0000000 4 210 180 1938 3378 T\001
4 1 1 1 0 3 20 0.0000000 4 210 150 2073 3468 1\001
4 1 1 1 0 3 20 0.0000000 4 210 180 10358 5454 T\001
4 1 1 1 0 3 20 0.0000000 4 210 150 10493 5544 2\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Tank/Tank_desc.tex version [cb521024f4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Tank (Tank_desc.tex)
% Generated by MTT on Tue Jan 13 18:03:04 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Tank} is
   displayed in Figure \Ref{Tank_abg} and its label
   file is listed in Section \Ref{sec:Tank_lbl}.
   The subsystems are listed in Section \Ref{sec:Tank_sub}.

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Tank/Tank_lbl.txt version [4e0b60130e].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Tank - thermal storage component for compressible fluids.
%DESCRIPTION Two port thermal storage component for compressible
%DESCRIPTION fluids
%DESCRIPTION Parameter 1 Passed to Tankp subcomponent
%DESCRIPTION Parameter 2 Parameter two of density component.
%DESCRIPTION Typical label file entry:
%DESCRIPTION % Component type Tank
%DESCRIPTION   	C1	none	ideal_gas,r_g,c_p,v_t;r_g
%DESCRIPTION Port [Th_in]: Thermal flow bond (T/Sdot)
%DESCRIPTION Port [Th_out]: Thermal flow bond (T/Sdot)
%DESCRIPTION Port [Hy_in]: Hydraulic flow bond (P/Vdot)
%DESCRIPTION Port [Hy_out]: Hydraulic flow bond (P/Vdot)
%DESCRIPTION Port [pTh]: Thermal flow pseudo bond direct to tank (T/Edot)
%DESCRIPTION Port [pHy]: Hydraulic flow pseudo bond direct to tank (P/mdot)

%% Label file for system Tank (Tank_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/03/26 09:00:26  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type SS
	[Hy_in]		external	external
	[Hy_out]	external	external
	[pHy]		external	external
	[pTh]		external	external
	[Th_in]		external	external
	[Th_out]	external	external
	zero		internal	internal

% Component type Tankp
	tank		none		$1

% Component type VMe
	v2m		none	density,$2
	m2v		none	specific_volume,$2


Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Tankp/Tankp_abg.fig version [cbe50075c1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2926 3646 3376 3646
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2926 946 3376 946
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 947 3151 2072 3376 1847
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 3646 3151 2521 3376 2746
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 5850 4275 5850 225 225 225 225 4275 5850 4275
4 1 -1 0 0 22 20 0.0000 4 210 870 3151 2431 C:tank\001
4 1 4 0 0 0 20 0.0000 4 240 915 3150 765 SS:[Th]\001
4 1 4 0 0 0 20 0.0000 4 255 930 3105 3960 SS:[Hy]\001
4 1 4 0 0 0 20 0.0000 4 240 405 2836 2026 [in]\001
4 1 4 0 0 0 20 0.0000 4 240 555 2791 2746 [out]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Tankp/Tankp_cr.r version [b03cd8ad39].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Constitutive relation file for Tankp (Tankp_cr.r)
% Generated by MTT at Thu Mar  5 10:30:23 GMT 1998

OPERATOR Tankp; 
%%%% Incompressible %%%%
%Temperature
FOR ALL c_p,c,StoredMass,StoredEnthalpy
LET Tankp(incompressible,c_p,c,effort,1,
	StoredEnthalpy,state,1,
	StoredMass,state,2
	) = StoredEnthalpy/(StoredMass*c_p);

%Pressure
FOR ALL c_p,c,StoredMass,StoredEnthalpy
LET Tankp(incompressible,c_p,c,effort,2,
	StoredEnthalpy,state,1,
	StoredMass,state,2
	) = StoredMass/c;

%%%% Ideal gas %%%%
%Temperature
FOR ALL R,c_p,Volume,StoredMass,StoredEnthalpy
LET Tankp(ideal_gas,R,c_p,Volume,effort,1,
	StoredEnthalpy,state,1,
	StoredMass,state,2
	) = (StoredEnthalpy/(c_p*StoredMass));

%Pressure
FOR ALL R,c_p,Volume,StoredMass,StoredEnthalpy
LET Tankp(ideal_gas,R,c_p,Volume,effort,2,
	StoredEnthalpy,state,1,
	StoredMass,state,2
	) = R*( ( (StoredEnthalpy/(c_p*StoredMass)))/(Volume/StoredMass) );

END;

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Tankp/Tankp_desc.tex version [aa7ccbe134].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Tankp (Tankp_desc.tex)
% Generated by MTT on Fri Mar 20 12:21:36 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Tankp} is
   displayed in Figure \Ref{Tankp_abg} and its label
   file is listed in Section \Ref{sec:Tankp_lbl}.
   The subsystems are listed in Section \Ref{sec:Tankp_sub}.

\textbf{Tankp} is a pseudo bond graph based model of a tank storing
(as the two states)
\begin{itemize}
\item enthalpy and 
\item mass
\end{itemize}

There are two versions:
\begin{itemize}
\item the incompressible version where the tank has a pressure-based
  capacitance $c_t$ and
\item the ideal-gas version were the tank has a volume  $v_t$ and $r$
  and $c_p$ are the universal gas constant and the specific heat respectively.
\end{itemize}








Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Tankp/Tankp_lbl.txt version [685d1ad022].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Tankp	Pseudo bond graph model of a tank storing mass and enthalpy
%DESCRIPTION Parameter 1: EITHER
%DESCRIPTION incompressible,c OR
%DESCRIPTION ideal_gas,R,c_p,v_t

%% Label file for system Tankp (Tankp_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	tank		Tankp		$1

% Component type SS
	[Hy]		external	external
	[Th]		external	external

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Turb/Turb_abg.fig version [5566bbcbd7].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85





















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6528 2028 8103 2028 7878 2253
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4051 2026 5626 2026 5401 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 3151 5626 3151 5401 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2028 2028 3603 2028 3378 2253
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1981 3151 4008 3151 3783 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8101 3151 10128 3151 9903 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6526 3151 7651 3151 7426 3376
2 1 0 2 5 7 0 0 -1 0.000 0 0 -1 0 0 4
	 3826 1801 3826 901 5401 901 5176 1126
2 1 0 2 5 7 0 0 -1 0.000 0 0 -1 0 0 4
	 4276 2926 4276 1351 5401 1351 5176 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 6751 901 8326 901 8326 1801 8551 1576
2 1 0 2 5 -1 0 0 -1 0.000 0 0 -1 0 0 4
	 7876 2926 7876 1351 6751 1351 6976 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8553 2025 10128 2025 9903 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11029 2028 12604 2028 12379 2253
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8550 1800 9450 900 9450 1125
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9338 788 9563 1013
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 3619 6075 4744 6300 4519
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 5194 6075 6319 6300 6094
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 6994 6075 8119 6300 7894
4 2 4 0 0 0 12 0.0000 4 180 540 5677 2437 [Th_in]\001
4 2 4 0 0 0 12 0.0000 4 180 570 5722 3022 [Hy_in]\001
4 0 4 0 0 0 12 0.0000 4 180 675 6577 3022 [Hy_out]\001
4 0 4 0 0 0 12 0.0000 4 180 645 6577 2437 [Th_out]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 8372 2117 0\001
4 1 1 1 0 3 30 0.0000 4 60 120 9506 3297 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 9506 2937 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 9506 3567 V\001
4 1 1 1 0 3 20 0.0000 4 195 135 9641 3027 2\001
4 0 4 0 0 0 20 0.0000 4 255 1440 10269 3250 SS:[Hydraulic_out]\001
4 1 1 1 0 3 20 0.0000 4 195 135 2482 3022 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 2347 3292 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 2347 2932 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 2347 3562 V\001
4 1 1 1 0 3 20 0.0000 4 195 165 2391 1806 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 2526 1896 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 2526 2571 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 2391 2436 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 2391 2166 .\001
4 2 4 0 0 0 20 0.0000 4 255 1290 1895 3245 SS:[Hydraulic_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1275 1942 2077 SS:[Thermal_in]\001
4 1 -1 0 0 22 20 0.0000 4 270 1305 6121 1261 Poly:poly\001
4 2 4 0 0 22 12 0.0000 4 180 345 6616 856 [T2]\001
4 2 4 0 0 22 12 0.0000 4 180 345 6661 1531 [P2]\001
4 0 4 0 0 22 12 0.0000 4 180 345 5536 856 [T1]\001
4 0 4 0 0 22 12 0.0000 4 180 345 5536 1531 [P1]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 7921 3286 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 4276 3286 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3826 2161 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6080 5090 1\001
4 1 1 1 0 32 30 0.0000 4 240 195 5855 7610 t\001
4 1 1 1 0 32 30 0.0000 4 240 285 6305 7610 w\001
4 1 -1 0 0 22 20 0.0000 4 210 750 10575 2115 EBTF\001
4 1 1 1 0 3 20 0.0000 4 195 165 11982 1767 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 12117 1857 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 11982 2397 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 11982 2127 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 12117 2532 2\001
4 0 4 0 0 0 20 0.0000 4 255 1425 12700 2080 SS:[Thermal_out]\001
4 1 -1 0 0 22 20 0.0000 4 270 1530 6079 2749 wPipe:pipe\001
4 1 -1 0 0 22 20 0.0000 4 210 645 9630 765 SS:T\001
4 1 -1 0 0 22 20 0.0000 4 270 825 6080 6755 TF:k_t\001
4 1 4 0 0 0 20 0.0000 4 240 1215 6120 8460 SS:[Shaft]\001
4 1 4 0 0 0 12 0.0000 4 180 495 6076 3421 [Work]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Turb/Turb_desc.tex version [68c72a056b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Turb (Turb_desc.tex)
% Generated by MTT on Fri Mar 20 15:53:12 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Turb} is
   displayed in Figure \Ref{Turb_abg} and its label
   file is listed in Section \Ref{sec:Turb_lbl}.
   The subsystems are listed in Section \Ref{sec:Turb_sub}.

\textbf{Turb} represents an ideal turbine component for compressible
or incompressible flow though a pipe.

It is identical to the \textbf{Pump} component (which has a more
complete description) exept for the direction of work flow.

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/Turb/Turb_lbl.txt version [62ed8c5a7a].

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
68
69
70
71
72








































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Turb Ideal turbine component for compressible flow
%DESCRIPTION Parameter 1: c_p - specific heat of fluid
%DESCRIPTION Parameter 2: Parameter passed to Density component
%DESCRIPTION Parameter 3: alpha = (n-1)/n, n coefficient of polytropic
%DESCRIPTION expansion.
%DESCRIPTION Parameter 4: k_t pump constant: mass flow = k_t*shaft speed

%ALIAS	in		Thermal_in,Hydraulic_in
%ALIAS	out		Thermal_out,Hydraulic_out

%ALIAS	Th_in		Thermal_in
%ALIAS	Hy_in		Hydraulic_in

%ALIAS	Th_out		Thermal_out
%ALIAS	Hy_out		Hydraulic_out

%ALIAS  $1		c_p
%ALIAS  $2		ideal_gas,r
%ALIAS  $3		alpha
%ALIAS  $4		effort,k

%% Label file for system Turb (Turb_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.5  1998/07/03 10:12:18  peterg
% %% New aliased parameter form
% %%
% %% Revision 1.4  1998/07/02 19:48:45  peterg
% %% Changed aliases
% %%
% %% Revision 1.3  1998/07/02 10:55:24  peterg
% %% Lower case in out
% %%
% %% Revision 1.2  1998/07/02 10:51:10  peterg
% %% Added port aliases
% %%
% %% Revision 1.1  1998/04/07 15:21:02  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Pipe
	pipe	none		c_p;ideal_gas,r

% Component type Poly
	poly		Poly		alpha

% Component type SS
	[Hydraulic_in]	external	external
	[Hydraulic_out]	external	external
	[Shaft]		external	external
	[Thermal_in]	external	external
	[Thermal_out]	external	external
	T		external	0

% Component type TF
	k_t		lin	effort,k




Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/hPipe/hPipe_abg.fig version [411e1f86bc].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5143 4050 6088 3105 6088 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 2488 1822 5210 1822 6110 2722 5840 2722
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6313 4500 6313 3150 6538 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6538 3150 7438 4050 7213 4050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2445 4052 4020 4052 3795 4277
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8564 4052 10139 4052 9914 4277
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 6538 2700 7438 1800 10138 1800 9913 2025
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 13050 4950 45 4950 45 450 13050 450 13050 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6165 3105 6435 3105
4 1 -1 0 0 22 20 0.0000 4 195 150 6315 3017 0\001
4 1 1 1 0 3 20 0.0000 4 195 510 5865 3872 mp v\001
4 1 1 1 0 3 20 0.0000 4 195 330 6043 4050 1 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 5729 3691 .\001
4 1 1 1 0 3 20 0.0000 4 195 510 6675 3872 mp v\001
4 1 1 1 0 3 20 0.0000 4 195 330 6853 4050 2 2\001
4 1 1 1 0 3 30 0.0000 4 60 120 6539 3691 .\001
4 2 4 0 0 22 20 0.0000 4 270 2355 2399 4141 SS:[Hydraulic_in]\001
4 1 1 1 0 3 20 0.0000 4 195 165 2805 3782 P\001
4 1 1 1 0 3 20 0.0000 4 195 135 2941 4683 1\001
4 1 1 1 0 3 20 0.0000 4 195 195 2806 4548 V\001
4 1 1 1 0 3 30 0.0000 4 60 120 2805 4277 .\001
4 2 4 0 0 22 20 0.0000 4 270 2145 2355 1892 SS:[Thermal_in]\001
4 1 1 1 0 3 20 0.0000 4 195 165 2894 1531 T\001
4 0 4 0 0 22 20 0.0000 4 270 2550 10319 4187 SS:[Hydraulic_out]\001
4 1 1 1 0 3 20 0.0000 4 195 165 9689 3783 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 9600 4458 V\001
4 1 1 1 0 3 30 0.0000 4 60 120 9599 4187 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 9735 4593 2\001
4 0 4 0 0 22 20 0.0000 4 270 2340 10365 1892 SS:[Thermal_out]\001
4 1 1 1 0 3 20 0.0000 4 195 165 9734 1532 T\001
4 1 -1 0 0 22 20 0.0000 4 210 945 4558 4185 TF:P2T\001
4 1 -1 0 0 22 20 0.0000 4 210 945 8068 4140 TF:T2P\001
4 1 4 0 0 22 20 0.0000 4 270 1290 6359 4771 SS:[Heat]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/hPipe/hPipe_desc.tex version [5824e24429].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system hPipe (hPipe_desc.tex)
% Generated by MTT on Tue Mar 31 09:54:08 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{hPipe} is
   displayed in Figure \Ref{hPipe_abg} and its label
   file is listed in Section \Ref{sec:hPipe_lbl}.
   The subsystems are listed in Section \Ref{sec:hPipe_sub}.
   

\textbf{hPipe} represents an ideal (energy conserving) pipe carrying a
fluid with heat transfer. To ensure energy conservation, power bonds are used and
connected by (energy conserving) \textbf{TF} components.
It is assumed that the working fluid is an ideal gas (gas constant $r$) and that a mass
$m_t$ is stored within pipe with a volume $v_t$.

The central \textbf{0} junction carries temperature ($T$) and the two
hydraulic ports are connected to this by appropriate transformers.
The modulus of the \textbf{TF} component labeled ``P2T'' is such P and
T are related by the ideal gas law
\begin{equation}
  P = \frac{Rm_t}{v_t} T
\end{equation}

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/hPipe/hPipe_lbl.txt version [4fbc3c7372].

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



























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY hPipe: Pipe for compressible fluid with heat transfer and heat storage.

%DESCRIPTION hPipe represents an ideal (energy conserving) pipe carrying a
%DESCRIPTION fluid with heat transfer. To ensure energy conservation, power bonds are used and
%DESCRIPTION connected by (energy conserving) TF components.
%DESCRIPTION It is assumed that the working fluid is an ideal gas (gas constant r) and that a mass
%DESCRIPTION m_t is stored within pipe with a volume v_t.

%DESCRIPTION Parameter 1: m_t (mass in pipe)
%DESCRIPTION Parameter 2: v_t (volume of pipe)
%DESCRIPTION Parameter 3: r (gas constant)
%DESCRIPTION Typical lable entry 
%DESCRIPTION % Component type hPipe
%DESCRIPTION 	pipe		none		m_p;v_p;r

%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out

%ALIAS	$1	m
%ALIAS	$2	v
%ALIAS	$3	r



%% Label file for system hPipe (hPipe_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/03 17:38:32  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type SS
	[Heat]		SS	external,external
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external

% Component type TF
	P2T		lin	flow,r*m/v
	T2P		lin	effort,r*m/v

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/wPipe/wPipe_abg.fig version [41fd44dc27].

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
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












































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1666 3781 3241 3781 3016 4006
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3691 3781 4591 3781 4366 4006
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3466 1756 3466 2431 3691 2206
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3466 3556 3466 2881 3691 3106
2 1 0 2 5 7 0 0 -1 0.000 0 0 -1 0 0 4
	 4366 2656 5491 2656 5491 3331 5716 3106
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6392 1532 7292 2432 7022 2432
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7742 2882 8642 3782 8372 3782
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7764 2454 8664 1554 8664 1824
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6392 3782 7292 2882 7292 3152
2 1 0 2 5 7 0 0 -1 0.000 0 0 -1 0 0 4
	 10666 2658 9766 2658 9766 3333 9993 3106
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11566 1758 11566 2433 11791 2208
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11566 3558 11566 2883 11791 3108
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9766 1531 11341 1531 11116 1756
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1666 1531 3241 1531 3016 1756
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3691 1531 5266 1531 5041 1756
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11836 1533 13411 1533 13186 1758
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11791 3781 13366 3781 13141 4006
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10411 3781 11311 3781 11086 4006
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7515 4275 7516 3106 7741 3331
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7515 5895 7516 4726 7741 4951
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 16200 6300 45 6300 45 180 16200 180 16200 6300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7335 5895 7695 5895
4 2 4 0 0 22 20 0.0000 4 270 2355 2430 3915 SS:[Hydraulic_in]\001
4 2 4 0 0 22 20 0.0000 4 270 2145 2476 1666 SS:[Thermal_in]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3466 1621 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3466 3916 0\001
4 1 4 0 0 22 12 0.0000 4 180 405 4186 2521 [rho]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 7517 2792 1\001
4 1 -1 0 0 22 20 0.0000 4 195 150 11566 1623 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 11566 3918 0\001
4 1 4 0 0 22 12 0.0000 4 180 405 10846 2523 [rho]\001
4 1 4 0 0 22 12 0.0000 4 180 495 9766 3558 [mod]\001
4 1 -1 0 0 22 20 0.0000 4 210 840 5851 1621 TF:t2u\001
4 1 -1 0 0 22 20 0.0000 4 270 1515 5536 3916 EMTF:p2pv\001
4 1 4 0 0 22 12 0.0000 4 180 495 5491 3601 [mod]\001
4 2 4 0 0 22 12 0.0000 4 180 240 3331 3016 [P]\001
4 2 4 0 0 22 12 0.0000 4 180 240 3331 2386 [T]\001
4 2 4 0 0 22 12 0.0000 4 180 240 11431 2386 [T]\001
4 2 4 0 0 22 12 0.0000 4 180 240 11431 3016 [P]\001
4 0 4 0 0 22 20 0.0000 4 270 2340 13591 1621 SS:[Thermal_out]\001
4 0 4 0 0 22 20 0.0000 4 270 2550 13546 3916 SS:[Hydraulic_out]\001
4 1 4 0 0 22 12 0.0000 4 180 270 4816 3601 [in]\001
4 1 4 0 0 22 12 0.0000 4 180 405 6301 3601 [out]\001
4 1 4 0 0 22 12 0.0000 4 180 405 10441 3556 [out]\001
4 1 4 0 0 22 12 0.0000 4 180 270 8911 3556 [in]\001
4 1 -1 0 0 22 20 0.0000 4 210 840 9316 1621 TF:u2t\001
4 1 -1 0 0 22 20 0.0000 4 270 1515 9631 3871 EMTF:pv2p\001
4 1 1 1 0 3 20 0.0000 4 195 135 2161 3646 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 2026 3511 P\001
4 1 1 1 0 3 20 0.0000 4 195 165 12960 1261 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 13095 1396 2\001
4 1 1 1 0 3 20 0.0000 4 195 135 13051 3647 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 12916 3512 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 12827 4187 V\001
4 1 1 1 0 3 30 0.0000 4 60 120 12826 3916 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 12962 4322 2\001
4 1 1 1 0 3 20 0.0000 4 195 135 2162 4412 1\001
4 1 1 1 0 3 20 0.0000 4 195 195 2027 4277 V\001
4 1 1 1 0 3 30 0.0000 4 60 120 2026 4006 .\001
4 1 1 1 0 3 20 0.0000 4 135 210 6841 3736 m\001
4 1 1 1 0 3 30 0.0000 4 60 120 6841 3511 .\001
4 1 1 1 0 3 20 0.0000 4 135 210 8101 3691 m\001
4 1 1 1 0 3 30 0.0000 4 60 120 8101 3466 .\001
4 1 1 1 0 3 20 0.0000 4 135 210 6570 2295 m\001
4 1 1 1 0 3 30 0.0000 4 60 120 6570 2070 .\001
4 1 1 1 0 3 20 0.0000 4 135 210 8461 2341 m\001
4 1 1 1 0 3 30 0.0000 4 60 120 8461 2116 .\001
4 1 1 1 0 3 20 0.0000 4 135 150 7922 1847 u\001
4 1 1 1 0 3 20 0.0000 4 195 135 8057 1982 2\001
4 1 1 1 0 3 20 0.0000 4 195 300 6482 3062 p v\001
4 1 1 1 0 3 20 0.0000 4 195 330 6570 3240 1 1\001
4 1 1 1 0 3 20 0.0000 4 195 300 8372 3063 p v\001
4 1 1 1 0 3 20 0.0000 4 195 330 8460 3241 2 2\001
4 1 -1 0 0 22 20 0.0000 4 270 1725 3511 2791 Density:rho1\001
4 1 -1 0 0 22 20 0.0000 4 270 1725 11521 2793 Density:rho2\001
4 1 1 1 0 3 20 0.0000 4 195 135 7246 1981 1\001
4 1 1 1 0 3 20 0.0000 4 135 150 7111 1846 u\001
4 1 1 1 0 3 20 0.0000 4 195 165 2115 1260 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 2250 1395 1\001
4 1 -1 0 0 22 20 0.0000 4 195 150 7517 4592 1\001
4 1 4 0 0 22 20 0.0000 4 270 1380 7516 6211 SS:[Shaft]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/wPipe/wPipe_desc.tex version [25ee8a0694].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system wPipe (wPipe_desc.tex)
% Generated by MTT on Mon Mar 9 09:11:22 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{wPipe} is
   displayed in Figure \Ref{wPipe_abg} and its label
   file is listed in Section \Ref{sec:wPipe_lbl}.
   The subsystems are listed in Section \Ref{sec:wPipe_sub}.

\textbf{wPipe} represents an ideal (energy conserving) pipe carrying a
fluid with work transfer. To ensure energy conservation, power bonds are used and
connected by (energy conserving) \textbf{TF} components.

The central \textbf{1} junction carries mass flow ($\dot m$) and the
four ports are connected to this by appropriate transformers. In the
case of the hydraulic ports, these transformers are \emph{modulated}
by the corresponding fluid density.
The bonds impinging on this  \textbf{1} junction carry the
corresponding effort variables; in particular, the thermal bonds carry
specific internal energy $u$ and the hydraulic bonds carry $Pv$ where
$P$ is the pressure and $v$ the specific volume.

The ports ``Work\_in'' and ``Work\_out'' are convenient for attaching
(for example) the shadt work of a pump, turbine or compressor.

The ports are 
\begin{itemize}
\item [Hy\_in] Pressure/volume-flow inflow
\item [Hy\_in] Pressure/volume-flow outflow
\item [Th\_in] Temperature/Entropy-flow in flow
\item [Th\_out] Temperature/Entropy-flow out flow
\item [Shaft] Torque/angular velocity input.
\end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Thermal/CompressibleFlow/wPipe/wPipe_lbl.txt version [abb521f401].

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
68
69
70
71
72
73
74
75
76












































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY wPipe Isentropic pipe with work transfer.

%DESCRIPTION wPipe represents an ideal (energy conserving) pipe carrying a
%DESCRIPTION fluid with work transfer. To ensure energy conservation, power bonds are used and
%DESCRIPTION connected by (energy conserving) TF components.

%DESCRIPTION Parameter 1: c_v - specific heat of fluid
%DESCRIPTION Parameter 2: Parameter passed to Density component
%DESCRIPTION Ports:

%DESCRIPTION [Hy_in] Pressure/volume-flow inflow
%DESCRIPTION [Hy_in] Pressure/volume-flow outflow
%DESCRIPTION [Th_in] Temperature/Entropy-flow in flow
%DESCRIPTION [Th_out] Temperature/Entropy-flow out flow
%DESCRIPTION [Shaft] Torque/angular velocity input.

%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out

%ALIAS	Work	Shaft

%ALIAS  $1		c_v
%ALIAS  $2		density,ideal_gas,r

%ALIAS	Density		CompressibleFlow/Density

%% Label file for system wPipe (wPipe_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/07/04 08:33:30  peterg
% %% New-style SS
% %%
% %% Revision 1.1  1998/07/03 17:38:20  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Density
	rho1		none	density,ideal_gas,r
	rho2		none	density,ideal_gas,r

% Component type EMTF
	p2pv		lin		flow
	pv2p		lin		effort

% Component type SS
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Shaft]		SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external

% Component type TF
	t2u		lin	effort,c_v
	u2t		lin	flow,c_v




Deleted mttroot/mtt/lib/comp/compound/Thermal/Conv/Conv_abg.fig version [7d2151b2ad].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4051 1351 5176 1351 4951 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5401 1576 5401 2701 5626 2476
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5401 3151 5401 4276 5626 4051
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2251 4501 5176 4501 4951 4726
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 6751 1351 6526 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 1351 8551 1351 8326 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9226 1350 10351 1350 10126 1575
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 8370 2925 4275 2925 4275 630 8370 630 8370 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2206 1351 3331 1351 3106 1576
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11925 6075 11925 225 675 225 675 6075 11925 6075
4 1 -1 0 0 22 20 0.0000 4 210 390 3736 1441 ES\001
4 1 -1 0 0 22 20 0.0000 4 195 150 5401 1441 1\001
4 1 -1 0 0 22 20 0.0000 4 195 150 5401 4636 1\001
4 1 -1 0 0 22 20 0.0000 4 270 1215 5401 3061 FMR:c_p\001
4 1 1 1 0 3 30 0.0000 4 60 120 2657 4682 .\001
4 1 1 1 0 3 20 0.0000 4 135 210 2657 4952 m\001
4 1 4 0 0 0 20 0.0000 4 240 285 3466 1126 [s]\001
4 1 4 0 0 0 20 0.0000 4 240 300 4006 1126 [e]\001
4 1 1 1 0 3 20 0.0000 4 195 135 4592 1262 1\001
4 1 1 1 0 3 20 0.0000 4 195 615 4770 1080 T - T\001
4 1 1 1 0 3 20 0.0000 4 195 135 5085 1260 0\001
4 1 1 1 0 3 20 0.0000 4 195 180 4683 1803 E\001
4 1 1 1 0 3 30 0.0000 4 60 120 4683 1533 .\001
4 1 1 1 0 3 20 0.0000 4 195 180 6079 1804 E\001
4 1 1 1 0 3 30 0.0000 4 60 120 6079 1534 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 6120 1125 0\001
4 1 -1 0 0 22 20 0.0000 4 210 390 7111 1441 AF\001
4 1 -1 0 0 22 20 0.0000 4 210 390 8911 1441 ES\001
4 1 1 1 0 3 20 0.0000 4 195 180 7832 1803 E\001
4 1 4 0 0 0 20 0.0000 4 240 300 8641 1081 [e]\001
4 1 4 0 0 0 20 0.0000 4 240 285 9136 1081 [s]\001
4 1 1 1 0 3 30 0.0000 4 60 120 7832 1533 .\001
4 1 1 1 0 3 20 0.0000 4 195 615 7922 1082 T - T\001
4 1 1 1 0 3 20 0.0000 4 195 135 8237 1262 0\001
4 1 1 1 0 3 20 0.0000 4 195 135 7744 1264 2\001
4 1 1 1 0 3 20 0.0000 4 270 2340 6930 2340 Pseudo Bond Graph\001
4 2 4 0 0 0 20 0.0000 4 240 1200 2160 4590 SS:[Mdot]\001
4 2 4 0 0 0 20 0.0000 4 255 1275 2072 1442 SS:[Th_in]\001
4 1 1 1 0 3 20 0.0000 4 195 165 2611 1171 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 2746 1261 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 2746 1936 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 2611 1801 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 2611 1531 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 9590 1220 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 9725 1310 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 9590 1850 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 9590 1580 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 9725 1985 2\001
4 0 4 0 0 0 20 0.0000 4 255 1425 10443 1443 SS:[Th_out]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/Conv/Conv_desc.tex version [f754dcd4e7].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Conv (Conv_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:53 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/03/09 10:19:43  peterg
% %% Added note about energy consevation.
% %%
% %% Revision 1.1  1998/03/09 10:13:27  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Conv} is
   displayed in Figure \Ref{Conv_abg} and its label
   file is listed in Section \Ref{sec:Conv_lbl}.
   The subsystems are listed in Section \Ref{sec:Conv_sub}.

The \textbf{Conv} component represents one way isenentropic flow of 
fluid though a pipe. Externally, it has true energy bonds: $P$/$\dot V$
(Pressure/volume-flow) representing hydraulic energy and $T$/$\dot
S$(Temperature/Entropy-flow) representing convected thermal energy.

Internally, however, the thermal part is represented by a pseudo bond
graph which computes the flow of internal energy $\dot E$ from the
upstream temperature $T_1$ and the mass flow rate $\dot m$ as:
\begin{equation}
  \dot E = c_p T_1 \dot m
\end{equation}
The $AF$ component makes the $FMR$ component use $T_1$ rather than
$T_1-T_2$.

The two \textbf{ES} components provide the conversion from true to
psuedo thermal bonds and vice versa.

%The pipe has an resistance to flow represented by the \textbf{RS}
%component labeled `r' which can be linear or nonlinear. The hydraulic
%energy loss reappears on the thermal bond of this (energy-conserving)
%\textbf{RS} component.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Thermal/Conv/Conv_lbl.txt version [829d4c79b1].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Conv	Convection of heat through a pipe
%DESCRIPTION Parameter 1: Specific heat of fluid (c_p)

%% Label file for system Conv (Conv_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type FMR
	c_p		lin	effort,$1

% Component type SS
	[Hy_in]		SS	external,external
	[Hy_out]	SS	external,external
	[Th_in]		SS	external,external
	[Th_out]	SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/Cycle/Cycle_abg.fig version [7b351255a8].

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
68
69
70
71
72
73
74
75
76
77













































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 1800 6750 1800 6525 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 2025 5175 3375 5400 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3825 5175 5175 5400 4950
2 2 0 3 1 7 1 0 -1 0.000 1 0 -1 0 0 5
	 6075 900 9000 900 9000 2700 6075 2700 6075 900
2 2 0 2 1 3 1 0 20 0.000 0 0 -1 0 0 5
	 8325 900 8550 900 8550 2700 8325 2700 8325 900
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10125 3825 10125 5175 10350 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 1800 9900 1800 9675 2025
2 2 0 2 1 3 1 0 20 0.000 0 0 -1 0 0 5
	 8550 1665 9585 1665 9585 1935 8550 1935 8550 1665
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 4725 1440 5805 1440
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 9675 1440 10755 1440
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 7785 3465 8415 2835
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 1800 4950 1800 4725 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1755 1800 3105 1800 2880 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 2025 3375 5175 3600 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 5175 3600 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10350 1800 11700 1800 11475 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12150 1800 13500 1800 13275 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 11700 5175 12150 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11925 2025 11925 5175 12150 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10125 2025 10125 3375 10350 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 2025 5400 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 2025 10350 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 5175 10350 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 5175 5400 5175
4 1 -1 0 0 0 20 0.0000 4 255 855 7290 1890 CU:gas\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 1890 1\001
4 1 -1 0 0 0 20 0.0000 4 255 1590 5175 3690 INTF:entropy\001
4 1 -1 0 0 0 20 0.0000 4 195 135 10125 1890 1\001
4 1 1 1 0 3 20 0.0000 4 270 1035 7200 1440 Ideal gas\001
4 1 1 1 0 3 20 0.0000 4 210 885 4635 1305 Heat in\001
4 1 1 1 0 3 20 0.0000 4 210 1080 10170 1305 Work out\001
4 1 1 1 0 3 20 0.0000 4 270 1800 5130 5895 Entropy change\001
4 1 1 1 0 3 20 0.0000 4 270 1365 7110 3690 Ideal piston\001
4 1 -1 0 0 0 20 0.0000 4 195 1560 10125 3690 INTF:volume\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3375 1890 0\001
4 2 4 0 0 0 20 0.0000 4 240 1140 1575 1890 SS:[Heat]\001
4 1 -1 0 0 0 20 0.0000 4 195 585 3375 5490 SS:T\001
4 1 1 1 0 3 20 0.0000 4 255 1485 3240 5895 Temperature\001
4 1 -1 0 0 0 20 0.0000 4 195 570 5130 5490 SS:S\001
4 1 -1 0 0 0 20 0.0000 4 195 615 10125 5490 SS:V\001
4 1 -1 0 0 0 20 0.0000 4 195 570 11880 5490 SS:P\001
4 0 4 0 0 0 20 0.0000 4 240 1230 13680 1890 SS:[Work]\001
4 1 1 1 0 3 20 0.0000 4 270 1815 10080 5850 Volume change\001
4 1 1 1 0 3 20 0.0000 4 195 975 11925 5850 Pressure\001
4 1 -1 0 0 0 20 0.0000 4 195 135 11925 1890 0\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/Cycle/Cycle_desc.tex version [d51575eb68].

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
68
69
70
71







































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Cycle (Cycle_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/06/30 12:46:24  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Cycle} is
   displayed in Figure \Ref{Cycle_abg} and its label
   file is listed in Section \Ref{sec:Cycle_lbl}.
   The subsystems are listed in Section \Ref{sec:Cycle_sub}.

The system has two heat engine ports: 
\begin{enumerate}
\item \textbf{[Heat]} and
\item \textbf{[Work]}
\end{enumerate}
By convention, energy flows in to the \textbf{[Heat]} port and out of
the \textbf{[Work]} port. Both ports are true energy ports.


The subsystem \textbf{CU} (Section \Ref{sec:CU}) is a two-port
component describing an ideal gas. It has two energy ports which, with
integral causality correspond to
\begin{enumerate}
\item Entropy flow in; temperature out
\item Volume rate of change in; pressure out
\end{enumerate}

Four \textbf{SS} components are set up as sensors to measure the
important quantities pertaining to the cycle:
\begin{enumerate}
\item \textbf{S} to measure the integrated entropy flow
\item \textbf{T} to measure the (absolute) temperature
\item \textbf{V} to measure the integrated volume change
\item \textbf{P} to measure the pressure
\end{enumerate}

   \begin{table}[htbp]
     \begin{center}
       \leavevmode
       \begin{tabular}{|l|l|l|l|l|}
         \hline
         Cycle & Compression & Heating & Expansion & Cooling \\
         \hline
         Otto & II & II & II & II \\
         Carnot & II & DI & II & DI \\
         Diesel & II & ID & II & II \\
         Joule & II & ID & II & ID \\
         \hline
       \end{tabular}
       \caption{Cycles and their causality}
       \label{tab:cycles}
     \end{center}
   \end{table}
   
   A number of cycles can be built depending on the causality of the
   two ports \textbf{[Heat]} and \textbf{[Work]} of \textbf{Cycle}
   Some possible cycles listed in Tables \Ref{tab:cycles} where each
   table entry gives the causality on the heat and work ports
   respectively.

Deleted mttroot/mtt/lib/comp/compound/Thermal/Cycle/Cycle_lbl.txt version [d82e73d04d].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY Cycle: Closed cycle with ideal gas
#DESCRIPTION Uses the CU two-port thermal capacitor.

#ALIAS in	Heat
#ALIAS out	Work

#ALIAS $1	ideal_gas
#ALIAS $2	c_v
#ALIAS $3	gamma_g
#ALIAS $4	m_g

## Label file for system Cycle (Cycle_lbl.txt)

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.2  1998/07/21 14:21:04  peterg
# ## New style file
# ##
# ## Revision 1.1  1997/12/08 20:24:43  peterg
# ## Initial revision
# ##
# ## Revision 1.1  1997/12/07 20:38:05  peterg
# ## Initial revision
# ##
# ###############################################################

## Each line should be of one of the following forms:
#	a comment (ie starting with #)
#	Component-name	CR_name	arg1,arg2,..argn
#	blank




# Component type CU
	gas	CU	ideal_gas,c_v,gamma_g,m_g

# Component type INTF
	entropy
	volume

# Component type SS
	S	SS	external,0
	T	SS	external,0
	V	SS	external,0
	P	SS	external,0
	[Heat]	SS	external,external
	[Work]	SS	external,external



Deleted mttroot/mtt/lib/comp/compound/Thermal/Cycle/Cycle_simp.r version [b8f003f5e9].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce commands to simplify output for system Cycle (Cycle_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Pipe/Pipe_abg.fig version [d78afb5ca3].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84




















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2715 1351 3840 1351 3615 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4515 1351 5640 1351 5415 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5865 1576 5865 2701 6090 2476
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5865 3151 5865 4276 6090 4051
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2715 4501 5640 4501 5415 4726
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6090 1351 7215 1351 6990 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7890 1351 9015 1351 8790 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6090 4501 10815 4501 10590 4726
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9690 1350 10815 1350 10590 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11039 4274 11039 3149 11264 3374
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11039 2699 11039 1574 11264 1799
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11267 1353 12392 1353 12167 1578
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11267 4500 12392 4500 12167 4725
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 8834 2925 4739 2925 4739 630 8834 630 8834 2925
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 15075 6075 15075 450 450 450 450 6075 15075 6075
4 2 4 0 0 0 20 0.0000 4 255 2085 2624 4590 SS:[Hydraulic_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1935 2581 1442 SS:[Thermal_in]\001
4 1 -1 0 0 22 20 0.0000 4 210 390 4200 1441 ES\001
4 1 -1 0 0 22 20 0.0000 4 195 150 5865 1441 1\001
4 1 -1 0 0 22 20 0.0000 4 195 150 5865 4636 1\001
4 1 -1 0 0 22 20 0.0000 4 210 390 7575 1441 AF\001
4 1 -1 0 0 22 20 0.0000 4 270 1665 5865 3061 FMR:rho_cp\001
4 1 -1 0 0 22 20 0.0000 4 210 390 9375 1441 ES\001
4 1 1 1 0 3 20 0.0000 4 195 180 8296 1803 E\001
4 1 1 1 0 3 20 0.0000 4 195 135 3256 4412 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 3121 4682 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 3121 4322 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 3121 4952 V\001
4 1 4 0 0 0 20 0.0000 4 240 285 3930 1126 [s]\001
4 1 4 0 0 0 20 0.0000 4 240 300 4470 1126 [e]\001
4 1 4 0 0 0 20 0.0000 4 240 300 9105 1081 [e]\001
4 1 4 0 0 0 20 0.0000 4 240 285 9600 1081 [s]\001
4 1 1 1 0 3 20 0.0000 4 195 165 3120 1171 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 3255 1261 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 3255 1936 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 3120 1801 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 3120 1531 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 5056 1262 1\001
4 1 1 1 0 3 20 0.0000 4 195 615 5234 1080 T - T\001
4 1 1 1 0 3 20 0.0000 4 195 135 5549 1260 0\001
4 1 1 1 0 3 30 0.0000 4 60 120 8296 1533 .\001
4 1 1 1 0 3 20 0.0000 4 195 615 8386 1082 T - T\001
4 1 1 1 0 3 20 0.0000 4 195 135 8701 1262 0\001
4 1 1 1 0 3 20 0.0000 4 195 135 8208 1264 2\001
4 1 -1 0 0 22 20 0.0000 4 195 150 11039 1440 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 11039 4590 1\001
4 1 -1 0 0 22 20 0.0000 4 210 600 11084 3015 RS:r\001
4 0 4 0 0 0 20 0.0000 4 255 2235 12617 4593 SS:[Hydraulic_out]\001
4 0 4 0 0 0 20 0.0000 4 255 2085 12572 1443 SS:[Thermal_out]\001
4 1 1 1 0 3 30 0.0000 4 60 120 11674 4685 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 11674 4325 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 11674 4955 V\001
4 1 1 1 0 3 20 0.0000 4 195 135 11809 4415 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 11674 1175 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 11809 1265 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 11674 1805 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 11674 1535 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 11809 1940 2\001
4 1 1 1 0 3 20 0.0000 4 270 2340 7394 2340 Pseudo Bond Graph\001
4 1 1 1 0 3 20 0.0000 4 195 180 5147 1803 E\001
4 1 1 1 0 3 30 0.0000 4 60 120 5147 1533 .\001
4 1 1 1 0 3 20 0.0000 4 195 180 6543 1804 E\001
4 1 1 1 0 3 30 0.0000 4 60 120 6543 1534 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 6584 1125 0\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Pipe/Pipe_desc.tex version [0ebe3c440d].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Pipe (Pipe_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:53 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/03/09 10:13:27  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Pipe} is
   displayed in Figure \Ref{Pipe_abg} and its label
   file is listed in Section \Ref{sec:Pipe_lbl}.
   The subsystems are listed in Section \Ref{sec:Pipe_sub}.

The \textbf{Pipe} component represents one way flow of incompressible
fluid though a pipe. Externally, it has true energy bonds: $P$/$\dot V$
(Pressure/volume-flow) representing hydraulic energy and $T$/$\dot
S$(Temperature/Entropy-flow) representing convected thermal energy.

Internally, however, the thermal part is represented by a pseudo bond
graph which computes the flow of internal energy $\dot E$ from the
upstream temperature $T_1$ and the volumetric flow rate $\dot V$ as:
\begin{equation}
  \dot E = \rho c_p T_1 \dot V
\end{equation}
The $AF$ component makes the $FMR$ component use $T_1$ rather than
$T_1-T_2$.

The two \textbf{ES} components provide the conversion from true to
psuedo thermal bonds and vice versa.

The pipe has an resistance to flow represented by the \textbf{RS}
component labeled `r' which can be linear or nonlinear. The hydraulic
energy loss reappears on the thermal bond of this (energy-conserving)
\textbf{RS} component.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Pipe/Pipe_lbl.txt version [5c1c8daacb].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Pipe (Pipe_lbl.txt)
%SUMMARY Pipe: Pipe containing hot incompressible liquid
%DESCRIPTION

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/11/20 11:34:17  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out


%ALIAS	$1	rho
%ALIAS	$2	c_p
%ALIAS	$3	flow,r


% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type FMR
	rho_cp		lin	effort,$1*$2

% Component type RS
	r		$1	$3

% Component type SS
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Pump/Pump_abg.fig version [64178c150c].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2714 2476 3839 2476 3614 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4289 2476 5414 2476 5189 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6313 2477 8297 2478 8072 2703
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2713 1351 5418 1353 5193 1578
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6313 1351 8297 1352 8072 1577
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 3825 4050 2700 4275 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 5400 4050 4275 4275 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4063 7020 4063 5895 4288 6120
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 10800 7650 10800 450 405 450 405 7650 10800 7650
4 2 4 0 0 0 20 0.0000 4 255 2085 2669 2567 SS:[Hydraulic_in]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 4064 2612 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 3166 2389 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 3031 2659 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 3031 2299 P\001
4 0 4 0 0 0 20 0.0000 4 255 2235 8522 2571 SS:[Hydraulic_out]\001
4 1 1 1 0 3 30 0.0000 4 60 120 7579 2663 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 7579 2303 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 7579 2933 V\001
4 1 1 1 0 3 20 0.0000 4 195 135 7714 2393 2\001
4 0 4 0 0 0 20 0.0000 4 255 1035 6313 2341 [Hy_out]\001
4 1 -1 0 0 22 20 0.0000 4 270 1305 5953 1936 Pipe:pipe\001
4 2 4 0 0 0 20 0.0000 4 255 870 5459 1172 [Th_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1935 2536 1444 SS:[Thermal_in]\001
4 1 1 1 0 3 20 0.0000 4 195 165 3075 1173 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 3210 1263 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 3210 1938 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 3075 1803 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 3075 1533 .\001
4 0 4 0 0 0 20 0.0000 4 255 1020 6313 1171 [Th_out]\001
4 0 4 0 0 0 20 0.0000 4 255 2085 8477 1400 SS:[Thermal_out]\001
4 1 1 1 0 3 20 0.0000 4 195 165 7579 1132 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 7714 1222 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 7579 1762 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 7579 1492 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 7714 1897 2\001
4 2 4 0 0 0 20 0.0000 4 255 885 5457 2340 [Hy_in]\001
4 1 1 1 0 3 20 0.0000 4 195 195 3031 2929 V\001
4 1 -1 0 0 22 20 0.0000 4 270 915 4063 4141 TF:k_p\001
4 1 -1 0 0 22 20 0.0000 4 195 150 4064 5717 1\001
4 1 4 0 0 0 20 0.0000 4 240 1215 4063 7381 SS:[Shaft]\001
4 1 1 1 0 32 30 0.0000 4 240 195 3838 6661 t\001
4 1 1 1 0 32 30 0.0000 4 240 285 4288 6661 w\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Pump/Pump_desc.tex version [af214b606c].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Pump (Pump_desc.tex)
% Generated by MTT on Mon Mar 9 09:11:22 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Pump} is
   displayed in Figure \Ref{Pump_abg} and its label
   file is listed in Section \Ref{sec:Pump_lbl}.
   The subsystems are listed in Section \Ref{sec:Pump_sub}.

\textbf{Pump} represents an ideal pump for incompressible fluid
driving fluid though a \textbf{Pipe} component. The pipe component
provides the correct thermal flow; if its resistance is set to zero,
the pump is an ideal component.

The flow must be one way (in to out) for correct thermal properties.

The ports are 
\begin{itemize}
\item [Hy_in] Pressure/volume-flow inflow
\item [Hy_in] Pressure/volume-flow outflow
\item [Th_in] Temperature/Entropy-flow in flow
\item [Th_out] Temperature/Entropy-flow out flow
\item [Shaft] Torque/angular velocity input.
\end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Pump/Pump_lbl.txt version [9da52c1c35].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Pump: a hydraulic pump - incompressible flow
%DESCRIPTION Typical lable: pump  lin  rho;c_p;flow,r;k_p

%% Label file for system Pump (Pump_lbl.txt)


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/11/20 10:07:14  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%ALIAS	Pipe	IncompressibleFlow/Pipe
%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out

%ALIAS	Work	Shaft

%ALIAS  $1	rho
%ALIAS  $2	c_p
%ALIAS  $3	flow,r
%ALIAS  $4	flow,k_p

%ALIAS	$1	lin

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank


% Component type Pipe
	pipe		lin	rho;c_p;flow,r

% Component type TF
	k_p		lin	flow,k_p

% Component type SS
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external
	[Shaft]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Tank/Tank_abg.fig version [33782b4512].

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
68
69
70
71
72
73
74
75
76












































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2940 2477 4065 2477 3840 2702
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4740 2477 5865 2477 5640 2702
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2940 5627 5865 5627 5640 5852
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6315 2478 7440 2478 7215 2703
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8116 2479 9241 2479 9016 2704
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6315 5626 9240 5626 9015 5851
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 7484 6571 4739 6571 4739 1801 7484 1801 7484 6571
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5864 5401 6314 5401
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5864 2701 6314 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6089 2702 6089 3827 6314 3602
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6089 5401 6089 4276 6314 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6088 1127 6088 2252 6313 2027
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11700 7200 11700 225 675 225 675 7200 11700 7200
4 0 4 0 0 0 20 0.0000 4 255 2235 9421 5719 SS:[Hydraulic_out]\001
4 0 4 0 0 0 20 0.0000 4 255 2085 9376 2569 SS:[Thermal_out]\001
4 2 4 0 0 0 20 0.0000 4 255 2085 2894 5716 SS:[Hydraulic_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1935 2806 2568 SS:[Thermal_in]\001
4 1 -1 0 0 22 20 0.0000 4 210 390 4425 2567 ES\001
4 1 1 1 0 3 20 0.0000 4 195 135 3481 5538 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 3346 5808 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 3346 5448 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 3346 6078 V\001
4 1 4 0 0 0 20 0.0000 4 240 285 4155 2252 [s]\001
4 1 4 0 0 0 20 0.0000 4 240 300 4695 2252 [e]\001
4 1 1 1 0 3 20 0.0000 4 195 165 3345 2297 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 3480 2387 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 3480 3062 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 3345 2927 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 3345 2657 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 5281 2388 1\001
4 1 1 1 0 3 20 0.0000 4 195 615 5459 2206 T - T\001
4 1 1 1 0 3 20 0.0000 4 195 135 5774 2386 0\001
4 1 1 1 0 3 30 0.0000 4 60 120 5372 2659 .\001
4 1 1 1 0 3 20 0.0000 4 195 180 5372 2929 E\001
4 1 -1 0 0 22 20 0.0000 4 210 870 6089 4186 C:tank\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6090 2567 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6090 5762 0\001
4 1 -1 0 0 22 20 0.0000 4 210 390 7800 2568 ES\001
4 1 1 1 0 3 30 0.0000 4 60 120 8523 5811 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 8523 5451 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 8523 6081 V\001
4 1 1 1 0 3 20 0.0000 4 195 135 8658 5541 2\001
4 1 1 1 0 3 20 0.0000 4 195 180 6721 2930 E\001
4 1 4 0 0 0 20 0.0000 4 240 300 7530 2208 [e]\001
4 1 4 0 0 0 20 0.0000 4 240 285 8025 2208 [s]\001
4 1 1 1 0 3 20 0.0000 4 195 165 8523 2301 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 8658 2391 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 8523 2931 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 8523 2661 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 8658 3066 2\001
4 1 1 1 0 3 30 0.0000 4 60 120 6721 2660 .\001
4 1 1 1 0 3 20 0.0000 4 195 615 6811 2209 T - T\001
4 1 1 1 0 3 20 0.0000 4 195 135 7126 2389 0\001
4 1 1 1 0 3 20 0.0000 4 195 135 6633 2391 2\001
4 1 1 1 0 3 20 0.0000 4 270 2340 6134 6346 Pseudo Bond Graph\001
4 1 4 0 0 0 20 0.0000 4 240 555 5639 3826 [out]\001
4 1 4 0 0 0 20 0.0000 4 240 405 5684 4501 [in]\001
4 1 4 0 0 0 20 0.0000 4 255 1500 6088 990 SS:[Heat_in]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Tank/Tank_cr.r version [79aee20085].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Constitutive relation file for Tank (Tank_cr.r)
% Generated by MTT at Thu Mar  5 10:30:23 GMT 1998

OPERATOR tank;

%Pressure
FOR ALL rho,c_p,c,Volume,Energy
LET tank(rho,c_p,c,effort,1,
	Volume,state,1,
	Energy,state,2
	) = (Volume*rho)/c;

%Temperature
FOR ALL rho,c_p,c,Volume,Energy
LET tank(rho,c_p,c,effort,2,
	Volume,state,1,
	Energy,state,2
	) = Energy/(Volume*rho*c_p);

END;

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Tank/Tank_desc.tex version [cb521024f4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Tank (Tank_desc.tex)
% Generated by MTT on Tue Jan 13 18:03:04 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Tank} is
   displayed in Figure \Ref{Tank_abg} and its label
   file is listed in Section \Ref{sec:Tank_lbl}.
   The subsystems are listed in Section \Ref{sec:Tank_sub}.

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/Tank/Tank_lbl.txt version [7694e0fcab].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Tank (Tank_lbl.txt)
%SUMMARY Tank: Tank of hot incompressible liquid
%DESCRIPTION c is the pressure constant: P=(rho*V)/c
%DESCRIPTION Typical lable: tank  Tank  rho;c_p;c

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/11/20 09:46:34  peterg
% %% Modernised lbl syntax
% %%
% %% Revision 1.1  1998/11/20 08:57:19  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out

%ALIAS	Heat	Heat_in

% Argument aliases
%ALIAS	$1	rho
%ALIAS	$2	c_p
%ALIAS	$3	c

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	tank		Tank	       rho,c_p,c

% Component type SS
	[Heat_in]	SS		external,external
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/lPump/lPump_abg.fig version [2ccac3b7ce].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6526 7426 6526 6301 6751 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 6302 6078 6302 5853 6527
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5177 6078 5177 5853 5402
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6076 2476 3601 4951 3871 4951
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6076 3601 3601 6076 3871 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6976 2701 6976 2476 9451 4951
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 3825 6975 3600 9450 6075
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6976 6301 9228 6301 9003 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6976 5176 9228 5176 9003 5401
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2253 6302 3378 6302 3153 6527
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2253 5177 3378 5177 3153 5402
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9678 5177 10803 5177 10578 5402
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9678 6302 10803 6302 10578 6527
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 9001 6525 7876 6750 8101
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 13275 9675 13275 1350 45 1350 45 9675 13275 9675
4 2 4 0 0 0 20 0.0000 4 255 2085 2205 6390 SS:[Hydraulic_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1935 2205 5265 SS:[Thermal_in]\001
4 2 4 0 0 0 20 0.0000 4 255 870 6123 4998 [Th_in]\001
4 0 4 0 0 0 20 0.0000 4 255 1020 6977 4997 [Th_out]\001
4 1 4 0 0 0 20 0.0000 4 240 810 6572 6167 [Shaft]\001
4 2 4 0 0 0 20 0.0000 4 255 885 5986 6166 [Hy_in]\001
4 0 4 0 0 0 20 0.0000 4 255 1035 7112 6167 [Hy_out]\001
4 1 -1 0 0 22 20 0.0000 4 270 1665 6527 5762 Pump:pump\001
4 1 -1 0 0 22 20 0.0000 4 270 1260 6527 3152 Pipe:leak\001
4 1 1 1 0 3 20 0.0000 4 195 135 2705 6215 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 2570 6125 P\001
4 1 1 1 0 3 20 0.0000 4 195 165 2614 4999 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 2749 5089 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 2749 5764 1\001
4 1 1 1 0 3 20 0.0000 4 195 165 2614 5629 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 2614 5359 .\001
4 1 1 1 0 3 20 0.0000 4 195 195 2570 6755 V\001
4 1 1 1 0 3 30 0.0000 4 60 120 2570 6485 .\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3603 6393 0\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3603 5268 0\001
4 0 4 0 0 0 20 0.0000 4 255 2085 10941 5271 SS:[Thermal_out]\001
4 0 4 0 0 0 20 0.0000 4 255 2235 10941 6397 SS:[Hydraulic_out]\001
4 1 1 1 0 3 20 0.0000 4 195 165 10043 4958 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 10178 5048 2\001
4 1 1 1 0 3 20 0.0000 4 195 165 10043 5588 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 10043 5318 .\001
4 1 1 1 0 3 20 0.0000 4 195 135 10178 5723 2\001
4 1 -1 0 0 22 20 0.0000 4 195 150 9453 5268 0\001
4 1 1 1 0 3 30 0.0000 4 60 120 10088 6489 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 10088 6129 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 10088 6759 V\001
4 1 1 1 0 3 20 0.0000 4 195 135 10223 6219 2\001
4 1 -1 0 0 22 20 0.0000 4 195 150 9498 6438 0\001
4 0 4 0 0 0 20 0.0000 4 255 870 7023 2343 [Th_in]\001
4 0 4 0 0 0 20 0.0000 4 255 885 7021 3466 [Hy_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1020 6032 2342 [Th_out]\001
4 2 4 0 0 0 20 0.0000 4 255 1035 6032 3467 [Hy_out]\001
4 1 4 0 0 0 20 0.0000 4 240 1215 6482 9317 SS:[Shaft]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6528 7743 1\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/lPump/lPump_desc.tex version [e567a661c2].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system lPump (lPump_desc.tex)
% Generated by MTT on Mon Mar 9 10:35:44 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{lPump} is
   displayed in Figure \Ref{lPump_abg} and its label
   file is listed in Section \Ref{sec:lPump_lbl}.
   The subsystems are listed in Section \Ref{sec:lPump_sub}.

\textbf{lPump} corrsponds to the \textbf{Pump} component but with a
backflow leakage around the ump driven by the pressure drop across
the pump. This leakage is implemented using the \textbf{Pipe}
component to give the correct thermal behaviour.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Thermal/IncompressibleFlow/lPump/lPump_lbl.txt version [d8173c6ec9].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system lPump (lPump_lbl.txt)
%SUMMARY lPump: a hydraulic pump with leakage - incompressible flow

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Component aliases
%ALIAS	Pipe	IncompressibleFlow/Pipe
%ALIAS	Pump	IncompressibleFlow/Pump

% Port aliases
%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out

% Argument aliases
%ALIAS  $1	rho
%ALIAS  $2	c_p
%ALIAS  $3	flow,r
%ALIAS  $4	flow,k_p
%ALIAS  $5	flow,r_l


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type Pipe
	leak		lin	$1;$2;$5

% Component type Pump
	pump		lin	$1;$2;$3;$4

% Component type SS
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external
	[Shaft]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/RT/RT_abg.fig version [932b6ad72c].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 2701 5625 2701 5400 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 2701 7425 2701 7200 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 2476 5850 1126 6075 1351
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11475 3600 450 3600 450 451 11475 451 11475 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 2701 3375 2701 3150 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8325 2701 9675 2701 9450 2926
4 1 -1 0 0 0 20 0.0000 4 195 135 5850 2791 1\001
4 1 -1 0 0 0 20 0.0000 4 195 375 5850 991 R:r\001
4 1 4 0 0 0 20 0.0000 4 255 315 4410 2476 [p]\001
4 1 4 0 0 0 20 0.0000 4 255 315 7290 2476 [p]\001
4 1 1 1 0 3 20 0.0000 4 240 210 5040 3106 Q\001
4 1 1 1 0 3 30 0.0000 4 60 105 5085 2836 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 5040 2521 T\001
4 1 1 1 0 3 20 0.0000 4 240 210 6615 3106 Q\001
4 1 1 1 0 3 30 0.0000 4 60 105 6660 2836 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 6615 2521 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 6795 2611 2\001
4 1 1 1 0 3 20 0.0000 4 195 135 5220 2611 1\001
4 1 -1 0 0 0 20 0.0000 4 255 765 3825 2790 FP:fp1\001
4 2 4 0 0 0 20 0.0000 4 240 810 1980 2790 SS:[in]\001
4 1 4 0 0 0 20 0.0000 4 240 270 3285 2476 [f]\001
4 1 1 1 0 3 20 0.0000 4 195 165 2475 3106 S\001
4 1 1 1 0 3 30 0.0000 4 60 105 2520 2836 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 2475 2521 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 2610 2611 1\001
4 1 1 1 0 3 20 0.0000 4 195 135 2610 3241 1\001
4 1 -1 0 0 0 20 0.0000 4 255 765 7920 2790 FP:fp2\001
4 1 4 0 0 0 20 0.0000 4 240 270 8505 2476 [f]\001
4 1 1 1 0 3 20 0.0000 4 195 165 9090 3106 S\001
4 1 1 1 0 3 30 0.0000 4 60 105 9135 2836 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 9090 2521 T\001
4 1 1 1 0 3 20 0.0000 4 195 135 9270 3241 2\001
4 1 1 1 0 3 20 0.0000 4 195 135 9270 2611 2\001
4 0 4 0 0 0 20 0.0000 4 240 960 9810 2791 SS:[out]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/RT/RT_desc.tex version [2c0ca51cf3].

1
2
3
4
5





-
-
-
-
-
Component \textbf{RT} is a two port thermal resistor with true power
bonds. Internally, it has a pseudo Bond Graph representation, and the
corresponding thermal resistance just acts as an ordinary one-port
\textbf{R} component.
 

Deleted mttroot/mtt/lib/comp/compound/Thermal/RT/RT_lbl.txt version [f1b276aa6b].

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































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY RT: Two port thermal resistance with T/Sdot bonds
%DESCRIPTION Port [in]: T/Sdot power in
%DESCRIPTION Port [out]: T/Sdot power out
%DESCRIPTION CR and parameters as for a one-port R component
%DESCRIPTION Internally pseudo bond graph 
%DESCRIPTION Example label file entry:
%DESCRIPTION % Component type RT
%DESCRIPTION	r		lin	flow,r

%ALIAS	ThermalIn	in
%ALIAS	ThermalOut	out

%ALIAS	$1	flow,r
%ALIAS	$a1	lin


%% Label file for system RT (RT_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.7  2001/07/03 22:59:10  gawthrop
% %% Fixed problems with argument passing for CRs
% %%
% %% Revision 1.6  2001/06/13 17:10:26  gawthrop
% %% Alias for the cr (ie ALIAS	$1	lin)
% %%
% %% Revision 1.5  2001/06/11 19:51:08  gawthrop
% %% Zapped spurious $1 alias
% %%
% %% Revision 1.4  1998/07/22 11:31:42  peterg
% %% New port names
% %%
% %% Revision 1.3  1998/07/21 16:26:05  peterg
% %% Now has aliased parameters.
% %%
% %% Revision 1.2  1998/06/29 10:08:14  peterg
% %% Converted to FP component
% %% Removed lables from FP
% %%
% %% Revision 1.1  1997/09/04  09:48:47  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank


% Component type R
	r		lin		flow,r

% Component type FP
        fp1
        fp2

% Component type SS
	[in]		SS		external,external
	[out]		SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/RT/TestRT_abg.fig version [cbe47fe6bb].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 3600 3600 3600 3375 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 3600 5850 3600 5625 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3600 3420 3600 3780
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4500 3420 4500 3780
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 7020 4725 1125 4725 1125 2295 7020 2295 7020 4725
4 1 -1 0 0 2 20 0.0000 4 195 705 4050 3690 RT:rt\001
4 1 -1 0 0 2 20 0.0000 4 255 870 1800 3690 SS:T_1\001
4 1 -1 0 0 2 20 0.0000 4 255 870 6345 3690 SS:T_2\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/RT/TestRT_lbl.txt version [c0d3a5ad40].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TestRT
%DESCRIPTION <Detailed description here>
%% Label file for system TestRT (TestRT_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type RT
	rt		lin		flow,r;0

% Component type SS
	T_1		external	external
	T_2		external	external

Deleted mttroot/mtt/lib/comp/compound/Thermal/RT1/RT1_abg.fig version [b3391c9064].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1575 2700 2925 2700 2700 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 2700 5175 2700 4950 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 2475 5400 1125 5625 1350
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 2700 6975 2700 6750 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7876 2701 9226 2701 9001 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10081 2701 11431 2701 11206 2926
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 12600 4275 12600 450 225 450 225 4275 12600 4275
4 1 -1 0 0 0 20 0.0000000 4 210 690 3420 2790 ES:es\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 5400 2790 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 390 5400 990 R:r\001
4 2 4 0 0 0 20 0.0000000 4 240 870 1485 2790 SS:[in]\001
4 1 4 0 0 0 20 0.0000000 4 240 330 2835 2475 [s]\001
4 1 4 0 0 0 20 0.0000000 4 240 345 3960 2475 [e]\001
4 1 -1 0 0 0 20 0.0000000 4 210 705 7470 2790 AF:af\001
4 1 -1 0 0 0 20 0.0000000 4 210 690 9676 2791 ES:se\001
4 0 4 0 0 0 20 0.0000000 4 240 1020 11611 2791 SS:[out]\001
4 1 4 0 0 0 20 0.0000000 4 240 345 9091 2476 [e]\001
4 1 4 0 0 0 20 0.0000000 4 240 330 10306 2476 [s]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/RT1/RT1_desc.tex version [4642e64d86].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Component \textbf{RT1} is a two port thermal resistor with true power
bonds. Internally, it has a pseudo Bond Graph representation, and the
corresponding thermal resistance just acts as an ordinary one-port
\textbf{R} component.
Unlike the {\bf RT} component, it is {\em one-sided\/} in the snese
that the paper flow depends only on the upstream temperature. It is
useful for modelling radiation via the Stefan-Boltzmann law when using
the {\bf StefanBoltzmann} CR.


This one-sidedness is achieved using the {\bf AF} component to isolate
the intrnal {\bf R} component from the downstream temperature.
 

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/comp/compound/Thermal/RT1/RT1_lbl.txt version [024d59e57d].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system RT1 (RT1_lbl.txt)
%SUMMARY RT1: Two port thermal resistance with T/Sdot bonds
%DESCRIPTION Port [in]: T/Sdot power in
%DESCRIPTION Port [out]: T/Sdot power out
%DESCRIPTION CR and parameters as for a one-port R component
%DESCRIPTION One sided: flow depends on upstream temperature only
%DESCRIPTION Useful for radiation modelling
%DESCRIPTION Example label file entry:
%DESCRIPTION % Component type RT1
%DESCRIPTION	r		lin	flow,r


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 10:40:45  peterg
% %% Put under RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	out	out

% Argument aliases
%ALIAS	$1	r
%ALIAS	$1	lin

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AF
	af

% Component type ES
	es
	se

% Component type R
	r		lin	flow,r

% Component type SS
	[in]	SS		external,external
	[out]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/ThermalConversion/ES/ES_abg.fig version [59448e3014].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4515 2701 5865 2701 5640 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2715 2701 4065 2701 3840 2926
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 3600 225 3600 225 1801 8325 1801 8325 3600
4 1 4 0 0 0 20 0.0000000 4 270 360 4650 2476 [p]\001
4 1 -1 0 0 0 20 0.0000000 4 210 330 4290 2791 FP\001
4 1 4 0 0 0 20 0.0000000 4 240 315 3975 2476 [f]\001
4 1 1 1 0 3 20 0.0000000 4 210 165 3165 3106 S\001
4 1 1 1 0 3 30 0.0000000 4 60 105 3210 2836 .\001
4 1 1 1 0 3 20 0.0000000 4 270 210 5280 3106 Q\001
4 1 1 1 0 3 30 0.0000000 4 60 105 5325 2836 .\001
4 1 1 1 0 3 20 0.0000000 4 210 180 5280 2521 T\001
4 1 1 1 0 3 20 0.0000000 4 210 180 3165 2521 T\001
4 1 1 1 0 3 20 0.0000000 4 210 150 3300 2611 1\001
4 1 1 1 0 3 20 0.0000000 4 210 150 3300 3241 1\001
4 1 1 1 0 3 20 0.0000000 4 210 150 5460 2611 1\001
4 0 4 0 0 0 20 0.0000000 4 270 2115 6000 2791 SS:[EnergyFlow]\001
4 2 4 0 0 0 20 0.0000000 4 270 2220 2655 2790 SS:[EntropyFlow]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/ThermalConversion/ES/ES_lbl.txt version [aac3c82503].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system ES (ES_lbl.txt)
%SUMMARY ES	Identical to the FP component except for the port labels
%DESCRIPTION Converts true thermal to pseudo BGs

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	e|p	EnergyFlow
%ALIAS	s|f	EntropyFlow

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[EnergyFlow]	SS		external,external
	[EntropyFlow]	SS		external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/VM/VM_abg.fig version [3136079f4d].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 3825 3600 3825 3375 4050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 3600 4500 2925 4500 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 1980 5400 2655 5625 2430
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 2925 6975 3600 6750 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7246 3826 8371 3826 8146 4051
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5175 10125 450 225 450 225 5175 10125 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 1125 4500 1125 4275 1350
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4500 900 4500 1395
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 1800 4500 1800 4275 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4500 1575 4500 2070
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 4050 6300 4725 6525 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 4050 4500 4725 4320 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 4725 4950 4725 5175 4950
4 2 4 0 0 0 20 0.0000 4 255 1290 2073 3918 SS:[Hy_in]\001
4 1 1 1 0 3 30 0.0000 4 60 120 2570 4010 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 2570 3650 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 2570 4280 V\001
4 1 4 0 0 0 20 0.0000 4 240 570 5445 1935 [rho]\001
4 2 4 0 0 0 20 0.0000 4 240 675 5355 2700 [mod]\001
4 1 -1 0 0 22 20 0.0000 4 210 1365 5400 3015 EMAF:rho\001
4 1 4 0 0 0 20 0.0000 4 240 405 4860 3285 [in]\001
4 1 4 0 0 0 20 0.0000 4 240 555 5851 3241 [out]\001
4 1 1 1 0 3 30 0.0000 4 60 120 8018 3968 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 8018 3608 P\001
4 1 1 1 0 3 20 0.0000 4 135 210 8018 4238 m\001
4 0 4 0 0 0 20 0.0000 4 255 1440 8551 3916 SS:[Hy_out]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3825 3915 1\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6975 3915 0\001
4 1 1 1 0 3 20 0.0000 4 195 165 2613 948 T\001
4 2 4 0 0 0 20 0.0000 4 240 345 4410 1665 [P]\001
4 2 4 0 0 0 20 0.0000 4 240 360 4455 945 [T]\001
4 2 4 0 0 0 20 0.0000 4 240 750 2119 1849 SS:[P]\001
4 2 4 0 0 0 20 0.0000 4 240 765 2119 1219 SS:[T]\001
4 1 -1 0 0 22 20 0.0000 4 270 2130 5715 1530 Density:density\001
4 1 -1 0 0 22 20 0.0000 4 195 150 4725 4815 0\001
4 1 -1 0 0 22 20 0.0000 4 210 405 5985 4815 AE\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/VM/VM_desc.tex version [8bf823999e].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system VM (VM_desc.tex)
% Generated by MTT on Thu Mar 19 14:37:43 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{VM} is
   displayed in Figure \Ref{VM_abg} and its label
   file is listed in Section \Ref{sec:VM_lbl}.
   The subsystems are listed in Section \Ref{sec:VM_sub}.

The \textbf{VM} component acts as a density-modulated transformer
converting a $P$/$\dot V$ energy bond to a $P$/$\dot m$ pseudo bond. It used
the \textbf{Density} component and therfore inherits the properties of
that component -- in particular it takes the same parameter. The four
ports are:

\begin{itemize}
\item [Hy_in]: hydraulic in
\item [Hy_out]: hydraulic out
\item [P]: Pressure
\item [T]: Temperature
\end{itemize}

Deleted mttroot/mtt/lib/comp/compound/Thermal/VM/VM_lbl.txt version [86421d4963].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY VM: Volumetric to mass flow and vv - pseudo mass-flow bond
%DESCRIPTION Converts between P/Vdot energy bond to a P/mdot pseudo bond
%DESCRIPTION Parameter 1: passed to the Density subcomponent
%% Label file for system VM (VM_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/03/26 08:37:59  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Density
	density		none		$1

% Component type EMAF
	rho

% Component type SS
	[Hy_in]		SS	external,external
	[Hy_out]	SS	external,external
	[P]		SS	external,external
	[T]		SS	external,external

Deleted mttroot/mtt/lib/comp/compound/Thermal/VMe/VMe_abg.fig version [671e477a6f].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 3825 4950 3825 4725 4050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 1350 4500 1350 4275 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 2250 5400 3600 5625 3375
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9045 4725 9045 450 225 450 225 4725 9045 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6076 3826 7201 3826 6976 4051
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4500 1125 4500 1620
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 2025 4500 2025 4275 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4500 1800 4500 2295
4 1 1 1 0 3 20 0.0000 4 195 165 2613 1173 T\001
4 2 4 0 0 0 20 0.0000 4 255 1290 2073 3918 SS:[Hy_in]\001
4 1 4 0 0 0 20 0.0000 4 240 570 5400 2115 [rho]\001
4 1 1 1 0 3 30 0.0000 4 60 120 2570 4010 .\001
4 1 1 1 0 3 20 0.0000 4 195 165 2570 3650 P\001
4 1 1 1 0 3 20 0.0000 4 195 195 2570 4280 V\001
4 1 4 0 0 0 20 0.0000 4 240 405 4725 3690 [in]\001
4 2 4 0 0 0 20 0.0000 4 240 675 5310 3330 [mod]\001
4 1 -1 0 0 22 20 0.0000 4 210 1065 5535 3915 EMTF:tf\001
4 1 4 0 0 0 20 0.0000 4 240 555 6301 3691 [out]\001
4 1 1 1 0 3 30 0.0000 4 60 120 6848 3968 .\001
4 1 1 1 0 3 20 0.0000 4 195 270 6848 3608 Pv\001
4 1 1 1 0 3 20 0.0000 4 135 210 6848 4238 m\001
4 1 -1 0 0 22 20 0.0000 4 270 2130 5805 1665 Density:density\001
4 2 4 0 0 0 20 0.0000 4 240 345 4410 1890 [P]\001
4 2 4 0 0 0 20 0.0000 4 240 360 4455 1170 [T]\001
4 2 4 0 0 0 20 0.0000 4 240 750 2119 2074 SS:[P]\001
4 2 4 0 0 0 20 0.0000 4 240 765 2119 1444 SS:[T]\001
4 0 4 0 0 0 20 0.0000 4 255 1440 7381 3916 SS:[Hy_out]\001

Deleted mttroot/mtt/lib/comp/compound/Thermal/VMe/VMe_desc.tex version [2e1c5f9d5d].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system VMe (VMe_desc.tex)
% Generated by MTT on Thu Mar 19 14:37:43 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{VMe} is
   displayed in Figure \Ref{VMe_abg} and its label
   file is listed in Section \Ref{sec:VMe_lbl}.
   The subsystems are listed in Section \Ref{sec:VMe_sub}.

The \textbf{VMe} component acts as a density-modulated transformer
converting a $P$/$\dot V$ energy bond to a $Pv$/$\dot m$ bond. It used
the \textbf{Density} component and therfore inherits the properties of
that component -- in particular it takes the same parameter. The four
ports are:

\begin{itemize}
\item [Hy_in]: hydraulic in
\item [Hy_out]: hydraulic out
\item [P]: Pressure
\item [T]: Temperature
\end{itemize}

Deleted mttroot/mtt/lib/comp/compound/Thermal/VMe/VMe_lbl.txt version [1cd2644cf2].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY VMe: Volumetric to mass flow and vv - energy bonds
%DESCRIPTION Converts between P/Vdot energy bond to a Pv/mdot energy bond
%DESCRIPTION Parameter 1: passed to the Density subcomponent
%% Label file for system VMe (VMe_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/03/26 08:38:15  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Density
	density		none		$1

% Component type EMTF
	tf		lin		flow

% Component type SS
	[Hy_in]		SS	external,external
	[Hy_out]	SS	external,external
	[P]		SS	external,external
	[T]		SS	external,external

Deleted mttroot/mtt/lib/comp/simple/AE_alias.m version [6bf2090b41].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = AE_alias	# Port aliases for AE

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

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/AE_cause.m version [4bfc8d144a].

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
68
69
70
71
72
73
74
75
76
77
78
79















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = AE_cause(bonds);
% AE_cause - Causality for effort amplifier component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  AE_cause
% [bonds,status] = AE_cause(bonds)

%SUMMARY AE: effort amplifier
%DESCRIPTION Port[1]: amplifier effort input e_1 (f_1=0)
%DESCRIPTION Port[2]: amplifier effort output e_2 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/11/01 11:40:30  peterg
% %% Documentation.
% %%
% %% Revision 1.1  1996/08/30 19:05:21  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.


status = -1;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'AE')==0
  return
end

% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);

% Port 1 must impose (zero) flow and port 2 have flow imposed
if (f_1==-1)|(f_2==1) % Conflict
  status = 1;
 else 					% Do the rest of the causality

   if f_1 == 0 				% Set port 1 effort
     f_1 = 1;
   end;
   
   if f_2 == 0 				% Set port 2 effort
     f_2 = -1;
   end;
   
   number_set = sum(sum([e_1 e_2]~=zeros(1,2) ));
   if number_set==0 			% Under causal
     status = -1;
   elseif number_set==1 		% Set the causality
     if e_1 == 0
       e_1 = -e_2;
     else
       e_2 = -e_1;
     end
     status = 0;
   elseif number_set==2 		% Check the causality
     if e_1==-e_2
       status = 0;
     else
       status = 1;
     end
 end;
end;
 
 bonds = [e_1 f_1
           e_2 f_2]

Deleted mttroot/mtt/lib/comp/simple/AE_eqn.m version [2991c6f3bd].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = AE_eqn(name,bond_number,bonds,direction,cr,args, ...
                            structure,eqnfile);
% AE_eqn. Equation generation for effort amplifier.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/08/30 19:03:10  peter
% %% Added argument check.
% %% Added extra name argument.
% %%
% %% Revision 1.2  1996/08/30 13:23:11  peter
% %% Added bond number check
% %%
% %% Revision 1.1  1996/08/22 13:12:34  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'AE')==0
  return
end

% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);


% Flow on port 1 is always zero
   fprintf(eqnfile, '%s := 0;\n', ...
      varname(name,bond_number(1), -1));
  
  
outcause = 1;
incause = 1;

if e_2 == -1 				% Unicausal: e_2 := e_1
  outbond = bond_number(2);
  inbond = bond_number(1);
  outport = 2;
  inport = 1;
else 	                                % Bicausal: e_1 := e_2      
  outbond = bond_number(1);
  inbond = bond_number(2);
  outport = 1;
  inport = 2;
end


eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);

			  
			  
			  



Deleted mttroot/mtt/lib/comp/simple/AF_alias.m version [779ca55ad2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = AF_alias	# Port aliases for AF

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

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/AF_cause.m version [de8629abe8].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = AF_cause(bonds);
% AF_cause - Causality for Flow amplifier component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  AF_cause
% [bonds,status] = AF_cause(bonds)

%SUMMARY AF: flow amplifier
%DESCRIPTION Port[1]: amplifier flow input f_1 (e_1=0)
%DESCRIPTION Port[2]: amplifier flow output f_2 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/08/30 19:05:32  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

status = -1;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'AF')==0
  return
end

% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);

% Port 1 must impose (zero) effort and port 2 have effort imposed
if (e_1==1)|(e_2==-1) % Conflict
  status = 1;
 else 					% Do the rest of the causality

   if e_1 == 0 				% Set port 1 effort
     e_1 = -1;
   end;
   
   if e_2 == 0 				% Set port 2 effort
     e_2 = 1;
   end;
   
   number_set = sum(sum([f_1 f_2]~=zeros(1,2) ));
   if number_set==0 			% Under causal
     status = -1;
   elseif number_set==1 		% Set the causality
     if f_1 == 0
       f_1 = -f_2;
     else
       f_2 = -f_1;
     end
     status = 0;
   elseif number_set==2 		% Check the causality
     if f_1==-f_2
       status = 0;
     else
       status = 1;
     end
 end;
end;
 
 bonds = [e_1 f_1
           e_2 f_2];

Deleted mttroot/mtt/lib/comp/simple/AF_eqn.m version [1fcd8b0274].

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
68
69
70
71
72
73









































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = AF_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% AF_eqn - equations for flow amplifier
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  AF_eqn
% structure = AF_eqn(bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/09/11 13:35:14  peter
% %% New equation.m method used.
% %%
% %% Revision 1.1  1996/08/30 18:38:57  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'AF')==0
  return
end

% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);

% Effort on port 1 is always zero
   fprintf(eqnfile, '%s := 0;\n', ...
      varname(name,bond_number(1), 1));
  
outcause = -1;
incause = -1;

if f_2 == 1 				% Unicausal: f_2 := f_1
  outbond = bond_number(2);
  inbond = bond_number(1);
  outport = 2;
  inport = 1;
else 	                                % Bicausal: f_1 := f_2      
  outbond = bond_number(1);
  inbond = bond_number(2);
  outport = 1;
  inport = 2;
end


eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);







Deleted mttroot/mtt/lib/comp/simple/C2_cause.m version [1f39f9455a].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = C2_cause(bonds);
% C2_cause - Unicausal multiport C2 C2omponent
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  C2_cause
% [bonds,status] = C2_cause(bonds)

%SUMMARY C2: elementary C component with two ports
%DESCRIPTION Two port dynamic component
%DESCRIPTION Preferred integral causality (flow input)
%DESCRIPTION Cannot be bicausal




% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Copyright (c) P.J. Gawthrop, 1996.

% Unicausal multiport C component
% Same causal pattern as R component

[bonds,status] = R_cause(bonds);


Deleted mttroot/mtt/lib/comp/simple/C_alias.m version [1470d15671].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = C_alias	# Port aliases for C

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/07/02 14:49:14  peterg
## Initial revision
##
###############################################################

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/C_cause.m version [2222eab409].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = C_cause(bonds);
% C_cause - Unicausal multiport C component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  C_cause
% [bonds,status] = C_cause(bonds)

%SUMMARY C: elementary C component
%DESCRIPTION Single port dynamic component
%DESCRIPTION Preferred integral causality (flow input)
%DESCRIPTION Cannot be bicausal



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/11/01 12:35:36  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

% Unicausal multiport C component
% Same causal pattern as R component

% [bonds,status] = R_cause(bonds);

% Set causality to preferred if not already set.
% Find the number of ports
[ports,junk] = size(bonds);

% default undercausal status
statuses = -ones(ports,1);

% Force unicausality but DONT set if not already set
preferred = -1;
for i = 1:ports
  if (bonds(i,1)~=0)&(bonds(i,2)~=0) % Both bonds set
    statuses(i) = bonds(i,1)~=bonds(i,2);
  elseif bonds(i,2)~=0               % Bond 1 set
    bonds(i,1) = bonds(i,2);
    statuses(i) = 0;
  elseif bonds(i,1)~=0               % Bond 2 set
    bonds(i,2) = bonds(i,1);
    statuses(i) = 0;
  else				# Don't set
#    bonds(i,1) = preferred;
#    bonds(i,2) = preferred;
#    statuses(i) = 0;
  end;
end;

if max(statuses)==1
  status = 1;
elseif min(statuses)==-1
  status = -1;
else
  status = 0;
end;


Deleted mttroot/mtt/lib/comp/simple/C_eqn.m version [2daad60fd9].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function structure =  C_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% C_eqn - equation generation for C component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  C_eqn
% structure =  C_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

			
if nargin<8
  eqnfile = 'stdout';
end;

% Unicausal version
CorI = 1;
structure = cieqn(name,bond_number,bonds,direction,cr,args, structure, ...
                 CorI, eqnfile);







Deleted mttroot/mtt/lib/comp/simple/EBTF_alias.m version [e1757cdf64].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = EBTF_alias	# Port aliases for EBTF

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

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/EBTF_cause.m version [61b581107d].

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 [bonds,status] = EBTF_cause(bonds);
% EBTF_cause - causality for a EBTF component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  EBTF_cause
% [bonds,status] = EBTF_cause(bonds)

%SUMMARY EBTF: transformer component - bicausal on effort
%DESCRIPTION Energy conserving two-port
%DESCRIPTION e_1 f_1 = e_2 f_2 and e_1 and e_2 are both imposed.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




% Copyright (c) P.J. Gawthrop, 1998.

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'EBTF')==0
  return
end

% Effort must be imposed by both bonds
if (bonds(1,1)==-1)|(bonds(2,1)==-1) % Overcausal
  status = 1;
  return
end;

bonds(1,1) = 1; 
bonds(2,1) = 1;

% Flow bond must have through causality
if (bonds(1,2)==0)&(bonds(2,2)==0) % Undercausal
  status = -1;
  return
end;

if (bonds(1,2)==bonds(2,2))&(bonds(1,2)!=0) % Overcausal
  status = 1;
  return
end;

%Set flow causality
if (bonds(1,2)!=0)
  bonds(2,2) = -bonds(1,2)
else
  bonds(1,2) = -bonds(2,2)
end;
  
status = 0;







Deleted mttroot/mtt/lib/comp/simple/EBTF_eqn.m version [f9d4dc3a42].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = EBTF_eqn(name,bond_number,bonds,direction,cr,args, ...
                            structure,eqnfile);

if nargin<8
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'EBTF')==0
  return
end

% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);


% Effort -- no equation

% Flow
effort1_name = varname(name,bond_number(1), 1);
effort2_name = varname(name,bond_number(2), 1);
flow1_name = varname(name,bond_number(1), -1);
flow2_name = varname(name,bond_number(2), -1);

if f_1==-1 %Write flow on port 2
  fprintf(eqnfile,'%s := (%s/%s)*%s;\n' , ...
      flow2_name, ...
      effort1_name, ...
      effort2_name, ...
      flow1_name);
else %Write flow on port 1
  fprintf(eqnfile,'%s := (%s/%s)*%s;\n' , ...
      flow1_name, ...
      effort2_name, ...
      effort1_name, ...
      flow2_name);
end;

 









Deleted mttroot/mtt/lib/comp/simple/EMTF_alias.m version [b25e2d18fc].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = EMTF_alias	# Port aliases for EMTF

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

  alias.in     = '1';
  alias.out    = '2';
  alias.mod    = '3';

endfunction


Deleted mttroot/mtt/lib/comp/simple/EMTF_cause.m version [e4232f67a5].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83



















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = EMTF_cause(bonds);
% EMTF_cause - causality for a modulated TF component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  EMTF_cause
% [bonds,status] = EMTF_cause(bonds)
% Causality for effort-modulated EMTF 
% At the moment, modulation can NOT be inverted.

%SUMMARY EMTF: effort-modulated transformer
%DESCRIPTION Energy conserving three-port
%DESCRIPTION Ports [1] and [2] as for TF
%DESCRIPTION e_1 = f(f_2); f_1 = f(e_2)
%DESCRIPTION Effort on port[3] modulates the CR


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

status = -1;

% Check that there are exactly three bonds.
if check_bonds(bonds,3,'EMTF')==0
  return
end

% Extract the bond information
TF_bonds = bonds(1:2,:);
e_3 = bonds(3,1);
f_3 = bonds(3,2);

%Causality of EMTF is same as that of a TF on ports 1 and 2
[TF_bonds,TF_status] = TF_cause(TF_bonds);


% Effort is the modulation - imposed on component.
if e_3==-1 				% Conflict
  mod_status_e = 1;
else 					% Do the rest of the causality
  if e_3==0 				% Set to the fixed causality
    e_3 = 1;
  end;
  mod_status_e = 0;
end;
 
% Zero flow imposed by component.
if f_3==-1 				% Conflict
  mod_status_f = 1;
else 					% Do the rest of the causality
  if f_3==0 				% Set to the fixed causality
    f_3 = 1;
  end;
  mod_status_f = 0;
end;
 
bonds = [TF_bonds
         e_3 f_3];
	
if (TF_status == 0) & (mod_status_e == 0) & (mod_status_f == 0)
  status = 0;
end;

if (TF_status == 1) | (mod_status_e == 1) | (mod_status_f == 1)
  status = 1;
end;

 
 
 
 
 
   

Deleted mttroot/mtt/lib/comp/simple/EMTF_eqn.m version [f2e12d75c2].

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
68
69
70
71
72
73
74
75
76
77
78














































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = EMTF_eqn(name,bond_number,bonds,direction,cr,args, ...
                            structure,eqnfile);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


			
if nargin<8
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
if check_bonds(bonds,3,'EMTF')==0
  return
end

% There are 3 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);
e_3 = bonds(3,1);


% Effort
outcause = 1;
incause = [1;1];
if e_1==1
  outbond = bond_number(2);
  inbond =  bond_number([1 3]);
  outport = 2;
  inport = [1;3];
else
  outbond = bond_number(1);
  inbond =  bond_number([2 3]);
  outport = 1;
  inport = [2;3];
end;

eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);

% Flow
outcause = -1;
incause = [-1;1];
if f_1==-1
  outbond = bond_number(2);
  inbond =  bond_number([1 3]);
  outport = 2;
  inport = [1;3];
else
  outbond = bond_number(1);
  inbond =  bond_number([2 3]);
  outport = 1;
  inport = [2;3];
end;

eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);

% Modulation: flow on port 3 is always zero
  fprintf(eqnfile, '%s := 0;\n', ...
      varname(name,bond_number(3), -1));







Deleted mttroot/mtt/lib/comp/simple/ES_alias.m version [682108bc4c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = ES_alias	# Port aliases for ES

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

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/ES_cause.m version [b7ca65e279].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = ES_cause(bonds);
% Causality for ES component

%SUMMARY ES: converts thermal pseudobond to true bond and vv
%DESCRIPTION Port [e]: temperature (T) / enthalpy flow (E) bond
%DESCRIPTION Port [s]: temperature (T) / entropy flow (S) bond



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1997.

status = -1;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'ES')==0
  return
end

% Same causality as TF
[bonds,status] = TF_cause(bonds);


Deleted mttroot/mtt/lib/comp/simple/ES_eqn.m version [31e29928e3].

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
68
69
70
71
72








































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = ES_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% ES_eqn - equations for ES component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  ES_eqn
% ES_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/02/25 16:59:56  peterg
% %% Corrected enthalpy-entropy conversion -- use temp on the entropy side.
% %%
% %% Revision 1.1  1998/02/25 15:03:51  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1997.


if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
ports = 2;
if check_bonds(bonds,ports,'ES')==0
  return
end


% There are 2 ports; extract the information
e_bond = bonds(1,:);
s_bond = bonds(2,:);

% The efforts are the same - but the enthalpy side has relative T
if e_bond(1)==1 %effort imposed on the enthalpy bond 
%  fprintf(eqnfile,'%s := %s + t_0;\n' , ...
  fprintf(eqnfile,'%s := %s;\n' , ...
    varname(name,bond_number(2), 1), ...
    varname(name,bond_number(1), 1) );
else %effort imposed on the entropy bond 
%  fprintf(eqnfile,'%s := %s - t_0;\n' , ...
  fprintf(eqnfile,'%s := %s;\n' , ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(2), 1) );
end;

% The flows need to be converted - use the absolute temp on the
% entropy side
if e_bond(2)==-1 %flow imposed on the enthalpy bond 
  fprintf(eqnfile,'%s := %s/%s;\n' , ...
    varname(name,bond_number(2), -1), ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(2), 1) );
else % flow imposed on the entropy bond 
    fprintf(eqnfile,'%s := %s*%s;\n' , ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(2), -1), ...
    varname(name,bond_number(2), 1) );
end;

Deleted mttroot/mtt/lib/comp/simple/FMR_alias.m version [fb7f54e190].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = FMR_alias	# Port aliases for FMR

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

  alias.in     = '1';
  alias.out    = '2';
  alias.mod    = '3';

endfunction


Deleted mttroot/mtt/lib/comp/simple/FMR_cause.m version [5abb14a644].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83



















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = FMR_cause(bonds);

% Causality for Flow-modulated R component

%SUMMARY FMR: flow-modulated resistor
%DESCRIPTION Port[in]: a simple one port resistor
%DESCRIPTION Port[out]: flow provides modulation for the resistor
%DESCRIPTION Used with the lin CR, with parameters flow,r this gives
%DESCRIPTION a resistance r*f_m where f_m is the flow on port [out]
%DESCRIPTION Can be bicausal - deduces modulation from e and f on port[in]

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/11/01 11:53:48  peterg
% %% Documentation
% %%
% %% Revision 1.2  1996/08/30 13:29:05  peter
% %% Error check on bond numbers.
% %%
% %% Revision 1.1  1996/08/09 08:28:02  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


status = -1;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'FMR')==0
  return
end


% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);

% e_2 must be effort causality (imposes zero effort)
 if e_2 == 1 				% Conflict
   status = 1;
 else 					% Do the rest of the causality
   if e_2==0 				% Set to the fixed causality
     e_2 = -1;
   end;
   
   number_set = sum(sum([e_1 f_1 f_2]~=zeros(1,3) ));
   if number_set<2 			% Under causal
     status = -1;
   elseif number_set==2 		% Set the causality
     if f_2 == -1 			% Unicausal
       if e_1 == 0
 	e_1 = f_1;
       else
	 f_1 = e_1;
       end;
     elseif f_2 == 1 			% Bicausal
       e_1 = 1;
       f_1 = -1;
     elseif f_2 == 0
       if e_1==f_1
	 f_2 = -1;                      % Unicausal
       else
	 f_2 = 1;                      % Bicausal
       end;
     end;
     status = 0;
   elseif number_set==3 		% Check the causality
     if ( (f_2==-1)&(e_1~=f_1) )|( (f_2==1)&(e_1==f_1) )
       status = 1;
     else
       status = 0;
     end;
   end;
 end;
 
 bonds = [e_1 f_1
           e_2 f_2];

Deleted mttroot/mtt/lib/comp/simple/FMR_eqn.m version [5ad1df79af].

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
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









































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = FMR_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% FMR_eqn - equations for flow-modulated resistor
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  FMR_eqn
% FMR_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/08/30 18:35:43  peter
% %% New name argument added.
% %%
% %% Revision 1.1  1996/08/30 16:38:25  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.


if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
ports = 2;
if check_bonds(bonds,ports,'FMR')==0
  return
end


% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);

if length(cr)==0  % Then do default unity CR
  if f_2 == -1 				% Standard with modulation
    if f_1 == 1 			% Flow out
      op = '*';
    else                                % Effort out
      op = '/';
    end;
    
    fprintf(eqnfile, '%s := %s%s%s;\n', ...
	varname(name,bond_number(1), -e_1), ...
	varname(name,bond_number(1), e_1), ...
	op, ...
	varname(name,bond_number(2), -1));
  else 					% Deduce modulation
    
    fprintf(eqnfile, '%s := %s/%s;\n', ...
	varname(name,bond_number(2), -1), ...
	varname(name,bond_number(1), -1), ...
	varname(name,bond_number(1), 1));
  end;
else  % write the full works
  if f_2 == -1 				% Standard with modulation
    outport = 1;
    outnumber = bond_number(1);
    if f_1 == 1 			% Flow out
      outcause = -1;
    else                                % Effort out
      outcause = 1;
    end;    
    incause = [-outcause; -1]; % Flow input on port 2
    eqn =  equation(name,cr,args,outnumber,outcause,outport, ...
                               bond_number,incause,1:ports);
    fprintf(eqnfile, '%s',eqn);

  else % Modulation is output
    outport = 2;
    outcause = -1;
    outnumber = bond_number(2);
    innumber = bond_number(1)*[1;1];    
    incause = [1; -1]; % Effort and flow on port 1
    inports = [1; 1];
    eqn =  equation(name,cr,args,outnumber,outcause,outport, ...
                               innumber,incause,inports);
    fprintf(eqnfile, '%s',eqn);
  end;
end;

  % Effort on port 2 is always zero
  fprintf(eqnfile, '%s := 0;\n', ...
      varname(name,bond_number(2), 1));

 
      


 



Deleted mttroot/mtt/lib/comp/simple/FP_alias.m version [793aa2894c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = FP_alias	# Port aliases for FP

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/07/07 15:01:09  peterg
## Named ports correctely  f --> 1, p --> 2
##
## Revision 1.1  1998/07/02 14:46:42  peterg
## Initial revision
##
###############################################################

  alias.f     = '1';
  alias.p     = '2';

  alias.s     = '1';
  alias.e     = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/FP_cause.m version [95df5297d9].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = FP_cause(bonds);
% Causality for FP component

%SUMMARY FP: converts true bond to a pseudo bond with power flow as flow
%DESCRIPTION Port [f]: True bond with a flow covariable
%DESCRIPTION Port [p]: Pseudo bond with power (ef) as flow variable



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/06/29 09:56:24  peterg
% %% Changed name to FP from ES
% %%
% %% Revision 1.1  1998/06/29 09:56:02  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1997/09/04  08:34:53  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1997.

status = -1;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'FP')==0
  return
end

% Same causality as TF
[bonds,status] = TF_cause(bonds);



Deleted mttroot/mtt/lib/comp/simple/FP_eqn.m version [764e3abe81].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = FP_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% FP_eqn - equations for FP component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  FP_eqn
% FP_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/07/07 15:00:04  peterg
% %% Replaced e_ by f_
% %%          s_ by p_
% %%
% %% Revision 1.2  1998/06/29 09:54:16  peterg
% %% Changed name from ES to FP
% %%
% %% Revision 1.1  1998/06/29 09:53:22  peterg
% %% Initial revision
% %%
% %% Revision 1.3  1998/03/27 10:59:43  peterg
% %% Zapped t_0 again ...
% %%
% %% Revision 1.2  1998/02/25 16:59:56  peterg
% %% Corrected enthalpy-entropy conversion -- use temp on the entropy side.
% %%
% %% Revision 1.1  1998/02/25 15:03:51  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1997.


if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
ports = 2;
if check_bonds(bonds,ports,'FP')==0
  return
end


% There are 2 ports; extract the information
f_bond = bonds(1,:);
p_bond = bonds(2,:);

% The efforts are the same
if p_bond(1)==1 %effort imposed on the pseudo bond 
    fprintf(eqnfile,'%s := %s;\n' , ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(2), 1) );
else %effort imposed on the true bond 
    fprintf(eqnfile,'%s := %s;\n' , ...
    varname(name,bond_number(2), 1), ...
    varname(name,bond_number(1), 1) );
end;

% The flows need to be converted
if p_bond(2)==-1 %flow imposed on the pseudo bond 
  fprintf(eqnfile,'%s := %s/%s;\n' , ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(2), -1), ...
    varname(name,bond_number(1), 1) );
else % flow imposed on the true bond 
    fprintf(eqnfile,'%s := %s*%s;\n' , ...
    varname(name,bond_number(2), -1), ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(2), 1) );
end;

Deleted mttroot/mtt/lib/comp/simple/GY_alias.m version [e9fdf0c734].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = GY_alias	# Port aliases for GY

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

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/GY_cause.m version [eeb1062035].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = GY_cause(bonds);
% GY_cause - causality for GY component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  GY_cause
% [bonds,status] = GY_cause(bonds);

%SUMMARY GY: elementary gyrator component
%DESCRIPTION Energy conserving two-port
%DESCRIPTION e_1 = f(f_2); f_1 = f(e_2)



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1997/09/12  09:42:12  peterg
% %% Fixed causality bug.
% %%
% %% Revision 1.1  1996/11/01  12:04:25  peterg
% %% Initial revision
% %% 
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

%Causality of GY is same as that of a TF but with flipped effort/flow
bonds(2,:) = - bonds(2,2:-1:1);
[bonds,status] = TF_cause(bonds);
bonds(2,:) = - bonds(2,2:-1:1);

Deleted mttroot/mtt/lib/comp/simple/GY_eqn.m version [f2e485f0f7].

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
68
69
70
71
72
73
74
75
76
77













































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = GY_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% GY_eqn - equations for GY component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  GY_eqn
% structure = GY_eqn(bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.


if nargin<8
  eqnfile = 'stdout';
end;


% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);


% Effort - flow
if e_1==1
  outbond = bond_number(2);
  inbond =  bond_number(1);
  outport = 2;
  inport = 1;
  outcause = -1;
  incause = 1;
else
  outbond = bond_number(1);
  inbond =  bond_number(2);
  outport = 1;
  inport = 2;
  outcause = 1;
  incause = -1;
end;

eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);

% Flow-effort
if f_1==-1
  outbond = bond_number(2);
  inbond =  bond_number(1);
  outport = 2;
  inport = 1;
  outcause = 1;
  incause = -1; 
else
  outbond = bond_number(1);
  inbond =  bond_number(2);
  outport = 1;
  inport = 2;
  outcause = -1;
  incause = 1; 
end;

eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);

Deleted mttroot/mtt/lib/comp/simple/I_alias.m version [0cb127a054].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = I_alias	# Port aliases for I

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

  alias.in   = '1';
  alias.out  = '1';

endfunction


Deleted mttroot/mtt/lib/comp/simple/I_cause.m version [30d1b2c13a].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = I_cause(bonds);
% I_cause  - Unicausal multiport C component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  I_cause
% [bonds,status] = I_cause(bonds)

%SUMMARY I: elementary I component
%DESCRIPTION Single port dynamic component
%DESCRIPTION Preferred integral causality (effort input)
%DESCRIPTION Cannot be bicausal


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

% Same causal pattern as R component
[bonds,status] = R_cause(bonds);


Deleted mttroot/mtt/lib/comp/simple/I_eqn.m version [b3f1b49438].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function structure =  I_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% I_eqn - equations for I component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  I_eqn
% structure =  I_eqn(bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.


if nargin<8
  eqnfile = 'stdout';
end;

% Unicausal version
CorI = -1;
structure = cieqn(name,bond_number,bonds,direction,cr,args, structure, ...
                 CorI, eqnfile);

Deleted mttroot/mtt/lib/comp/simple/PS_alias.m version [9be95d8930].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = PS_alias	# Port aliases for PS

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

  alias.in     = '1';
  alias.out    = '2';
  alias.power  = '3';

endfunction


Deleted mttroot/mtt/lib/comp/simple/PS_cause.m version [c1061e4855].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = PS_cause(bonds);
% Causality for PS component

%SUMMARY PS: Power sensor
%DESCRIPTION Port[in]: Inflowing bond
%DESCRIPTION Port[out]: Outflowing bond e_2=e_1; f_2=f_1.
%DESCRIPTION Port[power]: f = power = e_1*f_1 = e_2*f_2


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1997.

status = -1;

% Check that there are exactly three bonds.
if check_bonds(bonds,3,'PS')==0
  return
end

% Do the [in] and [out] ports -- like a TF
inout_bonds = bonds(1:2,:);
[inout_bonds,inout_status] = TF_cause(inout_bonds);

% Do the power port -- must have flow out and effort in
power_bonds = bonds(3,:);
for i = 1:2
  if (power_bonds(i)==1)
    power_status = 0;
  elseif (power_bonds(i)==0)
    power_bonds(i)==1;
    power_status = 0;
  else
    power_status = 1;
  end;
end;


  
  
  
  
% Reconstruct the bonds
bonds = [inout_bonds; power_bonds];

% Generate an overall status
if (inout_status==1)|(power_status==1)
  status = 1;
elseif
  (inout_status==-1)|(power_status==-1)
  status=-1;
else
  status = 0;
end;


Deleted mttroot/mtt/lib/comp/simple/PS_eqn.m version [2c48293db7].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = PS_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% PS_eqn - equations for a power sensor
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  PS_eqn
% PS_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Copyright (c) P.J. Gawthrop, 1997.


if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly three bonds.
ports = 3;
if check_bonds(bonds,ports,'PS')==0
  return
end


% There are 3 ports; extract the information
inout_bonds = bonds(1:2,:);
power_bonds = bonds(3,:);

inout_direction = direction(1:2,:);
power_direction = direction(3,:);

% Do ports [in] and [out] - unit gain TF.
structure = TF_eqn(name,bond_number(1:2),inout_bonds,inout_direction, ...
'lin','effort,1', structure,eqnfile);

% Do port [power] - the power bit.
% This computes f_2 = e_1*f_1
fprintf(eqnfile,'%s := %s*%s;\n' , ...
    varname(name,bond_number(3), -power_bonds(1)), ...
    varname(name,bond_number(1),  1), ...
    varname(name,bond_number(1), -1) );



Deleted mttroot/mtt/lib/comp/simple/RST_alias.m version [bd9ad2f3b7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = RST_alias	# Port aliases for RST

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

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/RST_cause.m version [9248b5c94d].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = RST_cause(bonds);
% Causality for RST component

%SUMMARY RST: thermal resistor with entropy generation
%DESCRIPTION Port[in]: a simple one port resistor but:
%DESCRIPTION flow is multiplied by e_out
%DESCRIPTION Port[out]: thermal power - effort is temperature, flow is entropy flow
%DESCRIPTION Not bicausal (yet)


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1997.

status = -1;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'RST')==0
  return
end

% Same causality as RS
[bonds,status] = RS_cause(bonds);

Deleted mttroot/mtt/lib/comp/simple/RST_eqn.m version [a09541d179].

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
68
69
70
71
72
73
74
75
76












































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = RT_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% RT_eqn - equations for flow-modulated resistor
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  RT_eqn
% RT_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% VeRTion control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/03  09:30:45  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Copyright (c) P.J. Gawthrop, 1997.


if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
ports = 2;
if check_bonds(bonds,ports,'RT')==0
  return
end


% There are 2 ports; extract the information
in_bonds = bonds(1,:);
out_bonds = bonds(2,:);
in_direction = direction(1,:);
out_direction = direction(2,:);

% Do port [in] - a standard resistor -- except for modulation by e_2
structure = R_eqn(name,bond_number(1),in_bonds,in_direction,cr,args, ...
    structure,eqnfile);

% Resistance is multiplied by effort e_1 + e_2 (ie effort on upsteam side of
% the 1 junction)
if in_bonds(1) == 1 % Flow output - divide by e_1+e_2
  fprintf(eqnfile,'%s := %s/(%s+%s);\n' , ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(2), 1) );
else
   % Effort output - multiply by e_1+e_2
  fprintf(eqnfile,'%s := %s*(%s+%s);\n' , ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(1), 1), ...
    varname(name,bond_number(2), 1) );
end;


% Do port [out] - the thermal bit. RT is power conserving.
% This computes f_2 = e_1*f_1/e_2 or  e_2 = e_1*f_1/f_2
fprintf(eqnfile,'%s := %s*%s/%s;\n' , ...
    varname(name,bond_number(2), -out_bonds(1)), ...
    varname(name,bond_number(1),  1), ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(2), out_bonds(1)) );


Deleted mttroot/mtt/lib/comp/simple/RS_alias.m version [6c14fcbe8a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = RS_alias	# Port aliases for RS

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

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/RS_cause.m version [c96451fbaa].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = RS_cause(bonds);
% Causality for RS component

%SUMMARY RS: resistor with entropy generation
%DESCRIPTION Port[in]: a simple one port resistor
%DESCRIPTION Port[out]: thermal power - effort is temperature, flow is entropy flow
%DESCRIPTION Not bicausal (yet)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Copyright (c) P.J. Gawthrop, 1997.

status = -1;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'RS')==0
  return
end

% There are 2 ports; extract the information
in_bonds = bonds(1,:);
out_bonds = bonds(2,:);

% Port [in] is an ordinary resistor
[in_bonds,in_status] = R_cause(in_bonds); 

% Port [out] has the same causality pattern as an ordinary resistor
[out_bonds,out_status] = R_cause(out_bonds); 

% Reconstruct the bonds
bonds = [in_bonds; out_bonds];

% Generate an overall status
if (in_status==1)|(out_status==1)
  status = 1;
elseif
  (in_status==-1)|(out_status==-1)
  status=-1;
else
  status = 0;
end;


Deleted mttroot/mtt/lib/comp/simple/RS_eqn.m version [47ff4db70d].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = RS_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% RS_eqn - equations for flow-modulated resistor
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  RS_eqn
% RS_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Copyright (c) P.J. Gawthrop, 1997.


if nargin<6
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
ports = 2;
if check_bonds(bonds,ports,'RS')==0
  return
end


% There are 2 ports; extract the information
in_bonds = bonds(1,:);
out_bonds = bonds(2,:);
in_direction = direction(1,:);
out_direction = direction(2,:);

% Do port [in] - a standard resistor
structure = R_eqn(name,bond_number(1),in_bonds,in_direction,cr,args, ...
    structure,eqnfile);

% Do port [out] - the thermal bit. RS is power conserving.
% This computes f_2 = e_1*f_1/e_2 or  e_2 = e_1*f_1/f_2
fprintf(eqnfile,'%s := %s*%s/%s;\n' , ...
    varname(name,bond_number(2), -out_bonds(1)), ...
    varname(name,bond_number(1),  1), ...
    varname(name,bond_number(1), -1), ...
    varname(name,bond_number(2), out_bonds(1)) );


Deleted mttroot/mtt/lib/comp/simple/R_alias.m version [12d1346387].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = R_alias	# Port aliases for R

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

  alias.in     = '1';
  alias.out    = '1';

endfunction


Deleted mttroot/mtt/lib/comp/simple/R_cause.m version [9a5c0ab992].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = R_cause(bonds);
% R_cause - Causality function for a (multi-port) unicausal R component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  R_cause
% [bonds,status] = R_cause(bonds)

%SUMMARY R: R component
%DESCRIPTION Multiport component with no dynamics
%DESCRIPTION Cannot be bicausal

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/08/30 19:05:08  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.
 

% Find the number of ports
[ports,junk] = size(bonds);

% default undercausal status
statuses = -ones(ports,1);

% Force unicausality
for i = 1:ports
  if (bonds(i,1)~=0)&(bonds(i,2)~=0) % Both bonds set
    statuses(i) = bonds(i,1)~=bonds(i,2);
  elseif bonds(i,2)~=0               % Bond 1 set
    bonds(i,1) = bonds(i,2);
    statuses(i) = 0;
  elseif bonds(i,1)~=0               % Bond 2 set
    bonds(i,2) = bonds(i,1);
    statuses(i) = 0;
  end;
end;

if max(statuses)==1
  status = 1;
elseif min(statuses)==-1
  status = -1;
else
  status = 0;
end;
  

Deleted mttroot/mtt/lib/comp/simple/R_eqn.m version [56cc6513ff].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = R_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% R_eqn - Equation function for a (multi-port) unicausal R component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  R_eqn
% structure = R_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/09/12 16:40:45  peter
% %% Now does a default (when no constitutive relationship) with a unit
% %% constitutive relationship on each port.
% %%
% %% Revision 1.2  1996/09/12 13:12:04  peter
% %% Removed an fprintf that was a mistake.
% %%
% %% Revision 1.1  1996/09/12 11:00:56  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

if nargin<8
  eqnfile = 'stdout';
end;


% Find the number of ports
[ports,junk] = size(bonds);


for outport = 1:ports
  outcause = -bonds(outport,1);
  outnumber = bond_number(outport);
  if length(cr)>0
    incause = bonds(:,1);
    inport = 1:ports;
    inbond = bond_number;
  else % default if no cr: unit cr on each port
    incause = bonds(outport,1);
    inport = outport;
    inbond = outnumber;
  end;
  
  eqn =  equation(name,cr,args,outnumber,outcause,outport, ...
                               inbond,incause,inport);
  fprintf(eqnfile, '%s',eqn);
end;


Deleted mttroot/mtt/lib/comp/simple/SS_alias.m version [532fa03c37].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = SS_alias	# Port aliases for SS

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/07/28 19:08:22  peterg
## Some vector aliases added.
##
## Revision 1.1  1998/07/02 14:37:42  peterg
## Initial revision
##
###############################################################

  alias.in   = "1";
  alias.out  = "1";

  MAX = 10;
  value = "1";
  for i=1:MAX
    eval(sprintf("alias.in%i = \"%s\";", i, value));
    eval(sprintf("alias.out%i = \"%s\";", i, value));
    value = sprintf("%s,%i",value,i+1);
  endfor;
endfunction


Deleted mttroot/mtt/lib/comp/simple/SS_cause.m version [8964220e5e].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = SS_cause(bonds)
% SS_cause = causality for an SS component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  SS_cause
% [bonds,status] = SS_cause(bonds)

%SUMMARY SS: source-sensor component
%DESCRIPTION multi-port source sensor component
%DESCRIPTION when the name is [name], acts as port `name' of a system.
%DESCRIPTION may be bicausal

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/11/01 14:41:14  peterg
% %% Check correct bonds
% %%
% %% Revision 1.1  1996/11/01 12:18:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

## Check that there is exactly one bonds.
##if check_bonds(bonds,1,'SS')==0
##  return
##end

disp("Starting SS_cause");

[n_bonds,junk] = size(bonds);
Status=zeros(n_bonds,1);
for i=1:n_bonds
  if (bonds(i,1)==0)|(bonds(i,2)==0) % Under causal
    Status(i) = -1;
  else                          % causal
    Status(i) = 0;
 end;
end;
status=min(Status);







Deleted mttroot/mtt/lib/comp/simple/SS_eqn.m version [412af5e8bd].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function structure =  SS_eqn(name,Bond_number,Bonds,Direction,cr,args, ...
    structure,filenum);

disp("SS_eqn");
name,Bond_number,Bonds,Direction

% Set up globals to count the component inputs and outputs. This relies on
% the named SS (the ports) being in the correct order. Using globals here
% avoids changing the common argument list for all _eqn files for something
% which is only used for named SS components.
global local_u_index
global local_y_index
global at_top_level

% SS_eqn - equations for SS component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  SS_eqn
% structure =  SS_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,filenum);


% Copyright (c) P.J. Gawthrop, 1996.

			
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.23  1998/12/03 16:46:16  peterg
% %% Deblanked attributes so that zero attribute works.
% %%
% %% Revision 1.22  1998/07/28 19:05:46  peterg
% %% Fixed a few bugs.
% %%
% %% Revision 1.21  1998/07/28 14:21:31  peterg
% %% Vector SS ports.
% %%
% %% Revision 1.20  1998/07/08 14:42:52  peterg
% %% Removed the annoying info message - it causes problems with big
% %% systems
% %%
% %% Revision 1.19  1998/07/08 11:33:54  peterg
% %% Replace mtt_info by mtt_error when appropriate
% %%
% %% Revision 1.18  1998/07/08 11:30:45  peterg
% %% Removed second (fileID) argument from mtt_info
% %%
% %% Revision 1.17  1998/07/04 07:15:44  peterg
% %% Back under RCS
% %%
% %% Revision 1.16  1998/04/11 19:07:16  peterg
% %% Now do named ports as ordinary ports iff at top level.
% %% --- not yet complete, need to pass necesssary info though to this
% %%     function
% %%
% %% Revision 1.15  1997/12/16 19:16:07  peterg
% %% Added unknown input to the effort part.
% %%
% %% Revision 1.14  1997/12/16 18:25:19  peterg
% %% Added unknown_input attribure to flow -- effort still needs doing
% %%
% %% Revision 1.13  1997/09/18 13:15:15  peterg
% %% Fixed incorrect error message flagging inappropriate flow outputs
% %% -- used to give the effort rather than the flow in the error message.
% %%
% %% Revision 1.12  1997/08/26 07:51:30  peterg
% %% Now counts the local input and outputs by order of appearence rather
% %% than by port number - it therfore handles ports with bicausality correctely.
% %%
% %% Revision 1.11  1997/05/09 08:21:07  peterg
% %% Explicit computation of port number -- avoids str2num
% %%
% %% Revision 1.10  1997/03/22  17:13:03  peterg
% %% Fixed bug for port nos. > 1 digit!
% %%
% %% Revision 1.9  1997/03/22  15:50:59  peterg
% %% Changed %1.0f to %d format.
% %%
% %% Revision 1.8  1996/12/10 16:52:29  peterg
% %% Detect null string using strcmp, not length.
% %% Put filnum argument to mtt_info.
% %%
% %% Revision 1.7  1996/12/07 17:17:40  peterg
% %% Added some ;
% %%
% %% Revision 1.6  1996/12/05 09:49:09  peterg
% %% Explicit computation of port number from string.
% %%
% %% Revision 1.5  1996/12/04 21:27:53  peterg
% %% Replaced str2num by sprintf
% %%
% %% Revision 1.4  1996/08/18  20:06:21  peter
% %% Included zero outputs.
% %%
% %% Revision 1.3  1996/08/09 14:08:04  peter
% %% Empty effort and flow attributes replaced by 'external'.
% %%
% %% Revision 1.2  1996/08/08 16:38:19  peter
% %% Changed to filenumer type of fprintf
% %%
% %% Revision 1.1  1996/08/08 16:19:08  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% The string 'cr' contains the effort attributes;  
% 'arg' contains the flow attributes. 
% external indicates an external variable
% internal indicates an internal variable
% anything else is the name of a constant.
% Blank is taken to be external
% If its a numbered port:
%     cr contains 'MTT_port'
%     arg contains port number

if (strcmp(cr,"SS"))		# Then its the standard file
  a = split(args,",")
  [N,M]=size(a);
  if (N~=2)			# Must have 2 arguments
    mtt_error(sprintf("SS should have 2 args not %i", N));
  end;

  effort_attribute = deblank(a(1,:));
  flow_attribute   = deblank(a(2,:));

else				# Old style file
  effort_attribute = cr;
  flow_attribute = args;
				# mtt_info(sprintf("SS component: Hmm... looks like an old-style label file"));
end;

% Default attributes
if strcmp(effort_attribute,'')
  effort_attribute = 'external';
end;

if strcmp(flow_attribute,'')
  flow_attribute = 'external';
end;

inputs = structure(3);
outputs = structure(4);
zero_outputs = structure(5);
unknown_inputs = structure(6);
  
n_bonds = length(Bond_number)	# Multi port?
for i=1:n_bonds			# Loop over all the bonds
  bond_number = Bond_number(i);
  bonds = Bonds(i,:);
  direction = Direction(i,:);
  
 Named_Port = name(1)=="[";	
 if Named_Port
   sname = name(2:length(name)); #Strip the []
 else
   sname = name;
 end;
  
   if Named_Port&&~at_top_level % It's a named port
    % Effort 
    if bonds(1,1)==-1 % Source
      local_u_index = local_u_index + 1
      fprintf(filenum, "%s := %s_MTTu%d;\n", ...
              varname(sname, bond_number,1), sname, local_u_index);
    else % Sensor
      local_y_index = local_y_index + 1
      fprintf(filenum, "%s_MTTy%d := %s;\n", ...
              sname, local_y_index, varname(sname, bond_number,1));
    end;
    % Flow 
    if bonds(1,2)==1 % Source
      local_u_index = local_u_index + 1
      fprintf(filenum, "%s := %s_MTTu%d;\n", ...
              varname(sname, bond_number,-1), sname, local_u_index);
    else % Sensor
      local_y_index = local_y_index + 1
      fprintf(filenum, "%s_MTTy%d := %s;\n", ...
              sname, local_y_index, varname(sname, bond_number,-1));
    end;  
  else				# Now do SS which are not ports
    % Effort
    if strcmp(effort_attribute, "external")
      if bonds(1,1)==-1 % Source
	inputs = inputs+1;
	fprintf(filenum, "%s := MTTu(%d,1);\n", ...
		varname(sname, bond_number,1),inputs);
      else % Sensor
	outputs = outputs+1;
	fprintf(filenum, "MTTy(%d,1) := %s;\n", ...
		outputs, varname(sname, bond_number,1));
      end;
    elseif strcmp(effort_attribute, "unknown") % Unknown input
      unknown_inputs = unknown_inputs + 1;
      fprintf(filenum, "%s := MTTUi%d;\n", ...
	      varname(sname, bond_number,1), unknown_inputs);
    elseif strcmp(effort_attribute, "internal")
      % Do nothing
    else 
      if bonds(1,1)==-1 % Named or unknown source
	fprintf(filenum, "%s := %s;\n", ...
		varname(sname, bond_number,1), effort_attribute);
      else % Sensor
	if strcmp(effort_attribute, "zero") %Zero output
	  zero_outputs = zero_outputs + 1;
	  fprintf(filenum, "MTTyz%d := %s;\n", ...
		  zero_outputs, varname(sname, bond_number,1));
	else
	  mtt_error([effort_attribute, " not appropriate for an output "]);
	end;
      end;
    end;
    
    % Flow
    if strcmp(flow_attribute, "external")
      if bonds(1,2)==1 % Source
	inputs = inputs+1
	fprintf(filenum, "%s := MTTu(%d,1);\n", varname(sname, bond_number,-1),inputs);
      else % Sensor
	outputs = outputs+1
	fprintf(filenum, "MTTy(%d,1) := %s;\n", outputs, ...
		varname(sname, bond_number,-1));
      end;
    elseif strcmp(flow_attribute, "unknown") % Unknown input
      unknown_inputs = unknown_inputs + 1
      fprintf(filenum, "%s := MTTUi%d;\n", ...
	      varname(sname, bond_number,-1), unknown_inputs);
    elseif strcmp(flow_attribute, "internal")
      % Do nothing
    else % Named constant
      if bonds(1,2)==1 % Source
	fprintf(filenum, "%s := %s;\n", ...
		varname(sname, bond_number,-1), flow_attribute);
      else % Sensor
	if strcmp(flow_attribute, "zero") %Zero output
	  zero_outputs = zero_outputs + 1
	  fprintf(filenum, "MTTyz%d := %s;\n", ...
		  zero_outputs, varname(sname, bond_number,-1));
	else
	  mtt_error([flow_attribute, " not appropriate for an output "]);
	end;
      end;
    end;
  end;
  structure(3) = inputs;
  structure(4) = outputs;
  structure(5) = zero_outputs;
  structure(6) = unknown_inputs;
  
end;

Deleted mttroot/mtt/lib/comp/simple/TF_alias.m version [5fdd82024a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function alias = TF_alias	# Port aliases for TF

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

  alias.in     = '1';
  alias.out    = '2';

endfunction


Deleted mttroot/mtt/lib/comp/simple/TF_cause.m version [7adfcd4d2d].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = TF_cause(bonds);
% TF_cause - causality for a TF component
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  TF_cause
% [bonds,status] = TF_cause(bonds)

%SUMMARY TF: elementary transformer component
%DESCRIPTION Energy conserving two-port
%DESCRIPTION e_1 = f(e_2); f_1 = f(f_2)


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/11/01 12:05:54  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'TF')==0
  return
end


%Causality of TF is same as that of a junction
[bonds,status] = zero_cause(bonds);

Deleted mttroot/mtt/lib/comp/simple/TF_eqn.m version [0f6f6099bc].

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
68
69
70
71
72
73
74
75











































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = TF_eqn(name,bond_number,bonds,direction,cr,args, ...
                            structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/08/19 09:05:04  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

			
if nargin<8
  eqnfile = 'stdout';
end;

% Check that there are exactly two bonds.
if check_bonds(bonds,2,'TF')==0
  return
end

% There are 2 ports; extract the information
e_1 = bonds(1,1);
f_1 = bonds(1,2);
e_2 = bonds(2,1);
f_2 = bonds(2,2);


% Effort
outcause = 1;
incause = 1;
if e_1==1
  outbond = bond_number(2);
  inbond =  bond_number(1);
  outport = 2;
  inport = 1;
else
  outbond = bond_number(1);
  inbond =  bond_number(2);
  outport = 1;
  inport = 2;
end;

eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);

% Flow
outcause = -1;
incause = -1;
if f_1==-1
  outbond = bond_number(2);
  inbond =  bond_number(1);
  outport = 2;
  inport = 1;
else
  outbond = bond_number(1);
  inbond =  bond_number(2);
  outport = 1;
  inport = 2;
end;

eqn =  equation(name,cr,args,outbond,outcause,outport, ...
                             inbond,incause,inport);
fprintf(eqnfile, '%s',eqn);








Deleted mttroot/mtt/lib/comp/simple/check_bonds.m version [1d5b1ad1e3].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function ok = check_bonds(bonds,n,component);
% check_bonds - check to see correct number (n) of bonds.
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  check_bonds
% err = check_bonds(bonds,n);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.
% Check that there are exactly two bonds.
[n_bonds,cols] = size(bonds);
if n_bonds~=n
  mtt_info(sprintf('MTT error: %s must have %1.0f (not %1.0f) bonds', ...
      component, n, n_bonds));
  ok=0;
else
  ok=1;
end

Deleted mttroot/mtt/lib/comp/simple/cicause.m version [94090e2bee].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = cicause(bonds,default);
% cicause - Sets causality for C & I components
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  cicause
% [bonds,status] = cicause(bonds,default)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.



if (norm(bonds)>1)
  if (bonds(1)==-bonds(2)) % Over causal
    status = 1;
  else                       % Causal
    status = 0;
  end;
elseif norm(bonds)==0 % Acausal
  % bonds = default*[1 1]; %Set integral causality
  % status = 0;
  status = -1;
else % Set causality 
  % Effort
  if bonds(1)==0
    status = 0;
    bonds(1) = bonds(2);
  end;

  % Flow
  if bonds(2)==0
    status = 0;
    bonds(2) = bonds(1);
  end;

end;

Deleted mttroot/mtt/lib/comp/simple/cieqn.m version [1e5df81dfe].

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
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




































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function structure =  cieqn(name, bond_number,bonds,direction,cr,args, ...
    structure,CorI,eqnfile);
% cieqn - Equation function for a (multi-port) unicausal C or I component
% CorI = 1 for C, -1 for I; 0 for ISW

% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  cieqn


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1997/12/04 13:48:00  peterg
% %% Added sign info to take account of direction of bonds.
% %%
% %% Revision 1.1  1997/04/09  10:18:26  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

if nargin<8
  eqnfile = 'stdout';
end;

CorIorISW = CorI;
if CorIorISW==0 % ISW
   CorI = -1;
end;

% Find the number of ports
[ports,junk] = size(bonds);

% Right-hand side causality
RHS_cause = (bonds(:,1)==CorI*ones(ports,1))*CorI
state_cause = zeros(ports,1); % State causality

for outport = 1:ports

#  % Sort out direction
#  if direction(outport,1) == 1
#    sign = '+';
#  else
#    sign = '-';
#  end;

  sign = '+';  
  LHS_number = bond_number(outport);
  if bonds(outport,1) == -CorI % Integral causality on this port
    state = structure(1)+1;
    LHS_cause = CorI;

    % Print equation of form x_i = MTTx(i)
    fprintf(eqnfile, '%s := MTTx(%1.0f,1);\n', ...
        varname(name,LHS_number, state_cause), state);

    % Print equation of form xdot = input - with sign
    fprintf(eqnfile, 'MTTdX(%1.0f,1) := %s%s;\n', state, sign, ...
                     varname(name,LHS_number,-LHS_cause));
    % Print equation of form output = CR (state) 
    eqn =  equation(name,cr,args,LHS_number,LHS_cause,outport, ...
                             bond_number,state_cause,1:ports);
    fprintf(eqnfile, '%s',eqn);
    structure(1) = state;
  else % Derivative causality
    nonstate = structure(2)+1;
    LHS_cause = -CorI;

    % Print equation of form zdot = MTTdz(i) -- with sign 
    fprintf(eqnfile, '%s := %sMTTdz(%1.0f,1);\n', ...
                             varname(name,LHS_number,LHS_cause), sign, ...
                             nonstate);
    % Print equation of form MTTz(i) = z_i
    fprintf(eqnfile, 'MTTz(%1.0f,1) := %s;\n', nonstate, ...
             varname(name,LHS_number, state_cause));
				 
   % Print equation of form z_i = CR(input)
      eqn =  equation(name,cr,args,LHS_number,state_cause, outport, ...
                             bond_number,RHS_cause,1:ports);
    fprintf(eqnfile, '%s',eqn);
    structure(2) = nonstate;
 end;
end;









Deleted mttroot/mtt/lib/comp/simple/comp_ports.m version [09c16f9abd].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81

















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function ports = comp_ports(comp_type,N)
%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  comp_ports
% ports = comp_ports(comp_type)
% Returns the port list for simple components


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.8  1998/06/29 12:16:05  peterg
% %% Whoops - FP bonds are p and f (in that order)
% %%
% %% Revision 1.7  1998/06/29 12:13:36  peterg
% %% Changed FP ports to f and p
% %%
% %% Revision 1.6  1998/06/29 09:55:17  peterg
% %% Changed name to FP from ES
% %%
% %% Revision 1.5  1998/04/12 15:01:53  peterg
% %% Converted to uniform port notation - always use []
% %%
% %% Revision 1.4  1998/03/31 08:39:31  peterg
% %% Added EBTF
% %%
% %% Revision 1.3  1997/11/21 11:32:57  peterg
% %% N ports numbered 1..N
% %%
% %% Revision 1.2  1997/08/28  08:08:24  peterg
% %% Added RS component to the two-port list
% %%
% %% Revision 1.1  1997/08/02 19:35:47  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


junctions = '-zero-one-';
one_ports = '-SS-';
two_ports = '-TF-GY-AE-AF-FMR-RS-EBTF-';
N_ports   = '-R-C-I-';
comp_type = ['-', comp_type, '-'];

#if length(findstr(comp_type,junctions))==1
#  ports = ['[undefined]'];
#elseif length(findstr(comp_type,one_ports))==1
#  ports = ['[in]'];
#elseif length(findstr(comp_type,two_ports))==1
#  ports = ['[in]';'[out]'];
#elseif length(findstr(comp_type,'[-EMTF-]'))==1
#  ports = ['[in]';'[out]';'[mod]'];
#elseif length(findstr(comp_type,'[-FP-]'))==1
#  ports = ['[p]';'[f]'];
#elseif length(findstr(comp_type,'[-PS-]'))==1
#  ports = ['[in]';'[out]';'[power]'];
#elseif length(findstr(comp_type,N_ports))==1
#  if N==1
#    ports = ['[in]'];
#  elseif N==2
#    ports = ['[in]';'[out]'];
#  elseif N>2
#    ports = '[1]';
#    for i=2:N
#      ports = [ports; sprintf("[%i]",i)];
#    end;
#  end;
#end;
 
# All the above is now done in the alias files
  ports = '[1]';
  for i=2:N
    ports = [ports; sprintf("[%i]",i)];
  end;

endfunction

Deleted mttroot/mtt/lib/comp/simple/juncause.m version [c96eb0a15f].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = juncause(bonds,jun,cause)
% [bonds,status] = juncause(bonds,jun,cause)

% Causality for  either effort or flow on  either zero or one junctions

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/08/09  08:29:04  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


j =  (3-cause)/2; % j is 1 for effort, 2 for flow

[n_bonds,junk] = size(bonds);
[causing_bond, n,other_bonds,m] = getindex(bonds(:,j),jun);
if n>1 % over causal
  status = 1;
elseif n==1 %causal
  status = 0;
  bonds(other_bonds(:,1),j) = -jun*ones(m,1);
elseif n==0  % undercausal - try other way
  [causing_bond, n,other_bonds,m] = getindex(bonds(:,j),-jun);
  if n==n_bonds % over causal
    status = 1;
  elseif n==n_bonds-1 %causal
    status = 0;
    bonds(other_bonds(:,1),j) = jun*ones(m,1);
  else  % undercausal
    status = -1;
  end;
end;




Deleted mttroot/mtt/lib/comp/simple/juneqn.m version [1b08ed726b].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  juneqn(name,bond_number,bonds,direction,cr,args,jun,filenumber)
% juneqn - Equations for  both  effort and flow on  either 
% zero or one junctions
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  juneqn
% juneqn(name,bond_number,bonds,direction,cr,args,jun,filenumber)

% Copyright (c) P.J. Gawthrop, 1996.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/12/05 10:02:45  peterg
% %% Explicit generation of strong-causality equations -- oneequation not
% %% used now.
% %%
% %% Revision 1.2  1996/08/08  18:09:10  peter
% %% Changed to finenumber format.
% %%
% %% Revision 1.1  1996/08/08 16:38:50  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Same causality as junction
column =  (3-jun)/2; 
[causing_bond,n,other_bonds,m] = getindex(bonds(:,column),jun)
for i=other_bonds'
  fprintf(filenumber, '%s \t:=\t%s;\n', ...
      varname(name, bond_number(i),jun), ...
      varname(name, bond_number(causing_bond),jun) ...
  );
end;


% Opposite causality to junction
column =  (3+jun)/2;
[caused_bond,n,other_bonds,m] = getindex(bonds(:,column),jun)
fprintf(filenumber, '%s\t:= \n',  varname(name, bond_number(caused_bond),-jun));
for i=other_bonds'
  term_sign = -direction(caused_bond,column)*direction(i,column)
  fprintf(filenumber, '\t\t%s %s\n', sign2name(term_sign), ...
      varname(name, bond_number(i),-jun));
end;
fprintf(filenumber, ';\n');

Deleted mttroot/mtt/lib/comp/simple/one_cause.m version [3018a4a5e9].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = one_cause(bonds);
% one_cause - causality for a one junction
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  one_cause


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Copyright (c) P.J. Gawthrop, 1996.

%Effort
[bonds,e_status] = juncause(bonds,-1,1);

%Flow
[bonds,f_status] = juncause(bonds,-1,-1);

if (e_status==1)|(f_status==1)       % Over causal
  status = 1;
elseif (e_status==-1)|(f_status==-1) % Under causal
  status = -1;
else                                  % causal
  status = 0;
end;

Deleted mttroot/mtt/lib/comp/simple/one_eqn.m version [ec7724f3d8].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  structure = one_eqn(name,bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% one_eqn - equations for a one junction
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  one_eqn
% one_eqn(name,bond_number,bonds,direction,cr,args, ...
%    structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/12/05 10:00:49  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

disp("one-eqn")
name,bond_number,bonds,direction,cr,args
if nargin<7
  eqnfile = 'stdout';
end;

juneqn(name,bond_number,bonds,direction,cr,args,-1,eqnfile)




Deleted mttroot/mtt/lib/comp/simple/oneeqn.m version [b6cf957a10].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  oneeqn(name,LHS_number,LHS_cause,RHS_number,RHS_cause,cr,args, ...
    eqnfile);
% oneeqn - prints a single equation
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  oneeqn
% oneeqn(name,LHS_number,LHS_cause,RHS_number,RHS_cause,cr,args,eqnfile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



if nargin<7
  eqnfile = 'stdout';
end;


fprintf(eqnfile, '%s := %s;\n', ...
    varname(name, LHS_number,LHS_cause), ...
    cr2name(name,RHS_number,LHS_cause,RHS_cause,cr,args));

Deleted mttroot/mtt/lib/comp/simple/zero_cause.m version [93a4da1931].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [bonds,status] = zero_cause(bonds);
% zero_cause - causality for zero junctions
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  zero_cause
% [bonds,status] = zero_cause(bonds);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Effort
[bonds,e_status] = juncause(bonds,1,1);

%Flow
[bonds,f_status] = juncause(bonds,1,-1);

status = 0;
if (e_status==1)|(f_status==1)       % Over causal
  status = 1;
endif;
if (e_status==-1)|(f_status==-1) % Under causal
  status = -1;
endif;

  

Deleted mttroot/mtt/lib/comp/simple/zero_eqn.m version [1f6c065bc3].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function structure =  zero_eqn(name, bond_number,bonds,direction,cr,args, ...
    structure,eqnfile);
% zero_eqn - equations for zero junctions
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  zero_eqn
% zero_eqn(name, bond_number,bonds,direction,cr,args, structure,eqnfile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


if nargin<7
  eqnfile = 'stdout';
end;


juneqn(name, bond_number,bonds,direction,cr,args,1,eqnfile)




Deleted mttroot/mtt/lib/control/PPP/Beam_numpar.m version [0d62366729].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Script file  Beam_numpar.m
%% numpar file (Beam_numpar.m)
%% Generated by MTT at Thu Apr 22 07:00:08 BST 1999
% Global variable list
global ...
     area ...
     areamoment ...
     beamlength ...
     beamthickness ...
     beamwidth ...
     density ...
     ei ...
     n ...
     youngs ...
     dk ...
     dm ...
     dz ...
     rhoa ;
 %  -*-octave-*- Put Emacs into octave-mode
 %  Numerical parameter file (Beam_numpar.txt)
 %  Generated by MTT at Mon Apr 19 06:24:08 BST 1999

 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  %% Version control history
 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  %% $Id$
 %  %% $Log$
 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 %  Parameters
n =  7;
beamlength =  0.58;
beamwidth =  0.05;
beamthickness =  0.005;
youngs =  1e6;
density =  1e5;
area =  beamwidth*beamthickness;
areamoment =  (beamthickness*beamwidth^2)/12;

ei=  58.6957			; %  from Reza
rhoa=  0.7989			; %  from Reza
 
dz =  beamlength/n;  %  BernoulliEuler
dm =  rhoa*dz;  %  BernoulliEuler
dk =  ei/dz;  %  BernoulliEuler

Deleted mttroot/mtt/lib/control/PPP/Beam_sm.m version [cd16b034f7].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-octave-*- Put Emacs into octave-mode%
function [mtta,mttb,mttc,mttd] = Beam_sm();
% [mtta,mttb,mttc,mttd] = Beam_sm();
%System Beam, representation sm, language m;
%File Beam_sm.m;
%Generated by MTT on Thu Apr 22 07:02:48 BST 1999;
%
%====== Set up the global variables ======%
global ...
area ...
areamoment ...
beamlength ...
beamthickness ...
beamwidth ...
density ...
ei ...
n ...
youngs ...
dk ...
dm ...
dz ...
rhoa ;
%a matrix%
mtta = zeros(14,14);
mtta(1,2) = -dk/dz;
mtta(2,1) = 1.0/(dm*dz);
mtta(2,3) = -2.0/(dm*dz);
mtta(2,5) = 1.0/(dm*dz);
mtta(3,2) = (2.0*dk)/dz;
mtta(3,4) = -dk/dz;
mtta(4,3) = 1.0/(dm*dz);
mtta(4,5) = -2.0/(dm*dz);
mtta(4,7) = 1.0/(dm*dz);
mtta(5,2) = -dk/dz;
mtta(5,4) = (2.0*dk)/dz;
mtta(5,6) = -dk/dz;
mtta(6,5) = 1.0/(dm*dz);
mtta(6,7) = -2.0/(dm*dz);
mtta(6,9) = 1.0/(dm*dz);
mtta(7,4) = -dk/dz;
mtta(7,6) = (2.0*dk)/dz;
mtta(7,8) = -dk/dz;
mtta(8,7) = 1.0/(dm*dz);
mtta(8,9) = -2.0/(dm*dz);
mtta(8,11) = 1.0/(dm*dz);
mtta(9,6) = -dk/dz;
mtta(9,8) = (2.0*dk)/dz;
mtta(9,10) = -dk/dz;
mtta(10,9) = 1.0/(dm*dz);
mtta(10,11) = -2.0/(dm*dz);
mtta(10,13) = 1.0/(dm*dz);
mtta(11,8) = -dk/dz;
mtta(11,10) = (2.0*dk)/dz;
mtta(11,12) = -dk/dz;
mtta(12,11) = 1.0/(dm*dz);
mtta(12,13) = -2.0/(dm*dz);
mtta(13,10) = -dk/dz;
mtta(13,12) = (2.0*dk)/dz;
mtta(13,14) = -dk/dz;
mtta(14,13) = 1.0/(dm*dz);
%b matrix%
mttb = zeros(14,1);
mttb(11) = 1.0/dz;
mttb(13) = -2.0/dz;
%c matrix%
mttc = zeros(1,14);
mttc(1,1) = 1.0/dm;
%d matrix%
mttd = zeros(1,1);

Deleted mttroot/mtt/lib/control/PPP/NMPsystem.m version [2fed1aea39].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [A,B,C,D] = NMPsystem ()

  ## usage:  [A,B,C,D] = NMPsystem ()
  ##
  ## NMP system example (2-s)/(s-1)^3

  A = [3 -3 1
       1  0  0
       0  1  0];

  B = [1 
       0 
       0];

  C = [0 -0.5 1];

  D = 0;



endfunction

Deleted mttroot/mtt/lib/control/PPP/TwoMassSpring.m version [5f26391fd5].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [A,B,C,D] = TwoMassSpring (k,m_1,m_2)

  ## usage:  [A,B,C,D] = TwoMassSpring (k,m_1,m_2)
  ##
  ## Two mass-spring example from Middleton et al.  EE9908

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.2  1999/05/18 22:31:26  peterg
  ## Fixed error in dim of D
  ##
  ## Revision 1.1  1999/05/18 22:28:56  peterg
  ## Initial revision
  ##
  ###############################################################


  A = [0    1 0 0
       -k/m_1 0 k/m_1 0
       0    0 0 1
       k/m_2 0 -k/m_2 0];
  B = [0
       1/m_1
       0 
       0];
  C = [1 0 0 0
       0 0 1 0];

  D = zeros(2,1);

endfunction

Deleted mttroot/mtt/lib/control/PPP/airc.m version [c3d4271b18].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [A,B,C,D] = airc
% System AIRC 
% This system is the aircraft example from the book:
% J.M Maciejowski: Multivariable Feedback Design  Addison-Wesley, 1989
% It has 5 states, 3 inputs and 3 outputs.

% P J Gawthrop Jan 1998

A = [    0         0    1.1320         0   -1.0000
         0   -0.0538   -0.1712         0    0.0705
         0         0         0    1.0000         0
         0    0.0485         0   -0.8556   -1.0130
         0   -0.2909         0    1.0532   -0.6859];

B = [    0         0         0
   -0.1200    1.0000         0
         0         0         0
    4.4190         0   -1.6650
    1.5750         0   -0.0732];

C = [1     0     0     0     0
     0     1     0     0     0
     0     0     1     0     0];

D = zeros(3,3);


Deleted mttroot/mtt/lib/control/PPP/autm.m version [e5ff112d0d].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [A,B,C,D]=autm
% System AUTM
% This system is the automotive gas turbine example from the book:
% Y.S. Hung and A.G.J. Macfarlane: "Multivariable Feedback. A
% quasi-classical approach."  Springer 1982
% It has 12 states, 2 inputs and 2 outputs.

% P J Gawthrop Jan 1998

%A-matrix
A = zeros(12,12);
A(1,2) 	= 1;
A(2,1) 	= -0.202; A(2,2) = -1.150;
A(3,4) 	= 1;
A(4,5) 	= 1;
A(5,3) 	= -2.360; A(5,4) = -13.60; A(5,5) = -12.80;
A(6,7) 	= 1;
A(7,8) 	= 1;
A(8,6) 	= -1.620; A(8,7) = -9.400; A(8,8) = -9.150;
A(9,10) = 1;
A(10,11) = 1;
A(11,12) = 1;
A(12,9) = -188.0; A(12,10) = -111.6; A(12,11) = -116.4; A(12,12) = -20.8;

%B-matrix
B = zeros(12,2);
B(2,1)   =  1.0439; B(2,2)   = 4.1486;
B(5,1)   = -1.794;  B(5,2)   = 2.6775;
B(8,1)   =  1.0439; B(8,2)   = 4.1486;
B(12,1)  = -1.794;  B(12,2)  = 2.6775;

%C-matrix
C = zeros(2,12);
C(1,1)  = 0.2640; C(1,2)  = 0.8060; C(1,3) = -1.420; C(2,4) = -15.00; 
C(2,6)  = 4.9000; C(2,7)  = 2.1200; C(2,8) = 1.9500; C(2,9) = 9.3500;
C(2,10) = 25.800; C(2,11) = 7.1400;

%D-matrix
D = zeros(2,2);

Deleted mttroot/mtt/lib/control/PPP/butterworth_matrix.m version [c40a4036f0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function A = butterworth_matrix (n,p)

  ## usage:  A = butterworth (n,p)
  ##
  ## A-matrix for generating nth order Butterworth functions with parameter p

  ## Copyright (C) 2000 by Peter J. Gawthrop

  ## Butterworth poly
  pol = ppp_butter(n,p);
  
  ## Create A matrix (controller form)
  A = [-pol(2:n+1)
       eye(n-1) zeros(n-1,1)];
	
endfunction

Deleted mttroot/mtt/lib/control/PPP/damped_matrix.m version [62d084883f].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function A = damped_matrix (frequency,damping)

  ## usage:  A = damped_matrix (frequency,damping)
  ##
  ## Gives an A matrix with eigenvalues with specified 
  ## frequencies and damping ratio

  N = length(frequency);

  if nargin<2
    damping = zeros(size(frequency));
  endif
  
  if length(damping) != N
    error("Frequency and damping vectors have different lengths");
  endif
  
  A = zeros(2*N,2*N);
  for i=1:N
    j = 2*(i-1)+1;
    A_i = [-2*damping(i)*frequency(i) -frequency(i)^2
	   1                           0];
    A(j:j+1,j:j+1) = A_i;
  endfor
  
endfunction

Deleted mttroot/mtt/lib/control/PPP/laguerre_matrix.m version [2bc3da3dab].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function A = laguerre_matrix (n,p)

  ## usage:  A = laguerre_matrix (n,p)
  ##
  ## A-matrix for generating nth order Laguerre functions with parameter p

  ## Copyright (C) 1999 by Peter J. Gawthrop

  ## Create A matrix
  A = diag(-p*ones(n,1));
  for i=1:n-1
    A = A + diag(-2*p*ones(n-i,1),-i);
  endfor

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_aug.m version [85d071a163].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [A,v] = ppp_aug (A_1,A_2)

  ## usage:  [A,v] = ppp_aug (A_1,A_2)
  ##
  ## Augments square matrix A_1 with square matrix A_2 to create A=[A_1 0; A_2 0];
  ## and generates v, a compatible column vector with unit elements

  ## Copyright (C) 1999 by Peter J. Gawthrop


  [n_1,m_1] = size(A_1);
  if n_1 != m_1
    error("A_1 must be square");
  endif
  
  [n_2,m_2] = size(A_2);
  if n_2 != m_2
    error("A_2 must be square");
  endif

  A = [A_1            zeros(n_1,n_2)
       zeros(n_2,n_1) A_2];

  v = ones(n_1+n_2,1);

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_butter.m version [e0dda0f911].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function pol = ppp_butter (order,radius)

  ## usage:  pol = cgpc_butter (order,radius)
  ##
  ## Butterworth polynomial of given order and pole radius
  ## Copyright (C) 1999 by P.J. Gawthrop

  ## 	$Id$	

  theta = pi/(2*order);		# Angle with real axis

  even = (floor(order/2)==order/2);
  if even
    pol=1; N=order/2;
  else
    pol=[1 radius]; N=(order-1)/2;
  endif
  
  for i=1:N
    pol=conv(pol, [1 2*radius*cos(i*theta) radius^2]);
  endfor

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_closedloop.m version [3bb5af1be2].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Ac,Bc,Cc,Dc] = ppp_closedloop (A,B,C,D,k_x,k_w,l_x,l_y)

  ## usage:  [Ac,Bc,Cc,Dc] = ppp_closedloop (A,B,C,K_x,K_w,K_y,L)
  ##
  ## 


  ## Closed loop input  is [w;v]. 
  ## Closed loop output is [y;u]. 
  ## w is reference signal
  ## v is input disturbance
  ## Inputs:
  ## 	A,B,C,D		MIMO linear system matrices
  ## 	k_x,k_w,k_y	Gain matrices: u = k_w*w - k_x*x
  ##	L		Observer gain matrix
  ## Outputs
  ## 	Ac,Bc,Cc,Dc	Closed-loop charecteristic polynomial	

  ## Copyright (C) 1999 by Peter J. Gawthrop

  ## System dimensions
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  ## Create matrices describing closed-loop system
  Ac = [ A,  -B*k_x     
	l_x*C,  (A - l_x*C - B*k_x)];

  Bc = [B*k_w    B
	B*k_w    zeros(n_x,n_u)];

  Cc = [C               zeros(n_y,n_x)
	zeros(n_u,n_x)  -k_x          ];

  Dc = [zeros(n_y,n_y)     zeros(n_y,n_u)
	k_w              zeros(n_u,n_u)];

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_cost.m version [f7cb316246].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [J J_U] = ppp_cost (U,x,W,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww)

  ## usage: [J J_U] = ppp_cost (U,x,W,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww)
  ## Computes the PPP cost function given U,x and W
  ## 
  ## J_uu,J_ux,J_uw,J_xx,J_xw,J_ww cost derivatives from ppp_lin

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	

  J = U'*J_uu*U/2 + U'*(J_ux*x - J_uw*W) - x'*J_xw*W + x'*J_xx*x/2 + W'*J_ww*W'/2;
  J_U = J_uu*U + (J_ux*x - J_uw*W) ;

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_error.m version [3cf9868bce].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function err = ppp_error(par)

  ## usage:  err = error (par)
  ##
  ## 

  global ppp_y_0 ppp_sim_command ppp_par ppp_i_par ppp_x0 ppp_sim ppp_u
  
  pars = ppp_par;
  pars(ppp_i_par) = par;
  
  y = sidSimpleExtruder_ssim(ppp_x0,pars,ppp_sim,ppp_u);
  
  [N,n_y] = size(y);

  Err = y - ppp_y_0;
  err = sum(diag(Err'*Err))/N
endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex1.m version [a792430509].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex1 (ReturnName)

  ## usage:  ppp_ex1 ()
  ##
  ## PPP example - an unstable, nmp siso system
  ## 	$Id$	


  ## Example name
  name = "Linear unstable non-minimum phase third order system- Laguerre inputs";

  if nargin>0
    return
  endif
  

  ## System - unstable & NMP
  [A,B,C,D] = NMPsystem;
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  ## Setpoint
  A_w = ppp_aug(0,[]);

  ## Controller

  ##Optimisation horizon
  t = [4.0:0.05:5];

  ## A_u
  A_u = ppp_aug(laguerre_matrix(3,2.0), A_w);

  ## Design and plot
  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w,cond_uu] = ppp_lin_plot (A,B,C,D,A_u,A_w,t);


  ## Compute exact version
  poles = sort(eig(A_u));	# Desired poles - eigenvalues of A_u
  poles = poles(1:n_x);		# Loose the last one - due to setpoint 
  clp = poly(poles);		# Closed-loop cp
  kk = clp(2:n_x+1)+A(1,:);	# Corresponding gain
  A_c = A-B*kk;			# Closed-loop A
  K_X = ppp_open2closed (A_u,[A_c B*k_w; [0 0 0 0]],[kk -k_w]); # Exact
	
  ## Compute K_x using approx values
  A_c_a = A-B*k_x; 			
  K_X_comp = ppp_open2closed (A_u,[A_c_a B*k_w; [0 0 0 0]],[k_x -k_w]); # Computed Kx

  format bank
  log_cond_uu = log10(cond_uu)
  Exact_closed_loop_poles = poles'
  Approximate_closed_loop_poles = cl_poles
  Exact_k_x = kk
  Approximate_k_x = k_x
  Exact_K_X = K_X
  Approximate_K_X = [K_x -K_w]
  Computed_K_x = K_X_comp
  K_xw_error = Approximate_K_X-K_X
  format
endfunction



Deleted mttroot/mtt/lib/control/PPP/ppp_ex10.m version [cee25ffa57].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex10 (ReturnName)

  ## usage:  name = ppp_ex10 (ReturnName)
  ##
  ## PPP example - shows a standard multivariable system
  ##
 
  ## Example name
  name = "Remotely-piloted vehicle example:  system RPV from J.M Maciejowski: Multivariable Feedback Design";

  if nargin>0
    return
  endif
  
  ## System
  [A,B,C,D] = rpv;
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = 1*[0.9:0.01:1];		# Time horizon
  A_w = 0;		# Setpoint
#   TC = 0.1*[1 1];		# Time constants for each input
#   A_u = [];
#   for tc=TC			# Input
#     A_u = [A_u;ppp_aug(laguerre_matrix(2,1/tc), 0)];
#   endfor
  A_u = ppp_aug(laguerre_matrix(2,5.0), A_w)
  Q = [1;1];		# Output weightings

  ## Design and plot
  W = [1;2]
  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W);

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex11.m version [8afbccc82d].

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
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









































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,ys,us,J] = ppp_ex11 (ReturnName)

  ## usage:   [name,T,y,u,ys,us,T1,du,dus] = ppp_ex11 (ReturnName)
  ##
  ## PPP example

  ## 	$Id$	


  ## Example name
  name = "Input constraints +-1.5 on u* at tau=0,0.5,1,1.5,2";

  if nargin>0
    return
  endif
  
  ## System
  A = [-3 -3  -1
       1  0  0
       0  1  0];
  B = [1 
       0 
       0];
  C = [0 -0.5  1];
  D = 0;
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  ## Controller
  t = [6:0.02:7];		# Time horizon
  A_w = 0;			# Setpoint
  A_u = ppp_aug(laguerre_matrix(3,2.0), A_w); # Input functions

  Q = ones(n_y,1);;
  

  ## Constaints
  Gamma = [];
  gamma = [];

  ## Constaints - u
  Tau_u = [0:0.5:2];
  one = ones(size(Tau_u));
  limit = 1.5;
  Min_u = -limit*one;
  Max_u =  limit*one;
  Order_u = 0*one;

  ## Constraints - y
  Tau_y = [];			# No output constraints
  one = ones(size(Tau_y));
  limit = 1.5; 
  Min_y = -limit*one;
  Max_y =  limit*one;
  Order_y = 0*one;

  ## Simulation
  W=1;
  x_0 = zeros(3,1);

  ## Constrained - open-loop
  disp("Designing controller");
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw] = ppp_lin  (A,B,C,D,A_u,A_w,t,Q); # Unconstrained design
  [Gamma_u,gamma_u] = ppp_input_constraint (A_u,Tau_u,Min_u,Max_u);

  Gamma = Gamma_u;
  gamma = gamma_u;

  ## Constrained OL simulation
  disp("Computing constrained ol response");
  [u,U] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma);
  T = [0:t(2)-t(1):t(length(t))];
  [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,U,T);

  ## Unconstrained OL simulation
  disp("Computing unconstrained ol response");
  [uu,Uu] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,[],[]);
  [ysu,usu] = ppp_ystar (A,B,C,D,x_0,A_u,Uu,T);

  title("Constained and unconstrained y*");
  xlabel("t");
  grid;
  plot(T,ys,T,ysu)

  ## Non-linear - closed-loop
    disp("Computing constrained closed-loop response");
  [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			  Tau_u,Min_u,Max_u,Order_u, \
			  Tau_y,Min_y,Max_y,Order_y,W,x_0);

  title("y,y*,u and u*");
  xlabel("t");
  grid;
  plot(T,y,T,u,T,ys,T,us);

  ## Compute derivatives.
  dt = t(2)-t(1);
  du = diff(u)/dt;
  dus = diff(us)/dt;
  T1 = T(1:length(T)-1);
  ##plot(T1,du,T1,dus);
endfunction




Deleted mttroot/mtt/lib/control/PPP/ppp_ex12.m version [4b9ce5134a].

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
68
69
70
71
72
73
74
75











































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,ys,us,J,T1,du,dus] = ppp_ex12 (ReturnName)

  ## usage:   [name,T,y,u,ys,us,T1,du,dus] = ppp_ex12 (ReturnName)
  ##
  ## PPP example - shows input derivative constraints  
  ## $Id$


  ## Example name
  name = "Input derivative constraints +-1 on u* at tau=0,0.5,1,1.5,2";

  if nargin>0
    return
  endif
  
  ## System
  A = [-3 -3  -1
       1  0  0
       0  1  0];
  B = [1 
       0 
       0];
  C = [0 -0.5  1];
  D = 0;
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = [4:0.02:5];		# Time horizon
  A_w = 0;			# Setpoint
  A_u = ppp_aug(laguerre_matrix(3,2.0), A_w); # Input functions
  Q = ones(n_y,1);;

  ## Constaints - du*/dtau
  Tau = [0:0.5:2];
  one = ones(size(Tau));
  limit = 1;
  Min = -limit*one;
  Max =  limit*one;
  Order = one;
  [Gamma,gamma] = ppp_input_constraint (A_u,Tau,Min,Max,Order);

  W=1;
  x_0 = zeros(3,1);

  ## Constrained - open-loop
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw] = ppp_lin (A,B,C,D,A_u,A_w,t,Q);
  [u,U] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma);
  T = [0:t(2)-t(1):t(length(t))];
  [ys,us] = ppp_ystar(A,B,C,D,x_0,A_u,U,T);

  ## Non-linear - closed-loop
  [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			   Tau,Min,Max,Order, \
			   [],[],[],[], W,x_0);

  title("y,y*,u and u*");
  xlabel("t");
  grid;
  plot(T,y,T,u,T,ys,T,us);

  ## Compute derivatives.
  dt = t(2)-t(1);
  du = diff(u)/dt;
  dus = diff(us)/dt;
  T1 = T(1:length(T)-1);
  ##plot(T1,du,T1,dus);
endfunction








Deleted mttroot/mtt/lib/control/PPP/ppp_ex13.m version [410a811ae6].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex13 (ReturnName)

  ## usage:  ppp_ex13 ()
  ##
  ## PPP example: Sensitivity minimisation (incomplete)


  ## Example name
  name = "Sensitivity minimisation (incomplete)";

  if nargin>0
    return
  endif
  

  ## System - unstable
  A = [-3 -3 -1
       1  0  0
       0  1  0];
  B = [1 
       0 
       0];
  C = [0 -0.5 1
       0  1.0 0];
  D = [0;0];

  ## Setpoint
  A_w = [0;0]

  ## Controller
  t =[0:0.1:5];			# Optimisation horizon
  t1 =[0:0.1:1];
  t2 =[1.1:0.1:3.9];	
  t3 =[4:0.1:5];
  

  A_u = ppp_aug(laguerre_matrix(3,5.0), 0);
  q_s=1e3;
  Q = [exp(5*t)
       q_s*exp(-t)]
  size(Q)
  W = [1;0];

  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W)

endfunction



Deleted mttroot/mtt/lib/control/PPP/ppp_ex14m.m version [da6984e601].

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
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






































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,ys,us,ysu,usu,J] = ppp_ex14m (ReturnName)

  ## usage:   [name,T,y,u,ys,us,ysu,usu,J] = ppp_ex14 (ReturnName)
  ##
  ## PPP example - shows output constraints on nonlinear system
  ## 	$Id$	


  ## Example name
  name = "Output constraints -0.1 on y* at tau=0.1,0.5,1,2";

  if nargin>0
    if ReturnName
      return
    endif
  endif
  
  ## System
  A = [-3 -3  -1
       1  0  0
       0  1  0];
  B = [1 
       0 
       0];
  C = [0 -0.5  1];
  D = 0;
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = [4:0.02:5];		# Time horizon
  A_w = 0;			# Setpoint
  A_u = ppp_aug(laguerre_matrix(3,2.0), A_w); # Input functions
  Q = ones(n_y,1);;

  ## Constaints - u
  Tau_u = [];
  one = ones(size(Tau_u));
  limit = 3;
  Min_u = -limit*one;
  Max_u =  limit*one;
  Order_u = 0*one;

  ## Constraints - y
  Tau_y = [0.1 0.5 1 2]
  one = ones(size(Tau_y));
  Min_y =  -0.01*one; # Min_y(5) = 0.99;
  Max_y =  1e5*one;   # Max_y(5) = 1.01;
  Order_y = 0*one;

  ## Simulation
  W=1;
  x_0 = zeros(3,1);

  ## Constrained - open-loop
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw] = ppp_lin  (A,B,C,D,A_u,A_w,t,Q); # Unconstrained design
  [Gamma_u,gamma_u] = ppp_input_constraint (A_u,Tau_u,Min_u,Max_u);
  [Gamma_y,gamma_y] = ppp_output_constraint  (A,B,C,D,x_0,A_u,Tau_y,Min_y,Max_y,Order_y);

  Gamma = [Gamma_u; Gamma_y];
  gamma = [gamma_u; gamma_y];

  ## Constrained OL simulation
  [u,U] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma);
  T = [0:t(2)-t(1):t(length(t))];
  [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,U,T);

  ## Unconstrained OL simulation
  [uu,Uu] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,[],[]);
  [ysu,usu] = ppp_ystar (A,B,C,D,x_0,A_u,Uu,T);

  title("Constained and unconstrained y*");
  xlabel("t");
  grid;
  plot(T,ys,T,ysu)

  ## Non-linear - closed-loop
  movie = 1; 
  if movie
    hold on;
  endif
  
  [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			  Tau_u,Min_u,Max_u,Order_u, \
			  Tau_y,Min_y,Max_y,Order_y,W,x_0,movie);

  hold off;
#   title("y,y*,u and u*");
#   xlabel("t");
#   grid;
#   plot(T,y,T,u,T,ysu,T,usu);

  ## Compute derivatives.
  dt = t(2)-t(1);
  du = diff(u)/dt;
  dus = diff(us)/dt;
  T1 = T(1:length(T)-1);
  ##plot(T1,du,T1,dus);
endfunction




Deleted mttroot/mtt/lib/control/PPP/ppp_ex15.m version [a26d3cfd27].

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





























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  [name,T,y,u,ye,ue,J] = ppp_ex15 (ReturnName)

  ## usage:  ppp_ex15 ()
  ##
  ## PPP example - an unstable, nmp siso system
  ## 	$Id$	

  ## Example name
  name = "Linear unstable non-minimum phase third order system - intermittent control";

  if nargin>0
    return
  endif
  

  ## System - unstable
  A = [3 -3  1
       1  0  0
       0  1  0];
  B = [10
       0 
       0];
  C = [0 -0.5 1];
  D = 0;
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  ## Setpoint
  A_w = ppp_aug(0,[]);

  ## Controller
  t =[4.0:0.01:5.0];		# Optimisation horizon
  dt = t(2)-t(1);
  A_u = ppp_aug(laguerre_matrix(3,2.0), A_w);
  Q = 1;			# Weight

  ##Simulate
  W = 1;			# Setpoint
  x_0 = zeros(n_x,1);		# Initial state


  ## Closed-loop intermittent solution
  Delta_ol = 0.5		# Intermittent time

  disp("Intermittent control simulation");
  [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			  [],[],[],[], \
			  [],[],[],[],W,x_0,Delta_ol);

  ## Exact closed-loop
  disp("Exact closed-loop");
  [k_x,k_w] = ppp_lin (A,B,C,D,A_u,A_w,t,Q);
  [ye,Xe] = ppp_sm2sr(A-B*k_x, B, C, D, T, k_w*W, x_0); # Compute Closed-loop control
  ue = k_w*ones(size(T))*W - k_x*Xe';


  title("y and u, exact and intermittent");
  xlabel("t");
  grid;
  plot(T,y,T,u,T,ye,T,ue);

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex16.m version [b34052bc15].

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
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







































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,ys,us,J] = ppp_ex16 (ReturnName)

  ## usage:   [name,T,y,u,ys,us,T1,du,dus] = ppp_ex16 (ReturnName)
  ##
  ## PPP example

  ## 	$Id$	


  ## Example name
  name = "Input constraints +-1.5 on u* at tau=0,0.1,0.2..,2.0 - intermittent control";

  if nargin>0
    return
  endif
  
  ## System
  A = [-3 -3  -1
       1  0  0
       0  1  0];
  B = [1 
       0 
       0];
  C = [0 -0.5  1];
  D = 0;
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  ## Controller
  t = [5:0.01:6];		# Time horizon
  A_w = 0;			# Setpoint
  A_u = ppp_aug(laguerre_matrix(3,2.0), A_w); # Input functions
  A_u = ppp_aug(laguerre_matrix(1,0.5), A_u); # Add some extra slow modes
  Q = ones(n_y,1);;

  ## Constaints
  Gamma = [];
  gamma = [];

  ## Constaints - u
  Tau_u = [0:0.1:2]; 
  one = ones(size(Tau_u));
  limit = 1.5;
  Min_u = -limit*one;
  Max_u =  limit*one;
  Order_u = 0*one;

  ## Constaints - y
  Tau_y = [];
  one = ones(size(Tau_y));
  limit = 1.5; 
  Min_y = -limit*one;
  Max_y =  limit*one;
  Order_y = 0*one;

  ## Simulation
  W=1;
  x_0 = zeros(3,1);

  ## Constrained - open-loop
  disp("Control design");
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw] = ppp_lin  (A,B,C,D,A_u,A_w,t,Q); # Unconstrained design
  [Gamma_u,gamma_u] = ppp_input_constraint (A_u,Tau_u,Min_u,Max_u);

  Gamma = Gamma_u;
  gamma = gamma_u;

  disp("Open-loop simulations");
  ## Constrained OL simulation
  [u,U] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma);
  T = [0:t(2)-t(1):t(length(t))];
  [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,U,T);

  ## Unconstrained OL simulation
  [uu,Uu] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,[],[]);
  [ysu,usu] = ppp_ystar (A,B,C,D,x_0,A_u,Uu,T);

  title("Constrained and unconstrained y* and u*");
  xlabel("t");
  grid;
  axis([0 6 -1 2]);
  plot(T,ys,T,ysu,T,us,T,usu)
  axis;

  ## Non-linear - closed-loop
  disp("Closed-loop simulation");
  Delta_ol = 0.1;
  [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			  Tau_u,Min_u,Max_u,Order_u, \
			  Tau_y,Min_y,Max_y,Order_y,W,x_0,Delta_ol);

  title("y,y*,u and u*");
  xlabel("t");
  grid;
  plot(T,y,T,u,T,ys,T,us);
endfunction








Deleted mttroot/mtt/lib/control/PPP/ppp_ex17.m version [0cc0c0d748].

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
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





























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,ys,us,ysu,usu,J] = ppp_ex17 (ReturnName)

  ## usage:   [name,T,y,u,ys,us,ysu,usu,J] = ppp_ex17 (ReturnName)
  ##
  ## PPP example - shows output constraints on nonlinear system
  ## 	$Id$	


  ## Example name
  name = "Output constraints -0.1 on y* at tau=0.1,0.5,1,2 - intermittent control";

  if nargin>0
    if ReturnName
      return
    endif
  endif
  
  ## System
  A = [-3 -3  -1
       1  0  0
       0  1  0];
  B = [1 
       0 
       0];
  C = [0 -0.5  1];
  D = 0;
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = [9:0.02:10];		# Time horizon
  A_w = 0;			# Setpoint
  A_u = ppp_aug(laguerre_matrix(3,2.0), A_w); # Input functions
  Q = ones(n_y,1);;

  ## Constraints - u
  Tau_u = [];
  one = ones(size(Tau_u));
  limit = 3;
  Min_u = -limit*one;
  Max_u =  limit*one;
  Order_u = 0*one;

  ## Constraints - y
  Tau_y = [0.1 0.5 1 2]
  one = ones(size(Tau_y));
  Min_y =  -0.01*one; # Min_y(5) = 0.99;
  Max_y =  1e5*one;   # Max_y(5) = 1.01;
  Order_y = 0*one;

  ## Simulation
  W=1;
  x_0 = zeros(3,1);

  ## Constrained - open-loop
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw] = ppp_lin  (A,B,C,D,A_u,A_w,t,Q); # Unconstrained design
  [Gamma_u,gamma_u] = ppp_input_constraint (A_u,Tau_u,Min_u,Max_u);
  [Gamma_y,gamma_y] = ppp_output_constraint  (A,B,C,D,x_0,A_u,Tau_y,Min_y,Max_y,Order_y);

  Gamma = [Gamma_u; Gamma_y];
  gamma = [gamma_u; gamma_y];

  ## Constrained OL simulation
  [u,U] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma);
  T = [0:t(2)-t(1):t(length(t))];

  ## OL solution
  [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,U,T);

  ## Unconstrained OL simulation
  [uu,Uu] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,[],[]);
  [ysu,usu] = ppp_ystar (A,B,C,D,x_0,A_u,Uu,T);

  title("Constained and unconstrained y*");
  xlabel("t");
  grid;
  plot(T,ys,T,ysu)

  ## Non-linear - closed-loop
  delta_ol = 0.1;
  [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			  Tau_u,Min_u,Max_u,Order_u, \
			  Tau_y,Min_y,Max_y,Order_y,W,x_0,delta_ol);

  title("y,y*,u and u*");
  xlabel("t");
  grid;
  plot(T,y,T,u,T,ysu,T,usu);

endfunction




Deleted mttroot/mtt/lib/control/PPP/ppp_ex18.m version [4568857bd3].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex18 (ReturnName)

  ## usage:  ppp_ex18 ()
  ##
  ## PPP example - an unstable, nmp siso system
  ## 	$Id$	


  ## Example name
  name = "First order with redundant inputs";

  if nargin>0
    return
  endif
  
  ## System 
  A = 1
  B = 1
  C = 1
  D = 0;

  ## Setpoint
  A_w = ppp_aug(0,[]);

  ## Controller
  ##Optimisation horizon
  t =[2:0.1:3];

  ## A_u
  A_u = diag([0  -2 -4 -6])

  [ol_poles,cl_poles] = ppp_lin_plot (A,B,C,D,A_u,A_w,t)

  
endfunction





Deleted mttroot/mtt/lib/control/PPP/ppp_ex19.m version [667d1947d8].

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
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








































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,ys,us,J] = ppp_ex19 (ReturnName,n_extra,T_extra)

  ## usage:   [name,T,y,u,ys,us,T1,du,dus] = ppp_ex19 (ReturnName)
  ##
  ## PPP example

  ## 	$Id$	


  ## Example name
  name = "Input constraints with redundant U*";

  if (nargin>0)&&(ReturnName==1)
    return
  endif


  if nargin<2
    n_extra = 3
  endif
  
  if nargin<3
    T_extra = 2.0
  endif
  

  ## System
  A = 1
  B = 1
  C = 1
  D = 0;
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  ## Controller
  t = [2:0.01:3];		# Time horizon
  A_w = 0;
  A_u = diag([0  -6]);
  A_u = ppp_aug(A_u,laguerre_matrix(n_extra,1/T_extra))
  Q = 1;
  ## Constraints
  Gamma = [];
  gamma = [];

  ## Constraints - u
  Tau_u = [0 0.1 0.5 1 1.5 2];
  Tau_u = 0;
  one = ones(size(Tau_u));
  limit = 1.5;
  Min_u = -limit*one;
  Max_u =  limit*one;
  Order_u = 0*one;

  ## Constraints - y
  Tau_y = [];
  one = ones(size(Tau_y));
  limit = 1.5; 
  Min_y = -limit*one;
  Max_y =  limit*one;
  Order_y = 0*one;

  ## Simulation
  W=1;
  x_0 = zeros(n_x,1);

  ## Constrained - open-loop
  disp("Control design");
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw] = ppp_lin  (A,B,C,D,A_u,A_w,t); # Unconstrained design
  [Gamma_u,gamma_u] = ppp_input_constraint (A_u,Tau_u,Min_u,Max_u);

  Gamma = Gamma_u;
  gamma = gamma_u;

  disp("Open-loop simulations");
  ## Constrained OL simulation
  [u,U] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma);
  T = [0:t(2)-t(1):t(length(t))];
  [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,U,T);

  ## Unconstrained OL simulation
  [uu,Uu] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,[],[]);
  [ysu,usu] = ppp_ystar (A,B,C,D,x_0,A_u,Uu,T);

  title("Constrained and unconstrained y*");
  xlabel("t");
  grid;
  plot(T,ys,T,ysu)

  ## Non-linear - closed-loop
  disp("Closed-loop simulation");
  [T1,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			   Tau_u,Min_u,Max_u,Order_u, \
			   Tau_y,Min_y,Max_y,Order_y,W,x_0);

  title("y,y*,u and u*");
  xlabel("t");
  grid;
  plot(T1,y,T,ys,T1,u,T,us);
endfunction






Deleted mttroot/mtt/lib/control/PPP/ppp_ex2.m version [163faa5b9f].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex2 (Return_Name)

  ## usage:  Name = ppp_ex2 (Return_Name)
  ##
  ## PPP example: Effect of slow desired closed-loop
  ## 	$Id$	


  ## Example name
  name = "Effect of slow desired closed-loop: closed-loop is same as open loop";

  if nargin>0
    return
  endif
  
  ## System
  A = -1;			# Fast - time constant = 1
  B = 0.5;			# Gain is 1/2
  C = 1;
  D = 0;

  ## Controller
  t =[9:0.1:10];		# Optimisation horizon

  A_u = [-0.1 0			# Slow - time constant = 10
         1 0];

  A_w = 0;			# Constant set point

  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w] = ppp_lin_plot(A,B,C,D,A_u,A_w,t)
endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex20.m version [bd637b24f5].

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
68
69
70
71
72
73









































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,ys,us,ysu,usu] = ppp_ex20 (ReturnName)

  ## usage:  ppp_ex20 ()
  ##
  ## PPP example - 2nd-order 2i2o system
  ## 	$Id$	


  ## Example name
  name = "2nd-order 2i2o system with 1st-order basis"

  if nargin>0
    return
  endif

  ## System  
  A = [-2 -1
       1   0];
  B = [[1;0], [1;2]];
  C = [ [0,1]; [2,1]];
  D = zeros(2,2);

#  sys = ss2sys(A,B,C,D);
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

#   ## Display it
#   for j = 1:n_u
#     for i = 1:n_y
#       sysout(sysprune(sys,i,j),"tf")
#       step(sysprune(sys,i,j),1,5);
#     endfor
#   endfor
  
  ## Setpoint
  A_w = 0;

  ## Controller

  ##Optimisation horizon
  t =[4:0.01:5];

  ## A_u
  pole = [3];
  poles = 1;
  A_u = ppp_aug(butterworth_matrix(poles,pole),0);
  Q = ones(n_y,1);;

  ## Setpoints
  W = [1:n_y]';

  ## Design and plot
  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w,cond_uu] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W);

  format bank
  cl_poles

  A_c = A-B*k_x;			# Closed-loop A
  A_cw = [A_c B*k_w*W
          zeros(1,n_x+1)]

  log_cond_uu = log10(cond_uu)
				#  K_xwe = ppp_open2closed(A_u,A_cwe,[k_xe -k_we*W]); # Exact Kx
#  K_xwc = ppp_open2closed(A_u,A_cw,[k_x -k_w*W]); # Computed Kx
				#  Exact_K_xw = K_xwe
  PPP_K_xw = [K_x -K_w*W] 
#  Comp_K_xw = K_xwc

#  Error = Approx_K_xw - Comp_K_xw

endfunction



Deleted mttroot/mtt/lib/control/PPP/ppp_ex20.new.m version [fd66e71f1b].

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
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




























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# function name = ppp_ex20 (ReturnName)

#   ## usage:  name = ppp_ex20 (ReturnName)
#   ##
#   ## PPP example -- a standard multivariable example
#   ## 	$Id$	



#   ## Example name
#   name = "Turbogenerator example:  system TGEN from J.M Maciejowski: Multivariable Feedback Design";

#   if nargin>0
#     return
#   endif
  
  ## System
  [A,B,C,D] = airc;
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = [9:0.1:10];		# Time horizon
  A_w = zeros(n_y,1);		# Setpoint
  TC = 2*[1 1];		# Time constants for each input
 #  A_u = [];
#   for tc=TC			# Input
#     A_u = [A_u;ppp_aug(laguerre_matrix(3,1/tc), 0)];
#   endfor
 A_u =  ppp_aug(laguerre_matrix(5,1.0), 0);
 Q = [1;1];		# Output weightings

  ## Constraints
  Gamma = [];
  gamma = [];

  ## Constraints - u
  Tau_u = [0 0.1 0.5 1 1.5 2];
  Tau_u = 0;
  one = ones(size(Tau_u));
  limit = 1.5;
  Min_u = -limit*one;
  Max_u =  limit*one;
  Order_u = 0*one;

  ## Constraints - y
  Tau_y = [];
  one = ones(size(Tau_y));
  limit = 1.5; 
  Min_y = -limit*one;
  Max_y =  limit*one;
  Order_y = 0*one;

  ## Simulation
  W=[1;2;3];
  x_0 = zeros(n_x,1);

  ## Constrained - open-loop
  disp("Control design");
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw] = ppp_lin  (A,B,C,D,A_u,A_w,t); # Unconstrained design
  [Gamma_u,gamma_u] = ppp_input_constraint (A_u,Tau_u,Min_u,Max_u);

  Gamma = Gamma_u;
  gamma = gamma_u;

  disp("Open-loop simulations");
  ## Constrained OL simulation
  [u,U] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma);
  T = [0:t(2)-t(1):t(length(t))];
  [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,U,T);

  ## Unconstrained OL simulation
  [uu,Uu] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,[],[]);
  [ysu,usu] = ppp_ystar (A,B,C,D,x_0,A_u,Uu,T);

  title("Constrained and unconstrained y*");
  xlabel("t");
  grid;
  plot(T,ys,T,ysu)

  ## Non-linear - closed-loop
  disp("Closed-loop simulation");
  [T1,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, \
			   Tau_u,Min_u,Max_u,Order_u, \
			   Tau_y,Min_y,Max_y,Order_y,W,x_0);

  title("y,y*,u and u*");
  xlabel("t");
  grid;
  plot(T1,y,T,ys,T1,u,T,us);


#endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex21.m version [0b03160976].

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
68
69
70
71
72
73
74
75
76












































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,ys,us,ysu,usu] = ppp_ex21 (ReturnName)

  ## usage:  ppp_ex21 ()
  ##
  ## PPP example - 2nd-order 2i2o system system with anomalous behaviour"
  ## 	$Id$	


  ## Example name
  name = "2nd-order 2i2o system with anomalous behaviour"

  if nargin>0
    return
  endif

  ## System  
  A = [-2 -1
       1   0];
  B = [[1;0], [1;2]];
  C = [ [0,1]; [2,1]];
  D = zeros(2,2);

  sys = ss2sys(A,B,C,D);
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  ## Display it
  for j = 1:n_u
    for i = 1:n_y
      sysout(sysprune(sys,i,j),"tf")
      step(sysprune(sys,i,j),1,5);
    endfor
  endfor
  
  ## Setpoint
  A_w = 0;

  ## Controller

  ##Optimisation horizon
  t =[4:0.1:5];

  ## A_u
  pole = [4];
				#A_u = ppp_aug(laguerre_matrix(2,pole),0);
				#A_u = ppp_aug(diag([-3,-4]),0);
  A_u = ppp_aug(butterworth_matrix(2,pole),0);
  Q = ones(n_y,1);;

  ## Setpoints
  W = [1:n_y]';

  ## Initial condition
  x_0 = [0;0.5];

  ## Design and plot
  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w,cond_uu] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W,x_0);

  format short
  cl_poles

  A_c = A-B*k_x;			# Closed-loop A
  A_cw = [A_c B*k_w*W
          zeros(1,n_x+1)]

  log_cond_uu = log10(cond_uu)
				#  K_xwe = ppp_open2closed(A_u,A_cwe,[k_xe -k_we*W]); # Exact Kx
				#AA_u = ppp_inflate([A_u;A_u]);
  K_xwc = ppp_open2closed(A_u,A_cw,[k_x -k_w*W]) # Computed Kx
				#  Exact_K_xw = K_xwe
  Approx_K_xw = [K_x -K_w*W] 
  format

endfunction



Deleted mttroot/mtt/lib/control/PPP/ppp_ex3.m version [c1cd799f6a].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex3 (Return_Name)

  ## usage:  Name = ppp_ex3 (Return_Name)
  ##
  ## PPP example: Uncoupled 5x5 system
  ##  	$Id$	




  ## Example name
  name = "Uncoupled NxN system - n first order systems";

  if nargin>0
    return
  endif
  
  ## System - N uncoupled integrators
  N = 3
  A = -0.0*eye(N);
  B = eye(N);
  C = eye(N);
  D = zeros(N,N);

  t =[4:0.1:5];			# Optimisation horizon
  ## Create composite matrices
  A_u = [];			# Initialise
  A_w = [];			# Initialise

  for i=1:N			
    ## Setpoint - constant
    a_w = ppp_aug(0,[]);
    A_w = [A_w;a_w];

    ## Controller
    a_u = ppp_aug(-i,a_w);
    A_u = [A_u; a_u];
 endfor
  
  A_u = [-diag([1:N])]

  Q = ones(N,1);		# Equal output weightings
  W = ones(N,1);		# Setpoints are all unity

  ## Design and simulate
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u] = ppp_lin(A,B,C,D,A_u,A_w,t);
  # [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w] = \
  #     ppp_lin_plot(A,B,C,D,A_u,A_w,t,Q,W);

  Approximate_K_x = K_x#(1:2:2*N,:)
  A_c = A-B*k_x;
  Closed_Loop_Poles = eig(A-B*k_x)
  ## Now try out the open/closed loop theory
#   A_u = -diag(1:N);		# Full A_u matrix
#   A_c = -diag(1:N);		# Ideal closed-loop
#   k_x = diag(1:N);		# Ideal feedback
  KK = ppp_open2closed (ppp_inflate(A_u),A_c,k_x);
  Exact_K_x_tilde = KK
  

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex4.m version [f6af77ca79].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex4 (ReturnName)

  ## usage:  ppp_ex4 ()
  ##
  ## PPP example -- a 1i2o system with performance limitations
  ## 	$Id$	



  ## Example name
  name = "Resonant system (1i2o): illustrates performance limitations with 2 different time-constants";

  if nargin>0
    return
  endif
  

  ##  Mass- sping damper from Middleton et al EE9908

  ## Set parameters to unity
  m_1 = 1;		
  m_2 = 1;
  k = 1;

  ## System
  [A,B,C,D] = TwoMassSpring (k,m_1,m_2);

  for TC = [0.4 1]
    disp(sprintf("\nClosed-loop time constant = %1.1f\n",TC));
    ## Controller
    A_w = zeros(2,1);	# Setpoint: Unit W* for each output
    t =[11:0.1:12];			# Optimisation horizon
    [A_u] = ppp_aug(laguerre_matrix(4,1/TC), 0);	# U*

    Q = [1;0];

    ## Design and plot
    [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q)
    hold on;
  endfor

  hold off;
endfunction




Deleted mttroot/mtt/lib/control/PPP/ppp_ex5.m version [eab12a6897].

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


























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex5 (ReturnName)

  ## usage:  ppp_ex5 (ReturnName)
  ##
  ## PPP example -- a 28-state vibrating beam system
  ## 	$Id$	


  ## Example name
  name = "Vibrating beam: 14 state regulation problem with 7 beam velocities as output";

  if nargin>0
    return
  endif
  
  
  ## System - beam
  Beam_numpar;
  [A,B,C,D]=Beam_sm;
  
  ## Redo C and D to reveal ALL velocities
  c = C(1);
  C = zeros(7,14);
  for i = 1:7
    C(i,2*i-1) = c;
  endfor
  D = zeros(7,1);

  e = eig(A);			# Eigenvalues
  N = length(e);
  frequencies = sort(imag(e));
  frequencies = frequencies(N/2+1:N); # Modal frequencies

  ## Controller
  ## Controller design parameters
  t = [0.4:0.01:0.5];		# Optimisation horizon

  Q = ones(7,1); 

  ## Specify input basis functions 
  ##  - damped sinusoids with same frequencies as beam
  damping_ratio = 0.2;		# Damping ratio of inputs
  A_u = damped_matrix(frequencies,0.2*ones(size(frequencies)));
  u_0 = ones(14,1);		# Initial conditions

  A_w = zeros(7,1);		# Setpoint
  W =  zeros(7,1);		# Zero setpoint

  ## Set up an "typical" initial condition
  x_0 = zeros(14,1);
  x_0(2:2:14) = ones(1,7);	# Set initial twist to 1.

  ## Simulation
  [ol_poles,cl_poles] =  ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W,x_0);

  

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex6.m version [ba0ffb029f].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [name,T,y,u,J] = ppp_ex6 (ReturnName)

  ## usage:  [name,T,y,u,J] = ppp_ex6 (ReturnName)
  ##
  ## PPP example -- PPP for redundant actuation
  ## 	$Id$	


  ## Example name
  name = "Two input-one output system with input constraints";

  if nargin>0
    return
  endif
  
  ## System
  A = 0;
  B = [0.5 1];
  C = 1;
  D = [0 0];
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = [4:0.1:5];		# Time horizon
  A_w = 0;			# Setpoint
  A_u = [-2;-0.5];		# Input
  Q = 1;			# Output weight

  ## Constrain  input 1 at time tau=0
  Tau = 0;
  Max = 1;
  Min = -Max;
  Order = 0;
  i_u = 1;
  
  ## Simulation
  W=1;
  x_0 = 0;

  ## Linear
  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,t);
  
  ## Non-linear
  movie = 0;
  [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, Tau,Min,Max,Order, \
	      [],[],[],[], W,x_0);
  title("y,u_1,u_2");
  xlabel("t");
  grid;
  plot(T,y,T,u);

endfunction



Deleted mttroot/mtt/lib/control/PPP/ppp_ex7.m version [20afb5cf0e].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex7 (ReturnName)

  ## usage:  name = ppp_ex7 (ReturnName)
  ##
  ## PPP example -- standard multivariable system
  ## 	$Id$	


  ## Example name
  name = "Aircraft example:  system AIRC from J.M Maciejowski: Multivariable Feedback Design";

  if nargin>0
    return
  endif
  
  ## System
  [A,B,C,D] = airc;
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = [4:0.01:5];		# Time horizon
  A_w = 0;		# Setpoint (same for each input)
  #A_u = ppp_aug(laguerre_matrix(5,1), 0) # Same for each input 
  A_u = laguerre_matrix(5,1); # Same for each input 
  Q = ones(3,1);		# Output weightings
  ## Design and plot
  W = [1;2;3]
  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W);
   cl_poles

  ## Try open-closed theory but using computed values:
  A_c = A - B*k_x; eig(A_c)
  K_x
  KK = ppp_open2closed (A_u,A_c,k_x)

  100*((KK-K_x)./KK)
endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex8.m version [d3d175c796].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex8 (ReturnName)

  ## usage:  name = ppp_ex8 (ReturnName)
  ##
  ## PPP example - standard multivariable example
  ## 	$Id$	

  ## Example name
  name = "Automotive gas turbine example:  system AUTM from J.M Maciejowski: Multivariable Feedback Design";

  if nargin>0
    return
  endif
  
  ## System
  [A,B,C,D] = autm;
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = [4:0.1:5];		# Time horizon
  A_w = 0;			# Setpoint
  A_u = ppp_aug(laguerre_matrix(4,2.0), 0) # Input
  Q = [1;1e3];		# Output weightings

  ## Design and plot
  W = [1;2]
  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W);

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ex9.m version [c71a52df94].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function name = ppp_ex9 (ReturnName)

  ## usage:  name = ppp_ex9 (ReturnName)
  ##
  ## PPP example -- a standard multivariable example
  ## 	$Id$	



  ## Example name
  name = "Turbogenerator example:  system TGEN from J.M Maciejowski: Multivariable Feedback Design";

  if nargin>0
    return
  endif
  
  ## System
  [A,B,C,D] = tgen;
  [n_x,n_u,n_y] = abcddim(A,B,C,D)

  ## Controller
  t = [1.0:0.01:2.0];		# Time horizon
#   A_w = zeros(n_y,1);		# Setpoint
#   TC = 2*[1 1];		# Time constants for each input
#   A_u = [];
#   for tc=TC			# Input
#     A_u = [A_u;ppp_aug(laguerre_matrix(3,1/tc), 0)];
#   endfor
  A_w = 0;
  A_u = ppp_aug(ppp_aug(laguerre_matrix(2,1.0),laguerre_matrix(2,2.0)), A_w)
  Q = [1;1];		# Output weightings

  ## Design and plot
  W = [1;2]
  [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W);

#   ol_poles, cl_poles
#   k_x,k_w
#   K_X = [K_x -K_w]
#   A_c = A - B*k_x;
#   K_X_comp = ppp_open2closed (A_u,[A_c B*k_w*W; zeros(1,n_x+1)],[k_x -k_w*W])
endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_examples.m version [e27b26eff0].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function ppp_examples ()

  ## usage:  ppp_examples ()
  ##
  ## Various menu-driven PPP examples


  str="menu(""Predictive Pole-Placement (PPP) examples"",""Exit"",""All examples"; # Menu string

  used = 2;
  option=used;  

  while option>1

    exists=1; 
    i_example=1;		# Example counter
    while exists
      name=sprintf("ppp_ex%i",i_example);
      exists=(exist(name)==2);
      if exists
	title = eval(sprintf("%s(1);", name)); 
	str = sprintf("%s"",""%s",str,title);
	i_example++;
      endif
    endwhile
    n_examples = i_example-1;

    str = sprintf("%s"" );\n",str);

    option=eval(str);		# Menu - ask user

    if option>1			# Do something - else return
      if option==2		# All examples
	Examples=1:n_examples;
      else			# Just the chosen examples
	Examples = option-used;
      endif
      for example=Examples	# Do the chosen examples
	eval(sprintf("Title = ppp_ex%i(1);",example));
	disp(sprintf("Evaluating example ppp_ex%i:\n\t %s\n", example, Title));
	eval(sprintf("ppp_ex%i;",example));
      endfor
    endif
    
    
  endwhile

endfunction






Deleted mttroot/mtt/lib/control/PPP/ppp_extract.m version [b84460c15f].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function A_i = ppp_extract (A_u,input)

  ## usage:  A_i = ppp_extract (A_u)
  ##
  ## Extracts the ith A_u matrix.

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	

  [n,m] = size(A_u);		# Size of composite A_u matrix
  square = (n==m);		# Its a square matrix so same U* on each input
  if square
    A_i = A_u;			# All a_u the same
  else
    N = m;			# Number of U* functions per input  
    n_u = n/m;
    if floor(n_u) != n_u	# Check that n_u is an integer
      error("A_u must be square or be a column of square matrices");
    endif
    
    if input>n_u
      error("Input index too large");
    endif
    
    ## Extract the ith matrix
    start = (input-1)*N;
    range=(start+1:start+N);
    A_i = A_u(range,:);
  endif

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_identify.m version [fae8c72792].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [par,Par,Error,Y] = ppp_identify (system_name,u,y_0,par_names,par_0,extras)
  ## ppp_identify: System identification for PPP
  ## usage:  [par,Par,Error,Y] = ppp_identify(system_name,u,y_0,par_names,par_0,extras)
  ##
  ##  system_name     String containing system name
  ##  u               System input (column vector, each row is u')
  ##  y_0             Desired model output
  ##  par_names       Column vector of (padded) strings - the adjustable
  ##                  parameter names
  ##  par_0           Initial parameter vector estimate
  ##  extras (opt)    optimisation parameters
  ##        .criterion convergence criterion
  ##        .max_iterations limit to number of iterations
  ##        .v  Initial Levenberg-Marquardt parameter

  
  if nargin<6
    extras.criterion = 1e-5;
    extras.max_iterations = 10;
    extras.v = 1e-5;
    extras.verbose = 0;
  endif  

  s_system_name = sprintf("s%s", system_name); # Name of sensitivity system

  ## Set up parameters
  sim = eval([s_system_name, "_simpar;"]); # Simulation parameter
  sym = eval([s_system_name, "_sympar;"]); # Parameter names
  x0  = eval([s_system_name, "_state(par_0);"]); # Initial state

#   ## Set up the free parameter list
#   free = [];
#   [n,m] = size(par_names);
#   for i = 1:n
#     p_name = deblank(par_names(i,:));
#     s_name = sprintf("%ss", p_name);
#     if struct_contains(sym, p_name)
#       i_p = eval(sprintf("sym.%s;", p_name));
#       if struct_contains(sym, s_name)
# 	i_s = eval(sprintf("sym.%s;", s_name));
# 	free_i = eval(sprintf("[%i,%i];", i_p, i_s));
# 	free = [free; free_i];
#       else
# 	printf("Sensitivity parameter %s does not exist: ignoring \
# 	parameter %s\n", s_name, p_name);
#       endif
#     else
#       printf("Parameter %s does not exist: ignoring\n", p_name)
#     endif
#   endfor
#   free
  free = ppp_indices(par_names,sym);
  [par,Par,Error,Y] = ppp_optimise(s_system_name,x0,par_0,sim,u,y_0,free,extras);

endfunction







Deleted mttroot/mtt/lib/control/PPP/ppp_indices.m version [83cf0feda3].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function indices = ppp_indices (names,sympar)

  ## usage:  indices = ppp_indices (names,sympar)
  ##
  ## names: column vector of component names
  ## sympar: mtt-generated data structure od symbolic parameters


  ## Set up the
  indices = [];
  [n,m] = size(names);
  for i = 1:n
    p_name = deblank(names(i,:));
    s_name = sprintf("%ss", p_name);
    if struct_contains(sympar, p_name)
      i_p = eval(sprintf("sympar.%s;", p_name));
      if struct_contains(sympar, s_name)
	i_s = eval(sprintf("sympar.%s;", s_name));
	indices_i = eval(sprintf("[%i,%i];", i_p, i_s));
	indices = [indices; indices_i];
      else
	printf("Sensitivity parameter %s does not exist: ignoring \
	parameter %s\n", s_name, p_name);
      endif
    else
      printf("Parameter %s does not exist: ignoring\n", p_name)
    endif
  endfor
  

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_inflate.m version [7743bb793c].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function A_m = ppp_inflate (A_v)

  ## usage:  A_m = ppp_inflate (A_v)
  ##
  ## Creates the square matrix A_m with the matrix elements of the column
  ## vector of square matrices A_v.

  ## Copyright (C) 2001 by Peter J. Gawthrop

  [N,M] = size(A_v);

  if N<M
    error("A_v must have at least as many rows as columns");
  endif
  
  n = N/M;			# Number of matrix elements in A_v

  if round(n)<>n
    error("A_v must be a column vector of square matrices");
  endif
  
  A_m = [];
  for i = 1:n
    A_m = ppp_aug(A_m,ppp_extract(A_v,i));
  endfor

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_input_constraint.m version [7527131a2c].

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
68
69
70
71







































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Gamma,gamma] = ppp_input_constraint (A_u,Tau,Min,Max,Order,i_u,n_u)

  ## usage:  [Gamma,gamma] = ppp_input_constraint (A_u,Tau,Min,Max,Order)
  ##
  ## Derives the input constraint matrices Gamma and gamma
  ## For Constraints Min and max at times Tau 
  ## Order=0 - input constraints
  ## Order=1 - input derivative constraints
  ## etc
  ## i_u: Integer index of the input to be constrained
  ## n_u: Number of inputs
  ## NOTE You can stack up Gamma and gamma matrices for create multi-input constraints.

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	


  ## Sizes
  [n_U,m_U] = size(A_u);	# Number of basis functions
  [n,N_t] = size(Tau);		# Number of constraint times
  
  ## Defaults
  if nargin<5
    Order = zeros(1,N_t);
  endif

  if nargin<6
    i_u = 1;
    n_u = 1;
  endif
  
  if N_t==0			# Nothing to be done
    Gamma = [];
    gamma = [];
    return
  endif
  
  if n != 1
    error("Tau must be a row vector");
  endif
  
  n = length(Min);
  m = length(Max);
  o = length(Order);

  if (n != N_t)||(m != N_t)||(o != N_t)
    error("Tau, Min and max must be the same length");
  endif
  
  ## Extract the A_i matrix for this input
  A_i = ppp_extract(A_u,i_u);

  ## Create the constraints in the form: Gamma*U < gamma
  Gamma = [];
  gamma = [];
  one = ones(m_U,1);
  i=0;

  zero_l = zeros(1,(i_u-1)*m_U); # Pad left-hand
  zero_r = zeros(1,(n_u-i_u)*m_U); # Pad right-hand
  for tau = Tau			# Stack constraints for each tau
    i++;
    Gamma_tau = ( A_i^Order(i) * expm(A_i*tau) * one )';
    Gamma_tau = [ zero_l Gamma_tau zero_r ]; # Only for i_uth input
    Gamma = [Gamma;[-1;1]*Gamma_tau]; # One row for each of min and max

    gamma_tau = [-Min(i);Max(i)];
    gamma = [gamma;gamma_tau];
  endfor

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_lin.m version [342b9867d7].

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
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
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
173
174
175
176
177
178
179
180
181
182






















































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u,cond_uu] = ppp_lin(A,B,C,D,A_u,A_w,tau,Q,max_cond);
  ## usage:   [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u,cond_uu] = ppp_lin(A,B,C,D,A_u,A_w,tau,Q,max_cond)
  ##
  ## Linear PPP (Predictive pole-placement) computation 
  ## INPUTS:
  ## A,B,C,D: system matrices
  ## A_u: composite system matrix for U* generation 
  ##      one square matrix (A_ui) row for each system input
  ##      each A_ui generates U*' for ith system input.
  ## OR
  ## A_u: square system matrix for U* generation 
  ##      same square matrix for each system input.
  ## A_w: composite system matrix for W* generation 
  ##      one square matrix (A_wi) row for each system output
  ##      each A_wi generates W*' for ith system output.
  ## t: row vector of times for optimisation (equispaced in time)
  ## Q column vector of output weights (defaults to unity)
  ## OR
  ## Q matrix,  each row corresponds to time-varying weight compatible with t
  ## max_cond: Maximum condition number of J_uu (def 1/eps)
  ## OUTPUTS:
  ## k_x: State feedback gain
  ## k_w: setpoint gain
  ## ie u(t) = k_w w(t) - k_x x(t)
  ## K_x, K_w: open loop gains
  ## Us0: Value of U* at tau=0
  ## J_uu, J_ux, J_uw, J_xx,J_xw,J_ww: cost derivatives
  ## cond_uu : Condition number of J_uu
  ## Copyright (C) 1999, 2000 by Peter J. Gawthrop
  ## 	$Id$	

  ## Check some dimensions
  [n_x,n_u,n_y] = abcddim(A,B,C,D);
  if (n_x==-1)
    return
  endif

  ## Default Q
  if nargin<8
    Q = ones(n_y,1);
  endif

  ## Default order
  if nargin<9
    max_cond = 1e20;
  endif
  
  [n_U,m_U] = size(A_u);
  if (n_U != n_u*m_U)&&(n_U != m_U)
    error("A_u must be square or have N_u rows and N_u/n_u columns");
  endif

  if (n_U == m_U)		# U matrix square
    n_U = n_U*n_u;		# So same U* on each input
  endif

  
  [n_W,m_W] = size(A_w);
  if n_W>0
    if (n_W != n_y*m_W)&&(n_W != m_W)
      error("A_w must either be square or have N_w rows and N_w/n_y columns");
    endif
    square_W = (n_W== m_W);	# Flag indicates W is square
    if (n_W == m_W)		# W matrix square
      n_W = n_W*n_y;		# So same W* on each output
    endif
  endif
  

  [n_t,m_t] = size(tau);
  if n_t != 1
    error("tau must be a row vector");
  endif

  [n_Q,m_Q] = size(Q);
  if ((m_Q != 1)&&(m_Q != m_t)) || (n_Q != n_y)
    error("Q must be a column vector with one row per system output");
  endif

  if (m_Q == 1)			# Convert to vector Q(i)
    Q = Q*ones(1,m_t);		# Extend to cover full range of tau
  endif
  
  ##Set up initial states
  u_0 = ones(m_U,1);
  w_0 = ones(m_W,1);

  ## Find y_U - derivative of y* wrt U.
  i_U = 0;
  x_0 = zeros(n_x,1);		# This is for x=0
  y_u = [];			# Initialise
  Us = [];			# Initialise
  for i=1:n_U			# Do for each input function U*_i
    dU = zeros(n_U,1);
    dU(++i_U) = 1;		# Create dU/dU_i 
    [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,dU,tau); # Find ystar and ustar
    y_u = [y_u ys'];		# Save y_u (y for input u)  with one row for each t.
    Us = [Us us'];		# Save u (input)  with one row for each t.
  endfor

  Ws = [];			# Initialise
  if n_W>0
    ## Find w*
    i_W = 0;
    x_0 = zeros(n_x,1);		# This is for x=0
    for i=1:n_W			# Do for each setpoint function W*i
      dW = zeros(n_W,1);
      dW(++i_W) = 1;		# Create dW/dW_i 
      [ys,ws] = ppp_ystar ([],[],[],[],[],A_w,dW,tau); # Find ystar and ustar
      Ws = [Ws ws'];		# Save u (input)  with one row for each t.
    endfor
  endif
  


  ## Find y_x - derivative of y* wrt x.
  y_x=[];
  for t_i=tau
    y = C*expm(A*t_i);
    yy = reshape(y,1,n_y*n_x);	# Reshape to a row vector
    y_x = [y_x; yy];
  endfor

  ## Compute the integrals to give cost function derivatives
  [n_yu m] = size(y_u');
  [n_yx m] = size(y_x');
  [n_yw m] = size(Ws');

  J_uu = zeros(n_U,n_U);
  J_ux = zeros(n_U,n_x);
  J_uw = zeros(n_U,n_W);
  J_xx = zeros(n_x,n_x);
  J_xw = zeros(n_x,n_W);
  J_ww = zeros(n_W,n_W);

  ## Add up cost derivatives for each output but weighted by Q.
  ## Scaled by time interval
  ## y_u,y_x and Ws should really be 3D matrices, but instead are stored
  ## with one row for each time and one vector (size n_y) column for
  ## each element of U

  ## Scale Q
  Q = Q/m_t;			# Scale by T/dt = number of points
  ## Non-w bits
  for i = 1:n_y			# For each output
    QQ = ones(n_U,1)*Q(i,:);	# Resize Q
    J_uu = J_uu + (QQ .* y_u(:,i:n_y:n_yu)') * y_u(:,i:n_y:n_yu);
    J_ux = J_ux + (QQ .* y_u(:,i:n_y:n_yu)') * y_x(:,i:n_y:n_yx);
    QQ = ones(n_x,1)*Q(i,:);	# Resize Q
    J_xx = J_xx + (QQ .* y_x(:,i:n_y:n_yx)') * y_x(:,i:n_y:n_yx);
  endfor

  ## Exit if badly conditioned
  cond_uu = cond(J_uu);
  if cond_uu>max_cond
    error(sprintf("J_uu is badly conditioned. Condition number = 10^%i",log10(cond_uu)));
  endif

  ## w bits
  if n_W>0
    for i = 1:n_y			# For each output
      QQ = ones(n_U,1)*Q(i,:);	# Resize Q
      J_uw = J_uw + (QQ .* y_u(:,i:n_y:n_yu)') * Ws (:,i:n_y:n_yw);
      QQ = ones(n_x,1)*Q(i,:);	# Resize Q
      J_xw = J_xw + (QQ .* y_x(:,i:n_y:n_yx)') * Ws (:,i:n_y:n_yw);
      QQ = ones(n_W,1)*Q(i,:);	# Resize Q
      J_ww = J_ww + (QQ .* Ws (:,i:n_y:n_yw)') * Ws (:,i:n_y:n_yw);
    endfor
  endif

  ## Compute the open-loop gains
  K_w = J_uu\J_uw;
  K_x = J_uu\J_ux;

  ## U*(tau) at tau=0 
  Us0 = ppp_ustar(A_u,n_u,0);		
  
  ## Compute the closed-loop gains
  k_x = Us0*K_x;
  k_w = Us0*K_w;

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_lin_con_sol.m version [3f791341cb].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
function U = ppp_lin_con_sol (x,w,J_uu,J_ux,J_uw)

  ## usage:  U = ppp_lin_con_sol (x,w,J_uu,J_ux,J_uw)
  ##
  ## 

  ## Pass info to the solnp algorithm
  global ppp_J_uu, ppp_J_ux, ppp_J_uw

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_lin_obs.m version [3637bc55b1].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [l_x,l_y,L_x,L_y,J_uu,J_ux,J_uw,Us0] = ppp_lin_obs (A,B,C,D,A_u,A_y,t,Q)

  ## usage:  [l_x,l_y,L_x,L_y,J_uu,J_ux,J_uw,Us0] = ppp_lin_obs  (A,B,C,D,A_u,A_y,t,Q)
  ##
  ## Linear PPP (Predictive pole-placement) computation 
  ## INPUTS:
  ## A,B,C,D: system matrices
  ## A_u: composite system matrix for U* generation 
  ##      one square matrix (A_ui) row for each system input
  ##      each A_ui generates U*' for ith system input.
  ## A_y: composite system matrix for W* generation 
  ##      one square matrix (A_yi) row for each system output
  ##      each A_yi generates W*' for ith system output.
  ## t: row vector of times for optimisation (equispaced in time)
  ## Q column vector of output weights (defaults to unity)

  ## OUTPUTS:
  ## l_x: State feedback gain
  ## l_y: setpoint gain
  ## ie u(t) = l_y w(t) - l_x x(t)
  ## L_x, L_y: open loop gains
  ## J_uu, J_ux, J_uw: cost derivatives
  ## Us0: Value of U* at tau=0

  ## Check some dimensions
  [n_x,n_u,n_y] = abcddim(A,B,C,D);
  if (n_x==-1)
    return
  endif

  ## Default Q
  if nargin<8
    Q = ones(n_y,1);
  endif
  

#   B_x = eye(n_x);		# Pseudo B
#   D_x = zeros(n_y,n_x);		# Pseudo D
  [l_x,l_y,L_x,L_y,J_uu,J_ux,J_uw,Us0] = ppp_lin(A',C',B',D',A_u',A_y',t,Q);
  
  l_x = l_x';
  l_y = l_y';
  L_x = L_x';
  L_y = L_y';
endfunction









Deleted mttroot/mtt/lib/control/PPP/ppp_lin_plot.m version [e00d3bd973].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90


























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w,cond_uu] =  ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W,x_0)

  ## usage:   [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,t,Q,W,x_0)
  ##
  ## Linear PPP (Predictive pole-placement) computation with plotting
  ## INPUTS:
  ## A,B,C,D: system matrices
  ## A_u: composite system matrix for U* generation 
  ##      one square matrix (A_ui) row for each system input
  ##      each A_ui generates U*' for ith system input.
  ## A_w: composite system matrix for W* generation 
  ##      one square matrix (A_wi) row for each system output
  ##      each A_wi generates W*' for ith system output.
  ## t: row vector of times for optimisation (equispaced in time)
  ## Q: column vector of output weights (defaults to unity)
  ## W: Constant setpoint vector (one element per output)
  ## x_0: Initial state
  ## OUTPUTS:
  ## Various poles 'n zeros
  ## k_x: State feedback gain
  ## k_w: setpoint gain
  ## ie u(t) = k_w w(t) - k_x x(t)
  ## K_x, K_w: open loop gains
  ## J_uu, J_ux, J_uw: cost derivatives

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	

  ## Some dimensions
  [n_x,n_u,n_y] = abcddim(A,B,C,D);
  [n_U,m_U]=size(A_u);
  square = (n_U==m_U);		# Its a square matrix so same U* on each input
  [n_W,m_W]=size(A_w);
  if n_W==m_W			# A_w square
    n_W = n_W*n_y;		# Total W functions
  endif
  

  [n_t,m_t] = size(t);

  ## Default Q
  if nargin<8
    Q = ones(n_y,1);
  endif

  ## Default W
  if nargin<9
    W = ones(n_W,1)
  endif

  ## Default x_0
  if nargin<10
    x_0 = zeros(n_x,1);
  endif

  ## Check some dimensions
  [n_Q,m_Q] = size(Q);
  if ((m_Q != 1)&&(m_Q != m_t)) || (n_Q != n_y)
    error("Q must be a column vector with one row per system output");
  endif

  [n,m] = size(W);
  if ((m != 1) || (n != n_W))
    error("W must be a column vector with one element per system output");
  endif

  [n,m] = size(x_0);
  if ((m != 1) || (n != n_x))
    error("x_0 must be a column vector with one element per system state");
  endif

  ## Simulate
  [y,ystar,t,k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u,cond_uu]\
      =  ppp_lin_sim(A,B,C,D,A_u,A_w,t,Q,W,x_0);

  ## Plot
  xlabel("Time"); title("y* and y"); grid;
  plot(t,ystar,t,y);

  ## Compute some pole/zero info
  cl_poles = eig(A-B*k_x)';
  ol_poles = eig(A)';

  if nargout>3
    ol_zeros = tzero(A,B,C,D)';
    cl_zeros = tzero(A-B*k_x,B,C,D)';
  endif

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_lin_sim.m version [767b01c78f].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [y,ystar,t,k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u,cond_uu] =  ppp_lin_sim(A,B,C,D,A_u,A_w,tau,Q,W,x_0)

  ## usage:   [ol_poles,cl_poles,ol_zeros,cl_zeros,k_x,k_w,K_x,K_w] = ppp_lin_plot (A,B,C,D,A_u,A_w,tau,Q,W,x_0)
  ##
  ## Linear PPP (Predictive pole-placement) computation with plotting
  ## INPUTS:
  ## A,B,C,D: system matrices
  ## A_u: composite system matrix for U* generation 
  ##      one square matrix (A_ui) row for each system input
  ##      each A_ui generates U*' for ith system input.
  ## A_w: composite system matrix for W* generation 
  ##      one square matrix (A_wi) row for each system output
  ##      each A_wi generates W*' for ith system output.
  ## tau: row vector of times for optimisation (equispaced in time)
  ## Q: column vector of output weights (defaults to unity)
  ## W: Constant setpoint vector (one element per output)
  ## x_0: Initial state
  ## OUTPUTS:
  ## y : closed-loop output
  ## ystar : open-loop moving-horizon output
  ## t : time axis

  ## Copyright (C) 2001 by Peter J. Gawthrop
  ## 	$id: ppp_lin_plot.m,v 1.13 2001/01/26 16:03:13 peterg Exp $	

  ## Some dimensions
  [n_x,n_u,n_y] = abcddim(A,B,C,D);
  [n_U,m_U]=size(A_u);
  square = (n_U==m_U);		# Its a square matrix so same U* on each input
  [n_W,m_W]=size(A_w);
  if n_W==m_W			# A_w square
    n_W = n_W*n_y;		# Total W functions
  endif
  

  [n_tau,m_tau] = size(tau);

  ## Default Q
  if nargin<8
    Q = ones(n_y,1);
  endif

  ## Default W
  if nargin<9
    W = ones(n_W,1)
  endif

  ## Default x_0
  if nargin<10
    x_0 = zeros(n_x,1);
  endif

  ## Check some dimensions
  [n_Q,m_Q] = size(Q);
  if ((m_Q != 1)&&(m_Q != m_tau)) || (n_Q != n_y)
    error("Q must be a column vector with one row per system output");
  endif

  [n,m] = size(W);
  if ((m != 1) || (n != n_W))
    error("W must be a column vector with one element per system output");
  endif

  [n,m] = size(x_0);
  if ((m != 1) || (n != n_x))
    error("x_0 must be a column vector with one element per system state");
  endif

  ## Control design
  disp("Designing controller");
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww,y_u,cond_uu] = ppp_lin  (A,B,C,D,A_u,A_w,tau,Q);

  ## Set up simulation times
  dtau = tau(2) -tau(1);		# Time increment
  t =  0:dtau:tau(length(tau));	# Time starting at zero

  ## Compute the OL step response
  disp("Computing OL response");
  U = K_w*W - K_x*x_0;
  ystar = ppp_ystar (A,B,C,D,x_0,A_u,U,t);

  ## Compute the CL step response
  disp("Computing CL response");
  y = ppp_sm2sr(A-B*k_x, B, C, D, t, k_w*W, x_0); # Compute Closed-loop control


endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_nlin.m version [46741c2bd0].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [U, U_all, Error, Y] = ppp_nlin (system_name,x_0,par_0,sim,us,w,free,extras)

  ## usage:  [U, U_all, Error, Y] = ppp_nlin (system_name,x_0,par_0,sim,us,w,free,extras)
  ##
  ## 

   if nargin<8
     extras.criterion = 1e-8;
     extras.max_iterations = 10;
     extras.v = 0.1;
     extras.verbose = 1;
   endif

   s_system_name = sprintf("s%s", system_name); # Name of sensitivity system

   ## Details
   [n_x,n_y,n_u] = eval(sprintf("%s_def;", system_name));
   [n_tau,n_us] = size(us);

   ## Checks
   if (n_us<>n_u)
     error(sprintf("Inputs (%i) not equal to system inputs (%i)", n_us, n_u));
   endif
   
  [par,Par,Error,Y] = ppp_optimise(s_system_name,x_0,par_0,sim,us,w,free,extras);

  U = par(free(:,1));
  U_all = Par(free(:,1),:);
endfunction



Deleted mttroot/mtt/lib/control/PPP/ppp_nlin_sim.m version [26d1c64307].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198






































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [y,x,u,t,p,UU,UU_c,UU_l,t_ppp,t_est] = ppp_nlin_sim (system_name,i_ppp,i_par,A_u,w_s,N_ol,extras)

  ## usage: [y,x,u,t,p,UU,UU_c,UU_l,t_ppp,t_est] = ppp_nlin_sim (system_name,i_ppp,i_par,A_u,w_s,N_ol,extras) 
  ##
  ## 
  
  ## Simulate nonlinear PPP
  ## Copyright (C) 2000 by Peter J. Gawthrop

  ## Defaults
  if nargin<7
    extras.U_initial = "zero";
    extras.U_next = "continuation";
    extras.criterion = 1e-5;
    extras.max_iterations = 10;
    extras.v = 0.1;
    extras.verbose = 0;
    extras.estimate = 1;
  endif
  
  

  ## Names
  s_system_name = sprintf("s%s", system_name);

  ## System details -- defines simulation within ol interval
  par = eval(sprintf("%s_numpar;", system_name));
  simpar = eval(sprintf("%s_simpar;", system_name));
  x_0 = eval(sprintf("%s_state(par);", system_name));
  [n_x,n_y,n_u] = eval(sprintf("%s_def;", system_name));

  ## Sensitivity system details -- defines moving horizon simulation
  simpars = eval(sprintf("%s_simpar;", s_system_name));
  pars = eval(sprintf("%s_numpar;", s_system_name));

  ## Times
  ## -- within opt horizon
  n_Tau = round(simpars.last/simpars.dt);
  dtau = simpars.dt;
  Tau = [0:n_Tau-1]'*dtau;
  [n_tau,n_w] = size(w_s);
  tau = Tau(n_Tau-n_tau+1:n_Tau);
  w = w_s(length(w_s));		# Final value of setpoint

  ## -- within ol interval
  n_t = round(simpar.last/simpar.dt);
  dt = simpar.dt;
  t_ol = [0:n_t-1]'*dt;
  T_ol = n_t*dt;

  ## Create input basis functions
  [n_U,junk] = size(A_u);

  ## For moving horizon
  eA = expm(A_u*dtau);
  u_star_i = ones(n_U,1);
  u_star_tau = [];
  for i = 1:n_Tau
    u_star_tau = [u_star_tau; u_star_i'];
    u_star_i = eA*u_star_i;
  endfor

  ## and for actual implementation
  eA = expm(A_u*dt);
  u_star_i = ones(n_U,1);
  u_star_t = [];
  for i = 1:n_t
    u_star_t = [u_star_t; u_star_i'];
    u_star_i = eA*u_star_i;
  endfor
  
  if extras.verbose
    title("U*(tau)")
    xlabel("tau");
    plot(Tau,u_star_tau)
    title("U*(t)")
    xlabel("t_ol");
    plot(t_ol,u_star_t)
  endif
  

  ## Check number of inputs adjust if necessary
  if n_u>n_U
    disp(sprintf("Augmenting inputs with %i zeros", n_u-n_U));
    u_star_tau = [u_star_tau; zeros(n_u-n_U, n_Tau)];
    u_star_t   = [u_star_t; zeros(n_u-n_U, n_t)];
  endif
  
  if n_u<n_U
    error(sprintf("n_U (%i) must be less than or equal to n_u (%i)", \
		  n_U, n_u));
  endif
  
  ## Compute linear gains 
  [A,B,C,D] = eval(sprintf("%s_sm(par);", system_name));
  B = B(:,1); D = D(:,1);
  [k_x,k_w,K_x,K_w] = ppp_lin(A,B,C,D,A_u,0,tau');

  ## Main simulation loop
  y = [];
  x = [];
  u = [];
  t = [];

  p = [];

  t_last = 0;
  UU = [];
  UU_l =[];
  UU_c =[];
  
  t_ppp = [];
  t_est = [];

  x_0s = zeros(2*n_x,1);

  if  strcmp(extras.U_initial,"linear")
    U = K_w*w - K_x*x_0;
  elseif strcmp(extras.U_initial,"zero")
    U = zeros(n_U,1);
  else
    error(sprintf("extras.U_initial = \"%s\" is invalid", extras.U_initial));
  endif

  ## Reverse time to get "previous" U
  U = expm(-A_u*T_ol)*U;

  for i = 1:N_ol		# Main loop 
    ## Compute initial U from linear case
    U_l = K_w*w - K_x*x_0;

    ## Compute initial U  for next time from continuation trajectory
    U_c = expm(A_u*T_ol)*U;

    ## Create sensitivity system state
    x_0s(1:2:2*n_x) = x_0;
    
    ## Set next U (initial value for optimisation)
    if  strcmp(extras.U_next,"linear")
      U = U_l;
    elseif strcmp(extras.U_next,"continuation")
      U = U_c;
    elseif strcmp(extras.U_next,"zero")
      U = zeros(n_U,1);
    else
      error(sprintf("extras.U_next = \"%s\" is invalid", extras.U_next));
    endif
    pars(i_ppp(:,1)) = U;	# Put initial value of U into the parameter vector

    ## Compute U by optimisation
    tick = time;
    if extras.max_iterations>0
      [U, U_all, Error, Y] = ppp_nlin(system_name,x_0s,pars,simpars,u_star_tau,w_s,i_ppp,extras);
      pars(i_ppp(:,1)) = U;	# Put final value of U into the parameter vector
    else
      Error = [];
    endif
    ppp_time = time-tick;  
    t_ppp = [t_ppp;ppp_time];
    
    ## Generate control
    u_ol = u_star_t*U;		# Not used - just for show

    ## Simulate system over one ol interval
    par(i_ppp(:,3)) = pars(i_ppp(:,1)); # Update the simulation ppp weights
    [y_ol,x_ol] = eval(sprintf("%s_sim(x_0, par, simpar, u_star_t);", system_name));


    ## Tune parameters/states
    if (extras.estimate==1)
      tick = time;
      par_est = pars(i_par(:,1));
      p = [p; par_est'];
      pars = ppp_optimise(s_system_name,x_0s,pars,simpar,u_star_t,y_ol,i_par,extras);
      est_time = time-tick;  
      t_est = [t_est;est_time];
    endif

    x_0  = x_ol(n_t+1,:)';	# Extract state for next time
    y_ol = y_ol(1:n_t,:);	# Avoid extra points due to rounding error 
    x_ol = x_ol(1:n_t,:);	# Avoid extra points due to rounding error 
    
    
    y = [y; y_ol];
    x = [x; x_ol];
    u = [u; u_ol];

    UU = [UU; U'];
    UU_l = [UU_l; U_l'];
    UU_c = [UU_c; U_c'];

    t = [t; t_ol+t_last*ones(n_t,1) ];
    t_last = t_last + T_ol; 


  endfor

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_open2closed.m version [f6b3aefde7].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83



















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [K_x T] = ppp_open2closed (A_u,A_c,k_x,x_0);

  ## usage:  [K_x T] = ppp_open2closed (A_u,A_c,k_x,x_0);
  ## K_x is the open-loop matrix as in U = K_w W - K_x x
  ## Note that K_x is a column vector of matrices - one matrix per input.
  ## T is the transformation matrix: x = T*Ustar; A_c = T*A_u*T^-1; U = (k_x*T)'
  ## A_u: The control basis-function matrix
  ## Us0: The initial value of Ustar
  ## A_c: closed-loop system matrix
  ## k_x: closed-loop feedback gain
  ## x_0: initial state

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	


  ## Check sizes
  n_o = is_square(A_u);
  n_c = is_square(A_c);

  if (n_o==0)||(n_c==0)||(n_o<>n_c)
    error("A_u and A_c must be square and of the same dimension");
  endif

  [n_u,n_x] = size(k_x);

  ## Defaults
  if nargin<4
    x_0 = zeros(n_c,1);
  endif

  ## Create U*(0)
  ##Us0  = ppp_ustar(A_u,n_u);
  Us0 = ones(1,n_o);

  ## Decompose A_u and Us0 into two bits:
  if n_o==n_c
    A_w = [];
    u_0 = Us0(1:n_c)';		# Assume same Us0 on each input
  else
    A_w = A_u(n_c+1:n_o, n_c+1:n_o)
    A_u = A_u(1:n_c, 1:n_c)
    U_w = Us0(1,n_c+1:n_o)'
    u_0 = Us0(1:n_c)'
  endif
  
  if !is_controllable(A_u,u_0)
    error("The pair [A_u, u_0] must be controllable");
  endif

  ## Controllability matrices
  C_o = u_0;
  C_c = x_0;
  for i=1:n_c-1
    C_o = [C_o A_u^i*u_0]; 
    C_c = [C_c A_c^i*x_0];
  endfor

  ## Transformation matrix: x = T*Ustar; A_c = T*A_u*T^-1; U = (k_x*T)'
  iC_o = C_o^-1;
  T = C_c*iC_o;

  K_x = [];
  for j = 1:n_u
    ## K_j matrix
    K_j = [];
    for i=1:n_c;
      ## Create T_i = dT/dx_i
      T_i = zeros(n_c,1);
      T_i(i) = 1;
      for k=1:n_c-1;
	A_k = A_c^k;
	T_i = [T_i A_k(:,i)];
      endfor
      T_i = T_i*iC_o;
      kj = k_x(j,:);		# jth row of k_x
      K_ji = kj*T_i;		# ith row of K_j
      K_j = [K_j; K_ji];
    endfor
    K_x = [K_x; K_j'];
  endfor

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_optimise.m version [87f475bb1d].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188




























































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [par,Par,Error,Y,iterations,x] = \
      ppp_optimise(system_name,x_0,par_0,simpar,u,y_0,free,extras);
  ## Levenberg-Marquardt optimisation for PPP/MTT
  ## Usage: [par,Par,Error,Y,iterations,x] = ppp_optimise(system_name,x_0,par_0,simpar,u,y_0,free[,extras]);
  ##  system_name     String containing system name
  ##  x_0             Initial state
  ##  par_0           Initial parameter vector estimate
  ##  simpar          Simulation parameters:
  ##        .first      first time
  ##        .dt         time increment
  ##        .stepfactor Euler integration step factor
  ##  u               System input (column vector, each row is u')
  ##  y_0             Desired model output
  ##  free            one row for each adjustable parameter
  ##                  first column parameter indices
  ##                  second column corresponding sensitivity indices
  ##  extras (opt)    optimisation parameters
  ##        .criterion convergence criterion
  ##        .max_iterations limit to number of iterations
  ##        .v  Initial Levenberg-Marquardt parameter

  ###################################### 
  ##### Model Transformation Tools #####
  ######################################
  
  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.6  2001/07/03 22:59:10  gawthrop
  ## Fixed problems with argument passing for CRs
  ##
  ## Revision 1.5  2001/06/06 07:54:38  gawthrop
  ## Further fixes to make nonlinear PPP work ...
  ##
  ## Revision 1.4  2001/05/26 15:46:38  gawthrop
  ## Updated to account for new nonlinear ppp
  ##
  ## Revision 1.3  2001/04/05 11:50:12  gawthrop
  ## Tidied up documentation + verbose mode
  ##
  ## Revision 1.2  2001/04/04 08:36:25  gawthrop
  ## Restuctured to be more logical.
  ## Data is now in columns to be compatible with MTT.
  ##
  ## Revision 1.1  2000/12/28 11:58:07  peterg
  ## Put under CVS
  ##
  ###############################################################


  ## Copyright (C) 1999,2000 by Peter J. Gawthrop

  sim_command = sprintf("%s_ssim(x_0,par,simpar,u,i_s)", system_name);

  ## Extract indices
  i_t = free(:,1);		# Parameters
  i_s = free(:,2)';		# Sensitivities

  if nargin<8
    extras.criterion = 1e-5;
    extras.max_iterations = 10;
    extras.v = 1e-5;
    extras.verbose = 0;
  endif
  

  [n_data,n_y] = size(y_0);
  if n_data<n_y
    error("ppp_optimise: y_0 should be in columns, not rows")
  endif

  n_th = length(i_s);
  error_old = inf;
  error_old_old = inf;
  error = 1e50;
  reduction = inf;
  predicted_reduction = 0;
  par = par_0;
  Par = par_0;
  step = ones(n_th,1);
  Error = [];
  Y = [];
  iterations = 0;
  v = extras.v;			# Levenverg-Marquardt parameter.
  r = 1;			# Step ratio

  if extras.verbose		# Diagnostics
    printf("Iteration: %i\n", iterations);
    printf("  error:  %g\n", error);
    printf("  reduction:  %g\n", reduction);
    printf("  prediction: %g\n", predicted_reduction);
    printf("  ratio:      %g\n", r);
    printf("  L-M param:  %g\n", v);
    printf("  parameters: ");
    for i_th=1:n_th
      printf("%g ", par(i_t(i_th)));
    endfor
    printf("\n");
  endif
  
  while (abs(reduction)>extras.criterion)&&\
	(abs(error)>extras.criterion)&&\
	(iterations<extras.max_iterations)

    iterations = iterations + 1; # Increment iteration counter

    [y,y_par,x] = eval(sim_command); # Simulate
    [N_data,N_y] = size(y);

    if (N_y!=n_y)
      mess = sprintf("n_y (%i) in data not same as n_y (%i) in model", n_y,N_y);
      error(mess);
    endif
    
    ## Use the last part of the simulation to compare with data
    y = y(1+N_data-n_data:N_data,:);
    y_par = y_par(1+N_data-n_data:N_data,:);

    if extras.verbose		# Diagnostics
##      printf("y and y_0\n");
##      [y,y_0]
    endif
    
    ##Evaluate error, cost derivative J and cost second derivative JJ
    error = 0; 
    J = zeros(n_th,1);
    JJ = zeros(n_th,n_th);
    
    for i = 1:n_y
      E = y(:,i) - y_0(:,i);	#  Error in ith output
      error = error + (E'*E);	# Sum the squared error over outputs
      y_par_i = y_par(:,i:n_y:n_y*n_th); # sensitivity function (ith output)
      J  = J + y_par_i'*E;	# Jacobian
      JJ = JJ + y_par_i'*y_par_i; # Newton Euler approx Hessian
    endfor

    if iterations>1 # Adjust the Levenberg-Marquardt parameter
      reduction = error_old-error;
      predicted_reduction =  2*J'*step + step'*JJ*step;
      r = predicted_reduction/reduction;
      if (r<0.25)||(reduction<0)
	v = 4*v;
      elseif r>0.75
	v = v/2;
      endif

      if reduction<0		# Its getting worse
	par(i_t) = par(i_t) + step; # rewind parameter
	error = error_old;	# rewind error
	error_old = error_old_old; # rewind old error
	if extras.verbose
	  printf(" Rewinding ....\n");
	endif
      endif
    endif

    ## Compute step using pseudo inverse
    JJL = JJ + v*eye(n_th);	# Levenberg-Marquardt term
    step =  pinv(JJL)*J;	# Step size
    par(i_t) = par(i_t) - step; # Increment parameters
    error_old_old = error_old;	# Save old error
    error_old = error;		# Save error

    ##Some diagnostics
    Error = [Error error];	# Save error
    Par = [Par par];		# Save parameters
    Y = [Y y];			# Save output

    if extras.verbose		# Diagnostics
      printf("Iteration: %i\n", iterations);
      printf("  error:  %g\n", error);
      printf("  reduction:  %g\n", reduction);
      printf("  prediction: %g\n", predicted_reduction);
      printf("  ratio:      %g\n", r);
      printf("  L-M param:  %g\n", v);
      printf("  parameters: ");
      for i_th=1:n_th
	printf("%g ", par(i_t(i_th)));
      endfor
      printf("\n");
    endif
    

  endwhile

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_output_constraint.m version [cae34a060b].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Gamma,gamma] = ppp_output_constraint (A,B,C,D,x_0,A_u,Tau,Min,Max,Order,i_y)

  ## usage:  [Gamma,gamma] = ppp_output_constraint (A,B,C,D,A_u,Tau,Min,Max,Order)
  ##
  ## Derives the output constraint matrices Gamma and gamma
  ## For Constraints Min and max at times Tau 
  ## Order=0 - output constraints
  ## Order=1 - output derivative constraints
  ## etc
  ## NOTE You can stack up Gamma and gamma matrices for create multi-output constraints.

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	

  ## Sizes
  [n_x,n_u,n_y] = abcddim(A,B,C,D); # System dimensions
  [n_U,m_U] = size(A_u);	# Number of basis functions
  [n,n_tau] = size(Tau);		# Number of constraint times
  
  if n_tau==0			# Nothing to be done
    Gamma = [];
    gamma = [];
    return
  endif

  ## Defaults
  if nargin<10
    Order = zeros(1,n_tau);
  endif

  if nargin<11
    i_y = 1;			# First output
  endif

  if n != 1
    error("Tau must be a row vector");
  endif
  
  n = length(Min);
  m = length(Max);
  o = length(Order);

  if (n != n_tau)||(m != n_tau)||(o != n_tau)
    error("Tau, Min, Max and Order must be the same length");
  endif
  

  ## Compute Gamma 
  Gamma = [];
  for i=1:n_U
    U = zeros(n_U,1); U(i,1) = 1; # Set up U_i
    y_i = ppp_ystar (A,B,C,D,x_0,A_u,U,Tau);# Compute y* for ith input for each tau
    y_i = y_i(:,i_y:n_y:n_y*n_tau); # Pluck out output i_y
    Gamma = [Gamma [-y_i';y_i']]; # Put in parts for Min and max
  endfor

  ## Compute gamma
  gamma = [-Min';Max'];

endfunction


Deleted mttroot/mtt/lib/control/PPP/ppp_qp.m version [e94ddba2d2].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [u,U,J] = ppp_qp (x,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma)

  ## usage:  [u,U] = ppp_qp (x,W,J_uu,J_ux,J_uw,Gamma,gamma)
  ## INPUTS:
  ##      x: system state    
  ##      W: Setpoint vector
  ##      J_uu,J_ux,J_uw: Cost derivatives (see ppp_lin)
  ##      Us0: value of U* at tau=0 (see ppp_lin)
  ##      Gamma, gamma: U constrained by Gamma*U <= gamma 
  ## Outputs:
  ##      u: control signal
  ##      U: control weight vector
  ##
  ## Predictive pole-placement of linear systems using quadratic programming
  ## Use ppp_input_constraint and ppp_output_constraint to generate Gamma and gamma
  ## Use ppp_lin to generate J_uu,J_ux,J_uw
  ## Use ppp_cost to evaluate resultant cost function

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	

  ## Check the sizes
  n_x = length(x);

  [n_U,m_U] = size(J_uu);
  if n_U != m_U
    error("J_uu must be square");
  endif

  [n,m] = size(J_ux);
  if (n != n_U)||(m != n_x)
    error("J_ux should be %ix%i not %ix%i",n_U,n_x,n,m);
  endif


  if length(gamma)>0		# Constraints exist: do the QP algorithm 
    U = qp(J_uu,(J_ux*x - J_uw*W),Gamma,gamma); # QP solution for weights U
    #U = pd_lcp04(J_uu,(J_ux*x - J_uw*W),Gamma,gamma); # QP solution for weights U
    u = Us0*U;			# Control signal
  else			# Do the unconstrained solution
    ## Compute the open-loop gains
    K_w = J_uu\J_uw;
    K_x = J_uu\J_ux;

    ## Closed-loop control
    U = K_w*W - K_x*x;		# Basis functions weights - U(t)
    u = Us0*U;			# Control u(t)
  endif

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_qp_sim.m version [58fd63cdfa].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137









































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, Tau_u,Min_u,Max_u,Order_u, Tau_y,Min_y,Max_y,Order_y, W,x_0,Delta_ol,movie)

  ## usage: [T,y,u,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, Tau_u,Min_u,Max_u,Order_u, Tau_y,Min_y,Max_y,Order_y, W,x_0,movie)
  ## Needs documentation - see ppp_ex11 for example of use.
  ## OUTPUTS
  ## T: Time vector
  ## y,u,J output, input and cost

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	
  
  if nargin<19			# No intermittent control
    Delta_ol = 0;
  endif

  if nargin<20			# No movie
    movie = 0;
  endif

  ## Check some sizes
  [n_x,n_u,n_y] = abcddim(A,B,C,D);

  [n_x0,m_x0] = size(x_0);
  if (n_x0 != n_x)||(m_x0 != 1)
    error(sprintf("Initial state x_0 must be %ix1 not %ix%i",n_x,n_x0,m_x0));
  endif
  
  ## Input constraints (assume same on all inputs)
  Gamma_u=[];
  gamma_u=[];
  for i=1:n_u
    [Gamma_i,gamma_i] = ppp_input_constraint (A_u,Tau_u,Min_u,Max_u,Order_u,i,n_u);
    Gamma_u = [Gamma_u; Gamma_i];
    gamma_u = [gamma_u; gamma_i];
  endfor

  ## Output constraints
  [Gamma_y,gamma_y] = ppp_output_constraint  (A,B,C,D,x_0,A_u,Tau_y,Min_y,Max_y,Order_y);

  ## Composite constraints - t=0
  Gamma = [Gamma_u; Gamma_y];
  gamma = [gamma_u; gamma_y];

  ## Design the controller
  disp("Designing controller");
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww] = ppp_lin (A,B,C,D,A_u,A_w,t,Q);

  ## Set up various time vectors
  dt = t(2)-t(1);		# Time increment

  ## Make sure Delta_ol is multiple of dt
  Delta_ol = floor(Delta_ol/dt)*dt

  if Delta_ol>0			# Intermittent control
    T_ol = 0:dt:Delta_ol-dt;	# Create the open-loop time vector
  else
    T_ol = 0;
    Delta_ol = dt;
  endif
  
  T_cl = 0:Delta_ol:t(length(t))-Delta_ol; # Closed-loop time vector
  n_Tcl = length(T_cl);
  
  Ustar_ol = ppp_ustar(A_u,n_u,T_ol); # U* in the open-loop interval
  [n,m] = size(Ustar_ol);
  n_U = m/length(T_ol);		# Determine size of each Ustar

  ## Discrete-time system
  csys = ss2sys(A,B,C,D);
  dsys = c2d(csys,dt);
  [Ad, Bd] = sys2ss(dsys);

  x = x_0;			# Initialise state

  ## Initialise the saved variable arrays
  X = [];
  u = [];
  du = [];
  J = [];
  tick= time;
  i = 0;
  disp("Simulating ...");
  for t=T_cl			# Outer loop at Delta_ol
    ##disp(sprintf("Time %g", t));
    ## Output constraints
    [Gamma_y,gamma_y] = ppp_output_constraint  (A,B,C,D,x,A_u,Tau_y,Min_y,Max_y,Order_y);
    
    ## Composite constraints 
    Gamma = [Gamma_u; Gamma_y];
    gamma = [gamma_u; gamma_y];
    
    ## Compute U(t)
    [uu U] = ppp_qp (x,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma); # Compute U
 
    ## Compute the cost (not necessary but maybe interesting)
#    [J_t] = ppp_cost (U,x,W,J_uu,J_ux,J_uw,J_xx,J_xw,J_ww); # cost
#    J = [J J_t];

    ## Simulation loop
    i_ol = 0;
    for t_ol=T_ol		# Inner loop at dt

      ## Compute ol control
      i_ol = i_ol+1;
      range = (i_ol-1)*n_U + 1:i_ol*n_U; # Extract current U*
      ut = Ustar_ol(:,range)*U;	# Compute OL control (U* U)

      ## Simulate the system
      i = i+1;
      X = [X x];		# Save state
      u = [u ut];		# Save input
      x = Ad*x + Bd*ut;	# System

#       if movie			# Plot the moving horizon
# 	tau = T(1:n_T-i);	# Tau with moving horizon
# 	tauT = T(i+1:n_T);	# Tau with moving horizon + real time
# 	[ys,us,xs,xu,AA] = ppp_ystar (A,B,C,D,x,A_u,U,tau); # OL response
# 	plot(tauT,ys, tauT(1), ys(1), "*")
#       endif
    endfor
  endfor
  
  ## Save the last values
  X = [X x];		# Save state
  u = [u ut];		# Save input

  tock = time;
  Iterations = length(T_cl)
  Elapsed_Time = tock-tick
  y = C*X + D*u;		# System output

  T = 0:dt:t+Delta_ol;		# Overall time vector

endfunction



Deleted mttroot/mtt/lib/control/PPP/ppp_sim.m version [a4ff8b90d8].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [y,y_s] = ppp_sim (system_name,x_0,u,t,par,i_s,external)

  ## mtt_sim: Simulates system  sensitivity functions. 
  ## usage:  [y,y_s] = ppp_sim (system_name,x_0,u,t,par,i_s)
  ##   system_name string containing name of the sensitivity system
  ##   x_0         initial state 
  ##   u           system input (one input per row)
  ##   t           row vector of time
  ##   par         system parameter vector
  ##   i_s         indices of sensitivity parameters 


  if nargin<7
    external = 0;
  endif
  
  ## Some sizes
  n_s = length(i_s);
  n_t = length(t);


  for i = 1:n_s

    ## Set sensitivity parameters
    par(i_s(i)) = 1.0;
    par(complement(i_s(i),i_s)) = 0;

    if external
      par_string = "";
      for i_string=1:length(par)
	par_string = sprintf("%s %s", par_string, num2str(par(i_string)));
      endfor
      data_string = system(sprintf("./%s_ode2odes.out %s | cut -f 2-%i", \
				   system_name, par_string, 1+n_s));
      Y = str2num(data_string)';
    else
      Y = eval(sprintf("%s_sim(x_0,u,t,par);", system_name));
    endif

    [n_Y,m_Y] = size(Y);
     n_y = n_Y/2;
    if i==1	
      y = Y(1:2:n_Y,:);		# Save up the output
      y_s = zeros(n_s*n_y, n_t); # Initialise for speed
    endif
 
    y_s((i-1)*n_y+1:i*n_y,:)  = Y(2:2:n_Y,:);	# Other sensitivities
    
  endfor

title("");
plot(t,y);

endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_sm2sr.m version [b8cab9f99f].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Y,X] = ppp_sm2sr(A,B,C,D,T,u0,x0);
  ## Usage [Y,X] = ppp_sm2sr(A,B,C,D,T,u0,x0);
  ## Computes a step response
  ## A,B,C,D- state matrices
  ## T vector of time points
  ## u0 input gain vector: u = u0*unit step.

  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	

  [Ny,Nu] = size(D);
  [Ny,Nx] = size(C);

  if nargin<6
    u0 = zeros(Nu,1);
    u0(1) = 1;
  end;

  if nargin<7
    x0 = zeros(Nx,1);
  end;

  [N,M] = size(T);
  if M>N
    T = T';
    N = M;
  end;



  one = eye(Nx);

  Y = zeros(Ny,N);
  X = zeros(Nx,N);

  dt = T(2)-T(1);		# Assumes fixed interval
  expAdt = expm(A*dt);		# Compute matrix exponential
  i = 0;
  expAt = one;

  DoingStep = max(abs(u0))>0;	# Is there a step component?
  DoingInitial = max(abs(x0))>0; # Is there an initial component?
  for t = T'
    i=i+1;
    if Nx>0
      x = zeros(Nx,1);
      if DoingStep
	x = x + ( A\(expAt-one) )*B*u0;
      endif
      if DoingInitial
	x = x + expAt*x0;
      endif
      
      expAt = expAt*expAdt;

      X(:,i) = x;
      if Ny>0
	y = C*x + D*u0;
	Y(:,i) = y;
      endif
    elseif Ny>0
      y = D*u0;
      Y(:,i) = y;
    endif
  endfor


endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_ustar.m version [0be0149c8e].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function Ustar = ppp_ustar (A_u,n_u,tau,order,packed)

  ## usage:  Us = ppp_ustar(A_u,n_u,tau,order,packed)
  ##
  ## Computes the U* matrix at time tau in terms of A_u
  ## n_u : Number of system inputs
  ## If tau is a vector, computes U* at each tau and puts into a row vector:
  ## If packed==1
  ##     Ustar = [Ustar(tau_1) Ustar(tau_2) ...]
  ## else Ustar = [Ustar(tau_1); Ustar(tau_2) ...]
  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	

  if nargin<2
    n_u = 1;
  endif
  
  if nargin<3
    tau = 0;
  endif
  
  if nargin<4
    order = 0;
  endif
  
  if nargin<5
    packed=1;
  endif
  

  [n,m] = size(A_u);		# Size of composite A_u matrix
  N = m;			# Number of U* functions per input  
  nm = n/m;

  if (nm != n_u)&&(n!=m)	# Check consistency
    error("A_u must be square or be a column of square matrices");
  endif

  u_0 = ones(N,1);

  Ustar = [];
  for t = tau;
    ustar = [];
    for i = 1:n_u
      A_i = ppp_extract(A_u,i);
      Ak = A_i^order;
      eA = expm(A_i*t);
      if (packed==1)
	ustar = [ustar; zeros(1,(i-1)*N), (Ak*eA*u_0)', \
		 zeros(1,(n_u-i)*N)];
      else
	ustar = [ustar, (Ak*eA*u_0)'];
      endif
    endfor

    if (packed==1)
      Ustar = [Ustar ustar];
    else
      Ustar = [Ustar; ustar];
    endif
  endfor


endfunction

Deleted mttroot/mtt/lib/control/PPP/ppp_y_u.m version [8a57fa7a93].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83



















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [y_u, Us] = ppp_y_u (A,B,C,D,A_u,u_0,tau)

  ## usage:  y_u = ppp_y_u (A,B,C,D,A_u,u_0,t)
  ##
  ## Computes y_u derivative of y* wrt U
  ## Called by ppp_lin
  ## OBSOLETE

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.6  2000/12/27 16:41:05  peterg
  ## *** empty log message ***
  ##
  ## Revision 1.5  1999/05/31 01:58:01  peterg
  ## Now uses ppp_extract
  ##
  ## Revision 1.4  1999/05/12 00:10:35  peterg
  ## Modified for alternative (square) A_u
  ##
  ## Revision 1.3  1999/05/03 23:56:32  peterg
  ## Multivariable version - tested for N uncoupled systems
  ##
  ## Revision 1.2  1999/05/03 00:38:32  peterg
  ## Changed data storage:
  ## y_u saved as row vector, one row for each time, one column for
  ## each U
  ## y_x saved as row vector, one row for each time, one column for
  ## each x
  ## W* saved as row vector, one row for each time, one column for
  ## each element of W*
  ## This is consistent with paper.
  ##
  ## Revision 1.1  1999/04/29 06:02:43  peterg
  ## Initial revision
  ##
  ###############################################################



  ## Check argument dimensions
  [n_x,n_u,n_y] = abcddim(A,B,C,D);
  if (n_x==-1)
    return
  endif

  [n,m] = size(A_u);		# Size of composite A_u matrix
  N = m;			# Number of U* functions per input
  
  y_u = [];			# Initialise
  Us = [];
  
#   for input=1:n_u		# Do for each system input
#     a_u = ppp_extract(A_u,input); # Extract the relecant A_u matrix
#     for i=1:N			# Do for each input function U*_i
#       C_u = zeros(1,N); C_u(i) = 1; # Create C_u for this U*_i
#       b = B(:,input);		# B vector for this input
#       d = D(:,input);		# D vector for this input
#       [y,u] = ppp_transient (t,a_u,C_u,u_0,A,b,C,d); # Compute response for this input
#       y_u = [y_u y'];		# Save y_u (y for input u)  with one row for each t.
#       Us = [Us u'];		# Save u (input)  with one row for each t.
#     endfor
#   endfor
  i_U = 0;
  x_0 = zeros(n_x,1);		# This is for x=0
  for input=1:n_u		# Do for each system input
    a_u = ppp_extract(A_u,input); # Extract the relevant A_u matrix
    for i=1:N			# Do for each input function U*_i
      dU = zeros(N*n_u,1);
      dU(++i_U) = 1;		# Create dU/dU_i 
      [ys,us] = ppp_ystar (A,B,C,D,x_0,a_u,dU,tau); # Find ystar and ustar
      y_u = [y_u ys'];		# Save y_u (y for input u)  with one row for each t.
      Us = [Us us'];		# Save u (input)  with one row for each t.
    endfor
  endfor

endfunction




Deleted mttroot/mtt/lib/control/PPP/ppp_ystar.m version [d942259424].

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
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
123
124




























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [ys,us,xs,xu,AA] = ppp_ystar (A,B,C,D,x_0,A_u,U,tau)

  ## usage:  [ys,us,xs,xu,AA] = ppp_ystar (A,B,C,D,x_0,A_u,U,tau)
  ##
  ## Computes open-loop moving horizon variables at time tau
  ## Inputs:
  ## A,B,C,D     System matrices
  ## x_0         Initial state
  ## A_u         composite system matrix for U* generation 
  ##             one square matrix (A_ui) row for each system input
  ##             each A_ui generates U*' for ith system input.
  ## OR
  ## A_u         square system matrix for U* generation 
  ##             same square matrix for each system input
  ## U           Column vector of optimisation coefficients  
  ## tau         Row vector of times at which outputs are computed
  ## Outputs:
  ## ys          y*, one column for each time tau 
  ## us          u*, one column for each time tau 
  ## xs          x*, one column for each time tau 
  ## xu          x_u, one column for each time tau 
  ## AA          The composite system matrix
  
  ## Copyright (C) 1999 by Peter J. Gawthrop
  ## 	$Id$	


  [n_x,n_u,n_y] = abcddim(A,B,C,D); # System dimensions
  no_system = n_x==0;

  [n,m] = size(A_u);		# Size of composite A_u matrix
  square = (n==m);		# Is A_u square?
  n_U = m;			# functions per input

  
  [n,m] = size(U);
  if (m != 1)
    error("U must be a column vector");
  endif
  
  if n_u>0
    if n_u!=length(U)/n_U
      error("U must be a column vector with n_u*n_U components");
    endif
  else
    n_u = length(U)/n_U;	# Deduce n_u from U if no system
  endif
  

  [n,m]=size(tau);
  if (n != 1 )
    error("tau must be a row vector of times");
  endif
  
  if square			# Then same A_u for each input
    ## Reorganise vector U into matrix Utilde  
    Utilde = [];
    for i=1:n_u
      j = (i-1)*n_U;
      range = j+1:j+n_U;
      Utilde = [Utilde; U(range,1)'];
    endfor

    ## Composite A matrix
    if no_system
      AA = A_u;
    else
      Z = zeros(n_U,n_x);
      AA = [A   B*Utilde
	    Z   A_u];
    endif
    
    xx_0 = [x_0;ones(n_U,1)];	# Composite initial condition
  else				# Different A_u on each input
    ## Reorganise vector U into matrix Utilde  
    Utilde = [];
    for i=1:n_u
      j = (i-1)*n_U;
      k = (n_u-i)*n_U;
      range = j+1:j+n_U;
      Utilde = [Utilde; zeros(1,j), U(range,1)', zeros(1,k)];
    endfor

    ## Create the full A_u matrix (AA_u) with the A_i s on the diagonal
#     AA_u = [];
#     for i = 1:n_u
#       AA_u = ppp_aug(AA_u,ppp_extract(A_u,i));
#     endfor
    AA_u = ppp_inflate(A_u);

    ## Composite A matrix
    if no_system
      AA = AA_u;
    else
      Z = zeros(n_U*n_u,n_x);
      AA = [A   B*Utilde
	    Z   AA_u];
    endif
    xx_0 = [x_0;ones(n_U*n_u,1)];	# Composite initial condition
  endif
  
  
  ## Initialise
  xs = [];			# x star
  xu = [];			# x star
  ys = [];			# y star
  us = [];			# u star
  n_xx = length(xx_0);		# Length of composite state

  ## Compute the star variables
  for t=tau
    xxt = expm(AA*t)*xx_0;	# Composite state
    xst = xxt(1:n_x);		# x star
    xut = xxt(n_x+1:n_xx);	# x star
    yst = C*xst;		# y star
    ust = Utilde*xut;		# u star

    xs = [xs xst];		# x star
    xu = [xu xut];		# x star
    ys = [ys yst];		# y star
    us = [us ust];		# u star
  endfor

endfunction

Deleted mttroot/mtt/lib/control/PPP/rpv.m version [c302718039].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [A,B,C,D] = rpv
% System RPV
% This system is the remotely-piloted vehicle example from the book:
% J.M Maciejowski: Multivariable Feedback Design  Addison-Wesley, 1989
% It has 6 states, 2 inputs and 2 outputs.

% P J Gawthrop Jan 1998

A = [-0.0257  -36.6170  -18.8970  -32.0900    3.2509   -0.7626
      0.0001   -1.8997    0.9831   -0.0007   -0.1780   -0.0050
      0.0123   11.7200   -2.6316    0.0009  -31.6040   22.3960
           0         0    1.0000         0         0         0
           0         0         0         0  -30.0000         0
           0         0         0         0         0  -30.0000];

B = [0     0
     0     0
     0     0
     0     0
    30     0
     0    30];

C = [0     1     0     0     0     0
     0     0     0     1     0     0];

D = zeros(2,2);


Deleted mttroot/mtt/lib/control/PPP/tgen.m version [37e3b79324].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [A,B,C,D] = tgen
% System TGEN from
% This system is the turbogenerator example from the book:
% J.M Maciejowski: Multivariable Feedback Design  Addison-Wesley, 1989
% It has 6 states, 2 inputs and 2 outputs.

% P J Gawthrop Jan 1998

A = [-18.4456    4.2263   -2.2830    0.2260    0.4220   -0.0951
      -4.0977   -6.0706    5.6825   -0.6966   -1.2246    0.2873
       1.4449    1.4336   -2.6477    0.6092    0.8979   -0.2300
      -0.0093    0.2302   -0.5002   -0.1764   -6.3152    0.1350
      -0.0464   -0.3489    0.7238    6.3117   -0.6886    0.3645
      -0.0602   -0.2361    0.2300    0.0915   -0.3214   -0.2087];

B = [-0.2748    3.1463
     -0.0501   -9.3737
     -0.1550    7.4296
      0.0716   -4.9176
     -0.0814  -10.2648
      0.0244   13.7943];

C = [0.5971   -0.7697    4.8850    4.8608   -9.8177   -8.8610
     3.1013    9.3422   -5.6000   -0.7490    2.9974   10.5719];

D = zeros(2,2);


Deleted mttroot/mtt/lib/control/PPP/transient.m version [14fe0c3057].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function X = transient (t,A,x_0)

  ## usage:  L = transient (t,p,order)
  ##
  ## Computes transient response for time t with initial condition x_0

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.1  1999/04/27 04:46:05  peterg
  ## Initial revision
  ##
  ## Revision 1.1  1999/04/25 23:19:40  peterg
  ## Initial revision
  ##
  ###############################################################


X=[];
  for tt=t			# Create the Transient up to highest order
    x = expm(A*tt)*x_0;
    X = [X x];
  endfor

endfunction

Deleted mttroot/mtt/lib/cr/hh/ISW.hh version [ae8d942dc5].

1
2
3
4
5
6






-
-
-
-
-
-
#ifndef ISW_HH
#define ISW_HH

// dummy file

#endif // ISW_H

Deleted mttroot/mtt/lib/cr/hh/SS.hh version [24fd0512ed].

1
2
3
4
5
6






-
-
-
-
-
-
#ifndef SS_HH
#define SS_HH

// dummy file

#endif // SS_H

Deleted mttroot/mtt/lib/cr/hh/constants.hh version [65d242bd40].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
#ifndef CONSTANTS_HH
#define CONSTANTS_HH

const double	pi	= 3.14159264;
const double	pi2	= pi * pi;
const double	pi4	= pi2 * pi2;

// Reynolds number
const double	ReL	= 2300.0;	// transition from laminar flow
const double	ReT	= 4000.0;	// transition to turbulent flow

#endif // CONSTANTS

Deleted mttroot/mtt/lib/cr/hh/fade.hh version [8a88d4173b].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef FADE_HH
#define FADE_HH

#include <math.h>		// tanh

#include "constants.hh"		// pi

inline double
fade(const double x,
     const double x1,
     const double x2,
     const double y1,
     const double y2)
{
  /* fades two functions together smoothly over the range x1 to x2
   * function does not check that x2 > x1
   */
  double theta;
  theta = (x - x1) / (x2 - x1);		// map (linear)     {x1  , x2 } => {0   , +1 }
  theta = (theta - 0.5) * 2.0 * pi;	// map (linear)     {0   , +1 } => {-Pi , +Pi}
  theta = tanh(theta);			// map (non-linear) {-Pi , +Pi} => {-1  , +1 }
  theta = (theta + 1.0) / 2.0;		// map (linear)     {-1  , +1 } => {0   , +1 }

  return (theta * y1 + (1.0 - theta) * y2);
}

inline double
chkfade(const double x,
	const double x1,
	const double x2,
	const double y1,
	const double y2)
{
  double X1 = x1, X2 = x2;
  if (x1 > x2) {
    cerr << "* Warning: chkfade; x2 > x1, swapping" << endl;
    X1 = x2;
    X2 = x1;
  }
  return ((x <= X1) ? y1 : (x > X2) ? y2 : fade(x, X1, X2, y1, y2));
}

#endif // FADE_HH

Deleted mttroot/mtt/lib/cr/hh/frictionfactor.hh version [4c38b86070].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef FRICTIONFACTOR_HH
#define FRICTIONFACTOR_HH

#include <iostream>
#include <math.h>
#include <string>

#include "constants.hh"		// ReL, ReT
#include "fade.hh"

inline double
frictionfactor(const double Re, const double r) {
  if (0.0 == Re) {
    return 0.0;
  }
  else if (ReL >= Re) {		// laminar flow
    return 16.0 / Re;		// using k = 4.f.(l/d)
  } else if (ReT <= Re) {	// turbulent flow
    /* S.E.Haaland
     * Simple and explicit formulas for the friction factor in turbulent pipe flow
     * Journal of Fluids Engineering, 105 (1983)
     */
    double A = 6.91 / Re;
    double B = pow((r / 3.71), 1.11);
    double f = pow(-3.6 * log10(A + B), -2);
    return f;
  } else {			// transition region 
    double ffL = frictionfactor(ReL, r);
    double ffT = frictionfactor(ReT, r);
    return fade(Re, ReL, ReT, ffL, ffT);
  }
}

#endif // FRICTIONFACTOR_HH

Deleted mttroot/mtt/lib/cr/hh/kinematicviscosity.hh version [ee21aaf89a].

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





























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef KINEMATICVISCOSITY_HH
#define KINEMATICVISCOSITY_HH

#include <math.h>		// pow
#include <string>

inline double
kerosenekinematicviscosity(const double T)
  /*
   * B.S.Massey
   * Mechanics of fluids
   * ISBN: 0 412 34280 4
   * log-log plot of kinematic viscosity versus temperature is linear for kerosene
   * L(n) = log10(n)
   *
   * T =   0 deg C : nu = 4.0 mm2/s
   * T = 100 deg C : nu = 0.9 mm2/s
   *
   * deg C => K, mm2/s => m2/s
   *
   * T1 = 273.15 : nu1 = 4.0e-6 m2/s
   * T2 = 373.15 : nu2 = 0.9e-6 m2/s
   *
   * L(nu) = m L(T) + c
   *
   *    m = (L(nu2) - L(nu1)) / (L(T2) - L(T1))
   *      = L(nu2/nu1) / L(T2/T1)
   *      = L(0.9/4.0) / L(373.15/273.15)
   *      = -4.781567507
   *
   *    c = L(nu1) - m * L(T1)
   *      = L(4.0e-6) - m * L(273.15)
   *      = 6.251876827 
   *
   * nu {m2/s} = 10^(m * L(T {Kelvin}) + c)
   *
   *    = 10^(m * L(T) + c)
   *    = 10^c * (10^L(T))^m
   *    = 10^c * T^m
   *
   * 10^c = 1.78598097e6
   * 
   * nu = 1.78598097e6 * T^(-4.781567507)
   */
{
  return 1.79e6 * pow(T, -4.78);
}

inline double
kinematicviscosity(const string fluid,
		   const double T)
{
  if ("kerosene" == fluid) {
    return kerosenekinematicviscosity(T);
  } else {
    cerr << __FILE__ << ": fluid \"" << fluid << "\" unknown" << endl;
    exit(-1);
  }
}

#endif // KINEMATICVISCOSITY_HH

Deleted mttroot/mtt/lib/cr/hh/lin.hh version [2e8f415433].

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
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
123
124




























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef LIN_HH
#define LIN_HH

#include <iostream>

// translated from lin.cr

// one 2-port, R/C/I; two 2-port, TF/GY
inline double
lin(// parameters
    const causality_t	gain_causality,
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,
    const causality_t	in_causality,
    const int		in_port)
{
  if (out_port == in_port) {			  // R/C/I
    if (gain_causality == in_causality) {
      return input * gain;
    } else {
      return input / gain;
    }
  } else {					  // GY/TF
    if (out_causality == in_causality) {	// gyrator
      if ((out_port == 1 && out_causality != gain_causality)
	  ||(out_port == 2 && out_causality == gain_causality)) {
	return input * gain;
      } else {
	return input / gain;
      }
    } else {				// transformer
      if (out_causality == gain_causality) {
	return input * gain;
      } else {
	return input / gain;
      }
    }
  }
}

// two 2-port, AE/AF
inline double
lin(// parameters
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,
    const causality_t	in_causality,
    const int		in_port)
{
  return
    (out_port == 1) ? input * gain :
    input / gain;
}




// three 2-port, FMR
inline double
lin(// parameters
    const causality_t	gain_causality,
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,
    const causality_t	in_causality,
    const int		in_port,
    const double	modulation,
    const causality_t	mod_causality,
    const int		mod_port)
{
  if (mod_causality == flow) {		// uni-causal
    if (out_port == 2) {
      return 0;
    } else {
      double k = 1.0;
      if (gain_causality == in_causality) {
	k *= gain;
      } else {
	k /= gain;
      }
      if (in_causality == effort) {
	k *= modulation;
      } else {
	k /= modulation;
      }
      return input * k;
    }
  } else {				// bi-causal
    if ((in_causality == effort)
	&&(mod_causality == flow)
	&&(gain_causality == effort)
	&&(in_port == 1)
	&&(mod_port == 1)) {
      return (input / modulation) / gain;
    } else {

	// three 2-port, EMTF
	
	if ((out_causality == gain_causality && out_port == 2)
	    ||(out_causality != gain_causality && out_port == 1)) {
	  return input * gain * modulation;
	} else if((out_causality != gain_causality && out_port == 2)
		  ||(out_causality == gain_causality && out_port == 1)) {
	  return input / (gain * modulation);
	} else {
	  cerr << "* Error: __FILE__ does not cover this case" << endl;
	  exit(-1);
	}
    } // EMTF
  } // bi-causal
}


#endif // LIN_HH

Deleted mttroot/mtt/lib/cr/hh/pressuredrop.hh version [378b136495].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef PRESSUREDROP_HH
#define PRESSUREDROP_HH

#include <math.h>		// fabs, pow

#include "constants.hh"
#include "frictionfactor.hh"
#include "kinematicviscosity.hh"
#include "sign.hh"

inline double
pressuredrop(const string fluid,
	     const double d,
	     const double l,
	     const double r,
	     const double rho,
	     const double T,
	     const double Q)
{
  double nu = kinematicviscosity(fluid, T);
  double Re = 4.0 * fabs(Q) / (pi * d * nu);
  double f = frictionfactor(Re, r);
  double k = 4.0 * f * l / d;
  double dP = k * 8.0 * rho * pow(Q, 2) / (pi2 * pow(d, 4));
  return (dP * sign(Q));
}

inline double
pressuredrop(const string fluid,
	     const double d,
	     const double l,
	     const double r,
	     const double rho,
	     const double T,
	     const causality_t effort_causality, const int port,
	     const double Q, const causality_t flow_causality, const int port_in)
{
  
  /* assert(effort == causality);
   * assert(flow == causality_in);
   * assert(1 == port_in);
   * assert(1 == port);
   */
  return pressuredrop(fluid, d, l, r, rho, T, Q);
}

#endif // PRESSUREDROP_HH

Deleted mttroot/mtt/lib/cr/hh/sign.hh version [593009ad4f].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef SIGN_HH
#define SIGN_HH

template <class T>
inline int
sign(T x)
{
  return ((x > 0) ? +1 :
	  (x < 0) ? -1 :
	  0);
}

#endif // SIGN_HH

Deleted mttroot/mtt/lib/cr/hh/squarelaw.hh version [59c9450bf7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef SQUARELAW_HH
#define SQUARELAW_HH

#include <math.h>
#include "sign.hh"

inline double squarelaw(const double gain,
			const causality_t causality, const int port,
			const double input, const causality_t in_causality, const int in_port)
  /*
   * implements P = R Q^2
   * direction of flow is retained
   */
{
  if (causality == effort) {
    return pow(input, 2) * gain * sign(input * gain);
  } else {
    return sqrt(fabs(input / gain)) * sign(input / gain);
  }
}

#endif // SQUARELAE_HH

Deleted mttroot/mtt/lib/cr/hh/staticpressure.hh version [34ed9de7e9].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef STATICPRESSURE_HH
#define STATICPRESSURE_HH

#include <math.h>		// log, pow

#include "constants.hh"

inline double
staticpressure(const double beta,
	       const double C_d,
	       const double d,
	       const double P_ref,
	       const double rho,
	       const causality_t causality, const int port,
	       const double Q1, const causality_t causality1, const int port1,
	       const double Q2, const causality_t causality2, const int port2)
{
  static double P;
  if (0.0 != Q1 && 0.0 != Q2) {
    double num = pi2 * pow(d, 4) * log(Q1 / Q2);
    double den = 8.0 * beta * rho * Q1 * (Q2 - Q1 + C_d * (Q1 + Q2) / 2.0);
    P = P_ref + log(num / den)/beta;
  }
    return P;
}

#endif // STATICPRESSUE_HH

Deleted mttroot/mtt/lib/cr/r/CT2.cr version [19581da283].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CT2    Constitutive Relationship for a two port thermo C
%DESCRIPTION Parameter 1: c_v (specific heat at constant volume)
%DESCRIPTION Parameter 2: gamma = c_p/c_v
%DESCRIPTION Parameter 3: mass of (ideal) gas within component.
%DESCRIPTION Parameter 4: t_0 -- the temperature at which internal
%DESCRIPTION energy is zero.

%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/12/07 20:45:21  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/02  10:21:19  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/09/12 11:18:26  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


OPERATOR CT2;
Port 1 - Thermal
FOR ALL c_v,gamma,m,t_0,InternalEnergy,Volume
LET CT2(c_v,gamma,m,t_0,effort,1,
	InternalEnergy, state, 1,
	Volume, state, 2)
         = InternalEnergy/(m*c_v);

Port 2 - Mechanical
FOR ALL c_v,gamma,m,t_0,InternalEnergy,Volume
LET CT2(c_v,gamma,m,t_0,effort,2,
	InternalEnergy, state, 1,
	Volume, state, 2)
         = (gamma-1)*(InternalEnergy+c_v*m*t_0)/Volume;

Deleted mttroot/mtt/lib/cr/r/SS.cr version [0b96d2255a].

1
2
3



-
-
-
%% A dummy constitutive relationship file for SS 

END;;

Deleted mttroot/mtt/lib/cr/r/StefanBoltzmann.cr version [49afc9586a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY StefanBoltzmann: Stefan-Boltzmann radiation law.	
%DESCRIPTION Parameter 1: Stefan-Boltzmann constant
%DESCRIPTION Parameter 2: Area of radiating surface



OPERATOR StefanBoltzmann;


FOR ALL sigma,Area,input
LET StefanBoltzmann(sigma,Area,flow, 1, 
	input, effort, 1)
	 = sigma*area*input^4;


Deleted mttroot/mtt/lib/cr/r/cm.cr version [c86e6a6abf].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY cm: relation for 2-port CM component
%DESCRIPTION Parameter 1 capacitance at separation x_0
%DESCRIPTION Parameter 2 x_0
%DESCRIPTION parameter 3 moving-plate mass

%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/11/02  10:21:19  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/09/12 11:18:26  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


OPERATOR cm;
%Linear electrical bit
FOR ALL c_0,x_0,elec_state,mech_state LET
cm(c_0,x_0,effort,1,
	elec_state,state,1,
	mech_state,state,2
	)
	= elec_state/(c_0*x_0/mech_state);

%Nonlinear mechanical bit
FOR ALL c_0,x_0,elec_state,mech_state LET
cm(c_0,x_0,effort,2,
	elec_state,state,1,
	mech_state,state,2
	)
	= -(c_0*x_0)*((elec_state/mech_state)^2)/2; 

END;;

Deleted mttroot/mtt/lib/cr/r/cr.cr version [8711e303bd].

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
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













































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY cr generic CR
%DESCRIPTION Argument is an algebraic expression with no embeddedwhite space
%DESCRIPTION Only available for one ports just now
%DESCRIPTION effort (or integrated effort) variable must be called mtt_e
%DESCRIPTION flow (or integrated flow) variable must be called mtt_f
%DESCRIPTION For example:
%DESCRIPTION             mtt_e=k*mtt_f
%DESCRIPTION             mtt_f=mtt_e/r

% $Log$
% Revision 1.3  2000/10/05 10:13:00  peterg
% New eqn2ass function.
% Started extension to multiports
%
% Revision 1.2  2000/10/03 18:35:04  peterg
% Removed comment bug
%
% Revision 1.1  2000/10/03 18:34:00  peterg
% Initial revision
%

%Copyright (C) 2000 by Peter J. Gawthrop


% Function to convert equation to assignment
OPERATOR eqn2ass;
FOR ALL eqn,outlist,inputs 
LET eqn2ass(eqn,outlist,inputs) =
BEGIN
    ass := {}; mtt_ports := 0;
    solutions := solve(eqn,outlist);
    FOR EACH solution IN solutions DO
    BEGIN
       mtt_ports := mtt_ports + 1;
       rh := RHS(solution);
       FOR EACH input IN inputs DO
         rh := sub(input,rh);
       ass := APPEND(ass,{rh});
    END;
    IF mtt_ports EQ 1 THEN
      RETURN FIRST(ass) 
    ELSE
      RETURN ass; 

    %return sub(input,rhs(first(solve(eqn,outlist))));
    % Needs multiplicity warning
END;


OPERATOR cr;

% Version for one-port components

% We need four versions so that state does not need to be explicitly
% mentioned.
% At the moment, assume only one solution (in fact the first is
% chosen)

%%%% This is the Equation version
% Flow input
FOR ALL mtt_cr, input, out_cause
LET cr(mtt_cr,out_cause, 1, input, flow, 1) 
      = eqn2ass(mtt_cr,mtt_e,{mtt_f=input});

% Effort input
FOR ALL mtt_cr, input, out_cause
LET cr(mtt_cr,out_cause, 1, input, effort, 1)
    = eqn2ass(mtt_cr,mtt_f,{mtt_e=input});

% Effort output
FOR ALL mtt_cr, input, in_cause
LET cr(mtt_cr,effort, 1, input, in_cause, 1) 
    = eqn2ass(mtt_cr,mtt_e,{mtt_f=input});

% Flow output
FOR ALL mtt_cr, input, in_cause
LET cr(mtt_cr,flow, 1, input, in_cause, 1) 
    = eqn2ass(mtt_cr,mtt_f,{mtt_e=input});

%%%% This is the assignment version
% Flow input
FOR ALL mtt_cr_e,mtt_cr_f, input, out_cause
LET cr(mtt_cr_e,mtt_cr_f,out_cause, 1, input, flow, 1) 
    = sub(mtt_f=input,mtt_cr_f);

% Effort input
FOR ALL mtt_cr_e,mtt_cr_f, input, out_cause
LET cr(mtt_cr_e,mtt_cr_f,out_cause, 1, input, effort, 1) 
    = sub(mtt_e=input,mtt_cr_e);

% Effort output
FOR ALL mtt_cr_e,mtt_cr_f, input, in_cause
LET cr(mtt_cr_e,mtt_cr_f,effort, 1, input, in_cause, 1) 
    = sub(mtt_f=input,mtt_cr_f);

% Flow output
FOR ALL mtt_cr_e,mtt_cr_f, input, in_cause
LET cr(mtt_cr_e,mtt_cr_f,flow, 1, input, in_cause, 1) 
    = sub(mtt_e=input,mtt_cr_e);


%%% Q&D FMR 2 port.
FOR ALL mtt_cr_e,mtt_cr_f,input_1,input_2
LET cr(mtt_cr_e,mtt_cr_f,flow,1,
	input_1,effort,1,
	input_2,flow,2
	)  = sub(mtt_mod=input_2,sub(mtt_e=input_1,mtt_cr_e));

END;

Deleted mttroot/mtt/lib/cr/r/defaultcr.r version [76c5822e3e].

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































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% 
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Linear constitutive relationship.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%Linear Constitutive Relationship for single port components: R,C,I.
% e = Gain*f (if gain_causality = flow) 
%           f = Gain*e (if gain_causality = effort)
OPERATOR lin;
FOR ALL gain_causality, gain, causality, input, other_causality
SUCH THAT causality = gain_causality
LET lin(gain_causality, gain, other_causality, 1, input, causality, 1)
	 = gain*input;

%Linear CR: e = (1/Gain)*f (if gain_causality = flow) 
%           f = (1/Gain)*e (if gain_causality = effort)
FOR ALL gain_causality, gain, causality, input, other_causality
SUCH THAT causality NEQ gain_causality
LET lin(gain_causality, gain, other_causality, 1, input, causality, 1)
	 = input/gain;


% Linear Constitutive Relationship for AE and AF
% Output = gain * input

% Unicausal form
FOR ALL gain, input, causality
LET lin(gain, causality, 2, input, causality, 1) = gain*input;

%Bicausal form
FOR ALL gain, output, causality
LET lin(gain, causality, 1, output, causality, 2) = output/gain;

% Linear Constitutive Relationship for TF
FOR ALL gain, input, causality, gain_causality, outport, inport
SUCH THAT (
	(causality = gain_causality) AND (outport = 2)
	OR
	(causality NEQ gain_causality) AND (outport = 1)
	)
LET lin(gain_causality, gain, causality, outport, input, causality, inport)
	 = gain*input;

FOR ALL gain, input, causality, gain_causality, outport, inport
SUCH THAT (
	(causality NEQ gain_causality) AND (outport = 2)
	OR
	(causality = gain_causality) AND (outport = 1)
	)
LET lin(gain_causality, gain, causality, outport, input, causality, inport)
	 = input/gain;

END;

Deleted mttroot/mtt/lib/cr/r/delta_h.cr version [3c6f66bca6].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY delta_h	CR for gas turbine compressor


OPERATOR delta_h;

% Port 1 - generates delta h
FOR ALL c_p,Temperature,Massflow,DeltaT
LET delta_h(c_p, flow, 1,
		Temperature,effort,1,
		Massflow,flow,2,
		DeltaT,effort,3)
	 = Massflow*c_p*DeltaT;

% Port 2 - generates zero effort
FOR ALL c_p,Temperature,Massflow,DeltaT
LET delta_h(c_p, effort, 2,
		Temperature,effort,1,
		Massflow,flow,2,
		DeltaT,effort,3)
	 = 0;

% Port 3 - generates zero effort
FOR ALL c_p,Temperature,Massflow,DeltaT
LET delta_h(c_p, flow,3,
		Temperature,effort,1,
		Massflow,flow,2,
		DeltaT,effort,3)
	 = 0;



Deleted mttroot/mtt/lib/cr/r/lcos.cr version [ae185fb84f].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY lcos	linear constitutive relationship with cos modulation
%DESCRIPTION Parameter 1 defines input causality relating to parameter 2
%DESCRIPTION value is effort, flow or state
%DESCRIPTION Parameter 2 is the gain corresponding to the causality of
%DESCRIPTION parameter 1.
%DESCRIPTION Supported components:

%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Linear constitutive relationship with cos modulation


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/11/02 10:18:07  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


OPERATOR lcos;

%DESCRIPTION three port component: EMTF
FOR ALL gain, input, causality, gain_causality, outport, inport,
	 m_input, m_causality
SUCH THAT (
	(causality = gain_causality) AND (outport = 2)
	OR
	(causality NEQ gain_causality) AND (outport = 1)
	)
LET lcos(gain_causality, gain, causality, outport, 
	input, causality, inport,
	m_input, m_causality, 3)
	 = cos(m_input)*gain*input;

FOR ALL gain, input, causality, gain_causality, outport, inport,
	 m_input, m_causality
SUCH THAT (
	(causality NEQ gain_causality) AND (outport = 2)
	OR
	(causality = gain_causality) AND (outport = 1)
	)
LET lcos(gain_causality, gain, causality, outport, 
	input, causality, inport,
	m_input, m_causality, 3)
	 = input/(cos(m_input)*gain);

END;;

Deleted mttroot/mtt/lib/cr/r/lin.cr version [ad1038d916].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226


































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY lin    linear constitutive relationship
%DESCRIPTION Parameter 1 defines input causality relating to parameter 2
%DESCRIPTION value is effort, flow or state
%DESCRIPTION Parameter 2 is the gain corresponding to the causality of
%DESCRIPTION parameter 1.
%DESCRIPTION Supported components:

%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Linear constitutive relationship.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.3  1998/07/04 10:47:04  peterg
% % back under RCS
% %
% % Revision 1.2  1998/03/04 15:38:54  peterg
% % Added END statement
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%DESCRIPTION    single port components: R,C,I
%Linear Constitutive Relationship for single port components: R,C,I.
% e = Gain*f (if gain_causality = flow) 
%           f = Gain*e (if gain_causality = effort)
OPERATOR lin;
FOR ALL gain_causality, gain, causality, input, other_causality
SUCH THAT causality = gain_causality
LET lin(gain_causality, gain, other_causality, 1, input, causality, 1)
         = gain*input;

%Linear CR: e = (1/Gain)*f (if gain_causality = flow) 
%           f = (1/Gain)*e (if gain_causality = effort)
FOR ALL gain_causality, gain, causality, input, other_causality
SUCH THAT causality NEQ gain_causality
LET lin(gain_causality, gain, other_causality, 1, input, causality, 1)
         = input/gain;

%DESCRIPTION    two port components: AE, AF
% Linear Constitutive Relationship for AE and AF
% Output = gain * input

% Unicausal form
FOR ALL gain, input, causality
LET lin(gain, causality, 2, input, causality, 1) = gain*input;

%Bicausal form
FOR ALL gain, output, causality
LET lin(gain, causality, 1, output, causality, 2) = output/gain;

%DESCRIPTION   two port component: TF
% Linear Constitutive Relationship for TF
FOR ALL gain_causality, gain, causality, outport, input, same_causality, inport

SUCH THAT 
       ( causality = same_causality ) 
       AND 
       ( inport NEQ outport )
       AND
       (
       ( (causality = gain_causality) AND (outport = 2) )
       OR
       ( (causality NEQ gain_causality) AND (outport = 1) )
       )
LET lin(gain_causality, gain, causality, outport, 
          input, same_causality, inport)
        = gain*input;

FOR ALL gain_causality, gain, causality, outport, 
        input, same_causality, inport
SUCH THAT 
       ( causality = same_causality ) 
       AND       
       ( inport NEQ outport )
       AND
       (
       ( (causality NEQ gain_causality) AND (outport = 2) )
       OR
       ( (causality = gain_causality) AND (outport = 1) )
       )
LET lin(gain_causality, gain, causality, outport, 
         input, same_causality, inport)
        = input/gain;

%% This version in not reliable. I rellly need to pass component names
%% as cr arguments.

%DESCRIPTION    two port component: GY
% Linear Constitutive Relationship for GY

FOR ALL gain, input, causality, gain_causality, other_causality, 
        outport, inport
SUCH THAT 
        (causality NEQ other_causality) 
        AND
        ( inport NEQ outport )
        AND
        (
        ( (causality NEQ gain_causality) AND (outport = 2) )
        OR
        ( (causality NEQ gain_causality) AND (outport = 1) )
        )
LET lin(gain_causality, gain, other_causality, outport, 
        input, causality, inport)
         = input/gain;

FOR ALL gain, input, causality, gain_causality, other_causality, 
        outport, inport
SUCH THAT 
        (causality NEQ other_causality) 
        AND
        ( inport NEQ outport )
        AND
        (
        ( (causality = gain_causality) AND (outport = 2) )
        OR
        ( (causality = gain_causality) AND (outport = 1) )
        )
LET lin(gain_causality, gain, other_causality, outport, 
        input, causality, inport)
         = gain*input;

%DESCRIPTION    three port component: FMR

% Linear Constitutive Relationship for FMR - unicausal case
% Flow modulation multiplies effort on port 1 (or divides flow)

% The 4 possibilities follow...
FOR ALL gain_causality, gain, out_causality, input, in_causality,
        mod_input
SUCH THAT (gain_causality=in_causality) AND (out_causality=flow)
LET lin(gain_causality, gain, out_causality, 1, 
                input, in_causality, 1,
                mod_input, flow, 2)
         = input*gain*mod_input;

FOR ALL gain_causality, gain, out_causality, input, in_causality,
        mod_input
SUCH THAT (gain_causality=in_causality) AND (out_causality=effort)
LET lin(gain_causality, gain, out_causality, 1, 
                input, in_causality, 1,
                mod_input, flow, 2)
         = input*gain/mod_input;

FOR ALL gain_causality, gain, out_causality, input, in_causality,
        mod_input
SUCH THAT (gain_causality NEQ in_causality) AND (out_causality=flow)
LET lin(gain_causality, gain, out_causality, 1, 
                input, in_causality, 1,
                mod_input, flow, 2)
         = input*mod_input/gain;

FOR ALL gain_causality, gain, out_causality, input, in_causality,
        mod_input
SUCH THAT (gain_causality NEQ in_causality) AND (out_causality=effort)
LET lin(gain_causality, gain, out_causality, 1, 
                input, in_causality, 1,
                mod_input, flow, 2)
         = input/(gain*mod_input);

% Linear Constitutive Relationship for FMR - bicausal case
% Deduces the flow on port 2.

% The 2 possibilities follow...
FOR ALL gain,  e_input, f_input
LET lin(effort, gain, flow, 2, 
                e_input, effort, 1,
                f_input, flow, 1)
         = (f_input/e_input)/gain;

%EMTF component - modulation only
% Linear Constitutive Relationship for EMTF
FOR ALL gain_causality, gain, causality, outport, input, same_causality, inport
SUCH THAT 
       ( (causality = gain_causality) AND (outport = 2) )
       OR
       ( (causality NEQ gain_causality) AND (outport = 1) )
LET lin(gain_causality, causality, outport, 
          input, same_causality, inport,
	  gain, effort, 3)
        = gain*input;

FOR ALL gain_causality, gain, causality, outport, 
        input, same_causality, inport
SUCH THAT 
       ( (causality NEQ gain_causality) AND (outport = 2) )
       OR
       ( (causality = gain_causality) AND (outport = 1) )
LET lin(gain_causality, causality, outport, 
         input, same_causality, inport,
	  gain, effort, 3)
        = input/gain;

%EMTF component - modulation and gain
% Linear Constitutive Relationship for EMTF
FOR ALL gain_causality, gain, causality, outport, input,
same_causality, inport, modulation
SUCH THAT 
       ( (causality = gain_causality) AND (outport = 2) )
       OR
       ( (causality NEQ gain_causality) AND (outport = 1) )
LET lin(gain_causality, gain, causality, outport, 
          input, same_causality, inport,
	  modulation, effort, 3)
        = gain*modulation*input;

FOR ALL gain_causality, gain, causality, outport, 
        input, same_causality, inport, modulation
SUCH THAT 
       ( (causality NEQ gain_causality) AND (outport = 2) )
       OR
       ( (causality = gain_causality) AND (outport = 1) )
LET lin(gain_causality, gain, causality, outport, 
         input, same_causality, inport,
	  modulation, effort, 3)
        = input/(gain*modulation);

END;;

Deleted mttroot/mtt/lib/cr/r/linx.cr version [1543a01070].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%%% linx - cr for single port I and C with an initial state x_0



%DESCRIPTION    linear cr for single port I and C with an initial state x0
%DESCRIPTION    only adds x0 if in integral causality


OPERATOR linx;

%% Input causality as specified
%Linear Constitutive Relationship for single port components: C,I.
% e = Gain*f (if gain_causality = flow) 
%           f = Gain*e (if gain_causality = effort)

FOR ALL gain_causality, gain, causality, input, other_causality
SUCH THAT (causality = gain_causality) AND (causality = state)
LET linx(gain_causality, gain, x0, other_causality, 1, input, causality, 1)
         = gain*(input + x0);


FOR ALL gain_causality, gain, causality, input, other_causality
SUCH THAT (causality = gain_causality) AND (causality NEQ state)
LET linx(gain_causality, gain, x0, other_causality, 1, input, causality, 1)
         = gain*(input);

%% Input causality not as specified
%Linear CR: e = (1/Gain)*f (if gain_causality = flow) 
%           f = (1/Gain)*e (if gain_causality = effort)

FOR ALL gain_causality, gain, x0, causality, input, other_causality
SUCH THAT (causality NEQ gain_causality) AND  (causality = state)
LET linx(gain_causality, gain, x0, other_causality, 1, input, causality, 1)
         = (input+x0)/gain;

FOR ALL gain_causality, gain, x0, causality, input, other_causality
SUCH THAT (causality NEQ gain_causality) AND  (causality NEQ state)
LET linx(gain_causality, gain, x0, other_causality, 1, input, causality, 1)
         = (input)/gain;




END;;

Deleted mttroot/mtt/lib/cr/r/lsin.cr version [e44298d701].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY lsin	linear constitutive relationship with sin modulation
%DESCRIPTION Parameter 1 defines input causality relating to parameter 2
%DESCRIPTION value is effort, flow or state
%DESCRIPTION Parameter 2 is the gain corresponding to the causality of
%DESCRIPTION parameter 1.
%DESCRIPTION Supported components:

%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Linear constitutive relationship with sin modulation


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/11/02 10:18:25  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


OPERATOR lsin;

%DESCRIPTION three port component: EMTF
FOR ALL gain, input, causality, gain_causality, outport, inport,
	 m_input, m_causality
SUCH THAT (
	(causality = gain_causality) AND (outport = 2)
	OR
	(causality NEQ gain_causality) AND (outport = 1)
	)
LET lsin(gain_causality, gain, causality, outport, 
	input, causality, inport,
	m_input, m_causality, 3)
	 = sin(m_input)*gain*input;

FOR ALL gain, input, causality, gain_causality, outport, inport,
	 m_input, m_causality
SUCH THAT (
	(causality NEQ gain_causality) AND (outport = 2)
	OR
	(causality = gain_causality) AND (outport = 1)
	)
LET lsin(gain_causality, gain, causality, outport, 
	input, causality, inport,
	m_input, m_causality, 3)
	 = input/(sin(m_input)*gain);

END;;

Deleted mttroot/mtt/lib/cr/r/oneway.cr version [a74db11764].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY oneway	One way constitutive relationship eg Diode
%DESCRIPTION Parameter 1 is a large number being the forward gain
%DESCRIPTION	-- the reciprocal is the backward gain
%DESCRIPTION The input must be an effort
%DESCRIPTION Typical use is an R component with effort input

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


OPERATOR oneway; 

%Input has flow causality
FOR ALL r,  input
LET oneway(r, effort, 1, input, flow, 1)
	 = ((1 - sign(input))/2)*r*input;

%Input has effort causality
FOR ALL r,  input
LET oneway(r, flow, 1, input, effort, 1)
	 = ((1 - sign(input))/2)*(1/r)*input;

Deleted mttroot/mtt/lib/cr/r/polytrop.cr version [e32e195400].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY polytrop	CR for gas turbine compressor


OPERATOR polytrop;

% Port 1 generates zero flow
FOR ALL Ipressure,temperature,Fpressure,gamma,enthflow
LET polytrop(gamma, flow, 1,
		Fpressure,effort,1,
		enthflow,flow,2,
		temperature,effort,3,
		Ipressure,effort,4)
	 = 0;

% Port 2 generates deltaT
FOR ALL Ipressure,temperature,Fpressure,gamma,enthflow
LET polytrop(gamma, effort, 2,
		Fpressure,effort,1,
		enthflow,flow,2,
		temperature,effort,3,
		Ipressure,effort,4)
	 = temperature*((Ipressure/Fpressure)^(gamma)-1);

% Port 3 generates zero flow
FOR ALL Ipressure,temperature,Fpressure,gamma,enthflow
LET polytrop(gamma, flow, 3,
		Fpressure,effort,1,
		enthflow,flow,2,
		temperature,effort,3,
		Ipressure,effort,4)
	 = 0;

% Port 4 generates zero flow
FOR ALL Ipressure,temperature,Fpressure,gamma,enthflow
LET polytrop(gamma, flow, 4,
		Fpressure,effort,1,
		enthflow,flow,2,
		temperature,effort,3,
		Ipressure,effort,4)
	 = 0;

Deleted mttroot/mtt/lib/cr/r/powerlaw.cr version [18888cef83].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY powerlaw	powerlaw constitutive relationship
%DESCRIPTION Parameter 1 defines input causality relating to parameter 2
%DESCRIPTION value is effort or flow
%DESCRIPTION Parameter 2 is the gain r corresponding to the causality of
%DESCRIPTION parameter 1.
%DESCRIPTION Supported components:


%DESCRIPTION	single port components: R

%Powerlaw Constitutive Relationship for single port components: R


OPERATOR powerlaw;
FOR ALL gain_causality, gain, power, causality, input, other_causality
SUCH THAT causality = gain_causality
LET powerlaw(gain_causality, gain, power, other_causality, 1, input, causality, 1)
	 = gain*(abs(input)^power)*sign(input);


FOR ALL gain_causality, gain, power, causality, input, other_causality
SUCH THAT causality NEQ gain_causality
LET powerlaw(gain_causality, gain, power, other_causality, 1, input, causality, 1)
	 = ( (abs(input)/gain)^(1/power) )*sign(input);

END;

Deleted mttroot/mtt/lib/cr/r/reed.cr version [2dd994541f].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY reed Nonlinear 2-port R for musical reed component


%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Linear constitutive relationship.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/11/02 10:21:19  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/09/12 11:18:26  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Linear Constitutive Relationship for reed - unicausal case with 
% pressure output.
OPERATOR reed,abs,sign;

% Port 1 - the modulated R
FOR ALL D,q,H,airflow,displacement
LET reed(D,q,H, effort, 1, 
		airflow,flow,1,
		displacement, effort,2)
	 = (D*sign(airflow)*(airflow)^q)/((H-displacement)^2);

% Port 2 - zero flow
FOR ALL D,q,H,airflow,displacement
LET reed(D,q, flow, 2, 
		airflow,flow,1,
		displacement, effort,2)
	 =0;

Deleted mttroot/mtt/lib/cr/r/sat_tank.cr version [95637b5048].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY sat_tank Saturation nonlinearity with variable slopes for tank
%DESCRIPTION Parameter 1 is the slope of the "normal" linear part of the CR
%DESCRIPTION Parameter 2 is the "large" slope
%DESCRIPTION Parameter 3 is the lower bound of the state
%DESCRIPTION Parameter 4 is the upper bound of the state


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

OPERATOR sign0;
FOR ALL x
	LET sign0(x) = (sign(x)+1)/2;

OPERATOR sat_tank; 
%Output has effort causality, input is state
FOR ALL k_0, k_1, x_0, x_1, x
LET sat_tank(k_0, k_1, x_0, x_1, effort, 1,
         x, state, 1)
	 = x*k_0 + (x-x_1)*(k_1-k_0)*sign0(x-x_1) + (x-x_0)*(k_1-k_0)*sign0(x_0-x);


Deleted mttroot/mtt/lib/cr/r/slcos.cr version [e42d3ee3a4].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY slcos	linear constitutive relationship with sin modulation - sensitivity
%DESCRIPTION Parameter 1 defines input causality relating to parameter 2
%DESCRIPTION value is effort, flow or state
%DESCRIPTION Parameter 2 is the gain corresponding to the causality of
%DESCRIPTION parameter 1.
%DESCRIPTION Supported components:


OPERATOR slcos;

%DESCRIPTION four port component - effort i/o
FOR ALL gain, input, junk, m_input, dm_input
LET slcos(gain, effort, 2, 
	input, effort, 1,
	junk, flow, 2,
	m_input, effort, 3,
        dm_input,effort, 4)
	 = -gain*sin(m_input)*dm_input*input;

%DESCRIPTION four port component - flow i/o
FOR ALL gain, input, junk, m_input, dm_input
LET slcos(gain, flow, 2, 
	input, flow, 1,
	junk, effort, 2,
	m_input, effort, 3,
        dm_input,effort, 4)
	 = -gain*sin(m_input)*dm_input*input;

END;;

Deleted mttroot/mtt/lib/cr/r/slin.cr version [d6c337d46d].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%DESCRIPTION Sensitivity version of lin

% One port version for historical reasons
OPERATOR slin;
FOR ALL gain_causality, gain, causality, input, other_causality
LET slin(gain_causality, gain, other_causality, 1, input, causality, 1)
         = lin(gain_causality, gain, other_causality, 1, input,
	 causality, 1);

% Two port version for sC,sI,sR 

% Port 1 - standard 
FOR ALL gain_causality, gain, sgain, causality, input, sinput, other_causality
LET slin(gain_causality, gain, sgain, other_causality, 1, 
       input, causality, 1,
       sinput, causality, 2)
         = lin(gain_causality, gain, other_causality, 1, 
               input, causality, 1); 


% Port 2 - sensitivity
FOR ALL gain_causality, gain, sgain, causality, input, sinput, other_causality
LET slin(gain_causality, gain, sgain, other_causality, 2, 
       input, causality, 1,
       sinput, causality, 2)
         = lin(gain_causality, gain, other_causality, 1, 
               sinput, causality, 1)
         + sgain*df(lin(gain_causality, gain, other_causality, 1, 
               input, causality, 1), gain); 

END;;

Deleted mttroot/mtt/lib/cr/r/slsin.cr version [68fd274f15].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY slsin	linear constitutive relationship with sin modulation - sensitivity
%DESCRIPTION Parameter 1 defines input causality relating to parameter 2
%DESCRIPTION value is effort, flow or state
%DESCRIPTION Parameter 2 is the gain corresponding to the causality of
%DESCRIPTION parameter 1.
%DESCRIPTION Supported components:


OPERATOR slsin;

%DESCRIPTION four port component - effort i/o
FOR ALL gain, input, junk, m_input, dm_input
LET slsin(gain, effort, 2, 
	input, effort, 1,
	junk, flow, 2,
	m_input, effort, 3,
        dm_input,effort, 4)
	 = gain*cos(m_input)*dm_input*input;

%DESCRIPTION four port component - flow i/o
FOR ALL gain, input, junk, m_input, dm_input
LET slsin(gain, flow, 2, 
	input, flow, 1,
	junk, effort, 2,
	m_input, effort, 3,
        dm_input,effort, 4)
	 = gain*cos(m_input)*dm_input*input;

END;;

Deleted mttroot/mtt/lib/cr/r/square.cr version [34c368838f].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY square	square-law constitutive relationship
%DESCRIPTION Parameter 1 defines input causality relating to parameter 2
%DESCRIPTION value is effort or flow
%DESCRIPTION Parameter 2 is the gain r corresponding to the causality of
%DESCRIPTION parameter 1.
%DESCRIPTION Supported components:


%DESCRIPTION	single port components: R

%Square-Law Constitutive Relationship for single port components: R
% output = Gain*input^2*sign(input) {if gain_causality = causality} 
% output = (1/Gain^(1/2))*input^(1/2)*sign(input) 
%		{if gain_causality not= causality} 



OPERATOR square;
FOR ALL gain_causality, gain, causality, input, other_causality
SUCH THAT causality = gain_causality
LET square(gain_causality, gain, other_causality, 1, input, causality, 1)
	 = gain*input^2*sign(input);


FOR ALL gain_causality, gain, causality, input, other_causality
SUCH THAT causality NEQ gain_causality
LET square(gain_causality, gain, other_causality, 1, input, causality, 1)
	 = input^(1/2)*sign(input)/(gain^(1/2));


END;

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Comb_abg.m version [64d72d515d].

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
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
123
124
125





























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Comb] =  Comb_abg
# This function is the acausal bond graph representation of Comb
# Generated by MTT on Thu Mar 16 10:33:30 2000
# The file is in Octave format

# Subsystems and Ports

# Port Hydraulic_in
  Comb.ports.Hydraulic_in.type = "SS";
  Comb.ports.Hydraulic_in.cr = "SS";
  Comb.ports.Hydraulic_in.arg = "external,external";
  Comb.ports.Hydraulic_in.repetitions = 1;
  Comb.ports.Hydraulic_in.status = -1;
  Comb.ports.Hydraulic_in.connections = [-3 ];

# Port Hydraulic_out
  Comb.ports.Hydraulic_out.type = "SS";
  Comb.ports.Hydraulic_out.cr = "SS";
  Comb.ports.Hydraulic_out.arg = "external,external";
  Comb.ports.Hydraulic_out.repetitions = 1;
  Comb.ports.Hydraulic_out.status = -1;
  Comb.ports.Hydraulic_out.connections = [7 ];

# Port Heat
  Comb.ports.Heat.type = "SS";
  Comb.ports.Heat.cr = "SS";
  Comb.ports.Heat.arg = "external,external";
  Comb.ports.Heat.repetitions = 1;
  Comb.ports.Heat.status = -1;
  Comb.ports.Heat.connections = [-5 ];

# Port Thermal_in
  Comb.ports.Thermal_in.type = "SS";
  Comb.ports.Thermal_in.cr = "SS";
  Comb.ports.Thermal_in.arg = "external,external";
  Comb.ports.Thermal_in.repetitions = 1;
  Comb.ports.Thermal_in.status = -1;
  Comb.ports.Thermal_in.connections = [-2 ];

# Port Thermal_out
  Comb.ports.Thermal_out.type = "SS";
  Comb.ports.Thermal_out.cr = "SS";
  Comb.ports.Thermal_out.arg = "external,external";
  Comb.ports.Thermal_out.repetitions = 1;
  Comb.ports.Thermal_out.status = -1;
  Comb.ports.Thermal_out.connections = [6 ];

# Component P
  Comb.subsystems.P.type = "SS";
  Comb.subsystems.P.cr = "SS";
  Comb.subsystems.P.arg = "external,0";
  Comb.subsystems.P.repetitions = 1;
  Comb.subsystems.P.status = -1;
  Comb.subsystems.P.connections = [9 ];

# Component T
  Comb.subsystems.T.type = "SS";
  Comb.subsystems.T.cr = "SS";
  Comb.subsystems.T.arg = "external,0";
  Comb.subsystems.T.repetitions = 1;
  Comb.subsystems.T.status = -1;
  Comb.subsystems.T.connections = [8 ];

# Component pipe
  Comb.subsystems.pipe.type = "hPipe";
  Comb.subsystems.pipe.cr = "none";
  Comb.subsystems.pipe.arg = "m_c;v_c;r";
  Comb.subsystems.pipe.repetitions = 1;
  Comb.subsystems.pipe.status = -1;
  Comb.subsystems.pipe.connections = [5 3 -4 2 -1 ];

# Component mtt1
  Comb.subsystems.mtt1.type = "0";
  Comb.subsystems.mtt1.cr = "";
  Comb.subsystems.mtt1.arg = "";
  Comb.subsystems.mtt1.repetitions = 1;
  Comb.subsystems.mtt1.status = -1;
  Comb.subsystems.mtt1.connections = [1 -6 -8 ];

# Component mtt2
  Comb.subsystems.mtt2.type = "0";
  Comb.subsystems.mtt2.cr = "";
  Comb.subsystems.mtt2.arg = "";
  Comb.subsystems.mtt2.repetitions = 1;
  Comb.subsystems.mtt2.status = -1;
  Comb.subsystems.mtt2.connections = [4 -7 -9 ];

# Ordered list of Port names
  Comb.portlist(1,:) = "Hydraulic_in ";
  Comb.portlist(2,:) = "Hydraulic_out";
  Comb.portlist(3,:) = "Heat         ";
  Comb.portlist(4,:) = "Thermal_in   ";
  Comb.portlist(5,:) = "Thermal_out  ";

# Ordered list of subsystem names
  Comb.subsystemlist(1,:) = "P   ";
  Comb.subsystemlist(2,:) = "T   ";
  Comb.subsystemlist(3,:) = "pipe";
  Comb.subsystemlist(4,:) = "mtt1";
  Comb.subsystemlist(5,:) = "mtt2";

# Bonds 
  Comb.bonds = [
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      1 1 
      1 1 
      ];

# Aliases 
# A double underscore __ represents a comma 
Comb.alias.out = "Thermal_out,Hydraulic_out";
Comb.alias.Hy_out = "Hydraulic_out";
Comb.alias.v_c = "$2";
Comb.alias.Th_in = "Thermal_in";
Comb.alias.r = "$3";
Comb.alias.Th_out = "Thermal_out";
Comb.alias.in = "Thermal_in,Hydraulic_in";
Comb.alias.Hy_in = "Hydraulic_in";
Comb.alias.m_c = "$1";

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Density_abg.m version [1b2d66d65e].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81

















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Density] =  Density_abg
# This function is the acausal bond graph representation of Density
# Generated by MTT on Thu Mar 16 10:36:39 2000
# The file is in Octave format

# Subsystems and Ports

# Port Pressure
  Density.ports.Pressure.type = "SS";
  Density.ports.Pressure.cr = "SS";
  Density.ports.Pressure.arg = "external,external";
  Density.ports.Pressure.repetitions = 1;
  Density.ports.Pressure.status = -1;
  Density.ports.Pressure.connections = [-4 ];

# Port Temperature
  Density.ports.Temperature.type = "SS";
  Density.ports.Temperature.cr = "SS";
  Density.ports.Temperature.arg = "external,external";
  Density.ports.Temperature.repetitions = 1;
  Density.ports.Temperature.status = -1;
  Density.ports.Temperature.connections = [-5 ];

# Port Density
  Density.ports.Density.type = "SS";
  Density.ports.Density.cr = "SS";
  Density.ports.Density.arg = "external,external";
  Density.ports.Density.repetitions = 1;
  Density.ports.Density.status = -1;
  Density.ports.Density.connections = [3 ];

# Component r
  Density.subsystems.r.type = "R";
  Density.subsystems.r.cr = "Density";
  Density.subsystems.r.arg = "density,ideal_gas,r";
  Density.subsystems.r.repetitions = 1;
  Density.subsystems.r.status = -1;
  Density.subsystems.r.connections = [1 2 -3 ];

# Component mtt1
  Density.subsystems.mtt1.type = "AE";
  Density.subsystems.mtt1.cr = "";
  Density.subsystems.mtt1.arg = "";
  Density.subsystems.mtt1.repetitions = 1;
  Density.subsystems.mtt1.status = -1;
  Density.subsystems.mtt1.connections = [4 -1 ];

# Component mtt2
  Density.subsystems.mtt2.type = "AE";
  Density.subsystems.mtt2.cr = "";
  Density.subsystems.mtt2.arg = "";
  Density.subsystems.mtt2.repetitions = 1;
  Density.subsystems.mtt2.status = -1;
  Density.subsystems.mtt2.connections = [5 -2 ];

# Ordered list of Port names
  Density.portlist(1,:) = "Pressure   ";
  Density.portlist(2,:) = "Temperature";
  Density.portlist(3,:) = "Density    ";

# Ordered list of subsystem names
  Density.subsystemlist(1,:) = "r   ";
  Density.subsystemlist(2,:) = "mtt1";
  Density.subsystemlist(3,:) = "mtt2";

# Bonds 
  Density.bonds = [
      1 1 
      1 1 
      1 1 
      0 0 
      0 0 
      ];

# Aliases 
# A double underscore __ represents a comma 
Density.alias.P = "Pressure";
Density.alias.out = "Density";
Density.alias.rho = "Density";
Density.alias.T = "Temperature";
Density.alias.density__ideal_gas__r = "$1";

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Density_cr.r version [5fd3e01e3d].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Constitutive relation file for Density (Density_cr.r)
% Generated by MTT at Wed Mar 11 11:01:28 GMT 1998

OPERATOR Density;

% Ideal gas
FOR ALL R,Temperature,Pressure,Nothing
LET Density(density,ideal_gas,R,effort,3,
	Pressure,effort,1,
	Temperature,effort,2,
	Nothing,flow,3
	) = Pressure/(R*Temperature);

FOR ALL R,Temperature,Pressure,Nothing
LET Density(specific_volume,ideal_gas,R,effort,3,
	Pressure,effort,1,
	Temperature,effort,2,
	Nothing,flow,3
	) = (R*Temperature)/Pressure;

% Incompressible
FOR ALL rho,Temperature,Pressure,Nothing
LET Density(density,incompressible,rho,effort,3,
	Pressure,effort,1,
	Temperature,effort,2,
	Nothing,flow,3
	) = rho;

FOR ALL rho,Temperature,Pressure,Nothing
LET Density(specific_volume,incompressible,rho,effort,3,
	Pressure,effort,1,
	Temperature,effort,2,
	Nothing,flow,3
	) = 1/rho;

END;

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/In_abg.m version [39b730b677].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [In] =  In_abg
# This function is the acausal bond graph representation of In
# Generated by MTT on Thu Mar 16 10:33:58 2000
# The file is in Octave format

# Subsystems and Ports

# Port Hy_out
  In.ports.Hy_out.type = "SS";
  In.ports.Hy_out.cr = "SS";
  In.ports.Hy_out.arg = "external,external";
  In.ports.Hy_out.repetitions = 1;
  In.ports.Hy_out.status = -1;
  In.ports.Hy_out.connections = [2 ];

# Port Th_out
  In.ports.Th_out.type = "SS";
  In.ports.Th_out.cr = "SS";
  In.ports.Th_out.arg = "external,external";
  In.ports.Th_out.repetitions = 1;
  In.ports.Th_out.status = -1;
  In.ports.Th_out.connections = [1 ];

# Component Hy_in
  In.subsystems.Hy_in.type = "SS";
  In.subsystems.Hy_in.cr = "SS";
  In.subsystems.Hy_in.arg = "p_1,internal";
  In.subsystems.Hy_in.repetitions = 1;
  In.subsystems.Hy_in.status = -1;
  In.subsystems.Hy_in.connections = [-2 ];

# Component Th_in
  In.subsystems.Th_in.type = "SS";
  In.subsystems.Th_in.cr = "SS";
  In.subsystems.Th_in.arg = "t_1,internal";
  In.subsystems.Th_in.repetitions = 1;
  In.subsystems.Th_in.status = -1;
  In.subsystems.Th_in.connections = [-1 ];

# Ordered list of Port names
  In.portlist(1,:) = "Hy_out";
  In.portlist(2,:) = "Th_out";

# Ordered list of subsystem names
  In.subsystemlist(1,:) = "Hy_in";
  In.subsystemlist(2,:) = "Th_in";

# Bonds 
  In.bonds = [
      1 1 
      1 1 
      ];

# Aliases 
# A double underscore __ represents a comma 
In.alias.out = "Th_out,Hy_out";
In.alias.in = "Th_out,Hy_out";

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/In_desc.tex version [0c97485c1c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system In (In_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:36 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{In} is
   displayed in Figure \Ref{In_abg} and its label
   file is listed in Section \Ref{sec:In_lbl}.
   The subsystems are listed in Section \Ref{sec:In_sub}.

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Load_abg.m version [ebdf741bae].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Load] =  Load_abg
# This function is the acausal bond graph representation of Load
# Generated by MTT on Thu Mar 16 10:34:27 2000
# The file is in Octave format

# Subsystems and Ports

# Port in
  Load.ports.in.type = "SS";
  Load.ports.in.cr = "SS";
  Load.ports.in.arg = "external,external";
  Load.ports.in.repetitions = 1;
  Load.ports.in.status = -1;
  Load.ports.in.connections = [-1 ];

# Port out
  Load.ports.out.type = "SS";
  Load.ports.out.cr = "SS";
  Load.ports.out.arg = "external,external";
  Load.ports.out.repetitions = 1;
  Load.ports.out.status = -1;
  Load.ports.out.connections = [3 ];

# Component PowerSensor
  Load.subsystems.PowerSensor.type = "PS";
  Load.subsystems.PowerSensor.cr = "";
  Load.subsystems.PowerSensor.arg = "";
  Load.subsystems.PowerSensor.repetitions = 1;
  Load.subsystems.PowerSensor.status = -1;
  Load.subsystems.PowerSensor.connections = [1 -2 -3 ];

# Component r_l
  Load.subsystems.r_l.type = "R";
  Load.subsystems.r_l.cr = "lin";
  Load.subsystems.r_l.arg = "flow,r_l";
  Load.subsystems.r_l.repetitions = 1;
  Load.subsystems.r_l.status = -1;
  Load.subsystems.r_l.connections = [2 ];

# Ordered list of Port names
  Load.portlist(1,:) = "in ";
  Load.portlist(2,:) = "out";

# Ordered list of subsystem names
  Load.subsystemlist(1,:) = "PowerSensor";
  Load.subsystemlist(2,:) = "r_l        ";

# Bonds 
  Load.bonds = [
      0 0 
      0 0 
      0 0 
      ];

# Aliases 
# A double underscore __ represents a comma 
Load.alias.out = "out";
Load.alias.r_l = "$2";
Load.alias.in = "in";
Load.alias.PowerSensor = "$1";

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Out_abg.m version [06caed529c].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Out] =  Out_abg
# This function is the acausal bond graph representation of Out
# Generated by MTT on Thu Mar 16 10:34:51 2000
# The file is in Octave format

# Subsystems and Ports

# Port Hy_in
  Out.ports.Hy_in.type = "SS";
  Out.ports.Hy_in.cr = "SS";
  Out.ports.Hy_in.arg = "external,external";
  Out.ports.Hy_in.repetitions = 1;
  Out.ports.Hy_in.status = -1;
  Out.ports.Hy_in.connections = [-1 ];

# Port Th_in
  Out.ports.Th_in.type = "SS";
  Out.ports.Th_in.cr = "SS";
  Out.ports.Th_in.arg = "external,external";
  Out.ports.Th_in.repetitions = 1;
  Out.ports.Th_in.status = -1;
  Out.ports.Th_in.connections = [-2 ];

# Component Hy_out
  Out.subsystems.Hy_out.type = "SS";
  Out.subsystems.Hy_out.cr = "SS";
  Out.subsystems.Hy_out.arg = "p_1,internal";
  Out.subsystems.Hy_out.repetitions = 1;
  Out.subsystems.Hy_out.status = -1;
  Out.subsystems.Hy_out.connections = [1 ];

# Component Th_out
  Out.subsystems.Th_out.type = "SS";
  Out.subsystems.Th_out.cr = "SS";
  Out.subsystems.Th_out.arg = "t_1,internal";
  Out.subsystems.Th_out.repetitions = 1;
  Out.subsystems.Th_out.status = -1;
  Out.subsystems.Th_out.connections = [2 ];

# Ordered list of Port names
  Out.portlist(1,:) = "Hy_in";
  Out.portlist(2,:) = "Th_in";

# Ordered list of subsystem names
  Out.subsystemlist(1,:) = "Hy_out";
  Out.subsystemlist(2,:) = "Th_out";

# Bonds 
  Out.bonds = [
      -1 -1 
      -1 -1 
      ];

# Aliases 
# A double underscore __ represents a comma 
Out.alias.in = "Th_in,Hy_in";

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Out_desc.tex version [3dd57dc573].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Out (Out_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:44 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Out} is
   displayed in Figure \Ref{Out_abg} and its label
   file is listed in Section \Ref{sec:Out_lbl}.
   The subsystems are listed in Section \Ref{sec:Out_sub}.

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Poly_abg.m version [efdf7b7d95].

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
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


























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Poly] =  Poly_abg
# This function is the acausal bond graph representation of Poly
# Generated by MTT on Thu Mar 16 10:35:48 2000
# The file is in Octave format

# Subsystems and Ports

# Port Pressure_1
  Poly.ports.Pressure_1.type = "SS";
  Poly.ports.Pressure_1.cr = "SS";
  Poly.ports.Pressure_1.arg = "external,external";
  Poly.ports.Pressure_1.repetitions = 1;
  Poly.ports.Pressure_1.status = -1;
  Poly.ports.Pressure_1.connections = [-2 ];

# Port Temperature_1
  Poly.ports.Temperature_1.type = "SS";
  Poly.ports.Temperature_1.cr = "SS";
  Poly.ports.Temperature_1.arg = "external,external";
  Poly.ports.Temperature_1.repetitions = 1;
  Poly.ports.Temperature_1.status = -1;
  Poly.ports.Temperature_1.connections = [-6 ];

# Port Pressure_2
  Poly.ports.Pressure_2.type = "SS";
  Poly.ports.Pressure_2.cr = "SS";
  Poly.ports.Pressure_2.arg = "external,external";
  Poly.ports.Pressure_2.repetitions = 1;
  Poly.ports.Pressure_2.status = -1;
  Poly.ports.Pressure_2.connections = [-4 ];

# Port Temperature_2
  Poly.ports.Temperature_2.type = "SS";
  Poly.ports.Temperature_2.cr = "SS";
  Poly.ports.Temperature_2.arg = "external,external";
  Poly.ports.Temperature_2.repetitions = 1;
  Poly.ports.Temperature_2.status = -1;
  Poly.ports.Temperature_2.connections = [8 ];

# Component r
  Poly.subsystems.r.type = "R";
  Poly.subsystems.r.cr = "Poly";
  Poly.subsystems.r.arg = "alpha";
  Poly.subsystems.r.repetitions = 1;
  Poly.subsystems.r.status = -1;
  Poly.subsystems.r.connections = [1 3 5 -7 ];

# Component zero
  Poly.subsystems.zero.type = "SS";
  Poly.subsystems.zero.cr = "SS";
  Poly.subsystems.zero.arg = "0,0";
  Poly.subsystems.zero.repetitions = 1;
  Poly.subsystems.zero.status = -1;
  Poly.subsystems.zero.connections = [-9 ];

# Component mtt1
  Poly.subsystems.mtt1.type = "AE";
  Poly.subsystems.mtt1.cr = "";
  Poly.subsystems.mtt1.arg = "";
  Poly.subsystems.mtt1.repetitions = 1;
  Poly.subsystems.mtt1.status = -1;
  Poly.subsystems.mtt1.connections = [2 -1 ];

# Component mtt2
  Poly.subsystems.mtt2.type = "AE";
  Poly.subsystems.mtt2.cr = "";
  Poly.subsystems.mtt2.arg = "";
  Poly.subsystems.mtt2.repetitions = 1;
  Poly.subsystems.mtt2.status = -1;
  Poly.subsystems.mtt2.connections = [4 -3 ];

# Component mtt3
  Poly.subsystems.mtt3.type = "AE";
  Poly.subsystems.mtt3.cr = "";
  Poly.subsystems.mtt3.arg = "";
  Poly.subsystems.mtt3.repetitions = 1;
  Poly.subsystems.mtt3.status = -1;
  Poly.subsystems.mtt3.connections = [6 -5 ];

# Component mtt4
  Poly.subsystems.mtt4.type = "1";
  Poly.subsystems.mtt4.cr = "";
  Poly.subsystems.mtt4.arg = "";
  Poly.subsystems.mtt4.repetitions = 1;
  Poly.subsystems.mtt4.status = -1;
  Poly.subsystems.mtt4.connections = [7 -8 9 ];

# Ordered list of Port names
  Poly.portlist(1,:) = "Pressure_1   ";
  Poly.portlist(2,:) = "Temperature_1";
  Poly.portlist(3,:) = "Pressure_2   ";
  Poly.portlist(4,:) = "Temperature_2";

# Ordered list of subsystem names
  Poly.subsystemlist(1,:) = "r   ";
  Poly.subsystemlist(2,:) = "zero";
  Poly.subsystemlist(3,:) = "mtt1";
  Poly.subsystemlist(4,:) = "mtt2";
  Poly.subsystemlist(5,:) = "mtt3";
  Poly.subsystemlist(6,:) = "mtt4";

# Bonds 
  Poly.bonds = [
      1 1 
      0 0 
      1 1 
      0 0 
      1 1 
      0 0 
      0 0 
      0 0 
      1 -1 
      ];

# Aliases 
# A double underscore __ represents a comma 
Poly.alias.out = "Temperature_2";
Poly.alias.P1 = "Pressure_1";
Poly.alias.P2 = "Pressure_2";
Poly.alias.T1 = "Temperature_1";
Poly.alias.T2 = "Temperature_2";
Poly.alias.alpha = "$1";

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Poly_cr.r version [ad1eaacee8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Constitutive relation file for Poly (Poly_cr.r)
% Generated by MTT at Wed Mar 11 11:01:28 GMT 1998

OPERATOR Poly;

% Ideal gas

% Temperature output on port [T2]
FOR ALL alpha,P1,P2,T1,Nothing
LET Poly(alpha,effort,4,
	P1,effort,1,
	P2,effort,2,
	T1,effort,3,
	Nothing,flow,4
	) = T1*(P2/P1)^alpha;



END;

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/Pump_abg.m version [3fd343e8e9].

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
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
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
173
174
175
176
177
178
179
180




















































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [Pump] =  Pump_abg
# This function is the acausal bond graph representation of Pump
# Generated by MTT on Thu Mar 16 10:38:10 2000
# The file is in Octave format

# Subsystems and Ports

# Port Hydraulic_in
  Pump.ports.Hydraulic_in.type = "SS";
  Pump.ports.Hydraulic_in.cr = "SS";
  Pump.ports.Hydraulic_in.arg = "external,external";
  Pump.ports.Hydraulic_in.repetitions = 1;
  Pump.ports.Hydraulic_in.status = -1;
  Pump.ports.Hydraulic_in.connections = [-5 ];

# Port Hydraulic_out
  Pump.ports.Hydraulic_out.type = "SS";
  Pump.ports.Hydraulic_out.cr = "SS";
  Pump.ports.Hydraulic_out.arg = "external,external";
  Pump.ports.Hydraulic_out.repetitions = 1;
  Pump.ports.Hydraulic_out.status = -1;
  Pump.ports.Hydraulic_out.connections = [6 ];

# Port Shaft
  Pump.ports.Shaft.type = "SS";
  Pump.ports.Shaft.cr = "SS";
  Pump.ports.Shaft.arg = "external,external";
  Pump.ports.Shaft.repetitions = 1;
  Pump.ports.Shaft.status = -1;
  Pump.ports.Shaft.connections = [-12 ];

# Port Thermal_in
  Pump.ports.Thermal_in.type = "SS";
  Pump.ports.Thermal_in.cr = "SS";
  Pump.ports.Thermal_in.arg = "external,external";
  Pump.ports.Thermal_in.repetitions = 1;
  Pump.ports.Thermal_in.status = -1;
  Pump.ports.Thermal_in.connections = [-4 ];

# Port Thermal_out
  Pump.ports.Thermal_out.type = "SS";
  Pump.ports.Thermal_out.cr = "SS";
  Pump.ports.Thermal_out.arg = "external,external";
  Pump.ports.Thermal_out.repetitions = 1;
  Pump.ports.Thermal_out.status = -1;
  Pump.ports.Thermal_out.connections = [16 ];

# Component pipe
  Pump.subsystems.pipe.type = "wPipe";
  Pump.subsystems.pipe.cr = "none";
  Pump.subsystems.pipe.arg = "c_v;density,ideal_gas,r";
  Pump.subsystems.pipe.repetitions = 1;
  Pump.subsystems.pipe.status = -1;
  Pump.subsystems.pipe.connections = [3 -7 14 2 -1 ];

# Component poly
  Pump.subsystems.poly.type = "Poly";
  Pump.subsystems.poly.cr = "Poly";
  Pump.subsystems.poly.arg = "alpha";
  Pump.subsystems.poly.repetitions = 1;
  Pump.subsystems.poly.status = -1;
  Pump.subsystems.poly.connections = [9 8 11 -10 ];

# Component T
  Pump.subsystems.T.type = "SS";
  Pump.subsystems.T.cr = "SS";
  Pump.subsystems.T.arg = "external,0";
  Pump.subsystems.T.repetitions = 1;
  Pump.subsystems.T.status = -1;
  Pump.subsystems.T.connections = [17 ];

# Component k_p
  Pump.subsystems.k_p.type = "TF";
  Pump.subsystems.k_p.cr = "lin";
  Pump.subsystems.k_p.arg = "flow,k_p";
  Pump.subsystems.k_p.repetitions = 1;
  Pump.subsystems.k_p.status = -1;
  Pump.subsystems.k_p.connections = [13 -14 ];

# Component mtt1
  Pump.subsystems.mtt1.type = "0";
  Pump.subsystems.mtt1.cr = "";
  Pump.subsystems.mtt1.arg = "";
  Pump.subsystems.mtt1.repetitions = 1;
  Pump.subsystems.mtt1.status = -1;
  Pump.subsystems.mtt1.connections = [1 10 -15 -17 ];

# Component mtt2
  Pump.subsystems.mtt2.type = "0";
  Pump.subsystems.mtt2.cr = "";
  Pump.subsystems.mtt2.arg = "";
  Pump.subsystems.mtt2.repetitions = 1;
  Pump.subsystems.mtt2.status = -1;
  Pump.subsystems.mtt2.connections = [-6 7 -11 ];

# Component mtt3
  Pump.subsystems.mtt3.type = "0";
  Pump.subsystems.mtt3.cr = "";
  Pump.subsystems.mtt3.arg = "";
  Pump.subsystems.mtt3.repetitions = 1;
  Pump.subsystems.mtt3.status = -1;
  Pump.subsystems.mtt3.connections = [-3 5 -9 ];

# Component mtt4
  Pump.subsystems.mtt4.type = "0";
  Pump.subsystems.mtt4.cr = "";
  Pump.subsystems.mtt4.arg = "";
  Pump.subsystems.mtt4.repetitions = 1;
  Pump.subsystems.mtt4.status = -1;
  Pump.subsystems.mtt4.connections = [-2 4 -8 ];

# Component mtt5
  Pump.subsystems.mtt5.type = "EBTF";
  Pump.subsystems.mtt5.cr = "";
  Pump.subsystems.mtt5.arg = "";
  Pump.subsystems.mtt5.repetitions = 1;
  Pump.subsystems.mtt5.status = -1;
  Pump.subsystems.mtt5.connections = [15 -16 ];

# Component mtt6
  Pump.subsystems.mtt6.type = "1";
  Pump.subsystems.mtt6.cr = "";
  Pump.subsystems.mtt6.arg = "";
  Pump.subsystems.mtt6.repetitions = 1;
  Pump.subsystems.mtt6.status = -1;
  Pump.subsystems.mtt6.connections = [12 -13 ];

# Ordered list of Port names
  Pump.portlist(1,:) = "Hydraulic_in ";
  Pump.portlist(2,:) = "Hydraulic_out";
  Pump.portlist(3,:) = "Shaft        ";
  Pump.portlist(4,:) = "Thermal_in   ";
  Pump.portlist(5,:) = "Thermal_out  ";

# Ordered list of subsystem names
  Pump.subsystemlist(1,:) = "pipe";
  Pump.subsystemlist(2,:) = "poly";
  Pump.subsystemlist(3,:) = "T   ";
  Pump.subsystemlist(4,:) = "k_p ";
  Pump.subsystemlist(5,:) = "mtt1";
  Pump.subsystemlist(6,:) = "mtt2";
  Pump.subsystemlist(7,:) = "mtt3";
  Pump.subsystemlist(8,:) = "mtt4";
  Pump.subsystemlist(9,:) = "mtt5";
  Pump.subsystemlist(10,:) = "mtt6";

# Bonds 
  Pump.bonds = [
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      -1 -1 
      0 0 
      0 0 
      0 0 
      0 0 
      1 1 
      ];

# Aliases 
# A double underscore __ represents a comma 
Pump.alias.out = "Thermal_out,Hydraulic_out";
Pump.alias.Hy_out = "Hydraulic_out";
Pump.alias.c_v = "$1";
Pump.alias.flow__k_p = "$4";
Pump.alias.Th_in = "Thermal_in";
Pump.alias.Th_out = "Thermal_out";
Pump.alias.Work = "Shaft";
Pump.alias.alpha = "$3";
Pump.alias.in = "Thermal_in,Hydraulic_in";
Pump.alias.Hy_in = "Hydraulic_in";
Pump.alias.density__ideal_gas__r = "$2";

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/SimpleGasTurbineABG_abg.m version [43a702b612].

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
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
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





































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [SimpleGasTurbineABG] =  SimpleGasTurbineABG_abg
# This function is the acausal bond graph representation of SimpleGasTurbineABG
# Generated by MTT on Thu Mar 16 12:59:12 2000
# The file is in Octave format

# Subsystems and Ports

# Component c1
  SimpleGasTurbineABG.subsystems.c1.type = "Comb";
  SimpleGasTurbineABG.subsystems.c1.cr = "none";
  SimpleGasTurbineABG.subsystems.c1.arg = "m_c;v_c;r";
  SimpleGasTurbineABG.subsystems.c1.repetitions = 1;
  SimpleGasTurbineABG.subsystems.c1.status = -1;
  SimpleGasTurbineABG.subsystems.c1.connections = [14 -15 7 10 -11 ];

# Component j_s
  SimpleGasTurbineABG.subsystems.j_s.type = "I";
  SimpleGasTurbineABG.subsystems.j_s.cr = "lin";
  SimpleGasTurbineABG.subsystems.j_s.arg = "flow,j_s";
  SimpleGasTurbineABG.subsystems.j_s.repetitions = 1;
  SimpleGasTurbineABG.subsystems.j_s.status = -1;
  SimpleGasTurbineABG.subsystems.j_s.connections = [2 ];

# Component comp
  SimpleGasTurbineABG.subsystems.comp.type = "Pump";
  SimpleGasTurbineABG.subsystems.comp.cr = "none";
  SimpleGasTurbineABG.subsystems.comp.arg = "c_v;density,ideal_gas,r;alpha;effort,k";
  SimpleGasTurbineABG.subsystems.comp.repetitions = 1;
  SimpleGasTurbineABG.subsystems.comp.status = -1;
  SimpleGasTurbineABG.subsystems.comp.connections = [16 -14 1 12 -10 ];

# Component turb
  SimpleGasTurbineABG.subsystems.turb.type = "Pump";
  SimpleGasTurbineABG.subsystems.turb.cr = "none";
  SimpleGasTurbineABG.subsystems.turb.arg = "c_v;density,ideal_gas,r;alpha;effort,k";
  SimpleGasTurbineABG.subsystems.turb.repetitions = 1;
  SimpleGasTurbineABG.subsystems.turb.status = -1;
  SimpleGasTurbineABG.subsystems.turb.connections = [15 -17 -6 11 -13 ];

# Component Work
  SimpleGasTurbineABG.subsystems.Work.type = "SS";
  SimpleGasTurbineABG.subsystems.Work.cr = "SS";
  SimpleGasTurbineABG.subsystems.Work.arg = "0,external";
  SimpleGasTurbineABG.subsystems.Work.repetitions = 1;
  SimpleGasTurbineABG.subsystems.Work.status = -1;
  SimpleGasTurbineABG.subsystems.Work.connections = [4 ];

# Component Heat
  SimpleGasTurbineABG.subsystems.Heat.type = "SS";
  SimpleGasTurbineABG.subsystems.Heat.cr = "SS";
  SimpleGasTurbineABG.subsystems.Heat.arg = "0,external";
  SimpleGasTurbineABG.subsystems.Heat.repetitions = 1;
  SimpleGasTurbineABG.subsystems.Heat.status = -1;
  SimpleGasTurbineABG.subsystems.Heat.connections = [9 ];

# Component Speed
  SimpleGasTurbineABG.subsystems.Speed.type = "SS";
  SimpleGasTurbineABG.subsystems.Speed.cr = "SS";
  SimpleGasTurbineABG.subsystems.Speed.arg = "0,external";
  SimpleGasTurbineABG.subsystems.Speed.repetitions = 1;
  SimpleGasTurbineABG.subsystems.Speed.status = -1;
  SimpleGasTurbineABG.subsystems.Speed.connections = [5 ];

# Component T3
  SimpleGasTurbineABG.subsystems.T3.type = "SS";
  SimpleGasTurbineABG.subsystems.T3.cr = "SS";
  SimpleGasTurbineABG.subsystems.T3.arg = "external,external";
  SimpleGasTurbineABG.subsystems.T3.repetitions = 1;
  SimpleGasTurbineABG.subsystems.T3.status = -1;
  SimpleGasTurbineABG.subsystems.T3.connections = [-8 ];

# Component in
  SimpleGasTurbineABG.subsystems.in.type = "In";
  SimpleGasTurbineABG.subsystems.in.cr = "";
  SimpleGasTurbineABG.subsystems.in.arg = "";
  SimpleGasTurbineABG.subsystems.in.repetitions = 1;
  SimpleGasTurbineABG.subsystems.in.status = -1;
  SimpleGasTurbineABG.subsystems.in.connections = [-16 -12 ];

# Component out
  SimpleGasTurbineABG.subsystems.out.type = "Out";
  SimpleGasTurbineABG.subsystems.out.cr = "";
  SimpleGasTurbineABG.subsystems.out.arg = "";
  SimpleGasTurbineABG.subsystems.out.repetitions = 1;
  SimpleGasTurbineABG.subsystems.out.status = -1;
  SimpleGasTurbineABG.subsystems.out.connections = [17 13 ];

# Component mtt1
  SimpleGasTurbineABG.subsystems.mtt1.type = "1";
  SimpleGasTurbineABG.subsystems.mtt1.cr = "";
  SimpleGasTurbineABG.subsystems.mtt1.arg = "";
  SimpleGasTurbineABG.subsystems.mtt1.repetitions = 1;
  SimpleGasTurbineABG.subsystems.mtt1.status = -1;
  SimpleGasTurbineABG.subsystems.mtt1.connections = [-1 -2 -3 -5 6 ];

# Component mtt2
  SimpleGasTurbineABG.subsystems.mtt2.type = "Load";
  SimpleGasTurbineABG.subsystems.mtt2.cr = "";
  SimpleGasTurbineABG.subsystems.mtt2.arg = "";
  SimpleGasTurbineABG.subsystems.mtt2.repetitions = 1;
  SimpleGasTurbineABG.subsystems.mtt2.status = -1;
  SimpleGasTurbineABG.subsystems.mtt2.connections = [3 -4 ];

# Component mtt3
  SimpleGasTurbineABG.subsystems.mtt3.type = "PS";
  SimpleGasTurbineABG.subsystems.mtt3.cr = "";
  SimpleGasTurbineABG.subsystems.mtt3.arg = "";
  SimpleGasTurbineABG.subsystems.mtt3.repetitions = 1;
  SimpleGasTurbineABG.subsystems.mtt3.status = -1;
  SimpleGasTurbineABG.subsystems.mtt3.connections = [8 -7 -9 ];

# Ordered list of subsystem names
  SimpleGasTurbineABG.subsystemlist(1,:) = "c1   ";
  SimpleGasTurbineABG.subsystemlist(2,:) = "j_s  ";
  SimpleGasTurbineABG.subsystemlist(3,:) = "comp ";
  SimpleGasTurbineABG.subsystemlist(4,:) = "turb ";
  SimpleGasTurbineABG.subsystemlist(5,:) = "Work ";
  SimpleGasTurbineABG.subsystemlist(6,:) = "Heat ";
  SimpleGasTurbineABG.subsystemlist(7,:) = "Speed";
  SimpleGasTurbineABG.subsystemlist(8,:) = "T3   ";
  SimpleGasTurbineABG.subsystemlist(9,:) = "in   ";
  SimpleGasTurbineABG.subsystemlist(10,:) = "out  ";
  SimpleGasTurbineABG.subsystemlist(11,:) = "mtt1 ";
  SimpleGasTurbineABG.subsystemlist(12,:) = "mtt2 ";
  SimpleGasTurbineABG.subsystemlist(13,:) = "mtt3 ";

# Bonds 
  SimpleGasTurbineABG.bonds = [
      0 0 
      1 1 
      0 0 
      -1 -1 
      -1 -1 
      0 0 
      0 0 
      1 1 
      -1 -1 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      ];

# Aliases 
# A double underscore __ represents a comma 
# Explicit variable declarations
#VAR t_2
#VAR t_3
#VAR t_4
#VAR p_2
#VAR p_3
#VAR p_4
#VAR mdot
#VAR gamma_0
#VAR q_0
#VAR w_0
#VAR omega_0
#VAR r_p
#VAR c_p
#VAR mom_0
endfunction

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/SimpleGasTurbineABG_desc.tex version [cfa31dba4b].

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
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
123



























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- used to set EMACS into LaTeX-mode
% Verbal description for system SimpleGasTurbineABG (SimpleGasTurbineABG_desc.tex)
% Generated by MTT on Tue Jan 13 18:01:55 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/05/18 15:45:50  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{SimpleGasTurbineABG} is
   displayed in Figure \Ref{SimpleGasTurbineABG_abg} and its label
   file is listed in Section \Ref{sec:SimpleGasTurbineABG_lbl}.
   The subsystems are listed in Section \Ref{sec:SimpleGasTurbineABG_sub}.
   
   \textbf{SimpleGasTurbineABG} can be regarded as an single-spool gas
   turbine (producing shaft power) with an ideal-gas working fluid. It
   corresponds to the simple Joule Cycle as described in Chapter 12 of
   Rogers and Mayhew and in Chapter 2 of Cohen, Rogers and
   Saravanamutto. However, unlike those examples, the system is
   written with dynamics in mind.
   
   The system is described using an energy Bond Graph- this ensures
   that the first law is observed. In particular transformers are used
   to explicitly convert between energy covariables. Although this is
   a simple model, I believe that it provides the basis for building
   complex thermodynamic systems involving gas power cycles.


There are five main components:
\begin{enumerate}
\item p1 -- a \textbf{Pump} component representing the compressor
  stage. This converts shaft work to energy flow in the working fluid.
\item c1 -- a \textbf{Comb} component representing the combustion
  chamber. This converts the heat obtained by burning fuel to energy
  flow in the working fluid.
\item t1 -- a \textbf{Turb} component representing the turbine
  component. This converts the energy flow in the working fluid to
  shaft work
\item j\_s -- an \textbf{I} component representing the combined inertia
  of the shaft and compressor and turbine rotors.
\item a \textbf{Load} component to absorb the shaft power.
\end{enumerate}
The components \textbf{In} and \textbf{Out} provide the inlet and
outlet conditions.

Both \textbf{Pump} and \textbf{Turb} are implemented with the
\emph{polytropic} constitutive relationship with index $n$. When
$n=\gamma=\frac{c_p}{c_v}$ this corresponds to isentropic compression
and expansion and thus the \textbf{SimpleGasTurbineABG} achieves its
cycle efficiency. However, other values of $n$ can be used to account
for isentropic efficiency of less than unity.

To obtain a very simple dynamic model (and to avoid the need for an
accurate combustion chamber model) there are no dynamics associated
with the combustion chamber, but rahter it is assumed that the
corresponding temperature is imposed on the component (that is $T_3$
is the system input) the corresponding heat flow is then an output.

Both heat input and work output are measured using the \textbf{PS}
(power sensor) component, that for work output is embedded in the
\textbf{Load} component. These can be monitored to give the efficiency
of the \textbf{SimpleGasTurbineABG}.

A symbolic steady-state for the model was computed -- see Section
\ref{sec:SimpleGasTurbineABG_ss.tex}. In particular, the load
resistance was chosen to absorb all the generated work at the steady
state and the shaft inertia was chosen to give a unit time constant
for the linearised system. The mass flow and shaft speeds were taken
as unity.

For the purposed of simulation, the numerical values given in Examples
12.1 of Chapter 12 of Rogers and Mayhew, except that the isentropic
efficiencies are 100\% ($n=\gamma$) -- see Section
\ref{sec:SimpleGasTurbineABG_numpar.tex}.

Simulations were performed starting at the steady state and increasing
the combustion chamber temperature by 10\% at $t=1$ and reducing by
10\% at $t=5$. Graphs of the various outputs are plotted:
\begin{itemize}
\item Figure
  \Ref{fig:SimpleGasTurbineABG_odeso.ps-SimpleGasTurbineABG-p1-T,SimpleGasTurbineABG-c1-T,SimpleGasTurbineABG-t1-T}
  -- the temperatures at the output of the
  \begin{itemize}
  \item compressor,
  \item combustion chamber and
  \item turbine
  \end{itemize}
\item Figure
  \Ref{fig:SimpleGasTurbineABG_odeso.ps-SimpleGasTurbineABG-Heat,SimpleGasTurbineABG-Work}
  -- the heat input and work output
\item Figure
  \Ref{fig:SimpleGasTurbineABG_odeso.ps-SimpleGasTurbineABG-Speed} -- the shaft speed and
\item Figure
  \Ref{fig:SimpleGasTurbineABG_odeso.ps-SimpleGasTurbineABG-p1-P,SimpleGasTurbineABG-c1-P,SimpleGasTurbineABG-t1-P}
  -- the pressure at the output of the
  \begin{itemize}
  \item compressor,
  \item combustion chamber and
  \item turbine
  \end{itemize}
\end{itemize}

This model can be modified extended in various ways to yield related
dynamic systems. For example:
\begin{itemize}
\item an air cooler is obtained by changing the direction of heat and
  work flows
\item additional \textbf{Turb} and \textbf{Comb} components add reheat
  to the cycle
\item an isentropic nozzle can be added and the work output removed
  to give a jet engine.
\end{itemize}


%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/SimpleGasTurbineABG_input.txt version [a6afb44f57].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (SimpleGasTurbineABG_input.txt)
# Generated by MTT at Tue Mar 31 12:38:39 BST 1998

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

t_3 = 1000;

# Set the inputs
u(1) =	 t_3 + 0.1*t_3*(t>1) -  0.2*t_3*(t>5); # SimpleGasTurbineABG (T3)

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/SimpleGasTurbineABG_numpar.txt version [e69ca09250].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (SimpleGasTurbine_numpar.txt)
# Generated by MTT at Tue Mar 31 12:15:00 BST 1998

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

#Dummies
 alpha = 1;
 c_v = 1;
 density = 1;
 ideal_gas = 1;
 j_s = 1;
 k = 1;
 k_p = 1;
 m = 1;
 m_c = 1;
 p_1 = 1;
 r = 1;
 r_l = 1;
 t_1 = 1;
 v = 1;
 v_c = 1;


# Parameters
c_p = 	1005.0;
c_v = 	718.0; 
gamma_0 =  c_p/c_v;
alpha = (gamma_0-1)/gamma_0;
k = 	1.0;
p_1 = 	1e5; # 1 bar
p_4 = 	p_1; 
r = 	c_p-c_v;
t_1 = 	288.0; # In
v_c = 	1.0;

%Set the CC pressure and temperature
t_3 = 1000.0;
r_p = 6.0;
p_3 = r_p*p_1;

%Find stored mass to give combustion chamber pressure p_3 (at
% temperature t_3
m_c = (p_3*v_c)/(t_3*r);

%Equate pressures
p_4 = p_1;
p_2 = p_3;

%Compute ss temperatures (isentropic)
t_2 = t_1*(p_2/p_1)^alpha;
t_4 = t_3*(p_4/p_3)^alpha;

%Find the steady-state work output
w_0 = c_p*(t_3-t_4) - c_p*(t_2-t_1);

%Unit mass flow
mdot = 1;

%Corresponding shaft speed
omega_0 = mdot/k;

%Compute the corresponding load resistance (to absorb that work)
r_l = w_0/(omega_0)^2;

%Compute shaft inertia to give unit time constant (j_s*r_l)
j_s = r_l;

%Find angular momentum to give shaft speed omega_0
mom_0 =  omega_0*j_s;

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/SimpleGasTurbineABG_rep.txt version [993da43700].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system SimpleGasTurbineABG (SimpleGasTurbineABG_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%mtt -abg -o -ss SimpleGasTurbineABG abg tex
mtt -abg -o -ss SimpleGasTurbineABG struc tex
mtt -abg -o -ss SimpleGasTurbineABG sympar tex
mtt -abg -o -ss SimpleGasTurbineABG ode tex

mtt -abg -o -ss SimpleGasTurbineABG sspar r
mtt -abg -o -ss SimpleGasTurbineABG ss tex
mtt -abg -o -ss SimpleGasTurbineABG sm tex


mtt -abg -o -ss SimpleGasTurbineABG numpar tex
mtt -abg -o -ss SimpleGasTurbineABG input tex
mtt -abg -o -ss SimpleGasTurbineABG state tex
mtt -abg -o -ss SimpleGasTurbineABG simpar tex
mtt -abg -o -ss -c SimpleGasTurbineABG odeso ps 'SimpleGasTurbineABG_p1_T,SimpleGasTurbineABG_c1_T,SimpleGasTurbineABG_t1_T'
mtt -abg -o -ss -c SimpleGasTurbineABG odeso ps 'SimpleGasTurbineABG_Heat,SimpleGasTurbineABG_Work'
mtt -abg -o -ss -c SimpleGasTurbineABG odeso ps 'SimpleGasTurbineABG_Speed'
mtt -abg -o -ss -c SimpleGasTurbineABG odeso ps 'SimpleGasTurbineABG_p1_P,SimpleGasTurbineABG_c1_P,SimpleGasTurbineABG_t1_P'





Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/SimpleGasTurbineABG_simp.r version [ca6f515178].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
%% Reduce commands to simplify output for system SimpleGasTurbineABG (SimpleGasTurbineABG_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LET c_v = c_p - r;
END;

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/SimpleGasTurbineABG_sspar.r version [8d3c89c1a5].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (SimpleGasTurbineABG_sspar.r)
% Generated by MTT at Thu Mar 26 16:28:59 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Find stored mass to give combustion chamber pressure p_3 (at
% temperature t_3
m_c := (p_3*v_c)/(t_3*r);

%Equate pressures
p_4 := p_1;
p_2 := p_3;

%Compute ss temperatures (isentropic)
t_2 := t_1*(p_2/p_1)^alpha;
t_4 := t_3*(p_4/p_3)^alpha;

%Find the steady-state work output
w_0 := c_p*(t_3-t_4) - c_p*(t_2-t_1);

%Compute the corresponding load resistance (to absorb that work)
r_l := w_0/(omega_0)^2;

%Unit mass flow
mdot := 1;

%Corresponding shaft speed
omega_0 := mdot/k;

%Compute shaft inertia to give unit time constant (j_s*r_l)
j_s := r_l;

%Find angular momentum to give shaft speed omega_0
mom_0 :=  omega_0*j_s;


% Steady-state states
MTTX1 := 	mom_0;

% Steady-state inputs - combustion temperature
MTTU1 := 	t_3; % SimpleGasTurbineABG (T3)

;;END;

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/SimpleGasTurbineABG_state.txt version [ee6857149c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (SimpleGasTurbineABG_state.txt)
# Generated by MTT at Tue Mar 31 12:37:17 BST 1998

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

SimpleGasTurbineABG_numpar;

# Set the states
x(1) =	 j_s/k ; # SimpleGasTurbineABG (j_s)

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/hPipe_abg.m version [32f5edad6e].

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
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









































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [hPipe] =  hPipe_abg
# This function is the acausal bond graph representation of hPipe
# Generated by MTT on Thu Mar 16 10:33:07 2000
# The file is in Octave format

# Subsystems and Ports

# Port Heat
  hPipe.ports.Heat.type = "SS";
  hPipe.ports.Heat.cr = "SS";
  hPipe.ports.Heat.arg = "external,external";
  hPipe.ports.Heat.repetitions = 1;
  hPipe.ports.Heat.status = -1;
  hPipe.ports.Heat.connections = [-3 ];

# Port Hydraulic_in
  hPipe.ports.Hydraulic_in.type = "SS";
  hPipe.ports.Hydraulic_in.cr = "SS";
  hPipe.ports.Hydraulic_in.arg = "external,external";
  hPipe.ports.Hydraulic_in.repetitions = 1;
  hPipe.ports.Hydraulic_in.status = -1;
  hPipe.ports.Hydraulic_in.connections = [-5 ];

# Port Hydraulic_out
  hPipe.ports.Hydraulic_out.type = "SS";
  hPipe.ports.Hydraulic_out.cr = "SS";
  hPipe.ports.Hydraulic_out.arg = "external,external";
  hPipe.ports.Hydraulic_out.repetitions = 1;
  hPipe.ports.Hydraulic_out.status = -1;
  hPipe.ports.Hydraulic_out.connections = [6 ];

# Port Thermal_in
  hPipe.ports.Thermal_in.type = "SS";
  hPipe.ports.Thermal_in.cr = "SS";
  hPipe.ports.Thermal_in.arg = "external,external";
  hPipe.ports.Thermal_in.repetitions = 1;
  hPipe.ports.Thermal_in.status = -1;
  hPipe.ports.Thermal_in.connections = [-2 ];

# Port Thermal_out
  hPipe.ports.Thermal_out.type = "SS";
  hPipe.ports.Thermal_out.cr = "SS";
  hPipe.ports.Thermal_out.arg = "external,external";
  hPipe.ports.Thermal_out.repetitions = 1;
  hPipe.ports.Thermal_out.status = -1;
  hPipe.ports.Thermal_out.connections = [7 ];

# Component P2T
  hPipe.subsystems.P2T.type = "TF";
  hPipe.subsystems.P2T.cr = "lin";
  hPipe.subsystems.P2T.arg = "flow,r*m/v";
  hPipe.subsystems.P2T.repetitions = 1;
  hPipe.subsystems.P2T.status = -1;
  hPipe.subsystems.P2T.connections = [5 -1 ];

# Component T2P
  hPipe.subsystems.T2P.type = "TF";
  hPipe.subsystems.T2P.cr = "lin";
  hPipe.subsystems.T2P.arg = "effort,r*m/v";
  hPipe.subsystems.T2P.repetitions = 1;
  hPipe.subsystems.T2P.status = -1;
  hPipe.subsystems.T2P.connections = [4 -6 ];

# Component mtt1
  hPipe.subsystems.mtt1.type = "0";
  hPipe.subsystems.mtt1.cr = "";
  hPipe.subsystems.mtt1.arg = "";
  hPipe.subsystems.mtt1.repetitions = 1;
  hPipe.subsystems.mtt1.status = -1;
  hPipe.subsystems.mtt1.connections = [1 2 3 -4 -7 ];

# Ordered list of Port names
  hPipe.portlist(1,:) = "Heat         ";
  hPipe.portlist(2,:) = "Hydraulic_in ";
  hPipe.portlist(3,:) = "Hydraulic_out";
  hPipe.portlist(4,:) = "Thermal_in   ";
  hPipe.portlist(5,:) = "Thermal_out  ";

# Ordered list of subsystem names
  hPipe.subsystemlist(1,:) = "P2T ";
  hPipe.subsystemlist(2,:) = "T2P ";
  hPipe.subsystemlist(3,:) = "mtt1";

# Bonds 
  hPipe.bonds = [
      0 0 
      0 0 
      1 1 
      0 0 
      0 0 
      0 0 
      0 0 
      ];

# Aliases 
# A double underscore __ represents a comma 
hPipe.alias.out = "Thermal_out,Hydraulic_out";
hPipe.alias.Hy_out = "Hydraulic_out";
hPipe.alias.Th_in = "Thermal_in";
hPipe.alias.r = "$3";
hPipe.alias.Th_out = "Thermal_out";
hPipe.alias.m = "$1";
hPipe.alias.v = "$2";
hPipe.alias.in = "Thermal_in,Hydraulic_in";
hPipe.alias.Hy_in = "Hydraulic_in";

Deleted mttroot/mtt/lib/examples/ABG/SimpleGasTurbineABG/wPipe_abg.m version [b1c4a72c91].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199







































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [wPipe] =  wPipe_abg
# This function is the acausal bond graph representation of wPipe
# Generated by MTT on Thu Mar 16 10:37:39 2000
# The file is in Octave format

# Subsystems and Ports

# Port Hydraulic_in
  wPipe.ports.Hydraulic_in.type = "SS";
  wPipe.ports.Hydraulic_in.cr = "SS";
  wPipe.ports.Hydraulic_in.arg = "external,external";
  wPipe.ports.Hydraulic_in.repetitions = 1;
  wPipe.ports.Hydraulic_in.status = -1;
  wPipe.ports.Hydraulic_in.connections = [-1 ];

# Port Hydraulic_out
  wPipe.ports.Hydraulic_out.type = "SS";
  wPipe.ports.Hydraulic_out.cr = "SS";
  wPipe.ports.Hydraulic_out.arg = "external,external";
  wPipe.ports.Hydraulic_out.repetitions = 1;
  wPipe.ports.Hydraulic_out.status = -1;
  wPipe.ports.Hydraulic_out.connections = [17 ];

# Port Shaft
  wPipe.ports.Shaft.type = "SS";
  wPipe.ports.Shaft.cr = "SS";
  wPipe.ports.Shaft.arg = "external,external";
  wPipe.ports.Shaft.repetitions = 1;
  wPipe.ports.Shaft.status = -1;
  wPipe.ports.Shaft.connections = [-20 ];

# Port Thermal_in
  wPipe.ports.Thermal_in.type = "SS";
  wPipe.ports.Thermal_in.cr = "SS";
  wPipe.ports.Thermal_in.arg = "external,external";
  wPipe.ports.Thermal_in.repetitions = 1;
  wPipe.ports.Thermal_in.status = -1;
  wPipe.ports.Thermal_in.connections = [-14 ];

# Port Thermal_out
  wPipe.ports.Thermal_out.type = "SS";
  wPipe.ports.Thermal_out.cr = "SS";
  wPipe.ports.Thermal_out.arg = "external,external";
  wPipe.ports.Thermal_out.repetitions = 1;
  wPipe.ports.Thermal_out.status = -1;
  wPipe.ports.Thermal_out.connections = [16 ];

# Component rho1
  wPipe.subsystems.rho1.type = "Density";
  wPipe.subsystems.rho1.cr = "none";
  wPipe.subsystems.rho1.arg = "density,ideal_gas,r";
  wPipe.subsystems.rho1.repetitions = 1;
  wPipe.subsystems.rho1.status = -1;
  wPipe.subsystems.rho1.connections = [4 3 -5 ];

# Component rho2
  wPipe.subsystems.rho2.type = "Density";
  wPipe.subsystems.rho2.cr = "none";
  wPipe.subsystems.rho2.arg = "density,ideal_gas,r";
  wPipe.subsystems.rho2.repetitions = 1;
  wPipe.subsystems.rho2.status = -1;
  wPipe.subsystems.rho2.connections = [12 11 -10 ];

# Component p2pv
  wPipe.subsystems.p2pv.type = "EMTF";
  wPipe.subsystems.p2pv.cr = "lin";
  wPipe.subsystems.p2pv.arg = "flow";
  wPipe.subsystems.p2pv.repetitions = 1;
  wPipe.subsystems.p2pv.status = -1;
  wPipe.subsystems.p2pv.connections = [2 -9 5 ];

# Component pv2p
  wPipe.subsystems.pv2p.type = "EMTF";
  wPipe.subsystems.pv2p.cr = "lin";
  wPipe.subsystems.pv2p.arg = "effort";
  wPipe.subsystems.pv2p.repetitions = 1;
  wPipe.subsystems.pv2p.status = -1;
  wPipe.subsystems.pv2p.connections = [7 -18 10 ];

# Component t2u
  wPipe.subsystems.t2u.type = "TF";
  wPipe.subsystems.t2u.cr = "lin";
  wPipe.subsystems.t2u.arg = "effort,c_v";
  wPipe.subsystems.t2u.repetitions = 1;
  wPipe.subsystems.t2u.status = -1;
  wPipe.subsystems.t2u.connections = [15 -6 ];

# Component u2t
  wPipe.subsystems.u2t.type = "TF";
  wPipe.subsystems.u2t.cr = "lin";
  wPipe.subsystems.u2t.arg = "flow,c_v";
  wPipe.subsystems.u2t.repetitions = 1;
  wPipe.subsystems.u2t.status = -1;
  wPipe.subsystems.u2t.connections = [8 -13 ];

# Component mtt1
  wPipe.subsystems.mtt1.type = "0";
  wPipe.subsystems.mtt1.cr = "";
  wPipe.subsystems.mtt1.arg = "";
  wPipe.subsystems.mtt1.repetitions = 1;
  wPipe.subsystems.mtt1.status = -1;
  wPipe.subsystems.mtt1.connections = [-3 14 -15 ];

# Component mtt2
  wPipe.subsystems.mtt2.type = "0";
  wPipe.subsystems.mtt2.cr = "";
  wPipe.subsystems.mtt2.arg = "";
  wPipe.subsystems.mtt2.repetitions = 1;
  wPipe.subsystems.mtt2.status = -1;
  wPipe.subsystems.mtt2.connections = [1 -2 -4 ];

# Component mtt3
  wPipe.subsystems.mtt3.type = "1";
  wPipe.subsystems.mtt3.cr = "";
  wPipe.subsystems.mtt3.arg = "";
  wPipe.subsystems.mtt3.repetitions = 1;
  wPipe.subsystems.mtt3.status = -1;
  wPipe.subsystems.mtt3.connections = [6 -7 -8 9 19 ];

# Component mtt4
  wPipe.subsystems.mtt4.type = "0";
  wPipe.subsystems.mtt4.cr = "";
  wPipe.subsystems.mtt4.arg = "";
  wPipe.subsystems.mtt4.repetitions = 1;
  wPipe.subsystems.mtt4.status = -1;
  wPipe.subsystems.mtt4.connections = [-11 13 -16 ];

# Component mtt5
  wPipe.subsystems.mtt5.type = "0";
  wPipe.subsystems.mtt5.cr = "";
  wPipe.subsystems.mtt5.arg = "";
  wPipe.subsystems.mtt5.repetitions = 1;
  wPipe.subsystems.mtt5.status = -1;
  wPipe.subsystems.mtt5.connections = [-12 -17 18 ];

# Component mtt6
  wPipe.subsystems.mtt6.type = "1";
  wPipe.subsystems.mtt6.cr = "";
  wPipe.subsystems.mtt6.arg = "";
  wPipe.subsystems.mtt6.repetitions = 1;
  wPipe.subsystems.mtt6.status = -1;
  wPipe.subsystems.mtt6.connections = [-19 20 ];

# Ordered list of Port names
  wPipe.portlist(1,:) = "Hydraulic_in ";
  wPipe.portlist(2,:) = "Hydraulic_out";
  wPipe.portlist(3,:) = "Shaft        ";
  wPipe.portlist(4,:) = "Thermal_in   ";
  wPipe.portlist(5,:) = "Thermal_out  ";

# Ordered list of subsystem names
  wPipe.subsystemlist(1,:) = "rho1";
  wPipe.subsystemlist(2,:) = "rho2";
  wPipe.subsystemlist(3,:) = "p2pv";
  wPipe.subsystemlist(4,:) = "pv2p";
  wPipe.subsystemlist(5,:) = "t2u ";
  wPipe.subsystemlist(6,:) = "u2t ";
  wPipe.subsystemlist(7,:) = "mtt1";
  wPipe.subsystemlist(8,:) = "mtt2";
  wPipe.subsystemlist(9,:) = "mtt3";
  wPipe.subsystemlist(10,:) = "mtt4";
  wPipe.subsystemlist(11,:) = "mtt5";
  wPipe.subsystemlist(12,:) = "mtt6";

# Bonds 
  wPipe.bonds = [
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      0 0 
      -1 -1 
      ];

# Aliases 
# A double underscore __ represents a comma 
wPipe.alias.out = "Thermal_out,Hydraulic_out";
wPipe.alias.Hy_out = "Hydraulic_out";
wPipe.alias.c_v = "$1";
wPipe.alias.Th_in = "Thermal_in";
wPipe.alias.Th_out = "Thermal_out";
wPipe.alias.Work = "Shaft";
wPipe.alias.in = "Thermal_in,Hydraulic_in";
wPipe.alias.Hy_in = "Hydraulic_in";
wPipe.alias.density__ideal_gas__r = "$2";

Deleted mttroot/mtt/lib/examples/ABG/rcABG/rcABG_abg.m version [df1614e2f8].

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
68
69
70
71
72
73
74
75
76












































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [rc] =  rc_abg
# This function is the acausal bond graph representation of rc
# Generated by MTT on Thu Mar 16 08:45:29 2000
# The file is in Octave format

# Subsystems and Ports

# Component c
  rc.subsystems.c.type = "C";
  rc.subsystems.c.cr = "lin";
  rc.subsystems.c.arg = "effort,c";
  rc.subsystems.c.repetitions = 1;
  rc.subsystems.c.status = -1;
  rc.subsystems.c.connections = [5 ];

# Component r
  rc.subsystems.r.type = "R";
  rc.subsystems.r.cr = "lin";
  rc.subsystems.r.arg = "flow,r";
  rc.subsystems.r.repetitions = 1;
  rc.subsystems.r.status = -1;
  rc.subsystems.r.connections = [4 ];

# Component e1
  rc.subsystems.e1.type = "SS";
  rc.subsystems.e1.cr = "SS";
  rc.subsystems.e1.arg = "external,internal";
  rc.subsystems.e1.repetitions = 1;
  rc.subsystems.e1.status = -1;
  rc.subsystems.e1.connections = [-1 ];

# Component e2
  rc.subsystems.e2.type = "SS";
  rc.subsystems.e2.cr = "SS";
  rc.subsystems.e2.arg = "external,0";
  rc.subsystems.e2.repetitions = 1;
  rc.subsystems.e2.status = -1;
  rc.subsystems.e2.connections = [3 ];

# Component mtt1
  rc.subsystems.mtt1.type = "1";
  rc.subsystems.mtt1.cr = "";
  rc.subsystems.mtt1.arg = "";
  rc.subsystems.mtt1.repetitions = 1;
  rc.subsystems.mtt1.status = -1;
  rc.subsystems.mtt1.connections = [1 -2 -4 ];

# Component mtt2
  rc.subsystems.mtt2.type = "0";
  rc.subsystems.mtt2.cr = "";
  rc.subsystems.mtt2.arg = "";
  rc.subsystems.mtt2.repetitions = 1;
  rc.subsystems.mtt2.status = -1;
  rc.subsystems.mtt2.connections = [2 -3 -5 ];

# Ordered list of subsystem names
  rc.subsystemlist(1,:) = "c   ";
  rc.subsystemlist(2,:) = "r   ";
  rc.subsystemlist(3,:) = "e1  ";
  rc.subsystemlist(4,:) = "e2  ";
  rc.subsystemlist(5,:) = "mtt1";
  rc.subsystemlist(6,:) = "mtt2";

# Bonds 
  rc.bonds = [
      1 1 
      0 0 
      1 1 
      0 0 
      0 0 
      ];

# Aliases 
# A double underscore __ represents a comma 
rc.alias.r = "$2";
rc.alias.c = "$1";

Deleted mttroot/mtt/lib/examples/ABG/rcABG/rcABG_rep.txt version [a51dd327cb].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% %% Outline report file for system rcABG (rcABG_rep.txt)
mtt rcABG struc tex
mtt rcABG ode tex
mtt rcABG sm tex
mtt rcABG tf tex
mtt rcABG sro ps
mtt rcABG lmfr ps
mtt rcABG nyfr ps

mtt rcABG numpar txt
mtt rcABG input txt
mtt -c rcABG odeso ps
mtt rcABG rep txt


Deleted mttroot/mtt/lib/examples/AlgebraicLoops/aRC/aRC_abg.fig version [d59bd2ce5c].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 4680 630 6570 1620
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4725 1215 5175 1215
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4725 1080 5175 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4950 675 4950 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4950 1215 4950 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 6075 1530 6075 765
4 0 1 1 0 0 20 0.0000 4 180 165 5355 1215 c\001
4 0 1 1 0 0 20 0.0000 4 180 165 6300 1170 e\001
4 0 1 1 0 0 20 0.0000 4 255 180 6390 1305 2\001
-6
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 1800 1125 162 162 1800 1125 1890 1260
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1802 4277 2702 4277 2477 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 4277 4052 4277 3827 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4502 4277 5402 4277 5177 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 4051 2926 3151 3151 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 4051 4276 3151 4501 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 4276 2701 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5401 4051 5401 4276
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5401 4276 5401 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 4051 2701 4276
2 2 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 2475 585 3375 585 3375 765 2475 765 2475 585
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 675 2475 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 945 1800 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 1575 1800 1260
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 4500 2925 5400 3150 5175
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6750 6075 6750 225 675 225 675 6075 6750 6075
2 2 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 3600 585 4500 585 4500 765 3600 765 3600 585
2 1 0 2 1 7 101 0 -1 0.000 0 0 -1 0 0 2
	 3375 675 3600 675
2 1 0 2 1 7 101 0 -1 0.000 0 0 -1 0 0 2
	 4500 675 5850 675
2 1 0 2 1 7 101 0 -1 0.000 0 0 -1 0 0 2
	 1755 1575 5850 1575
2 1 0 2 4 7 100 0 -1 0.000 0 0 -1 0 0 2
	 1935 5040 2160 5265
2 1 0 2 4 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2070 5130 2706 4494 2706 4812
4 1 -1 0 0 0 20 0.0000 4 255 180 2927 4367 1\001
4 1 -1 0 0 0 20 0.0000 4 255 180 4277 4367 0\001
4 1 -1 0 0 0 20 0.0000 4 255 825 5987 4367 SS:e2\001
4 1 -1 0 0 0 20 0.0000 4 330 825 2926 2926 R:r_1\001
4 1 -1 0 0 0 20 0.0000 4 255 495 4276 2926 C:c\001
4 1 -1 0 0 0 20 0.0000 4 255 825 1395 4365 SS:e1\001
4 0 1 1 0 0 20 0.0000 4 330 495 2880 450 r_1\001
4 0 1 1 0 0 20 0.0000 4 180 165 1260 1170 e\001
4 0 1 1 0 0 20 0.0000 4 255 180 1350 1305 1\001
4 1 1 1 0 0 20 0.0000 4 255 1545 3600 2025 Schematic\001
4 1 1 1 0 0 20 0.0000 4 330 1725 4860 4860 Bond graph\001
4 1 -1 0 0 0 20 0.0000 4 330 825 3015 5715 R:r_2\001
4 0 1 1 0 0 20 0.0000 4 330 495 3870 450 r_2\001
4 1 -1 0 0 0 20 0.0000 4 330 1110 1755 5535 SS:loop\001

Deleted mttroot/mtt/lib/examples/AlgebraicLoops/aRC/aRC_desc.tex version [3196b31fcd].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system aRC (aRC_desc.tex)
% Generated by MTT on Sun Aug 24 11:03:55 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/08/24 10:27:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{aRC} is
   displayed in Figure \Ref{aRC_abg} and its label
   file is listed in Section \Ref{sec:aRC_lbl}.
   The subsystems are listed in Section \Ref{sec:aRC_sub}.

The system \textbf{aRC} is the simple electrical aRC ciaRCuit shown in
Figure \Ref{aRC_abg}. It can be regarded as a single-input
single-output system with input $e_1$ and output $e_2$.

The two resistors ($r_1$ and $r_2$) are in series; this give an
undercausal system with a corresponding algebraic loop. The loop is
broken by adding the {\bf SS} component ``loop'' to localise the
algabraic equation to choosinf the corresponding flow such that the
corresponding effort is zero. This algebraic equation appears in
Section \Ref{sec:aRC_dae.tex}.

This loop is algbraicly solved to give the ordinary differential
equation of Section \Ref{sec:aRC_ode.tex} and the transfer function of
Section \Ref{sec:aRC_tf.tex}.

Deleted mttroot/mtt/lib/examples/AlgebraicLoops/aRC/aRC_lbl.txt version [b09da23797].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY aRC: Simple RC circuit example with algebraic loop

%% Label file for system aRC (aRC_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/05/20 16:03:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1997/05/12  15:11:47  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1997/04/18  13:27:54  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1997/04/18  13:20:13  peterg
% %% Initial revision
% %% Revision 1.1  1996/09/10 11:37:14  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

% Source - effort source (e1) flow ignored
e1	SS external,internal

% Sensor - effort sensor (e2)	zero flow
e2	SS external,0

% R component - linear with resistance r (effort = r*flow)
r_1	lin	flow,r_1
r_2	lin	flow,r_2

% C component - linear with capacitance c (state = c*effort)
c	lin	effort,c

% Algebraic loop SS
loop	SS      zero,unknown



Deleted mttroot/mtt/lib/examples/AlgebraicLoops/aRC/aRC_rep.txt version [ecb3702c8e].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system aRC (aRC_rep.txt)
## Generated by MTT on" Fri Oct 15 14:56:13 EST 1999.

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

mtt aRC abg tex			# The system description
mtt aRC cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt aRC struc tex	        # The system structure
mtt aRC dae tex			# The system dae
mtt -A aRC ode tex	        # The system ode 
## mtt aRC sspar tex		# Steady-state parameters
## mtt aRC ss tex 		# Steady state
## mtt aRC dm tex		# Descriptor matrices (of linearised system)
## mtt aRC sm tex		# State matrices (of linearised system)
## mtt -A aRC tf tex		# Transfer function (of linearised system)
## mtt aRC lmfr ps		# log modulus of frequency response (of linearised system)
## mtt aRC simpar tex		# Simulation parameters
## mtt aRC numpar tex		# Numerical simulation parameters
## mtt aRC input tex		# Simulation input
## mtt aRC odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/AlgebraicLoops/aRC/aRC_sspar.r version [c42ae262e6].

1
2


-
-
%% Reduce steady-state parameter file for aRC (aRC_sspar.r) cat /home/peter/mtt_new/mtt/trans/m/aRCs_header.txt
END;

Deleted mttroot/mtt/lib/examples/Anaesthesia/MaplesonModelP/MaplesonModelP_abg.fig version [7c16f519c4].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291



































































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Inches
1200 2
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4201 7186 4201 6451 4336 6631
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4201 4801 4201 4066 4336 4246
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4276 7201 4801 6901 4651 6901
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9901 6151 10576 6151 10426 6001
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9901 5026 10576 5026 10426 4876
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4501 6226 5176 6226 5026 6076
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4501 5026 5176 5026 5026 4876
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9601 5266 9601 6001 9466 5821
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9901 3901 10576 3901 10426 3751
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4501 3901 5176 3901 5026 3751
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5401 1876 5701 1876
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5551 1201 5551 1876 5401 1726
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5926 1951 5926 2251
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 4051 3601 4351 3601
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 4501 1951 4501 2251
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 7351 1951 7351 2251
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4201 3601 6751 2326 6451 2251
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7051 2251 9526 3676 9526 3376
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5251 2101 4501 2101 4651 1951
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5926 2101 6601 2101 6451 1951
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7351 2101 8026 2101 7876 1951
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 9376 3676 9676 3676
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8491 11341 8491 12076 8356 11896
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5491 14941 5491 15676 5356 15496
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5401 8401 5701 8401
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5371 10246 5671 10246
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5326 12076 5626 12076
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5326 13876 5626 13876
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5326 15676 5626 15676
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8326 15676 8626 15676
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8326 13876 8626 13876
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8326 12076 8626 12076
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8326 10276 8626 10276
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8326 8401 8626 8401
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 6901 14926 7201 14926
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 6901 13126 7201 13126
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 6901 11326 7201 11326
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 6901 9526 7201 9526
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 6901 7651 7201 7651
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7021 14941 7021 15676 6901 15496
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7021 13141 7021 13876 6901 13696
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7021 11341 7021 12076 6901 11896
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7021 9541 7021 10276 6901 10096
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7051 7651 7051 8386 6931 8206
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9526 7501 8851 11101 8776 10951
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9526 7501 8851 12901 8776 12751
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9526 7501 8851 14701 8776 14551
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8476 7651 8476 8386 8341 8206
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8491 9541 8491 10276 8356 10096
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8491 13141 8491 13876 8356 13696
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8491 14941 8491 15676 8356 15496
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5551 7651 5551 8386 5416 8206
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5536 9496 5536 10231 5401 10051
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5491 11341 5491 12076 5356 11896
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5491 13141 5491 13876 5356 13696
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7051 1876 7501 1501 7501 1726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7201 7501 7801 8101 7651 8101
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7201 9301 7801 9901 7651 9901
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7201 11101 7801 11701 7651 11701
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7201 12901 7801 13501 7651 13501
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7201 14701 7801 15301 7651 15301
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9601 4051 9601 4351 9526 4276
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9601 4576 9601 4876 9526 4801
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9601 6376 9601 6676 9526 6601
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9601 7051 9601 7351 9526 7276
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4201 5476 4201 5176 4276 5251
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4201 6076 4201 5776 4276 5851
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8178 9303 7878 9303 7953 9378
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7578 9303 7278 9303 7353 9378
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8177 9152 8177 9452
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8178 11103 7878 11103 7953 11178
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7578 11103 7278 11103 7353 11178
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8177 10952 8177 11252
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8178 12903 7878 12903 7953 12978
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7578 12903 7278 12903 7353 12978
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8177 12752 8177 13052
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8178 14703 7878 14703 7953 14778
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7578 14703 7278 14703 7353 14778
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 8177 14552 8177 14852
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6676 14701 5926 14701 6076 14851
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6676 12901 5926 12901 6076 13051
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6676 11101 5926 11101 6076 11251
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6676 9301 5926 9301 6076 9451
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6676 7501 5926 7501 6076 7651
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9526 7501 8776 7501 8971 7636
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9526 7501 8851 9301 8776 9076
2 1 0 1 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9742 7410 10267 7110 10117 7110
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8101 7501 7801 7501 7876 7576
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7501 7501 7201 7501 7276 7576
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5102 9302 4802 9302 4877 9377
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5103 11103 4803 11103 4878 11178
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5028 12903 4728 12903 4803 12978
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5028 14703 4728 14703 4803 14778
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 9301 4201 7501 4351 7801
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4051 7576
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 3976 7576
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4051 7576
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4426 11101 4051 7576 4201 7801
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4426 12901 3901 7576 3976 7726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4426 14701 3676 7501 3826 7801
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5177 7502 4877 7502 4952 7577
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4577 7502 4277 7502 4352 7577
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 8700 9000 7050 6600 7050 6600 8700 9000 8700
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 12300 9000 10650 6600 10650 6600 12300 9000 12300
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 14175 9000 12525 6600 12525 6600 14175 9000 14175
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 15975 9000 14325 6600 14325 6600 15975 9000 15975
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 10500 9000 8850 6600 8850 6600 10500 9000 10500
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 13800 16125 300 16125 300 600 13800 600 13800 16125
4 0 0 0 0 0 12 0.0000000 4 180 495 10276 7051 C:apc2\001
4 0 0 0 0 0 12 0.0000000 4 180 510 4876 7051 C:vpc2\001
4 0 0 0 0 0 12 0.0000000 4 180 495 10651 5101 C:apc1\001
4 0 0 0 0 0 12 0.0000000 4 180 480 10651 6226 R:apr2\001
4 0 0 0 0 0 12 0.0000000 4 180 480 10651 4051 R:apr1\001
4 0 0 0 0 0 12 0.0000000 4 180 510 5251 5101 C:vpc1\001
4 0 0 0 0 0 12 0.0000000 4 180 495 5251 6301 R:vpr2\001
4 1 0 0 0 0 12 0.0000000 4 180 495 5551 3976 R:vpr1\001
4 1 0 0 0 0 12 0.0000000 4 180 390 9601 6301 1:ap3\001
4 1 0 0 0 0 12 0.0000000 4 180 405 4201 6301 1:vp3\001
4 1 0 0 0 0 12 0.0000000 4 180 390 9601 5101 0:ap2\001
4 1 0 0 0 0 12 0.0000000 4 180 405 4126 5101 0:vp2\001
4 1 0 0 0 0 12 0.0000000 4 180 390 9526 3976 1:ap1\001
4 1 0 0 0 0 12 0.0000000 4 180 405 4126 3976 1:vp1\001
4 0 0 0 0 0 12 0.0000000 4 180 420 7576 1576 SS:ye\001
4 0 0 0 0 0 12 0.0000000 4 135 390 5326 1201 SS:t0\001
4 1 0 0 0 0 12 0.0000000 4 135 270 4201 2176 R:ri\001
4 1 0 0 0 0 12 0.0000000 4 135 240 5551 2176 1:fi\001
4 1 0 0 0 0 12 0.0000000 4 135 225 7051 2176 0:ti\001
4 1 0 0 0 0 12 0.0000000 4 135 285 8401 2176 C:ci\001
4 0 0 0 0 0 12 0.0000000 4 135 345 8251 14776 1:fsa\001
4 0 0 0 0 0 12 0.0000000 4 135 330 8251 12976 1:ffa\001
4 0 0 0 0 0 12 0.0000000 4 135 315 8251 11176 1:fla\001
4 0 0 0 0 0 12 0.0000000 4 135 360 8251 9376 1:fva\001
4 0 0 0 0 0 12 0.0000000 4 135 360 8251 7576 1:fba\001
4 0 0 0 0 0 12 0.0000000 4 135 360 5251 14776 1:fsv\001
4 0 0 0 0 0 12 0.0000000 4 135 345 5251 12976 1:ffv\001
4 0 0 0 0 0 12 0.0000000 4 135 330 5251 11176 1:flv\001
4 0 0 0 0 0 12 0.0000000 4 135 375 5251 9376 1:fvv\001
4 0 0 0 0 0 12 0.0000000 4 180 345 9601 7576 0:tap\001
4 1 0 0 0 0 12 0.0000000 4 135 390 5476 15901 R:rs1\001
4 1 0 0 0 0 12 0.0000000 4 135 405 5551 10501 R:rv1\001
4 1 0 0 0 0 12 0.0000000 4 135 405 5551 8626 R:rb1\001
4 0 0 0 0 0 12 0.0000000 4 180 420 7501 15601 SS:ys\001
4 0 0 0 0 0 12 0.0000000 4 180 405 7501 13801 SS:yf\001
4 1 0 0 0 0 12 0.0000000 4 180 390 7726 12001 SS:yl\001
4 1 0 0 0 0 12 0.0000000 4 180 435 7801 10201 SS:yv\001
4 1 0 0 0 0 12 0.0000000 4 180 435 7801 8326 SS:yb\001
4 1 0 0 0 0 12 0.0000000 4 135 390 8476 15901 R:rs2\001
4 1 0 0 0 0 12 0.0000000 4 135 405 8476 10501 R:rv2\001
4 1 0 0 0 0 12 0.0000000 4 135 405 8476 8626 R:rb2\001
4 1 0 0 0 0 12 0.0000000 4 135 315 6976 15901 C:cs\001
4 1 0 0 0 0 12 0.0000000 4 135 300 7051 14101 C:cf\001
4 1 0 0 0 0 12 0.0000000 4 135 285 6976 12376 C:cl\001
4 1 0 0 0 0 12 0.0000000 4 135 330 6976 10501 C:cv\001
4 1 0 0 0 0 12 0.0000000 4 135 330 7051 8626 C:cb\001
4 1 0 0 0 0 12 0.0000000 4 135 255 7051 14776 0:ts\001
4 1 0 0 0 0 12 0.0000000 4 135 240 7051 12976 0:tf\001
4 1 0 0 0 0 12 0.0000000 4 135 225 7051 11176 0:tl\001
4 1 0 0 0 0 12 0.0000000 4 135 270 7051 9376 0:tv\001
4 1 0 0 0 0 12 0.0000000 4 135 270 7051 7576 0:tb\001
4 1 0 0 0 0 12 0.0000000 4 135 360 8476 12376 R:rl1\001
4 1 0 0 0 0 12 0.0000000 4 135 375 8476 14101 R:rf1\001
4 1 0 0 0 0 12 0.0000000 4 135 360 5476 12376 R:rl2\001
4 1 0 0 0 0 12 0.0000000 4 135 375 5476 14101 R:rf2\001
4 1 0 0 0 0 12 0.0000000 4 135 240 9601 4501 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 9601 6901 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 4201 5701 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 7728 9378 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 7728 11178 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 7728 12978 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 7728 14778 AF\001
4 0 0 0 0 0 12 0.0000000 4 135 375 5251 7576 1:fbv\001
4 2 0 0 0 0 12 0.0000000 4 180 360 4126 7501 0:tvp\001
4 1 0 0 0 0 12 0.0000000 4 135 240 7651 7576 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 4652 9377 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 4653 11178 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 4578 12978 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 4578 14778 AF\001
4 1 0 0 0 0 12 0.0000000 4 135 240 4727 7577 AF\001

Deleted mttroot/mtt/lib/examples/Anaesthesia/MaplesonModelP/MaplesonModelP_desc.tex version [d9550f793f].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system MaplesonModelP (MaplesonModelP_desc.tex)
% Generated by MTT on Wed Dec 10 09:04:14 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{MaplesonModelP} is
   displayed in Figure \Ref{MaplesonModelP_abg} and its label
   file is listed in Section \Ref{sec:MaplesonModelP_lbl}.
   The subsystems are listed in Section \Ref{sec:MaplesonModelP_sub}.

This is a Bond Graph interpretation of Mapleson's model P of the
pharmokokinetics of anaesthetic drug delivery. It is discussed in
detail in Chapter 9 of ``Metamodelling''.

It badly needs conversion to hierarchical form.


%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Anaesthesia/MaplesonModelP/MaplesonModelP_input.txt version [4de10d9765].

1
2
3
4
5
6
7
8
9









-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System MaplesonModelP, representation input, language txt; 
## File MaplesonModelP_input.txt; 
## Generated by MTT on Fri Nov 10 10:45:52 GMT 2000; 


MaplesonModelP_t0	= 0.75*760*(t<2); #75% atmospheric pressure for 2 sec.

Deleted mttroot/mtt/lib/examples/Anaesthesia/MaplesonModelP/MaplesonModelP_lbl.txt version [30211b8f11].

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
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
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







































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY MaplesonModelP: Pharmokinetic model from section 9.6 of"Metamodelling"
#DESCRIPTION Detailed model with pools
#DESCRIPTION
#DESCRIPTION Note that the bond graph has been redrawn to replace active bonds with
#DESCRIPTION AF components.
#DESCRIPTION This would be much neater using a heirachical model.
#DESCRIPTION 
#DESCRIPTION The following commands make the figures.
#DESCRIPTION 
#DESCRIPTION Fig 9.17	mtt MaplesonModelP abg view
#DESCRIPTION Figs 9.18-19	mtt MaplesonModelP odeso view 'T=[0:0.1:6]'
#DESCRIPTION Fig 9.20	mtt MaplesonModelP lmfr view 'W=logspace(-2,2,100)'
#DESCRIPTION Fig 9.21	mtt MaplesonModelP lpfr view 'W=logspace(-2,2,100)'


# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.1  1996/08/30  18:37:56  peter
# ## Initial revision
# ##
# ###############################################################

#VAR apools
#VAR breathing_interval
#VAR heart_interval
#VAR k_ap
#VAR k_b
#VAR k_f
#VAR k_i
#VAR k_l
#VAR k_s
#VAR k_v
#VAR k_vp
#VAR kb
#VAR kf
#VAR kl
#VAR ks
#VAR kv
#VAR lambdab
#VAR lambdablood
#VAR lambdaf
#VAR lambdal
#VAR lambdalung
#VAR lambdav
#VAR stroke_volume
#VAR t_1
#VAR t_2
#VAR t_b
#VAR t_f
#VAR t_i
#VAR t_l
#VAR t_s
#VAR t_v
#VAR v_i
#VAR vap
#VAR varterial
#VAR vb
#VAR vbp
#VAR vf
#VAR vfp
#VAR vgas
#VAR vl
#VAR vlp
#VAR vlung
#VAR vplung
#VAR vpools
#VAR vsp
#VAR vv
#VAR vvenous
#VAR vvp

### Common tension junctions ###
ti
tb
tv
tl
tf
ts
tap
tvp

##Common flow junctions - inspiration ###
fi

##Common flow junctions - arteries ###
fba
fva
fla
ffa
fsa

##Common flow junctions - veins ###
fbv
fvv
flv
ffv
fsv

## More junctions
ap3
vp3
ap2
vp2
ap1
vp1

### Resistances ###
rb1	lin	flow,r_b
rv1	lin	flow,r_v
rl1	lin	flow,r_l
rf1	lin	flow,r_f
rs1	lin	flow,r_s

rb2	lin	flow,r_b
rv2	lin	flow,r_v
rl2	lin	flow,r_l
rf2	lin	flow,r_f
rs2	lin	flow,r_s

ri	lin	flow,r_i

## Capacities ###
cb	lin	effort,c_b
cv	lin	effort,c_v
cl	lin	effort,c_l
cf	lin	effort,c_f
cs	lin	effort,c_s
ci	lin	effort,c_i


### Input ###
t0	SS  external,internal

### Outputs ###
yb	SS  external,0	
yv	SS  external,0	
yl	SS  external,0	
yf	SS  external,0	
ys	SS  external,0	
ye	SS  external,0	

### Arterial pool
# ap1	apool1
# ap2	apool2
# ap3	apool3

apc1	lin	effort,c_ap
apc2	lin	effort,c_ap

apr1	lin	flow,r_ap
apr2	lin	flow,r_ap


### Venous pool
# vp1	vpool1
# vp2	vpool2
# vp3	vpool3

vpc1	lin	effort,c_vp
vpc2	lin	effort,c_vp
vpr1	lin	flow,r_vp
vpr2	lin	flow,r_vp


Deleted mttroot/mtt/lib/examples/Anaesthesia/MaplesonModelP/MaplesonModelP_numpar.txt version [3482181f7e].

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
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
123
124
125





























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (MaplesonModelP_numpar.txt)
# Generated by MTT at Mon Aug 11 14:45:13 BST 1997

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

# Parameters

# Modified 17/11/93 to correspond to Mapleson's 1973 paper. 
# Like model O except that blood has its own pools distinct form the tissues. 


Heart_interval = 1.0/60.0;
Breathing_interval = 4*Heart_interval;
Stroke_volume = 0.108;
lambdaBlood = 0.46;
vArterial = 1.4;
vVenous = 4.0;

# %%%%%%%%%%%%%%%%%% Inspiration %%%%%%%%%%%%%%%%%%%%%%%%%%%
v_i = 0.4;
r_i = Breathing_interval/v_i;

# %%%%%%%%%%%%%%%%%% Lung %%%%%%%%%%%%%%%%%%%%%%%%%%% 
vLung = 0.6;
vPLung =  0;
vGas = 2.5;
lambdaLung = 0.46;

c_i = lambdaLung*(vLung + vPLung) + vGas;
t_i = r_i*c_i;
# %%%%%%%%%%%%%%%%%% Brain %%%%%%%%%%%%%%%%%%%%%%%%%%% 
kB = 0.000086;

vB = 0.0007;
vBP = 0.0;

lambdaB = 0.46;

c_b = lambdaB*vB + lambdaBlood*vBP;
r_b = Heart_interval/(kB*lambdaBlood*Stroke_volume);
t_b = r_b*c_b;

# %%%%%%%%%%%%%%%%%% Viscera %%%%%%%%%%%%%%%%%%%%%%%%%%% 
kV = 0.63;

vV = 6.2;
lambdaV = 0.46;
vVP = 0;

c_v = lambdaV*vV + lambdaBlood*vVP;
r_v = Heart_interval/(kV*lambdaBlood*Stroke_volume);
t_v = r_v*c_v;

# %%%%%%%%%%%%%%%%%% Lean %%%%%%%%%%%%%%%%%%%%%%%%%%% 
kL = 0.131;

vL = 39.2;
lambdaL = 0.46;
vLP = 0;

c_l = lambdaL*vL + lambdaBlood*vLP;
r_l = Heart_interval/(kL*lambdaBlood*Stroke_volume);
t_l = r_l*c_l;

# %%%%%%%%%%%%%%%%%% Fat %%%%%%%%%%%%%%%%%%%%%%%%%%% 
kF = 0.04;

vF = 12.2;
lambdaF = 1.40;
vFP = 0;

c_f = lambdaF*vF + lambdaBlood*(vFP);
r_f = Heart_interval/(kF*lambdaBlood*Stroke_volume);
t_f = r_f*c_f;

# %%%%%%%%%%%%%%%%%% Shunt %%%%%%%%%%%%%%%%%%%%%%%%%%% 
kS = 0.199;

vSP = 0.126*vVenous;

c_s = lambdaBlood*(vSP);
r_s = Heart_interval/(kS*lambdaBlood*Stroke_volume);
t_s = r_s*c_s;

# %%%%%%%%%%%%%%%%%% Time constants %%%%%%%%%%%%%%%%%%%%%%%%%%% 
t_1 = t_b*t_v*t_l*t_f*t_s;
t_2 = t_1*t_i;


# %%%%%%%%%%%%%%%%%% Convert from rs to ks %%%%%%%%%%%%%%%%%%%% 

k_b = 1/r_b;
k_v = 1/r_v;
k_l = 1/r_l;
k_f = 1/r_f;
k_s = 1/r_s;
k_i = 1/r_i;

# %%%%%%%%%%%%%%%%%% Arterial pools %%%%%%%%%%%%%%%%%%%%%%%%%%% 
# Two pool version 
aPools = 2;

vAP = vArterial;

c_ap = lambdaBlood*(vAP)/aPools;
r_ap  = Heart_interval/(lambdaBlood*Stroke_volume);

# %%%%%%%%%%%%%%%%%% Venous pools %%%%%%%%%%%%%%%%%%%%%%%%%%% 
# Two pool version 
vPools = 2;

vVP = vVenous - vSP;

c_vp = lambdaBlood*(vVP)/vPools;
r_vp  = Heart_interval/(lambdaBlood*Stroke_volume);

k_ap = 1/r_ap;
k_vp = 1/r_vp;


Deleted mttroot/mtt/lib/examples/Anaesthesia/MaplesonModelP/MaplesonModelP_rep.txt version [88420fc7c7].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system MaplesonModelP (MaplesonModelP_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1999/02/17 01:46:48  peterg
% %% Included simpar rep.
% %%
% %% Revision 1.1  1999/02/17 00:08:06  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt MaplesonModelP abg tex
mtt MaplesonModelP struc tex
mtt MaplesonModelP ode tex
mtt MaplesonModelP sm tex
mtt MaplesonModelP lmfr ps

mtt MaplesonModelP simpar txt
mtt MaplesonModelP numpar txt
mtt MaplesonModelP input txt
mtt MaplesonModelP odeso ps

Deleted mttroot/mtt/lib/examples/Anaesthesia/MaplesonModelP/MaplesonModelP_simpar.txt version [3858c22495].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system MaplesonModelP (MaplesonModelP_simpar.txt)
# Generated by MTT on Fri Nov 10 11:37:00 GMT 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


FIRST        = 0.0;       # First time in simulation output
DT          = 0.1;        # Print interval
LAST        = 10.0;       # Last time in simulation
STEPFACTOR  = 10;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/MakeFigure.m version [bcab2a5c23].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


par = Reactor_numpar;		# Parameters
sym = Reactor_sympar;		# Parameter indices

F_s= [90:10:500];		# Range of flows

Z_a = []; Z_b = []; P = [];
for f_s=F_s
  par(sym.f_s) = f_s;
  [A,B,C,D] = Reactor_sm(par);	# Linearised system

  p = sort(eig(A));
  P = [P p];

  C_a = C([1 3],:);		# C vector for c_a and t
  D_a = D([1 3],:);		# D vector for c_a and t
  z_a = tzero(A,B,C_a,D_a);	# Transmission zeros for c_a and t
  Z_a = [Z_a z_a];

  C_b = C(2:3,:);		# C vector for c_b and t
  D_b = D(2:3,:);		# D vector for c_b and t
  z_b = tzero(A,B,C_b,D_b);	# Transmission zeros for c_b and t
  Z_b = [Z_b z_b];
endfor

grid; xlabel("f_s"); ylabel("p1,p2");
plot(F_s,P(1:2,:));
psfig("Reactor_pole_1_2");

grid; xlabel("f_s"); ylabel("p3");
plot(F_s,P(3,:));
psfig("Reactor_pole_3");

grid; xlabel("f_s"); ylabel("z_a");
plot(F_s,Z_a);
psfig("Reactor_zero_a");

grid; xlabel("f_s"); ylabel("z_b");
plot(F_s,Z_b);
psfig("Reactor_zero_b");

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Makefile version [97d3b40e97].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
## Makes the schematic diagram and the (trasmission) zero figure
all: Reactor_pic.ps Reactor_zero_b.ps

Reactor_pic.ps: Reactor_pic.fig
	fig2dev -Lps Reactor_pic.fig> Reactor_pic.ps

Reactor_zero_b.ps: Reactor_abg.fig
	mtt -q Reactor sm m
	mtt -q Reactor numpar m;
	mtt -q Reactor sympar m;
	octave MakeFigure.m


Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_abg.fig version [42573cb4d6].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137









































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Inches
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3001 8701 3001 7801 3151 7951
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1801 9001 2701 9001 2551 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 8776 2701 9226
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3301 9001 4201 9001 4051 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4201 9301 3601 9901 3826 9901
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5701 9001 4801 9001 4951 9151
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 6000 2700 6000 2550 6150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 10350 5025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 6000 1800 5775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 6225 1800 6000
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 10200 600 10200 600 7500 11100 7500 11100 10200
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 6600 600 6600 600 5400 11100 5400 11100 6600
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5700 8775 5700 9225
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4425 9300 3975 9300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 4800 4500 8700 4650 8550
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6000 4800 4800 8700 5025 8625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9000 4800 5100 8700 5400 8700
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4800 4275 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4200 4275 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4800 5775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4200 5775 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4800 8775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4200 8775 4200
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 7200 3000 6300 3150 6450
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 10500 4800 3300 6000 3525 6075
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 5100 600 5100 600 3300 11100 3300 11100 5100
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4485 2395 4485 4130 4633 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 2999 2395 2999 4130 3148 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5970 2395 5970 4130 6119 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 10428 2397 10428 4132 10577 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8943 2397 8943 4132 9091 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 2100 2700 2100 2550 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3300 2100 4200 2100 4050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4800 2100 5700 2100 5550 2250
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4200 1800 3600 1200 3600 1425
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 1875 2700 2325
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 8701 1801 8101 1201 8101 1426
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9301 2101 10201 2101 10051 2251
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6300 2100 7200 2100 7050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7800 2100 8700 2100 8550 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 1950 4350 1650
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 1950 8850 1650
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 300 600 300 600 2700 11100 2700 11100 300
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 4800 3000 5700 3150 5550
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 9301 1801 9901 1201 9901 1426
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 10050 1350 9900 1200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 1200 9750 1050
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4801 1801 5401 1201 5401 1426
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5550 1350 5400 1200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5400 1200 5250 1050
4 1 0 0 0 0 20 0.0000 4 210 1035 3075 4575 FMR:rfa\001
4 1 0 0 0 0 20 0.0000 4 210 1065 4575 4575 Rate:AD\001
4 1 0 0 0 0 20 0.0000 4 210 1050 6000 4575 Rate:AB\001
4 2 0 0 0 0 20 0.0000 4 285 780 1651 9076 SS:t_0\001
4 2 0 0 0 0 20 0.0000 4 285 690 3451 9976 C:h_r\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 6075 1\001
4 2 0 0 0 0 20 0.0000 4 210 480 1725 6075 SS:f\001
4 1 0 0 0 0 20 0.0000 4 210 150 3001 9076 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4501 9076 0\001
4 1 0 0 0 0 20 0.0000 4 210 1005 9001 4576 Rate:BC\001
4 1 0 0 0 0 20 0.0000 4 210 1050 10576 4576 FMR:rfb\001
4 1 1 1 0 3 20 0.0000 4 210 2625 9600 7800 THERMAL MODEL\001
4 1 1 1 0 3 20 0.0000 4 210 2940 9450 5700 HYDRAULIC MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 900 3000 7575 FMR:rt\001
4 1 1 1 0 3 20 0.0000 4 210 2700 9675 3750 REACTION MODEL\001
4 2 0 0 0 0 20 0.0000 4 285 825 1650 2175 SS:c_0\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4500 2175 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 6000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 9001 2176 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 10501 2176 1\001
4 1 0 0 0 0 20 0.0000 4 210 420 7500 2175 AF\001
4 1 0 0 0 0 20 0.0000 4 285 795 8100 1050 C:m_b\001
4 1 0 0 0 0 20 0.0000 4 285 780 3600 1050 C:m_a\001
4 1 1 0 0 3 20 0.0000 4 210 3735 9075 600 CONCENTRATION MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 480 6151 9076 SS:t\001
4 1 0 0 0 0 20 0.0000 4 285 825 9975 1050 SS:c_b\001
4 1 0 0 0 0 20 0.0000 4 285 810 5475 1050 SS:c_a\001

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_desc.tex version [b3d301e887].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Reactor (Reactor_desc.tex)
% Generated by MTT on Fri Mar 3 12:43:33 GMT 2000.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\fig{Reactor_pic}
{Reactor_pic} {0.9} {System \textbf{Reactor}, Schematic}

Figure \Ref{fig:Reactor_pic} is the schematic diagram od a chemical reactor.
The acausal bond graph of system \textbf{Reactor} is displayed in
Figure \Ref{fig:Reactor_abg.ps} and its label file is listed in
Section \Ref{sec:Reactor_lbl}.  The subsystems are listed in Section
\Ref{sec:Reactor_sub}.

This example of a (nonlinear) chemical reactor is due to Trickett and
Bogle\footnote{ K. J. Tricket, \emph{Quantification of Inverse
    Responses for Controllability Assessment of Nonlinear Processes},
  PhD Thesis, University College London, 1994} is used in this
section.  The reactor has two reaction mechanisms: $\text{A}
\rightarrow \text{B} \rightarrow \text{C}$ and $\text{2A} \rightarrow
\text{D}$.  The reactor mass inflow and outflow $f_r$ are identical.
$q$ represents the heat inflow to the reactor.

This is a two input, two-output unstable nonlinear system with unstable zero
dynamics.
The following figures illustrate the properties of the
\emph{linearised} system.

\fig{Reactor_pole_1_2}
{Reactor_pole_1_2} {0.9} {System \textbf{Reactor}: poles 1 and 2
  v. steady-state flow $f_s$}

\fig{Reactor_pole_3}
{Reactor_pole_3} {0.9} {System \textbf{Reactor}: pole 3
  v. steady-state flow $f_s$}

\fig{Reactor_zero_a}
{Reactor_zero_a} {0.9} {System \textbf{Reactor}: zero of system with
  $t$ and $c_a$ as output
  v. steady-state flow $f_s$}

\fig{Reactor_zero_b}
{Reactor_zero_b} {0.9} {System \textbf{Reactor}: pole 3
  v. steady-state flow $f_s$}

\begin{itemize}
\item Figures \Ref{fig:Reactor_pole_1_2} and
  \Ref{fig:Reactor_pole_3} show the three poles of the
  \emph{linearised} system as the steady-state flow varies. 
\item Figure \Ref{fig:Reactor_zero_a} shows the system zero (when $t$ and
  $c_a$ are the two system outputs) as the
  \emph{linearised} system as the steady-state flow varies. 
\item Figure \Ref{fig:Reactor_zero_b} shows the system zero (when $t$ and
  $c_b$ are the two system outputs) as the
  \emph{linearised} system as the steady-state flow varies. 
\end{itemize}

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_input.txt version [033dc74e44].

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






























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (Reactor_input.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 17:09:55  peterg
## To RCS
##
###############################################################

## Reduce steady-state parameter file (Reactor_sspar.r)
## as siso_sspar ecxept that inputs/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume Reactor:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
x3 = c_p*t_s*v_r;


#Steady-state input q needed to achieve steady-state t_s
q_s = -( (t_0-t_s)*c_p*f_s + e_1*h_1*k_1*x1 + e_2*h_2*k_2*x2 + e_3*h_3*k_3*x1^2);

## The two inputs at steady-state
u1 = f_s;
u2 = q_s;


# Set the inputs
## Removed by MTT on Thu Dec 28 18:44:39 GMT 2000: mttu(1) = u1 + 0.1*u1*(t>0.01); # f (Reactor)
## Removed by MTT on Thu Dec 28 18:44:39 GMT 2000: mttu(2) = u2 + 0.1*u2*(t>0.05) ; # t (Reactor)



reactor_f	= u1 + 0.1*u1*(t>0.01); # Added by MTT on Thu Dec 28 18:44:47 GMT 2000
reactor_t	= u2 + 0.1*u2*(t>0.05); # Added by MTT on Thu Dec 28 18:44:47 GMT 2000

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_lbl.txt version [4b8c69ad2e].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Reactor (Reactor_lbl.txt)
%SUMMARY Reactor: Simple reactor model
%DESCRIPTION Pseudo bond graph reactor model (based on ancient version)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%ALIAS Rate Chemical/Rate

% Extra variables
%VAR t_s
%VAR f_s
%VAR t_0
%VAR c_0
%VAR rho
%VAR v_r
%VAR e_1
%VAR e_2
%VAR e_3
%VAR a
%VAR b
%VAR c
%VAR c_A
%VAR c_B
%VAR x1
%VAR x2
%VAR x3
%VAR q_S

%VAR u1
%VAR u2

% Port aliases

% Argument aliases

%% each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type C
	m_a	lin		effort,1
	m_b	lin		effort,1
	h_r	lin		effort,c_p

% Component type FMR
	rfa	lin		effort,1		
	rfb	lin		effort,1		
	rt	lin		effort,c_p

% Component type Rate
        AB	Rate	k_1,q_1,h_1,1
	BC	Rate	k_2,q_2,h_2,1
	AD	Rate	k_3,q_3,h_3,2

% Component type SS
	c_0	SS		c_0,internal
	c_a	SS		external,0
	c_b	SS		external,0
	f	SS		internal,external
	t	SS		external,external
	t_0	SS		t_0,internal

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_numpar.txt version [a664ac56b4].

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
68
69
70
71
72
73
74
75
76
77
78
79















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (Reactor_numpar.txt)
# Generated by MTT at Fri Mar  3 09:22:56 GMT 2000

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

## Dummies
a = 0;				# Dummy
b = 0;				# Dummy
c = 0;				# Dummy
c_0 = 0;			# Dummy
c_a = 0;			# Dummy
c_b = 0;			# Dummy
c_p = 0;			# Dummy
e_1 = 0;			# Dummy
e_2 = 0;			# Dummy
e_3 = 0;			# Dummy
f_s = 0;			# Dummy
h = 0;				# Dummy
h_1 = 0;			# Dummy
h_2 = 0;			# Dummy
h_3 = 0;			# Dummy
k = 0;				# Dummy
k_1 = 0;			# Dummy
k_2 = 0;			# Dummy
k_3 = 0;			# Dummy
n = 0;				# Dummy
q = 0;				# Dummy
q_1 = 0;			# Dummy
q_2 = 0;			# Dummy
q_3 = 0;			# Dummy
q_s = 0;			# Dummy
rho = 0;			# Dummy
t_0 = 0;			# Dummy
t_s = 0;			# Dummy
v_r = 0;			# Dummy
x1 = 0;				# Dummy
x2 = 0;				# Dummy
x3 = 0;				# Dummy

## The bulk liquid
rho = 900;			# Density
c_p = 5.0;			# Specific heat

## Substance A
k_1 = 2.5e10;			# Reaction rate constant
q_1 = 1e4;			# Exotherm constant
h_1 = 1e4;			# Heat of reaction

## Substance B
k_2 = 2.65e12;			# Reaction rate constant
q_2 = 1.2e4;			# Exotherm constant
h_2 = 1.2e4;			# Heat of reaction

## Substance C
k_3 = 6e7;			# Reaction rate constant
q_3 = 8e3;			# Exotherm constant
h_3 = 3e4;			# Heat of reaction

## Inflow parameters
c_0 = 10;			# Inflow conc
t_0 = 530;			# Inflow temp

## Steady-state values
t_s = 530;			# Steady-state temp
f_s = 100;			# Steady-state flow








Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_pic.fig version [c396b14562].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Landscape
Center
Inches
Letter  
100.00
Single
-2
1200 2
6 2400 3150 3225 3375
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2625 3300 2925 3300
4 0 -1 0 0 2 20 0.0000 4 210 210 2400 3375 A\001
4 0 -1 0 0 2 20 0.0000 4 210 225 3000 3375 D\001
-6
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 2100 2100 2100 3900 1500 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 1500 4050 3900 4050
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 1500 4350 2100 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2100 3600 3900 4200 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 3600 4350 4200 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 3900 4050 4200 4050
2 1 1 2 -1 -1 0 0 -1 6.000 0 0 -1 0 0 2
	 2100 2400 3600 2400
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2400 2925 2700 2925
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3000 2925 3300 2925
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 2850 4800 2850 3750
4 0 -1 0 0 2 20 0.0000 4 210 210 2175 3000 A\001
4 0 -1 0 0 2 20 0.0000 4 210 195 2775 3000 B\001
4 0 -1 0 0 2 20 0.0000 4 210 210 3375 3000 C\001
4 0 -1 0 0 2 20 0.0000 4 210 150 2250 3375 2\001
4 0 -1 0 0 3 12 0.0000 4 135 90 1875 4950 0\001
4 0 -1 0 0 3 12 0.0000 4 135 90 2250 4950 0\001
4 0 -1 0 0 3 20 0.0000 4 210 150 2775 5025 q\001
4 0 -1 0 0 3 20 0.0000 4 285 765 1500 4800 f , c  , t\001
4 0 -1 0 0 3 20 0.0000 4 285 765 3600 4800 f , c  , t\001
4 0 -1 0 0 3 12 0.0000 4 135 90 3975 4950 b\001
4 0 -1 0 0 3 12 0.0000 4 90 75 4350 4950 r\001

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_rep.txt version [db07825607].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system Reactor (Reactor_rep.txt)
## Generated by MTT on" Fri Mar  3 12:13:34 GMT 2000.

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

mtt Reactor abg tex			# The system description
mtt Reactor cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt Reactor struc tex	        # The system structure
## mtt Reactor dae tex	        # The system dae
mtt Reactor ode tex	        # The system ode 
mtt Reactor sspar tex		# Steady-state parameters
mtt Reactor ss tex 		# Steady state
## mtt Reactor dm tex		# Descriptor matrices (of linearised system)
mtt Reactor sm tex		# State matrices (of linearised system)
## mtt Reactor tf tex		# Transfer function (of linearised system)
## mtt Reactor lmfr ps		# log modulus of frequency response (of linearised system)
mtt Reactor simpar tex		# Simulation parameters
mtt Reactor numpar tex		# Numerical simulation parameters
mtt Reactor input tex		# Simulation input
mtt Reactor state tex		# Simulation initial state

## The system outputs
mtt -c Reactor odeso ps 'Reactor_c_a'
mtt -c Reactor odeso ps 'Reactor_c_b'
mtt -c Reactor odeso ps 'Reactor_t'

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_simp.r version [c0625028b5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output (mimo_sim.r)
m_r   := rho*v_r;
%mttx1 := c_a*v_r;
%mttx2 := c_b*v_r;

% THIS MUST BE CHANGED - probs with cp and FMRs
%c_p := 1;

%let mttx3/c_p = t;

let  e^(q_1/(mttx3/c_p)) = 1/epsilon_1;
let  e^(q_2/(mttx3/c_p)) = 1/epsilon_2;
let  e^(q_3/(mttx3/c_p)) = 1/epsilon_3;

let  e^(q_1/t_s) = 1/epsilon_1;
let  e^(q_2/t_s) = 1/epsilon_2;
let  e^(q_3/t_s) = 1/epsilon_3;

FACTOR mttx1,mttx2;

END;

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_simpar.txt version [5dd7482825].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system Reactor (Reactor_simpar.txt)
# Generated by MTT on Fri Mar 3 12:11:48 GMT 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/08/24 12:32:25  peterg
## Initial revision
##
###############################################################


LAST        = 0.1;       # Last time in simulation
DT          = 0.0002;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_sspar.r version [f8d86e9c44].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file (Reactor_sspar.r)
%% as siso_sspar ecxept that inputs/states have different meaning
%% Steady state for constant c_a, c_b and t=t_s and f=f_s

%% Unit volume Reactor:
v_r := 1;

%% Do the inputs first -- this avoids problems with reduce not
%% recognising that complicated expressions are zero

%% The exponentials.
e_1 := e^(-q_1/t_s);
e_2 := e^(-q_2/t_s);
e_3 := e^(-q_3/t_s);

%Steady-state input q needed to achieve steady-state t_s
q_s := -( 
        + (t_0-t_s)*c_p*f_s
        + e_1*h_1*k_1*x1
        + e_2*h_2*k_2*x2
        + e_3*h_3*k_3*x1^2
       );

%% The two inputs at steady-state
MTTu1 := f_s;
MTTu2 := q_s;

%States (masses)
x1 := c_a*v_r;
x2 := c_b*v_r;

%Thermal state
x3 := c_p*t_s*v_r;

%Load up the vectors
MTTx1 := x1;
MTTx2 := x2;
MTTx3 := x3;

MTTy1 := c_b;
MTTy2 := t_s;

%% Finally, solve for the steady-state concentrations
%% Solve for ca - a quadratic.
a 	:= k_3*e_3;	%ca^2 
b 	:= k_1*e_1 + f_s;	%ca^1 
c 	:= -c_0*f_s;

c_a	:= (-b + sqrt(b^2 - 4*a*c))/(2*a);

%% solve for c_b
c_b 	:= c_a*k_1*e_1/(f_s+k_2*e_2);


END;


Deleted mttroot/mtt/lib/examples/Chemical/Reactor/Reactor_state.txt version [cbf1efc5c4].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# State specification (Reactor_state.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 17:09:55  peterg
## To RCS
##
###############################################################

## Reduce steady-state parameter file (Reactor_sspar.r)
## as siso_sspar ecxept that states/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume Reactor:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
x3 = c_p*t_s*v_r;


#Steady-state state q needed to achieve steady-state t_s
q_s = -((t_0-t_s)*c_p*f_s + e_1*h_1*k_1*x1 + e_2*h_2*k_2*x2 + e_3*h_3*k_3*x1^2);

## The two inputs at steady-state
u1 = f_s;
u2 = q_s;

## Load up the states
## Removed by MTT on Thu Dec 28 18:46:20 GMT 2000: mttx(1) = x1;
## Removed by MTT on Thu Dec 28 18:46:20 GMT 2000: mttx(2) = x2;
## Removed by MTT on Thu Dec 28 18:46:20 GMT 2000: mttx(3) = x3;




reactor_h_r	= x3; # Added by MTT on Thu Dec 28 18:46:25 GMT 2000
reactor_m_a	= x1; # Added by MTT on Thu Dec 28 18:46:25 GMT 2000
reactor_m_b	= x2; # Added by MTT on Thu Dec 28 18:46:25 GMT 2000

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/MakeFigure.m version [138a415543].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Makes the figures

par = ReactorTF_numpar;		# Parameters
sym = ReactorTF_sympar;		# Parameter indices

F_s= [90:10:500];		# Range of flows

Z = [];
for f_s=F_s
  par(sym.f_s) = f_s;
  z = sort(eig(ReactorTF_sm(par)));
  Z = [Z z];
endfor


grid; xlabel("f_s"); ylabel("z_1");
plot(F_s,Z(1,:));
psfig("ReactorTF_zero_1");

grid; xlabel("f_s"); ylabel("z_2");
plot(F_s,Z(2,:));
psfig("ReactorTF_zero_2");

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/Makefile version [2d406594de].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Makes the schematic diagram and the zero figure
all: ReactorTF_pic.ps ReactorTF_zero_1.ps ReactorTF_zero_2.ps

ReactorTF_pic.ps: ReactorTF_pic.fig
	fig2dev -Lps ReactorTF_pic.fig> ReactorTF_pic.ps

ReactorTF_zero_1.ps: ReactorTF_abg.fig
	mtt -q ReactorTF sm m; mtt -q ReactorTF numpar m;
	mtt -q ReactorTF sympar m;
	octave MakeFigure.m

ReactorTF_zero_2.ps: ReactorTF_zero_1.ps
	touch ReactorTF_zero_2.ps

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_abg.fig version [986d2c3f0d].

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
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
123
124
125
126
127
128
129
130


































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Inches
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3001 8701 3001 7801 3151 7951
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1801 9001 2701 9001 2551 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 8776 2701 9226
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3301 9001 4201 9001 4051 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4201 9301 3601 9901 3826 9901
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5701 9001 4801 9001 4951 9151
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 6000 2700 6000 2550 6150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 10350 5025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 6000 1800 5775
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 10200 600 10200 600 7500 11100 7500 11100 10200
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 6600 600 6600 600 5400 11100 5400 11100 6600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 4800 4500 8700 4650 8550
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6000 4800 4800 8700 5025 8625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9000 4800 5100 8700 5400 8700
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4800 4275 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4200 4275 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4800 5775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4200 5775 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4800 8775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4200 8775 4200
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 7200 3000 6300 3150 6450
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 10500 4800 3300 6000 3525 6075
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 5100 600 5100 600 3300 11100 3300 11100 5100
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4485 2395 4485 4130 4633 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 2999 2395 2999 4130 3148 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5970 2395 5970 4130 6119 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 10428 2397 10428 4132 10577 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8943 2397 8943 4132 9091 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 2100 2700 2100 2550 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3300 2100 4200 2100 4050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4800 2100 5700 2100 5550 2250
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4200 1800 3600 1200 3600 1425
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 1875 2700 2325
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 8701 1801 8101 1201 8101 1426
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9301 2101 10201 2101 10051 2251
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 9301 1801 9901 1201 9901 1426
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6300 2100 7200 2100 7050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7800 2100 8700 2100 8550 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 1950 4350 1650
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 10050 1350 9900 1200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 1200 9750 1050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 1950 8850 1650
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 300 600 300 600 2700 11100 2700 11100 300
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 4800 3000 5700 3150 5550
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 4800 8775 4800 9000
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 5700 9000 5700 9225
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 6225 2700 6000
4 1 0 0 0 0 20 0.0000 4 210 1035 3075 4575 FMR:rfa\001
4 1 0 0 0 0 20 0.0000 4 210 1065 4575 4575 Rate:AD\001
4 1 0 0 0 0 20 0.0000 4 210 1050 6000 4575 Rate:AB\001
4 2 0 0 0 0 20 0.0000 4 285 780 1651 9076 SS:t_0\001
4 2 0 0 0 0 20 0.0000 4 285 690 3451 9976 C:h_r\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 6075 1\001
4 2 0 0 0 0 20 0.0000 4 210 480 1725 6075 SS:f\001
4 1 0 0 0 0 20 0.0000 4 210 150 3001 9076 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4501 9076 0\001
4 1 0 0 0 0 20 0.0000 4 210 1005 9001 4576 Rate:BC\001
4 1 0 0 0 0 20 0.0000 4 210 1050 10576 4576 FMR:rfb\001
4 1 1 1 0 3 20 0.0000 4 210 2625 9600 7800 THERMAL MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 900 3000 7575 FMR:rt\001
4 1 1 1 0 3 20 0.0000 4 210 2700 9675 3750 REACTION MODEL\001
4 2 0 0 0 0 20 0.0000 4 285 825 1650 2175 SS:c_0\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4500 2175 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 6000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 9001 2176 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 10501 2176 1\001
4 1 0 0 0 0 20 0.0000 4 210 420 7500 2175 AF\001
4 1 0 0 0 0 20 0.0000 4 285 795 8100 1050 C:m_b\001
4 1 0 0 0 0 20 0.0000 4 285 825 9975 1050 SS:c_b\001
4 1 0 0 0 0 20 0.0000 4 285 780 3600 1050 C:m_a\001
4 1 1 0 0 3 20 0.0000 4 210 3735 9075 600 CONCENTRATION MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 480 6151 9076 SS:t\001
4 1 1 1 0 3 20 0.0000 4 210 2940 9450 5700 HYDRAULIC MODEL\001

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_args.new version [5936bc7523].

1

-
 

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_desc.tex version [75defbbb1b].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system ReactorTF (ReactorTF_desc.tex)
% Generated by MTT on Fri Mar 3 12:43:33 GMT 2000.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\fig{ReactorTF_pic}
{ReactorTF_pic} {0.9} {System \textbf{ReactorTF}, Schematic}

Figure \Ref{fig:ReactorTF_pic} is the schematic diagram of a chemical
reactor.

The acausal bond graph of system \textbf{ReactorTF} is displayed in
Figure \Ref{fig:ReactorTF_abg.ps} and its label file is listed in
Section \Ref{sec:ReactorTF_lbl}.  The subsystems are listed in Section
\Ref{sec:ReactorTF_sub}.

This example of a (nonlinear) chemical reactor is due to Trickett and
Bogle\footnote{ K. J. Tricket, \emph{Quantification of Inverse
    Responses for Controllability Assessment of Nonlinear Processes},
  PhD Thesis, University College London, 1994} is used in this
section.  The reactor has two reaction mechanisms: $\text{A}
\rightarrow \text{B} \rightarrow \text{C}$ and $\text{2A} \rightarrow
\text{D}$.  The reactor mass inflow and outflow $f_r$ are identical.
$q$ represents the heat inflow to the reactor.

The control loop $t$/$f$ has been inverted. The resulting SISO
system has two interpretations:
\begin{enumerate}
\item the \emph{dynamics} of the $c_b$/$q$ loop when the $t$/$f$ loop
  is under perfect control and
\item the \emph{inverse} dynamics of the  $t$/$f$ loop.
\end{enumerate}

\fig{ReactorTF_zero_1} {ReactorTF_zero_1} {0.9}
{System\textbf{ReactorTF}: zero 1 v flow} 
\fig{ReactorTF_zero_2} {ReactorTF_zero_2} {0.9}
{System\textbf{ReactorTF}: zero 2 v flow} 

Figures \Ref{fig:ReactorTF_zero_1} and \Ref{fig:ReactorTF_zero_2}
shows the poles of the linearised system as the steady-state flow
varies: these are the \emph{zeros} of the $t$/$f$ control-loop when
the $c_b$/$q$ loop is \emph{open}.


Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_input.txt version [f7ef1cabad].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (ReactorTF_input.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

## Reduce steady-state parameter file (ReactorTF_sspar.r)
## as siso_sspar ecxept that inputs/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume ReactorTF:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
#x3 = c_p*t_s*v_r;


#Steady-state input q needed to achieve steady-state t_s
q_s = -( (t_0-t_s)*c_p*f_s + e_1*h_1*k_1*x1 + e_2*h_2*k_2*x2 + e_3*h_3*k_3*x1^2);

# Set the inputs
mttu(1) = q_s + 0.1*q_s*(t>0.01); # q (ReactorTF)




Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_lbl.txt version [ee07601a68].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system ReactorTF (ReactorTF_lbl.txt)
%SUMMARY ReactorTF: Simple reactor model -- TF loop inverted
%DESCRIPTION Pseudo bond graph reactor model (based on ancient version)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%ALIAS Rate Chemical/Rate

% Extra variables
%VAR t_s
%VAR f_s
%VAR t_0
%VAR c_0
%VAR rho
%VAR v_r
%VAR e_1
%VAR e_2
%VAR e_3
%VAR a
%VAR b
%VAR c
%VAR c_A
%VAR c_B
%VAR x1
%VAR x2
%VAR x3
%VAR q_S


% Port aliases

% Argument aliases

%% each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type C
	m_a	lin		effort,1
	m_b	lin		effort,1
	h_r	lin		effort,c_p

% Component type FMR
	rfa	lin		effort,1		
	rfb	lin		effort,1		
	rt	lin		effort,c_p

% Component type Rate
        AB	Rate	k_1,q_1,h_1,1
	BC	Rate	k_2,q_2,h_2,1
	AD	Rate	k_3,q_3,h_3,2

% Component type SS
	c_0	SS		c_0,internal
	c_b	SS		external,0
	f	SS		internal,internal
	t	SS		t_s,external
	t_0	SS		t_0,internal



Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_numpar.m version [b474b96e57].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186


























































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function mttpar = ReactorTF_numpar();
% mttpar = ReactorTF_numpar();
%System ReactorTF, representation numpar, language m;
%File ReactorTF_numpar.m;
%Generated by MTT on Thu Aug 24 14:28:46 BST 2000;
%

#====== Set up the global variables ======#
global ...
     a ...
     b ...
     c ...
     c_0 ...
     c_a ...
     c_b ...
     c_p ...
     e_1 ...
     e_2 ...
     e_3 ...
     f_s ...
     h ...
     h_1 ...
     h_2 ...
     h_3 ...
     k ...
     k_1 ...
     k_2 ...
     k_3 ...
     n ...
     q ...
     q_1 ...
     q_2 ...
     q_3 ...
     q_s ...
     rho ...
     t_0 ...
     t_s ...
     v_r ...
     x1 ...
     x2 ...
     x3 ;
## Set parameters to zero
 a = 0.0;
 b = 0.0;
 c = 0.0;
 c_0 = 0.0;
 c_a = 0.0;
 c_b = 0.0;
 c_p = 0.0;
 e_1 = 0.0;
 e_2 = 0.0;
 e_3 = 0.0;
 f_s = 0.0;
 h = 0.0;
 h_1 = 0.0;
 h_2 = 0.0;
 h_3 = 0.0;
 k = 0.0;
 k_1 = 0.0;
 k_2 = 0.0;
 k_3 = 0.0;
 n = 0.0;
 q = 0.0;
 q_1 = 0.0;
 q_2 = 0.0;
 q_3 = 0.0;
 q_s = 0.0;
 rho = 0.0;
 t_0 = 0.0;
 t_s = 0.0;
 v_r = 0.0;
 x1 = 0.0;
 x2 = 0.0;
 x3 = 0.0;
 %  -*-octave-*- Put Emacs into octave-mode
 %  Numerical parameter file (ReactorTF_numpar.txt)
 %  Generated by MTT at Fri Mar  3 09:22:56 GMT 2000

 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  %% Version control history
 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  %% $Id$
 %  %% $Log$
 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 % 
a =  0;				 %  Dummy
b =  0;				 %  Dummy
c =  0;				 %  Dummy
c_0 =  0;			 %  Dummy
c_a =  0;			 %  Dummy
c_b =  0;			 %  Dummy
c_p =  0;			 %  Dummy
e_1 =  0;			 %  Dummy
e_2 =  0;			 %  Dummy
e_3 =  0;			 %  Dummy
f_s =  0;			 %  Dummy
h =  0;				 %  Dummy
h_1 =  0;			 %  Dummy
h_2 =  0;			 %  Dummy
h_3 =  0;			 %  Dummy
k =  0;				 %  Dummy
k_1 =  0;			 %  Dummy
k_2 =  0;			 %  Dummy
k_3 =  0;			 %  Dummy
n =  0;				 %  Dummy
q =  0;				 %  Dummy
q_1 =  0;			 %  Dummy
q_2 =  0;			 %  Dummy
q_3 =  0;			 %  Dummy
q_s =  0;			 %  Dummy
rho =  0;			 %  Dummy
t_0 =  0;			 %  Dummy
t_s =  0;			 %  Dummy
v_r =  0;			 %  Dummy
x1 =  0;				 %  Dummy
x2 =  0;				 %  Dummy
x3 =  0;				 %  Dummy

 % 
rho =  900;			 %  Density
c_p =  5.0;			 %  Specific heat

 % 
k_1 =  2.5e10;			 %  Reaction rate constant
q_1 =  1e4;			 %  Exotherm constant
h_1 =  1e4;			 %  Heat of reaction

 % 
k_2 =  2.65e12;			 %  Reaction rate constant
q_2 =  1.2e4;			 %  Exotherm constant
h_2 =  1.2e4;			 %  Heat of reaction

 % 
k_3 =  6e7;			 %  Reaction rate constant
q_3 =  8e3;			 %  Exotherm constant
h_3 =  3e4;			 %  Heat of reaction

 % 
c_0 =  10;			 %  Inflow conc
t_0 =  500;			 %  Inflow temp

 % 
t_s =  530;			 %  Steady-state temp
f_s =  100;			 %  Steady-state flow








## Set up the parameter vector
  mttpar(1) 	= a;
  mttpar(2) 	= b;
  mttpar(3) 	= c;
  mttpar(4) 	= c_0;
  mttpar(5) 	= c_a;
  mttpar(6) 	= c_b;
  mttpar(7) 	= c_p;
  mttpar(8) 	= e_1;
  mttpar(9) 	= e_2;
  mttpar(10) 	= e_3;
  mttpar(11) 	= f_s;
  mttpar(12) 	= h;
  mttpar(13) 	= h_1;
  mttpar(14) 	= h_2;
  mttpar(15) 	= h_3;
  mttpar(16) 	= k;
  mttpar(17) 	= k_1;
  mttpar(18) 	= k_2;
  mttpar(19) 	= k_3;
  mttpar(20) 	= n;
  mttpar(21) 	= q;
  mttpar(22) 	= q_1;
  mttpar(23) 	= q_2;
  mttpar(24) 	= q_3;
  mttpar(25) 	= q_s;
  mttpar(26) 	= rho;
  mttpar(27) 	= t_0;
  mttpar(28) 	= t_s;
  mttpar(29) 	= v_r;
  mttpar(30) 	= x1;
  mttpar(31) 	= x2;
  mttpar(32) 	= x3;

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_numpar.txt version [28d37b19ef].

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
68
69
70
71
72
73
74
75
76
77
78
79















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (ReactorTF_numpar.txt)
# Generated by MTT at Fri Mar  3 09:22:56 GMT 2000

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

## Dummies
a = 0;				# Dummy
b = 0;				# Dummy
c = 0;				# Dummy
c_0 = 0;			# Dummy
c_a = 0;			# Dummy
c_b = 0;			# Dummy
c_p = 0;			# Dummy
e_1 = 0;			# Dummy
e_2 = 0;			# Dummy
e_3 = 0;			# Dummy
f_s = 0;			# Dummy
h = 0;				# Dummy
h_1 = 0;			# Dummy
h_2 = 0;			# Dummy
h_3 = 0;			# Dummy
k = 0;				# Dummy
k_1 = 0;			# Dummy
k_2 = 0;			# Dummy
k_3 = 0;			# Dummy
n = 0;				# Dummy
q = 0;				# Dummy
q_1 = 0;			# Dummy
q_2 = 0;			# Dummy
q_3 = 0;			# Dummy
q_s = 0;			# Dummy
rho = 0;			# Dummy
t_0 = 0;			# Dummy
t_s = 0;			# Dummy
v_r = 0;			# Dummy
x1 = 0;				# Dummy
x2 = 0;				# Dummy
x3 = 0;				# Dummy

## The bulk liquid
rho = 900;			# Density
c_p = 5.0;			# Specific heat

## Substance A
k_1 = 2.5e10;			# Reaction rate constant
q_1 = 1e4;			# Exotherm constant
h_1 = 1e4;			# Heat of reaction

## Substance B
k_2 = 2.65e12;			# Reaction rate constant
q_2 = 1.2e4;			# Exotherm constant
h_2 = 1.2e4;			# Heat of reaction

## Substance C
k_3 = 6e7;			# Reaction rate constant
q_3 = 8e3;			# Exotherm constant
h_3 = 3e4;			# Heat of reaction

## Inflow parameters
c_0 = 10;			# Inflow conc
t_0 = 500;			# Inflow temp

## Steady-state values
t_s = 530;			# Steady-state temp
f_s = 100;			# Steady-state flow








Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_pic.fig version [c396b14562].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Landscape
Center
Inches
Letter  
100.00
Single
-2
1200 2
6 2400 3150 3225 3375
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2625 3300 2925 3300
4 0 -1 0 0 2 20 0.0000 4 210 210 2400 3375 A\001
4 0 -1 0 0 2 20 0.0000 4 210 225 3000 3375 D\001
-6
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 2100 2100 2100 3900 1500 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 1500 4050 3900 4050
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 1500 4350 2100 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2100 3600 3900 4200 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 3600 4350 4200 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 3900 4050 4200 4050
2 1 1 2 -1 -1 0 0 -1 6.000 0 0 -1 0 0 2
	 2100 2400 3600 2400
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2400 2925 2700 2925
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3000 2925 3300 2925
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 2850 4800 2850 3750
4 0 -1 0 0 2 20 0.0000 4 210 210 2175 3000 A\001
4 0 -1 0 0 2 20 0.0000 4 210 195 2775 3000 B\001
4 0 -1 0 0 2 20 0.0000 4 210 210 3375 3000 C\001
4 0 -1 0 0 2 20 0.0000 4 210 150 2250 3375 2\001
4 0 -1 0 0 3 12 0.0000 4 135 90 1875 4950 0\001
4 0 -1 0 0 3 12 0.0000 4 135 90 2250 4950 0\001
4 0 -1 0 0 3 20 0.0000 4 210 150 2775 5025 q\001
4 0 -1 0 0 3 20 0.0000 4 285 765 1500 4800 f , c  , t\001
4 0 -1 0 0 3 20 0.0000 4 285 765 3600 4800 f , c  , t\001
4 0 -1 0 0 3 12 0.0000 4 135 90 3975 4950 b\001
4 0 -1 0 0 3 12 0.0000 4 90 75 4350 4950 r\001

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_rep.tex version [c4b39857a2].

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
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
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
























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


\section{\textbf{ReactorTF}: representation \textbf{abg}, language \textbf{tex}}
\label{sec:ReactorTF_abg.tex}
\index{\textbf{ReactorTF} -- abg}


MTT command:
\begin{verbatim}
mtt ReactorTF abg tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_abg.tex}


\section{\textbf{ReactorTF}: representation \textbf{cbg}, language \textbf{ps}}
\label{sec:ReactorTF_cbg.ps}
\index{\textbf{ReactorTF} -- cbg}


MTT command:
\begin{verbatim}
mtt ReactorTF cbg ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:ReactorTF_cbg.ps}.
\fig{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_cbg}
    {ReactorTF_cbg.ps}
    {0.9}
    {System \textbf{ReactorTF}, representation cbg}


\section{\textbf{ReactorTF}: representation \textbf{struc}, language \textbf{tex}}
\label{sec:ReactorTF_struc.tex}
\index{\textbf{ReactorTF} -- struc}


MTT command:
\begin{verbatim}
mtt ReactorTF struc tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_struc.tex}


\section{\textbf{ReactorTF}: representation \textbf{ode}, language \textbf{tex}}
\label{sec:ReactorTF_ode.tex}
\index{\textbf{ReactorTF} -- ode}


MTT command:
\begin{verbatim}
mtt ReactorTF ode tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_ode.tex}


\section{\textbf{ReactorTF}: representation \textbf{sspar}, language \textbf{tex}}
\label{sec:ReactorTF_sspar.tex}
\index{\textbf{ReactorTF} -- sspar}


MTT command:
\begin{verbatim}
mtt ReactorTF sspar tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_sspar.tex}


\section{\textbf{ReactorTF}: representation \textbf{ss}, language \textbf{tex}}
\label{sec:ReactorTF_ss.tex}
\index{\textbf{ReactorTF} -- ss}


MTT command:
\begin{verbatim}
mtt ReactorTF ss tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_ss.tex}


\section{\textbf{ReactorTF}: representation \textbf{sm}, language \textbf{tex}}
\label{sec:ReactorTF_sm.tex}
\index{\textbf{ReactorTF} -- sm}


MTT command:
\begin{verbatim}
mtt ReactorTF sm tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_sm.tex}


\section{\textbf{ReactorTF}: representation \textbf{simpar}, language \textbf{tex}}
\label{sec:ReactorTF_simpar.tex}
\index{\textbf{ReactorTF} -- simpar}


MTT command:
\begin{verbatim}
mtt ReactorTF simpar tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_simpar.tex}


\section{\textbf{ReactorTF}: representation \textbf{numpar}, language \textbf{tex}}
\label{sec:ReactorTF_numpar.tex}
\index{\textbf{ReactorTF} -- numpar}


MTT command:
\begin{verbatim}
mtt ReactorTF numpar tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_numpar.tex}


\section{\textbf{ReactorTF}: representation \textbf{input}, language \textbf{tex}}
\label{sec:ReactorTF_input.tex}
\index{\textbf{ReactorTF} -- input}


MTT command:
\begin{verbatim}
mtt ReactorTF input tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_input.tex}


\section{\textbf{ReactorTF}: representation \textbf{state}, language \textbf{tex}}
\label{sec:ReactorTF_state.tex}
\index{\textbf{ReactorTF} -- state}


MTT command:
\begin{verbatim}
mtt ReactorTF state tex 
\end{verbatim}
  \input{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_state.tex}


\section{\textbf{ReactorTF}: representation \textbf{odeso}, language \textbf{ps}}
\label{sec:ReactorTF_odeso.ps}
\index{\textbf{ReactorTF} -- odeso}


MTT command:
\begin{verbatim}
mtt ReactorTF odeso ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:ReactorTF_odeso.ps}.
\fig{/home/peterg/JUNK/Reactor/ReactorTF/MTT_work/ReactorTF_odeso}
    {ReactorTF_odeso.ps}
    {0.9}
    {System \textbf{ReactorTF}, representation odeso}

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_rep.txt version [e0ee6f308d].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system ReactorTF (ReactorTF_rep.txt)
## Generated by MTT on" Fri Mar  3 12:13:34 GMT 2000.

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

mtt ReactorTF abg tex			# The system description
mtt ReactorTF cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt ReactorTF struc tex	        # The system structure
## mtt ReactorTF dae tex	        # The system dae
mtt ReactorTF ode tex	        # The system ode 
mtt ReactorTF sspar tex		# Steady-state parameters
mtt ReactorTF ss tex 		# Steady state
## mtt ReactorTF dm tex		# Descriptor matrices (of linearised system)
mtt ReactorTF sm tex		# State matrices (of linearised system)
## mtt ReactorTF tf tex		# Transfer function (of linearised system)
## mtt ReactorTF lmfr ps		# log modulus of frequency response (of linearised system)
mtt ReactorTF simpar tex		# Simulation parameters
mtt ReactorTF numpar tex		# Numerical simulation parameters
mtt ReactorTF input tex		# Simulation input
mtt ReactorTF state tex		# Simulation initial state
mtt -c ReactorTF odeso ps

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_simp.r version [c0625028b5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output (mimo_sim.r)
m_r   := rho*v_r;
%mttx1 := c_a*v_r;
%mttx2 := c_b*v_r;

% THIS MUST BE CHANGED - probs with cp and FMRs
%c_p := 1;

%let mttx3/c_p = t;

let  e^(q_1/(mttx3/c_p)) = 1/epsilon_1;
let  e^(q_2/(mttx3/c_p)) = 1/epsilon_2;
let  e^(q_3/(mttx3/c_p)) = 1/epsilon_3;

let  e^(q_1/t_s) = 1/epsilon_1;
let  e^(q_2/t_s) = 1/epsilon_2;
let  e^(q_3/t_s) = 1/epsilon_3;

FACTOR mttx1,mttx2;

END;

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_simpar.txt version [a9ebdd151e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system ReactorTF (ReactorTF_simpar.txt)
# Generated by MTT on Fri Mar 3 12:11:48 GMT 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 0.05;       # Last time in simulation
DT          = 0.0002;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_sm.m version [8997bae617].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185

























































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [mtta,mttb,mttc,mttd] = ReactorTF_sm(mttpar);
% [mtta,mttb,mttc,mttd] = ReactorTF_sm(mttpar);
%System ReactorTF, representation sm, language m;
%File ReactorTF_sm.m;
%Generated by MTT on Thu Aug 24 14:45:50 BST 2000;
%
%====== Set up the global variables ======%
global ...
a ...
b ...
c ...
c_0 ...
c_a ...
c_b ...
c_p ...
e_1 ...
e_2 ...
e_3 ...
f_s ...
h ...
h_1 ...
h_2 ...
h_3 ...
k ...
k_1 ...
k_2 ...
k_3 ...
n ...
q ...
q_1 ...
q_2 ...
q_3 ...
q_s ...
rho ...
t_0 ...
t_s ...
v_r ...
x1 ...
x2 ...
x3 ;
a 	= mttpar(1);
b 	= mttpar(2);
c 	= mttpar(3);
c_0 	= mttpar(4);
c_a 	= mttpar(5);
c_b 	= mttpar(6);
c_p 	= mttpar(7);
e_1 	= mttpar(8);
e_2 	= mttpar(9);
e_3 	= mttpar(10);
f_s 	= mttpar(11);
h 	= mttpar(12);
h_1 	= mttpar(13);
h_2 	= mttpar(14);
h_3 	= mttpar(15);
k 	= mttpar(16);
k_1 	= mttpar(17);
k_2 	= mttpar(18);
k_3 	= mttpar(19);
n 	= mttpar(20);
q 	= mttpar(21);
q_1 	= mttpar(22);
q_2 	= mttpar(23);
q_3 	= mttpar(24);
q_s 	= mttpar(25);
rho 	= mttpar(26);
t_0 	= mttpar(27);
t_s 	= mttpar(28);
v_r 	= mttpar(29);
x1 	= mttpar(30);
x2 	= mttpar(31);
x3 	= mttpar(32);
%a matrix%
mtta = zeros(2,2);
mtt_t1 = exp((2.0*q_1+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s^2*h_3;
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_0*f_s*h_3*k_3;
mtt_t1 = mtt_t1-(exp((q_1+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s*h_1*k_1);
mtt_t1 = mtt_t1+2.0*exp((q_1+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s*h_3*k_1;
mtt_t1 = mtt_t1-(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))^2*c_0*h_1*k_1*k_3);
mtt_t1 = mtt_t1+2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))^2*c_0*h_3*k_1*k_3;
mtt_t1 = mtt_t1-(exp(q_3/t_s)*abs(exp(q_1/t_s))^2*h_1*k_1^2);
mtt_t1 = mtt_t1+exp(q_3/t_s)*abs(exp(q_1/t_s))^2*h_3*k_1^2;
mtt_t3 = 2.0*exp((2.0*q_1+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t4 = 2.0*exp((2.0*q_1)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t4 = mtt_t4*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1-(mtt_t3*abs(exp(q_1/t_s))*f_s*h_3)-(mtt_t4*abs(exp(q_1/t_s))*c_0*h_3*k_3);
mtt_t5 = 2.0*exp((2.0*q_1)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t5 = mtt_t5*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t3 = 2.0*exp((2.0*q_1)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1-(mtt_t5*abs(exp(q_1/t_s))*c_p*k_3*t_0)+mtt_t3*abs(exp(q_1/t_s))*c_p*k_3*t_s;
mtt_t4 = exp((q_1+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t4 = mtt_t4*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t3 = 2.0*exp((q_1+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1+mtt_t4*abs(exp(q_1/t_s))*h_1*k_1-(mtt_t3*abs(exp(q_1/t_s))*h_3*k_1);
mtt_t1 = mtt_t1+exp((4.0*q_1+q_3)/t_s)*f_s^2*h_3;
mtt_t1 = mtt_t1+4.0*exp((4.0*q_1)/t_s)*c_0*f_s*h_3*k_3;
mtt_t1 = mtt_t1+2.0*exp((3.0*q_1+q_3)/t_s)*f_s*h_3*k_1;
mtt_t1 = mtt_t1+exp((2.0*q_1+q_3)/t_s)*h_3*k_1^2;
mtt_t2 = 2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_3*t_0;
mtta(1,1) = mtt_t1/(mtt_t2-(2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_3*t_s));
mtt_t1 = -(exp((q_1+q_3)/t_s)*abs(exp(q_1/t_s))*f_s*h_2*k_2);
mtt_t1 = mtt_t1-(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_0*h_2*k_2*k_3);
mtt_t3 = exp((q_1+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1-(exp(q_3/t_s)*abs(exp(q_1/t_s))*h_2*k_1*k_2)+mtt_t3*h_2*k_2;
mtt_t2 = 2.0*exp((q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*k_3*t_0;
mtta(1,2) = mtt_t1/(mtt_t2-(2.0*exp((q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*k_3*t_s));
mtt_t1 = exp((2.0*q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s^2*h_3*k_1;
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))^2*c_p*f_s*k_1*k_3*t_0;
mtt_t1 = mtt_t1-(2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))^2*c_p*f_s*k_1*k_3*t_s);
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_1*k_2*k_3*t_0;
mtt_t1 = mtt_t1-(2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_1*k_2*k_3*t_s);
mtt_t1 = mtt_t1-(exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s*h_1*k_1^2);
mtt_t1 = mtt_t1+2.0*exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*f_s*h_3*k_1^2;
mtt_t1 = mtt_t1-(exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*h_1*k_1^3);
mtt_t1 = mtt_t1+exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))^2*h_3*k_1^3;
mtt_t3 = 2.0*exp((2.0*q_1+q_2+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t4 = exp((q_1+q_2+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t4 = mtt_t4*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1-(mtt_t3*abs(exp(q_1/t_s))*f_s*h_3*k_1)+mtt_t4*abs(exp(q_1/t_s))*h_1*k_1^2;
mtt_t5 = 2.0*exp((q_1+q_2+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t5 = mtt_t5*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1-(mtt_t5*abs(exp(q_1/t_s))*h_3*k_1^2);
mtt_t1 = mtt_t1+exp((4.0*q_1+q_2+q_3)/t_s)*f_s^2*h_3*k_1;
mtt_t1 = mtt_t1+4.0*exp((4.0*q_1+q_2)/t_s)*c_0*f_s*h_3*k_1*k_3;
mtt_t1 = mtt_t1+2.0*exp((3.0*q_1+q_2+q_3)/t_s)*f_s*h_3*k_1^2;
mtt_t1 = mtt_t1+exp((2.0*q_1+q_2+q_3)/t_s)*h_3*k_1^3;
mtt_t2 = 2.0*exp((3.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))^2*c_p*f_s*k_3*t_0;
mtt_t2 = mtt_t2-(2.0*exp((3.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))^2*c_p*f_s*k_3*t_s);
mtt_t2 = mtt_t2+2.0*exp((3.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_2*k_3*t_0;
mtta(2,1) = mtt_t1/(mtt_t2-(2.0*exp((3.0*q_1)/t_s)*abs(exp(q_1/t_s))^2*c_p*k_2*k_3*t_s));
mtt_t1 = -(2.0*exp((2.0*q_1+2.0*q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s^2*k_3*t_0);
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1+2.0*q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s^2*k_3*t_s;
mtt_t1 = mtt_t1-(4.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_2*k_3*t_0);
mtt_t1 = mtt_t1+4.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_2*k_3*t_s;
mtt_t1 = mtt_t1-(2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*c_p*k_2^2*k_3*t_0);
mtt_t1 = mtt_t1+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*c_p*k_2^2*k_3*t_s;
mtt_t1 = mtt_t1-(exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))*f_s*h_2*k_1*k_2);
mtt_t1 = mtt_t1-(exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))*h_2*k_1^2*k_2);
mtt_t3 = exp((q_1+q_2+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1+mtt_t3*h_2*k_1*k_2;
mtt_t2 = 2.0*exp((2.0*q_1+2.0*q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_3*t_0;
mtt_t2 = mtt_t2-(2.0*exp((2.0*q_1+2.0*q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_3*t_s);
mtt_t2 = mtt_t2+2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*k_2*k_3*t_0;
mtta(2,2) = mtt_t1/(mtt_t2-(2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*k_2*k_3*t_s));
%b matrix%
mttb = zeros(2,1);
mtt_t1 = -(exp((q_1+q_3)/t_s)*abs(exp(q_1/t_s))*f_s);
mtt_t1 = mtt_t1-(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_0*k_3);
mtt_t1 = mtt_t1-(exp(q_3/t_s)*abs(exp(q_1/t_s))*k_1);
mtt_t3 = exp((q_1+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t1 = mtt_t1+mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t4 = 2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_p*k_3*t_0;
mttb(1) = mtt_t1/(mtt_t4-(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_p*k_3*t_s));
mtt_t1 = -(exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))*f_s*k_1);
mtt_t3 = exp((q_1+q_2+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1-(exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))*k_1^2)+mtt_t3*k_1;
mtt_t2 = 2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_3*t_0;
mtt_t2 = mtt_t2-(2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*c_p*f_s*k_3*t_s);
mtt_t2 = mtt_t2+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*c_p*k_2*k_3*t_0;
mttb(2) = mtt_t1/(mtt_t2-(2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*c_p*k_2*k_3*t_s));
%c matrix%
mttc = zeros(1,2);
mttc(1,2) = 1.0;
%d matrix%
mttd = zeros(1,1);

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_sspar.r version [5ae7de35e5].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file (ReactorTF_sspar.r)
%% as siso_sspar ecxept that inputs/states have different meaning
%% Steady state for constant c_a, c_b and t=t_s and f=f_s

%% Unit volume ReactorTF:
v_r := 1;

%% Do the inputs first -- this avoids problems with reduce not
%% recognising that complicated expressions are zero

%% The exponentials.
e_1 := e^(-q_1/t_s);
e_2 := e^(-q_2/t_s);
e_3 := e^(-q_3/t_s);

%Steady-state input q needed to achieve steady-state t_s
q_s := -( 
        + (t_0-t_s)*c_p*f_s
        + e_1*h_1*k_1*x1
        + e_2*h_2*k_2*x2
        + e_3*h_3*k_3*x1^2
       );

%% The input at steady-state
MTTu1 := q_s;

%States (masses)
x1 := c_a*v_r;
x2 := c_b*v_r;

%Thermal state
x3 := c_p*t_s*v_r;

%Load up the vectors
MTTx1 := x1;
MTTx2 := x2;

MTTy1 := c_b;
%MTTy2 := t_s;

%% Finally, solve for the steady-state concentrations
%% Solve for ca - a quadratic.
a 	:= k_3*e_3;	%ca^2 
b 	:= k_1*e_1 + f_s;	%ca^1 
c 	:= -c_0*f_s;

c_a	:= (-b + sqrt(b^2 - 4*a*c))/(2*a);

%% solve for c_b
c_b 	:= c_a*k_1*e_1/(f_s+k_2*e_2);


END;


Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_state.txt version [c612c2654e].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# State specification (ReactorTF_state.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

## Reduce steady-state parameter file (ReactorTF_sspar.r)
## as siso_sspar ecxept that states/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume ReactorTF:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
#x3 = c_p*t_s*v_r;

## Load up the states
mttx(1) = x1;
mttx(2) = x2;
mttx(3) = x3;




Deleted mttroot/mtt/lib/examples/Chemical/ReactorTF/ReactorTF_sympar.m version [971206bf83].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function sympar = ReactorTF_sympar();
% sympar = ReactorTF_sympar();
%System ReactorTF, representation sympar, language m;
%File ReactorTF_sympar.m;
%Generated by MTT on Thu Aug 24 14:45:51 BST 2000;
%
global ...
mtt_no_globals ;
  sympar.a 	= 1; # ReactorTF
  sympar.b 	= 2; # ReactorTF
  sympar.c 	= 3; # ReactorTF
  sympar.c_0 	= 4; # ReactorTF
  sympar.c_A 	= 5; # ReactorTF
  sympar.c_B 	= 6; # ReactorTF
  sympar.c_p 	= 7; # ReactorTF
  sympar.e_1 	= 8; # ReactorTF
  sympar.e_2 	= 9; # ReactorTF
  sympar.e_3 	= 10; # ReactorTF
  sympar.f_s 	= 11; # ReactorTF
  sympar.h 	= 12; # Rate
  sympar.h_1 	= 13; # ReactorTF
  sympar.h_2 	= 14; # ReactorTF
  sympar.h_3 	= 15; # ReactorTF
  sympar.k 	= 16; # Rate
  sympar.k_1 	= 17; # ReactorTF
  sympar.k_2 	= 18; # ReactorTF
  sympar.k_3 	= 19; # ReactorTF
  sympar.n 	= 20; # Rate
  sympar.q 	= 21; # Rate
  sympar.q_1 	= 22; # ReactorTF
  sympar.q_2 	= 23; # ReactorTF
  sympar.q_3 	= 24; # ReactorTF
  sympar.q_S 	= 25; # ReactorTF
  sympar.rho 	= 26; # ReactorTF
  sympar.t_0 	= 27; # ReactorTF
  sympar.t_s 	= 28; # ReactorTF
  sympar.v_r 	= 29; # ReactorTF
  sympar.x1 	= 30; # ReactorTF
  sympar.x2 	= 31; # ReactorTF
  sympar.x3 	= 32; # ReactorTF

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/MakeFigure.m version [f0f759751c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Makes the figures

par = ReactorTQ_numpar;		# Parameters
sym = ReactorTQ_sympar;		# Parameter indices

F_s= [90:10:500];		# Range of flows

Z = [];
for f_s=F_s
  par(sym.f_s) = f_s;
  z = sort(eig(ReactorTQ_sm(par)));
  Z = [Z z];
endfor


grid; xlabel("f_s"); ylabel("z");
plot(F_s,Z);
psfig("ReactorTQ_zero");

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/Makefile version [1134f9d9da].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
## Makes the schematic diagram and the zero figure
all: ReactorTQ_pic.ps ReactorTQ_zero.ps

ReactorTQ_pic.ps: ReactorTQ_pic.fig
	fig2dev -Lps ReactorTQ_pic.fig> ReactorTQ_pic.ps

ReactorTQ_zero.ps: ReactorTQ_abg.fig
	mtt -q ReactorTQ sm m; mtt -q ReactorTQ numpar m;
	mtt -q ReactorTQ sympar m;
	octave MakeFigure.m

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_abg.fig version [cd7058cbd0].

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
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
123
124
125
126
127
128
































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Inches
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3001 8701 3001 7801 3151 7951
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1801 9001 2701 9001 2551 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 8776 2701 9226
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3301 9001 4201 9001 4051 9151
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4201 9301 3601 9901 3826 9901
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5701 9001 4801 9001 4951 9151
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 6000 2700 6000 2550 6150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 10350 5025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 6000 1800 5775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 6225 1800 6000
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 10200 600 10200 600 7500 11100 7500 11100 10200
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 6600 600 6600 600 5400 11100 5400 11100 6600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 4800 4500 8700 4650 8550
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6000 4800 4800 8700 5025 8625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9000 4800 5100 8700 5400 8700
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4800 4275 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 4200 4275 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4800 5775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 6225 4200 5775 4200
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4800 8775 4800
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 4200 8775 4200
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 7200 3000 6300 3150 6450
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 10500 4800 3300 6000 3525 6075
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 5100 600 5100 600 3300 11100 3300 11100 5100
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4485 2395 4485 4130 4633 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 2999 2395 2999 4130 3148 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 5970 2395 5970 4130 6119 3841
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 10428 2397 10428 4132 10577 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 8943 2397 8943 4132 9091 3843
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 1800 2100 2700 2100 2550 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3300 2100 4200 2100 4050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 4800 2100 5700 2100 5550 2250
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 4200 1800 3600 1200 3600 1425
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 1875 2700 2325
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 8701 1801 8101 1201 8101 1426
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 9301 2101 10201 2101 10051 2251
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 9301 1801 9901 1201 9901 1426
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 6300 2100 7200 2100 7050 2250
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 7800 2100 8700 2100 8550 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 1950 4350 1650
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 10050 1350 9900 1200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 1200 9750 1050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 1950 8850 1650
2 4 1 2 1 7 0 0 -1 4.000 0 0 7 0 0 5
	 11100 300 600 300 600 2700 11100 2700 11100 300
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 3
	 3000 4800 3000 5700 3150 5550
2 1 0 2 0 0 0 0 -1 0.000 0 0 0 0 0 2
	 4800 8775 4800 9225
4 1 0 0 0 0 20 0.0000 4 210 1035 3075 4575 FMR:rfa\001
4 1 0 0 0 0 20 0.0000 4 210 1065 4575 4575 Rate:AD\001
4 1 0 0 0 0 20 0.0000 4 210 1050 6000 4575 Rate:AB\001
4 2 0 0 0 0 20 0.0000 4 285 780 1651 9076 SS:t_0\001
4 2 0 0 0 0 20 0.0000 4 285 690 3451 9976 C:h_r\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 6075 1\001
4 2 0 0 0 0 20 0.0000 4 210 480 1725 6075 SS:f\001
4 1 0 0 0 0 20 0.0000 4 210 150 3001 9076 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4501 9076 0\001
4 1 0 0 0 0 20 0.0000 4 210 1005 9001 4576 Rate:BC\001
4 1 0 0 0 0 20 0.0000 4 210 1050 10576 4576 FMR:rfb\001
4 1 1 1 0 3 20 0.0000 4 210 2625 9600 7800 THERMAL MODEL\001
4 1 1 1 0 3 20 0.0000 4 210 2940 9450 5700 HYDRAULIC MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 900 3000 7575 FMR:rt\001
4 1 1 1 0 3 20 0.0000 4 210 2700 9675 3750 REACTION MODEL\001
4 2 0 0 0 0 20 0.0000 4 285 825 1650 2175 SS:c_0\001
4 1 0 0 0 0 20 0.0000 4 210 150 3000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 4500 2175 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 6000 2175 1\001
4 1 0 0 0 0 20 0.0000 4 210 150 9001 2176 0\001
4 1 0 0 0 0 20 0.0000 4 210 150 10501 2176 1\001
4 1 0 0 0 0 20 0.0000 4 210 420 7500 2175 AF\001
4 1 0 0 0 0 20 0.0000 4 285 795 8100 1050 C:m_b\001
4 1 0 0 0 0 20 0.0000 4 285 825 9975 1050 SS:c_b\001
4 1 0 0 0 0 20 0.0000 4 285 780 3600 1050 C:m_a\001
4 1 1 0 0 3 20 0.0000 4 210 3735 9075 600 CONCENTRATION MODEL\001
4 1 0 0 0 0 20 0.0000 4 210 480 6151 9076 SS:t\001

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_args.new version [5936bc7523].

1

-
 

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_desc.tex version [74095d0a13].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system ReactorTQ (ReactorTQ_desc.tex)
% Generated by MTT on Fri Mar 3 12:43:33 GMT 2000.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\fig{ReactorTQ_pic}
{ReactorTQ_pic} {0.9} {System \textbf{ReactorTQ}, Schematic}

Figure \Ref{fig:ReactorTQ_pic} is the schematic diagram of a chemical
reactor.

The acausal bond graph of system \textbf{ReactorTQ} is displayed in
Figure \Ref{fig:ReactorTQ_abg.ps} and its label file is listed in
Section \Ref{sec:ReactorTQ_lbl}.  The subsystems are listed in Section
\Ref{sec:ReactorTQ_sub}.

This example of a (nonlinear) chemical reactor is due to Trickett and
Bogle\footnote{ K. J. Tricket, \emph{Quantification of Inverse
    Responses for Controllability Assessment of Nonlinear Processes},
  PhD Thesis, University College London, 1994} is used in this
section.  The reactor has two reaction mechanisms: $\text{A}
\rightarrow \text{B} \rightarrow \text{C}$ and $\text{2A} \rightarrow
\text{D}$.  The reactor mass inflow and outflow $f_r$ are identical.
$q$ represents the heat inflow to the reactor.

The control loop $t$/$q$ has been inverted. The resulting SISO
system has two interpretations:
\begin{enumerate}
\item the \emph{dynamics} of the $c_b$/$f$ loop when the $t$/$q$ loop
  is under perfect control and
\item the \emph{inverse} dynamics of the  $t$/$q$ loop.
\end{enumerate}

\fig{ReactorTQ_zero} {ReactorTQ_zero} {0.9}
{System\textbf{ReactorTQ}: zeros v flow} 

Figure \Ref{fig:ReactorTQ_zero}
shows the poles of the linearised system as the steady-state flow
varies: these are the \emph{zeros} of the $c_b$/$f$ control-loop when
the $t$/$q$ loop is \emph{open}.


Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_input.txt version [322195a7f3].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (ReactorTQ_input.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

## Reduce steady-state parameter file (ReactorTQ_sspar.r)
## as siso_sspar ecxept that inputs/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume ReactorTQ:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;

#Thermal state
x3 = c_p*t_s*v_r;

# Set the inputs
mttu(1) = f_s + 0.1*f_s*(t>0.01); # f (ReactorTQ)



Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_lbl.txt version [a4a8cc895a].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system ReactorTQ (ReactorTQ_lbl.txt)
%SUMMARY ReactorTQ: Simple reactor model - with TQ loop inverted
%DESCRIPTION Pseudo bond graph reactor model (based on ancient version)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%ALIAS Rate Chemical/Rate

% Extra variables
%VAR t_s
%VAR f_s
%VAR t_0
%VAR c_0
%VAR rho
%VAR v_r
%VAR e_1
%VAR e_2
%VAR e_3
%VAR a
%VAR b
%VAR c
%VAR c_A
%VAR c_B
%VAR x1
%VAR x2
%VAR x3
%VAR q_S


% Port aliases

% Argument aliases

%% each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type C
	m_a	lin		effort,1
	m_b	lin		effort,1
	h_r	lin		effort,c_p

% Component type FMR
	rfa	lin		effort,1		
	rfb	lin		effort,1		
	rt	lin		effort,c_p

% Component type Rate
        AB	Rate	k_1,q_1,h_1,1
	BC	Rate	k_2,q_2,h_2,1
	AD	Rate	k_3,q_3,h_3,2

% Component type SS
	c_0	SS		c_0,internal
	c_b	SS		external,0
	f	SS		internal,external
	t	SS		t_s,internal
	t_0	SS		t_0,internal



Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_numpar.m version [ae40d20e8b].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186


























































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function mttpar = ReactorTQ_numpar();
% mttpar = ReactorTQ_numpar();
%System ReactorTQ, representation numpar, language m;
%File ReactorTQ_numpar.m;
%Generated by MTT on Thu Aug 24 14:29:20 BST 2000;
%

#====== Set up the global variables ======#
global ...
     a ...
     b ...
     c ...
     c_0 ...
     c_a ...
     c_b ...
     c_p ...
     e_1 ...
     e_2 ...
     e_3 ...
     f_s ...
     h ...
     h_1 ...
     h_2 ...
     h_3 ...
     k ...
     k_1 ...
     k_2 ...
     k_3 ...
     n ...
     q ...
     q_1 ...
     q_2 ...
     q_3 ...
     q_s ...
     rho ...
     t_0 ...
     t_s ...
     v_r ...
     x1 ...
     x2 ...
     x3 ;
## Set parameters to zero
 a = 0.0;
 b = 0.0;
 c = 0.0;
 c_0 = 0.0;
 c_a = 0.0;
 c_b = 0.0;
 c_p = 0.0;
 e_1 = 0.0;
 e_2 = 0.0;
 e_3 = 0.0;
 f_s = 0.0;
 h = 0.0;
 h_1 = 0.0;
 h_2 = 0.0;
 h_3 = 0.0;
 k = 0.0;
 k_1 = 0.0;
 k_2 = 0.0;
 k_3 = 0.0;
 n = 0.0;
 q = 0.0;
 q_1 = 0.0;
 q_2 = 0.0;
 q_3 = 0.0;
 q_s = 0.0;
 rho = 0.0;
 t_0 = 0.0;
 t_s = 0.0;
 v_r = 0.0;
 x1 = 0.0;
 x2 = 0.0;
 x3 = 0.0;
 %  -*-octave-*- Put Emacs into octave-mode
 %  Numerical parameter file (ReactorTQ_numpar.txt)
 %  Generated by MTT at Fri Mar  3 09:22:56 GMT 2000

 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  %% Version control history
 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  %% $Id$
 %  %% $Log$
 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 % 
a =  0;				 %  Dummy
b =  0;				 %  Dummy
c =  0;				 %  Dummy
c_0 =  0;			 %  Dummy
c_a =  0;			 %  Dummy
c_b =  0;			 %  Dummy
c_p =  0;			 %  Dummy
e_1 =  0;			 %  Dummy
e_2 =  0;			 %  Dummy
e_3 =  0;			 %  Dummy
f_s =  0;			 %  Dummy
h =  0;				 %  Dummy
h_1 =  0;			 %  Dummy
h_2 =  0;			 %  Dummy
h_3 =  0;			 %  Dummy
k =  0;				 %  Dummy
k_1 =  0;			 %  Dummy
k_2 =  0;			 %  Dummy
k_3 =  0;			 %  Dummy
n =  0;				 %  Dummy
q =  0;				 %  Dummy
q_1 =  0;			 %  Dummy
q_2 =  0;			 %  Dummy
q_3 =  0;			 %  Dummy
q_s =  0;			 %  Dummy
rho =  0;			 %  Dummy
t_0 =  0;			 %  Dummy
t_s =  0;			 %  Dummy
v_r =  0;			 %  Dummy
x1 =  0;				 %  Dummy
x2 =  0;				 %  Dummy
x3 =  0;				 %  Dummy

 % 
rho =  900;			 %  Density
c_p =  5.0;			 %  Specific heat

 % 
k_1 =  2.5e10;			 %  Reaction rate constant
q_1 =  1e4;			 %  Exotherm constant
h_1 =  1e4;			 %  Heat of reaction

 % 
k_2 =  2.65e12;			 %  Reaction rate constant
q_2 =  1.2e4;			 %  Exotherm constant
h_2 =  1.2e4;			 %  Heat of reaction

 % 
k_3 =  6e7;			 %  Reaction rate constant
q_3 =  8e3;			 %  Exotherm constant
h_3 =  3e4;			 %  Heat of reaction

 % 
c_0 =  10;			 %  Inflow conc
t_0 =  530;			 %  Inflow temp

 % 
t_s =  530;			 %  Steady-state temp
f_s =  100;			 %  Steady-state flow








## Set up the parameter vector
  mttpar(1) 	= a;
  mttpar(2) 	= b;
  mttpar(3) 	= c;
  mttpar(4) 	= c_0;
  mttpar(5) 	= c_a;
  mttpar(6) 	= c_b;
  mttpar(7) 	= c_p;
  mttpar(8) 	= e_1;
  mttpar(9) 	= e_2;
  mttpar(10) 	= e_3;
  mttpar(11) 	= f_s;
  mttpar(12) 	= h;
  mttpar(13) 	= h_1;
  mttpar(14) 	= h_2;
  mttpar(15) 	= h_3;
  mttpar(16) 	= k;
  mttpar(17) 	= k_1;
  mttpar(18) 	= k_2;
  mttpar(19) 	= k_3;
  mttpar(20) 	= n;
  mttpar(21) 	= q;
  mttpar(22) 	= q_1;
  mttpar(23) 	= q_2;
  mttpar(24) 	= q_3;
  mttpar(25) 	= q_s;
  mttpar(26) 	= rho;
  mttpar(27) 	= t_0;
  mttpar(28) 	= t_s;
  mttpar(29) 	= v_r;
  mttpar(30) 	= x1;
  mttpar(31) 	= x2;
  mttpar(32) 	= x3;

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_numpar.txt version [099621e14f].

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
68
69
70
71
72
73
74
75
76
77
78
79















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (ReactorTQ_numpar.txt)
# Generated by MTT at Fri Mar  3 09:22:56 GMT 2000

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

## Dummies
a = 0;				# Dummy
b = 0;				# Dummy
c = 0;				# Dummy
c_0 = 0;			# Dummy
c_a = 0;			# Dummy
c_b = 0;			# Dummy
c_p = 0;			# Dummy
e_1 = 0;			# Dummy
e_2 = 0;			# Dummy
e_3 = 0;			# Dummy
f_s = 0;			# Dummy
h = 0;				# Dummy
h_1 = 0;			# Dummy
h_2 = 0;			# Dummy
h_3 = 0;			# Dummy
k = 0;				# Dummy
k_1 = 0;			# Dummy
k_2 = 0;			# Dummy
k_3 = 0;			# Dummy
n = 0;				# Dummy
q = 0;				# Dummy
q_1 = 0;			# Dummy
q_2 = 0;			# Dummy
q_3 = 0;			# Dummy
q_s = 0;			# Dummy
rho = 0;			# Dummy
t_0 = 0;			# Dummy
t_s = 0;			# Dummy
v_r = 0;			# Dummy
x1 = 0;				# Dummy
x2 = 0;				# Dummy
x3 = 0;				# Dummy

## The bulk liquid
rho = 900;			# Density
c_p = 5.0;			# Specific heat

## Substance A
k_1 = 2.5e10;			# Reaction rate constant
q_1 = 1e4;			# Exotherm constant
h_1 = 1e4;			# Heat of reaction

## Substance B
k_2 = 2.65e12;			# Reaction rate constant
q_2 = 1.2e4;			# Exotherm constant
h_2 = 1.2e4;			# Heat of reaction

## Substance C
k_3 = 6e7;			# Reaction rate constant
q_3 = 8e3;			# Exotherm constant
h_3 = 3e4;			# Heat of reaction

## Inflow parameters
c_0 = 10;			# Inflow conc
t_0 = 530;			# Inflow temp

## Steady-state values
t_s = 530;			# Steady-state temp
f_s = 100;			# Steady-state flow








Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_pic.fig version [c396b14562].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Landscape
Center
Inches
Letter  
100.00
Single
-2
1200 2
6 2400 3150 3225 3375
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2625 3300 2925 3300
4 0 -1 0 0 2 20 0.0000 4 210 210 2400 3375 A\001
4 0 -1 0 0 2 20 0.0000 4 210 225 3000 3375 D\001
-6
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 2100 2100 2100 3900 1500 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 1500 4050 3900 4050
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 1500 4350 2100 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 2100 3600 3900 4200 3900
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 3600 4350 4200 4350
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
	 3900 4050 4200 4050
2 1 1 2 -1 -1 0 0 -1 6.000 0 0 -1 0 0 2
	 2100 2400 3600 2400
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 2400 2925 2700 2925
2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 1.00 60.00 120.00
	 3000 2925 3300 2925
2 1 0 2 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 2850 4800 2850 3750
4 0 -1 0 0 2 20 0.0000 4 210 210 2175 3000 A\001
4 0 -1 0 0 2 20 0.0000 4 210 195 2775 3000 B\001
4 0 -1 0 0 2 20 0.0000 4 210 210 3375 3000 C\001
4 0 -1 0 0 2 20 0.0000 4 210 150 2250 3375 2\001
4 0 -1 0 0 3 12 0.0000 4 135 90 1875 4950 0\001
4 0 -1 0 0 3 12 0.0000 4 135 90 2250 4950 0\001
4 0 -1 0 0 3 20 0.0000 4 210 150 2775 5025 q\001
4 0 -1 0 0 3 20 0.0000 4 285 765 1500 4800 f , c  , t\001
4 0 -1 0 0 3 20 0.0000 4 285 765 3600 4800 f , c  , t\001
4 0 -1 0 0 3 12 0.0000 4 135 90 3975 4950 b\001
4 0 -1 0 0 3 12 0.0000 4 90 75 4350 4950 r\001

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_rep.txt version [532236426b].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system ReactorTQ (ReactorTQ_rep.txt)
## Generated by MTT on" Fri Mar  3 12:13:34 GMT 2000.

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

mtt ReactorTQ abg tex			# The system description
mtt ReactorTQ cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt ReactorTQ struc tex	        # The system structure
## mtt ReactorTQ dae tex	        # The system dae
mtt ReactorTQ ode tex	        # The system ode 
## mtt ReactorTQ sspar tex		# Steady-state parameters
## mtt ReactorTQ ss tex 		# Steady state
## mtt ReactorTQ dm tex		# Descriptor matrices (of linearised system)
mtt ReactorTQ sm tex		# State matrices (of linearised system)
## mtt ReactorTQ tf tex		# Transfer function (of linearised system)
## mtt ReactorTQ lmfr ps		# log modulus of frequency response (of linearised system)
mtt ReactorTQ simpar tex		# Simulation parameters
mtt ReactorTQ numpar tex		# Numerical simulation parameters
mtt ReactorTQ input tex		# Simulation input
mtt ReactorTQ state tex		# Simulation initial state

mtt -c ReactorTQ odeso ps

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_simp.r version [c0625028b5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output (mimo_sim.r)
m_r   := rho*v_r;
%mttx1 := c_a*v_r;
%mttx2 := c_b*v_r;

% THIS MUST BE CHANGED - probs with cp and FMRs
%c_p := 1;

%let mttx3/c_p = t;

let  e^(q_1/(mttx3/c_p)) = 1/epsilon_1;
let  e^(q_2/(mttx3/c_p)) = 1/epsilon_2;
let  e^(q_3/(mttx3/c_p)) = 1/epsilon_3;

let  e^(q_1/t_s) = 1/epsilon_1;
let  e^(q_2/t_s) = 1/epsilon_2;
let  e^(q_3/t_s) = 1/epsilon_3;

FACTOR mttx1,mttx2;

END;

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_simpar.txt version [c234b6a60c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system ReactorTQ (ReactorTQ_simpar.txt)
# Generated by MTT on Fri Mar 3 12:11:48 GMT 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 0.05;       # Last time in simulation
DT          = 0.0002;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_sm.m version [7b078c7c09].

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
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



































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [mtta,mttb,mttc,mttd] = ReactorTQ_sm(mttpar);
% [mtta,mttb,mttc,mttd] = ReactorTQ_sm(mttpar);
%System ReactorTQ, representation sm, language m;
%File ReactorTQ_sm.m;
%Generated by MTT on Thu Aug 24 14:47:46 BST 2000;
%
%====== Set up the global variables ======%
global ...
a ...
b ...
c ...
c_0 ...
c_a ...
c_b ...
c_p ...
e_1 ...
e_2 ...
e_3 ...
f_s ...
h ...
h_1 ...
h_2 ...
h_3 ...
k ...
k_1 ...
k_2 ...
k_3 ...
n ...
q ...
q_1 ...
q_2 ...
q_3 ...
q_s ...
rho ...
t_0 ...
t_s ...
v_r ...
x1 ...
x2 ...
x3 ;
a 	= mttpar(1);
b 	= mttpar(2);
c 	= mttpar(3);
c_0 	= mttpar(4);
c_a 	= mttpar(5);
c_b 	= mttpar(6);
c_p 	= mttpar(7);
e_1 	= mttpar(8);
e_2 	= mttpar(9);
e_3 	= mttpar(10);
f_s 	= mttpar(11);
h 	= mttpar(12);
h_1 	= mttpar(13);
h_2 	= mttpar(14);
h_3 	= mttpar(15);
k 	= mttpar(16);
k_1 	= mttpar(17);
k_2 	= mttpar(18);
k_3 	= mttpar(19);
n 	= mttpar(20);
q 	= mttpar(21);
q_1 	= mttpar(22);
q_2 	= mttpar(23);
q_3 	= mttpar(24);
q_s 	= mttpar(25);
rho 	= mttpar(26);
t_0 	= mttpar(27);
t_s 	= mttpar(28);
v_r 	= mttpar(29);
x1 	= mttpar(30);
x2 	= mttpar(31);
x3 	= mttpar(32);
%a matrix%
mtta = zeros(2,2);
mtt_t1 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t1 = -sqrt((mtt_t1+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtta(1,1) = mtt_t1/abs(exp(q_1/t_s));
mtta(2,1) = k_1/exp(q_1/t_s);
mtta(2,2) = (-(exp(q_2/t_s)*f_s)-k_2)/exp(q_2/t_s);
%b matrix%
mttb = zeros(2,1);
mtt_t1 = exp((q_1+q_3)/t_s)*abs(exp(q_1/t_s))*f_s+2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*c_0*k_3;
mtt_t1 = mtt_t1+exp(q_3/t_s)*abs(exp(q_1/t_s))*k_1;
mtt_t3 = exp((q_1+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t1 = mtt_t1-(mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s)));
mttb(1) = mtt_t1/(2.0*exp(q_1/t_s)*abs(exp(q_1/t_s))*k_3);
mtt_t1 = exp((q_1+q_2+q_3)/t_s)*abs(exp(q_1/t_s))*f_s*k_1;
mtt_t3 = exp((q_1+q_2+q_3)/t_s);
mtt_t2 = exp((2.0*q_1+q_3)/t_s)*f_s^2+4.0*exp((2.0*q_1)/t_s)*c_0*f_s*k_3;
mtt_t3 = mtt_t3*sqrt((mtt_t2+2.0*exp((q_1+q_3)/t_s)*f_s*k_1+exp(q_3/t_s)*k_1^2)/exp(q_3/t_s));
mtt_t1 = mtt_t1+exp((q_2+q_3)/t_s)*abs(exp(q_1/t_s))*k_1^2-(mtt_t3*k_1);
mtt_t2 = 2.0*exp((2.0*q_1+q_2)/t_s)*abs(exp(q_1/t_s))*f_s*k_3;
mttb(2) = mtt_t1/(mtt_t2+2.0*exp((2.0*q_1)/t_s)*abs(exp(q_1/t_s))*k_2*k_3);
%c matrix%
mttc = zeros(1,2);
mttc(1,2) = 1.0;
%d matrix%
mttd = zeros(1,1);

Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_sspar.r version [686130de9e].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file (ReactorTQ_sspar.r)
%% as siso_sspar ecxept that inputs/states have different meaning
%% Steady state for constant c_a, c_b and t=t_s and f=f_s

%% Unit volume ReactorTQ:
v_r := 1;

%% Do the inputs first -- this avoids problems with reduce not
%% recognising that complicated expressions are zero

%% The exponentials.
e_1 := e^(-q_1/t_s);
e_2 := e^(-q_2/t_s);
e_3 := e^(-q_3/t_s);

%Steady-state input q needed to achieve steady-state t_s
q_s := -( 
        + (t_0-t_s)*f_s
        + e_1*h_1*k_1*x1
        + e_2*h_2*k_2*x2
        + e_3*h_3*k_3*x1^2
       );

%% The input at steady-state
MTTu1 := f_s;

%States (masses)
x1 := c_a*v_r;
x2 := c_b*v_r;

%Load up the vectors
MTTx1 := x1;
MTTx2 := x2;

MTTy1 := c_b;

%% Finally, solve for the steady-state concentrations
%% Solve for ca - a quadratic.
a 	:= k_3*e_3;	%ca^2 
b 	:= k_1*e_1 + f_s;	%ca^1 
c 	:= -c_0*f_s;

c_a	:= (-b + sqrt(b^2 - 4*a*c))/(2*a);

%% solve for c_b
c_b 	:= c_a*k_1*e_1/(f_s+k_2*e_2);


END;


Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_state.txt version [c8a0452632].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# State specification (ReactorTQ_state.txt)
# Generated by MTT at Fri Mar  3 11:52:23 GMT 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

## Reduce steady-state parameter file (ReactorTQ_sspar.r)
## as siso_sspar ecxept that states/states have different meaning
## Steady state for constant c_a, c_b and t=t_s and f=f_s

## Unit volume ReactorTQ:
v_r = 1;


## The exponentials.
e_1 = exp(-q_1/t_s);
e_2 = exp(-q_2/t_s);
e_3 = exp(-q_3/t_s);

## Solve for the steady-state concentrations
## Solve for ca - a quadratic.
a 	= k_3*e_3;	#ca^2 
b 	= k_1*e_1 + f_s;	#ca^1 
c 	= -c_0*f_s;

c_a	= (-b + sqrt(b^2 - 4*a*c))/(2*a);

## solve for c_b
c_b 	= c_a*k_1*e_1/(f_s+k_2*e_2);


#States (masses)
x1 = c_a*v_r;
x2 = c_b*v_r;


## The two inputs at steady-state
##mttu(1) = f_s;

## Load up the states
mttx(1) = x1;
mttx(2) = x2;




Deleted mttroot/mtt/lib/examples/Chemical/ReactorTQ/ReactorTQ_sympar.m version [b5bf2c1d7a].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function sympar = ReactorTQ_sympar();
% sympar = ReactorTQ_sympar();
%System ReactorTQ, representation sympar, language m;
%File ReactorTQ_sympar.m;
%Generated by MTT on Thu Aug 24 14:47:48 BST 2000;
%
global ...
mtt_no_globals ;
  sympar.a 	= 1; # ReactorTQ
  sympar.b 	= 2; # ReactorTQ
  sympar.c 	= 3; # ReactorTQ
  sympar.c_0 	= 4; # ReactorTQ
  sympar.c_A 	= 5; # ReactorTQ
  sympar.c_B 	= 6; # ReactorTQ
  sympar.c_p 	= 7; # ReactorTQ
  sympar.e_1 	= 8; # ReactorTQ
  sympar.e_2 	= 9; # ReactorTQ
  sympar.e_3 	= 10; # ReactorTQ
  sympar.f_s 	= 11; # ReactorTQ
  sympar.h 	= 12; # Rate
  sympar.h_1 	= 13; # ReactorTQ
  sympar.h_2 	= 14; # ReactorTQ
  sympar.h_3 	= 15; # ReactorTQ
  sympar.k 	= 16; # Rate
  sympar.k_1 	= 17; # ReactorTQ
  sympar.k_2 	= 18; # ReactorTQ
  sympar.k_3 	= 19; # ReactorTQ
  sympar.n 	= 20; # Rate
  sympar.q 	= 21; # Rate
  sympar.q_1 	= 22; # ReactorTQ
  sympar.q_2 	= 23; # ReactorTQ
  sympar.q_3 	= 24; # ReactorTQ
  sympar.q_S 	= 25; # ReactorTQ
  sympar.rho 	= 26; # ReactorTQ
  sympar.t_0 	= 27; # ReactorTQ
  sympar.t_s 	= 28; # ReactorTQ
  sympar.v_r 	= 29; # ReactorTQ
  sympar.x1 	= 30; # ReactorTQ
  sympar.x2 	= 31; # ReactorTQ
  sympar.x3 	= 32; # ReactorTQ

Deleted mttroot/mtt/lib/examples/Components/OnePorts/OnePorts_abg.fig version [a2d62ed5ea].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 2925 4725 2925 4500 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4725 2700 4725 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 3600 4725 3600 4500 3825
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3375 3375 3375 3825
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 4275 4725 4275 4500 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 4950 4725 4950 4500 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4725 4725 4725 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 5625 4725 5625 4500 5850
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 6300 4725 6300 4500 6525
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3375 6075 3375 6525
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 5850 6750 2025 6750 2025 2475 5850 2475 5850 6750
4 1 0 100 0 18 18 0.0000 4 270 690 5265 3015 R:r_1\001
4 1 0 100 0 18 18 0.0000 4 270 1050 2790 3015 SS:ss_1\001
4 1 0 100 0 18 18 0.0000 4 270 690 5265 3690 R:r_2\001
4 1 0 100 0 18 18 0.0000 4 270 1050 2790 3690 SS:ss_2\001
4 1 0 100 0 18 18 0.0000 4 270 750 5265 4365 C:c_3\001
4 1 0 100 0 18 18 0.0000 4 270 1050 2790 4365 SS:ss_3\001
4 1 0 100 0 18 18 0.0000 4 270 750 5265 5040 C:c_4\001
4 1 0 100 0 18 18 0.0000 4 270 1050 2790 5040 SS:ss_4\001
4 1 0 100 0 18 18 0.0000 4 270 540 5265 5715 I:i_5\001
4 1 0 100 0 18 18 0.0000 4 270 1050 2790 5715 SS:ss_5\001
4 1 0 100 0 18 18 0.0000 4 270 540 5265 6390 I:i_6\001
4 1 0 100 0 18 18 0.0000 4 270 1050 2790 6390 SS:ss_6\001

Deleted mttroot/mtt/lib/examples/Components/OnePorts/OnePorts_desc.tex version [bcbc416ce5].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system OnePorts (OnePorts_desc.tex)
% Generated by MTT on Fri Apr 19 08:12:54 BST 2002.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{OnePorts} is
   displayed in Figure \Ref{fig:OnePorts_abg.ps}; it contains the one
   port components: \textbf{R}, \textbf{C} and \textbf{I} in each of
   the two possible causalities.

   Note that the \textbf{R} has no prefered causality and, in this
   case, a causal stroke must be provided by the user. On the other
   hand, the \textbf{C} and \textbf{I} components are assigned
   prefered causality by MTT in the 3rd and 5th cases where no stroke
   is assigned by ther user. In the 4th and 6th cases, the user
   provides a causal stroke to put the components into derivative
   causality. \Ref{fig:OnePorts_cbg.ps} shows the causality
   automatically completed for the 3rd and 5th cases.
   
   Section \Ref{sec:OnePorts_ode.tex} gives the system equations, $y_1$ to
   $y_6$ are the outputs (with the given causality) of the 6
   components and $u_1$ to $u_6$ are the coresponding inputs. $x_1$
   and $x_2$ are the states of the 3rd and 5th cases (ie integrated
   flow and effort respectively), $z_1$ and $z_2$ are the
   corresponding quantities for the the 4th and 6th cases, the two
   components in derivative causality.

Deleted mttroot/mtt/lib/examples/Components/OnePorts/OnePorts_rep.txt version [9502ca8e13].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system OnePorts (OnePorts_rep.txt)
## Generated by MTT on" Thu Apr 18 08:49:49 BST 2002.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt OnePorts abg tex			# The system description
mtt OnePorts cbg ps 		        # The causal bond graph
mtt OnePorts struc tex	        # The system structure
mtt OnePorts sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt OnePorts dae tex	        # The system dae
mtt OnePorts ode tex	        # The system ode 
## mtt OnePorts sspar tex		# Steady-state parameters
## mtt OnePorts ss tex 		# Steady state
## mtt OnePorts dm tex		# Descriptor matrices (of linearised system)
## mtt OnePorts sm tex		# State matrices (of linearised system)
## mtt OnePorts tf tex		# Transfer function (of linearised system)
## mtt OnePorts lmfr ps		# log modulus of frequency response (of linearised system)
## mtt OnePorts simpar tex		# Simulation parameters
## mtt OnePorts numpar tex		# Numerical simulation parameters
## mtt OnePorts state tex		# Simulation initial state
## mtt OnePorts input tex		# Simulation input
## mtt OnePorts logic tex		# Logic control
## mtt OnePorts odeso ps		# Simulation output

## mtt OnePorts rep txt		# This file

Deleted mttroot/mtt/lib/examples/Components/TwoPorts/TwoPorts_abg.fig version [94a8b07bb2].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 2925 4050 2925 3825 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5175 2925 6525 2925 6300 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5175 2700 5175 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 3825 4050 3825 3825 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5175 3825 6525 3825 6300 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 3600 4050 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4725 4050 4725 3825 4950
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5175 4725 6525 4725 6300 4950
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5175 4500 5175 4950
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 5625 4050 5625 3825 5850
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5175 5625 6525 5625 6300 5850
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 5400 4050 5850
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 8100 6300 1125 6300 1125 2250 8100 2250 8100 6300
4 1 0 100 0 18 18 0.0000 4 270 900 4635 3015 TF:n_1\001
4 2 0 100 0 18 18 0.0000 4 270 1200 2520 3015 SS:ss_11\001
4 0 0 100 0 18 18 0.0000 4 270 1200 6705 3015 SS:ss_12\001
4 1 0 100 0 18 18 0.0000 4 270 900 4635 3915 TF:n_2\001
4 2 0 100 0 18 18 0.0000 4 270 1200 2520 3915 SS:ss_21\001
4 0 0 100 0 18 18 0.0000 4 270 1200 6705 3915 SS:ss_22\001
4 1 0 100 0 18 18 0.0000 4 270 960 4635 4815 GY:n_3\001
4 2 0 100 0 18 18 0.0000 4 270 1200 2520 4815 SS:ss_31\001
4 0 0 100 0 18 18 0.0000 4 270 1200 6705 4815 SS:ss_32\001
4 1 0 100 0 18 18 0.0000 4 270 960 4635 5715 GY:n_4\001
4 2 0 100 0 18 18 0.0000 4 270 1200 2520 5715 SS:ss_41\001
4 0 0 100 0 18 18 0.0000 4 270 1200 6705 5715 SS:ss_42\001

Deleted mttroot/mtt/lib/examples/Components/TwoPorts/TwoPorts_desc.tex version [72c779d344].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system TwoPorts (TwoPorts_desc.tex)
% Generated by MTT on Fri Apr 19 08:12:54 BST 2002.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoPorts} is
   displayed in Figure \Ref{fig:TwoPorts_abg.ps}; it contains the two
   port components: \textbf{TF} and \textbf{GY} in each of
   the two possible causalities.
   
   Note that the neither component has prefered causality and, in both
   cases, a causal stroke must be provided by the user. 
   
   Section \Ref{sec:TwoPorts_ode.tex} gives the system equations.

Deleted mttroot/mtt/lib/examples/Components/TwoPorts/TwoPorts_rep.txt version [287249d02f].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system TwoPorts (TwoPorts_rep.txt)
## Generated by MTT on" Thu Apr 18 08:45:30 BST 2002.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt TwoPorts abg tex			# The system description
mtt TwoPorts cbg ps 		        # The causal bond graph
mtt TwoPorts struc tex	        # The system structure
mtt TwoPorts sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt TwoPorts dae tex	        # The system dae
   mtt TwoPorts ode tex	        # The system ode 
## mtt TwoPorts sspar tex		# Steady-state parameters
## mtt TwoPorts ss tex 		# Steady state
## mtt TwoPorts dm tex		# Descriptor matrices (of linearised system)
## mtt TwoPorts sm tex		# State matrices (of linearised system)
## mtt TwoPorts tf tex		# Transfer function (of linearised system)
## mtt TwoPorts lmfr ps		# log modulus of frequency response (of linearised system)
## mtt TwoPorts simpar tex		# Simulation parameters
## mtt TwoPorts numpar tex		# Numerical simulation parameters
## mtt TwoPorts state tex		# Simulation initial state
## mtt TwoPorts input tex		# Simulation input
## mtt TwoPorts logic tex		# Logic control
## mtt TwoPorts odeso ps		# Simulation output

## mtt TwoPorts rep txt		# This file

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/INTFX_abg.fig version [d546a8c405].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1801 3151 2701 3151 2476 3376
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3151 4501 3151 4276 3376
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 2926 4726 2026 4951 2251
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 3151 5851 3151 5626 3376
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6975 4050 6975 1350 450 1350 450 4050 6975 4050
4 1 -1 0 0 0 20 0.0000 4 195 375 3151 3241 AF\001
4 1 -1 0 0 0 20 0.0000 4 195 135 4726 3241 0\001
4 1 -1 0 0 0 20 0.0000 4 195 600 4726 1891 CX:c\001
4 1 -1 0 0 0 20 0.0000 4 240 810 1306 3241 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 240 960 6346 3241 SS:[out]\001

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/INTFX_desc.tex version [9521268b12].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system INTFX (INTFX_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:16 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/08/24 11:20:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{INTFX} is
   displayed in Figure \Ref{INTFX_abg} and its label
   file is listed in Section \Ref{sec:INTFX_lbl}.
   The subsystems are listed in Section \Ref{sec:INTFX_sub}.

\textbf{INTFX} is a two-port component where the effort on port [out]
   is the integral of the flow on port [in].

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/INTFX_lbl.txt version [795adc6745].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY INTFX
%DESCRIPTION <Detailed description here>
%% Label file for system INTFX (INTFX_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type CX
	c		lin	effort,1

% Component type SS
	[in]		SS	external,external
	[out]		SS	external,external

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/Makefile version [bb886d4f73].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Makefile for the Two link GMV example

all: msdp_tf.m twolinkp_obs.m twolinkp_sm.m TwoLinkGMV_numpar.m 

msdP_tf.m: msdP_abg.fig 
	mtt -q msdP tf m

msdp_tf.m: msdP_tf.m
	tr [A-Z] [a-z] <msdP_tf.m >msdp_tf.m

TwoLinkP_obs.m: TwoLinkP_abg.fig TwoLinkP_lbl.txt
	mtt -q TwoLinkP obs m

twolinkp_obs.m: TwoLinkP_obs.m
	tr [A-Z] [a-z] <TwoLinkP_obs.m >twolinkp_obs.m

TwoLinkP_sm.m: TwoLinkP_abg.fig TwoLinkP_lbl.txt
	mtt -q TwoLinkP sm m

twolinkp_sm.m: TwoLinkP_sm.m
	tr [A-Z] [a-z] <TwoLinkP_sm.m >twolinkp_sm.m

TwoLinkGMV_numpar.m: TwoLinkGMV_numpar.txt
	mtt -q TwoLinkGMV numpar m

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/RODaX_abg.fig version [69d5bf8861].

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
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
123
124




























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 4950 1800 3375 1800 3600
4 1 -1 0 0 0 20 0.0000 4 195 135 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000 4 195 270 6933 5268 IX:J\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000 4 255 660 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000 4 255 660 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000 4 195 135 3603 5313 0\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 585 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000 4 195 960 4681 5266 INTFX:th\001
4 1 1 1 0 0 20 0.0000 4 195 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000 4 135 180 5580 9990 a\001
4 1 1 1 0 0 20 0.0000 4 195 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 345 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000 4 210 345 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000 4 255 990 2971 1216 SS:[x_a]\001
4 1 4 0 0 0 20 0.0000 4 255 990 2971 9361 SS:[x_b]\001
4 1 4 0 0 0 20 0.0000 4 255 990 8372 1217 SS:[y_a]\001
4 1 4 0 0 0 20 0.0000 4 255 990 8417 9362 SS:[y_b]\001
4 1 4 0 0 0 20 0.0000 4 255 1485 5671 1216 SS:[alpha_a]\001
4 1 4 0 0 0 20 0.0000 4 255 1485 5671 9361 SS:[alpha_b]\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000 4 195 1380 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 9855 Tip b\001
4 1 4 0 0 0 20 0.0000 4 255 1215 1756 3286 SS:[alpha]\001

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/RODaX_desc.tex version [df20b89acf].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system RODaX (RODaX_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/04/12 15:25:35  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  09:41:19  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{RODaX} is
   displayed in Figure \Ref{RODaX_abg} and its label
   file is listed in Section \Ref{sec:RODaX_lbl}.
   The subsystems are listed in Section \Ref{sec:RODaX_sub}.

{\bf RODaX} is essentially as described in Figure 10.2 of
``Metamodelling''. It has an additional port ``[angle]'' to provide
access to the rod angle.

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/RODaX_lbl.txt version [25a69a9380].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	RODaX: rigid rod in two dimensions - angle port.
%DESCRIPTION	Port [alpha_a]:	Angular torque/velocity - end a
%DESCRIPTION	Port [alpha_b]:	Angular torque/velocity - end b
%DESCRIPTION	Port [x_a]:	x force/velocity - end a
%DESCRIPTION	Port [x_b]:	x force/velocity - end b
%DESCRIPTION	Port [y_a]:	y force/velocity - end a
%DESCRIPTION	Port [y_b]:	y force/velocity - end b
%DESCRIPTION	Port [alpha]:	rod angle
%DESCRIPTION
%DESCRIPTION	Parameter 1:	length from end 1 to mass centre
%DESCRIPTION	Parameter 2:	length from end 2 to mass centre
%DESCRIPTION	Parameter 3:	inertia about mass centre
%DESCRIPTION	Parameter 4:	mass
%DESCRIPTION	See Section 10.2 of "Metamodelling"


%% Label file for system RODaX (RODaX_lbl.txt)




% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.1  1998/04/12 15:24:06  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,$3
m_x	lin	flow,$4
m_y	lin	flow,$4

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,$1
s2	lsin	flow,$2
c1	lcos	flow,$1
c2	lcos	flow,$2



	

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_abg.fig version [b9d6a07d06].

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
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






























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 8550 9225 8550 9000 8775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 8325 9225 8775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 9450 9225 9450 9000 9675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 9225 9225 9675
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10215 2475 10215 2475 7650 11025 7650 11025 10215
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 8325 5625 8775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 9225 5625 9675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 3825 5625 3825 8550 5625 8550 5400 8775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 3375 6525 3375 9450 5625 9450 5400 9675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 5400 9225 5400 9000 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 5175 9225 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 6300 9225 6300 9000 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 6075 9225 6525
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 7065 2475 7065 2475 4500 11025 4500 11025 7065
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 5400 5625 5400 5400 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 5175 5625 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 6300 5625 6300 5400 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 6075 5625 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 5400 3600 5400 3375 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3600 5175 3600 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 6300 3150 6300 2925 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 6075 3150 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 2250 9225 2250 9000 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 2025 9225 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 3150 9225 3150 9000 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 2925 9225 3375
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 3915 2475 3915 2475 1350 11025 1350 11025 3915
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 2250 5625 2250 5400 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 2025 5625 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 3150 5625 3150 5400 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 2925 5625 3375
4 0 -1 0 0 22 20 0.0000 4 270 1935 9315 8640 SS:Theta_1_m\001
4 0 -1 0 0 22 20 0.0000 4 270 1935 9315 9540 SS:Theta_2_m\001
4 1 -1 0 0 22 20 0.0000 4 210 2445 6750 9090 TwoLinkPX:model\001
4 0 4 0 0 22 20 0.0000 4 270 1230 7920 8415 [Theta_1]\001
4 0 4 0 0 22 20 0.0000 4 270 1230 7920 9315 [Theta_2]\001
4 2 4 0 0 22 20 0.0000 4 270 1140 5535 8415 [Joint_1]\001
4 2 4 0 0 22 20 0.0000 4 270 1140 5535 9315 [Joint_2]\001
4 1 1 1 0 3 26 0.0000 4 270 1005 6750 10080 Model\001
4 1 -1 0 0 22 20 0.0000 4 270 2415 6750 5940 TwoLinkP:system\001
4 0 4 0 0 22 20 0.0000 4 270 1230 7920 5265 [Theta_1]\001
4 0 4 0 0 22 20 0.0000 4 270 1230 7920 6165 [Theta_2]\001
4 0 -1 0 0 22 20 0.0000 4 270 1530 9315 5490 SS:Theta_1\001
4 0 -1 0 0 22 20 0.0000 4 270 1530 9315 6390 SS:Theta_2\001
4 2 4 0 0 22 20 0.0000 4 270 1140 5535 5265 [Joint_1]\001
4 2 4 0 0 22 20 0.0000 4 270 1140 5535 6165 [Joint_2]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3825 5490 0\001
4 2 -1 0 0 22 20 0.0000 4 270 1275 1935 6390 SS:Tau_2\001
4 2 -1 0 0 22 20 0.0000 4 270 1275 1980 5490 SS:Tau_1\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3375 6390 0\001
4 1 1 1 0 3 26 0.0000 4 360 1110 6705 6885 System\001
4 0 -1 0 0 22 20 0.0000 4 270 1785 9315 2340 SS:Theta_1_r\001
4 0 -1 0 0 22 20 0.0000 4 270 1785 9315 3240 SS:Theta_2_r\001
4 1 1 1 0 3 26 0.0000 4 360 2055 6705 3735 Specification\001
4 1 -1 0 0 22 20 0.0000 4 270 1860 6795 2340 msdP:spec_1\001
4 1 -1 0 0 22 20 0.0000 4 270 1860 6795 3195 msdP:spec_2\001
4 2 -1 0 0 22 20 0.0000 4 270 1260 4005 2340 SS:Ref_1\001
4 2 -1 0 0 22 20 0.0000 4 270 1260 3960 3240 SS:Ref_2\001

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_args.new version [5936bc7523].

1

-
 

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_desc.tex version [430b6e90d4].

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
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

































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system TwoLinkGMV (TwoLinkGMV_desc.tex)
% Generated by MTT on Wed Apr 15 18:15:23 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/04/15 18:41:58  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkGMV} is
   displayed in Figure \Ref{TwoLinkGMV_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkGMV_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkGMV_sub}.

This composite system provides an illustration of nonlinear
generalised minimum variance (GMV) control (continuous-time) operating on a
twolink manipulator. GMV can also be interpreted as:
\begin{itemize}
\item the exact linearisation (by feedback) followed by a
  pole-placement design on the resulting linear system and
\item a special case of generalised predictive control (GPC) were the
  prediction horizon is zero and the $P(s)$ polynomial is the same as
  the system relative degree and
\item One possible instance of physical-model-based control.
\end{itemize}

The composite system of Figure \Ref{TwoLinkGMV_abg} has three
(visible) parts:
\begin{enumerate}
\item a linear decoupled \emph{specification} system that describes the desired
  closed-loop system in terms of a physical system (two decoupled
  mass-spring-damper systems),
\item the system itself (a two-link manipulator) representing the
  system to be controlled, more details are given in Sections
  \Ref{sec:TwoLinkP_ode.tex} and \Ref{sec:TwoLinkP_rfe.tex}.
\item a model of the system with additional state inputs to be used as
  a state observer.
\end{enumerate}
The invisible parts are implemented in the text file
``TwoLinkGMV\_input.txt'' (see Section \Ref{sec:TwoLinkGMV_input.txt}).
These parts are:
\begin{itemize}
\item the reference signal (joint angles)
  \begin{equation}
    w(t) = 
    \begin{cases}
      \begin{pmatrix}
        \pi \\
        0
      \end{pmatrix} & 0 \ge t > 10 \\
      \begin{pmatrix}
        2\pi \\
        0
      \end{pmatrix} & 10 \ge t > 15 \\
      \begin{pmatrix}
        2\pi \\
        \pi
      \end{pmatrix} & 15 \ge t > 30 \\
    \end{cases}
  \end{equation}
\item The control signal (joint torques) being the solution of 
  \begin{equation}
    \phi^*(t) = O_o(\hat x(t)) + O_h(\hat x(t)) u(t) = w(t)
  \end{equation}
where $\hat x$ is the observed state.
\item The observer feedback signal
  \begin{equation}
    u_x = K ( y - \hat y)
  \end{equation}
where $K$ is the observer gain matrix and $y$ and $\hat y$ are the
system and model outputs respectively.
\end{itemize}
The observer gain is set up on the basis of the \emph{linearised}
system using LQ theory. This is implemented in the text file
``TwoLinkGMV\_state.txt'' (see Section \Ref{sec:TwoLinkGMV_state.txt})
using the Octave function ``lqe'' together with the MTT-generated
linearised system ``TwoLink\_sm''.


The system was simulated using Octave under MTT with the results given
in Figures
\Ref{fig:TwoLinkGMV_odeso.ps-TwoLinkGMV-Theta-1,TwoLinkGMV-Theta-1-r}
and
\Ref{fig:TwoLinkGMV_odeso.ps-TwoLinkGMV-Theta-2,TwoLinkGMV-Theta-2-r}
giving the actual and specification angles for joints 1 and 2
respectively.

The initial \emph{system} state was zero except that the angle of the
first rod was $\frac{\pi}{4}$. The initial \emph{observer} state was
(erroneously but deliberately) set at zero. This explains the
(decaying) discrepancy between the actual and specification angles.
Simulations with zero initial state gave precise matching.

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_input.txt version [4899e515e0].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkGMV_input.txt)
# Generated by MTT at Mon Apr 13 11:02:37 BST 1998

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

global ObserverGain;

# Reference signals
u(1) =	 pi + pi*(t>10) ;			# TwoLinkGMV (Ref_1)
u(2) =	 pi*(t>15) ;			# TwoLinkGMV (Ref_2)

# Control signals
w = u(1:2);			# Reference signal
x_model = x(9:12);		# Observed states
[O_o, O_h] = TwoLinkP_obs(x_model) #GPC O function (affine case)
[spec_n,spec_d] = msdP_tf;	# Spec transfer function
P = spec_d(3:-1:1);		# P poly with ascending coeffs
PP = [eye(2)*P(1) eye(2)*P(2) eye(2)*P(3)]; 
PO_o = PP*O_o;			# Compute Py with u zero
PO_h = PP*O_h;			# Coefficient of u
u_control =  PO_h\(w - PO_o);	# GMV control signal

u(3:4) = u_control;		# TwoLinkGMV (Tau_1)

# Observer
x_system = x(5:8);		# System states
error = x_system-x_model;	# Error in states
ObserverInput = ObserverGain*error;
u(5:8) = ObserverInput;		# Set the state-input to the observer

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_lbl.txt version [ad79cbc64e].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLinkGMV - GMV control of two-link manipulator
%DESCRIPTION This composite system provides an illustration
%DESCRIPTION of nonlinear generalised minimum variance (GMV) control
%DESCRIPTION (continuous-time) operating on a twolink manipulator. 

%% Label file for system TwoLinkGMV (TwoLinkGMV_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type SS
	Ref_1		SS	external,internal
	Ref_2		SS	external,internal
	Tau_1		SS	external,internal
	Tau_2		SS	external,internal

	Theta_1		SS	external,0
	Theta_2		SS	external,0

	Theta_1_m	SS	external,0
	Theta_2_m	SS	external,0

	Theta_1_r	SS	external,0
	Theta_2_r	SS	external,0

% Component type msdP
	spec_1
	spec_2

% Component type TwoLinkP
	system

% Component type TwoLinkPX
	model


Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_numpar.txt version [ccf91065f0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkGMV_numpar.txt)
# Generated by MTT at Mon Apr 13 10:57:02 BST 1998

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

# Parameters
c_s = 	1.0; # msdP
j_s = 	1.0; # msdP
r_s = 	1.414; # msdP

j_r = 	1.0; # TwoLinkP,TwoLinkPX
l_r = 	1.0; # TwoLinkP,TwoLinkPX
m_r = 	1.0; # TwoLinkP,TwoLinkPX

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_obspar.r version [c3ef6ba928].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce  GPC observability function parameters for system TwoLinkGMV (TwoLinkGMV_obspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MTTGPCNy := 2;
MTTGPCNu := 0;
Matrix MTTdU(5,1);
MTTdU(1,1) := MTTdU1;
MTTdU(2,1) := MTTdU2;
MTTdU(3,1) := MTTdU3;
MTTdU(4,1) := MTTdU4;
MTTdU(5,1) := MTTdU5;
Matrix MTTUU(2,5);
MTTUU(1,1) := MTTu1;
MTTUU(1,2) := MTTu11;
MTTUU(1,3) := MTTu12;
MTTUU(1,4) := MTTu13;
MTTUU(1,5) := MTTu14;
MTTUU(2,1) := MTTu2;
MTTUU(2,2) := MTTu21;
MTTUU(2,3) := MTTu22;
MTTUU(2,4) := MTTu23;
MTTUU(2,5) := MTTu24;
END;

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_rep.txt version [5a83bbbd32].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TwoLinkGMV (TwoLinkGMV_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt TwoLinkGMV abg tex
mtt TwoLinkGMV struc tex
mtt TwoLinkGMV sympar tex

mtt TwoLinkP struc tex
mtt TwoLinkP rfe tex
mtt TwoLinkP ode tex
mtt TwoLinkP obs tex

mtt TwoLinkP ss tex
mtt TwoLinkP sm tex

mtt msdP tf tex

mtt TwoLinkGMV numpar txt
mtt TwoLinkGMV state txt
mtt TwoLinkGMV input txt
mtt TwoLinkGMV odeso ps 'TwoLinkGMV_Theta_1,TwoLinkGMV_Theta_1_r'
mtt TwoLinkGMV odeso ps 'TwoLinkGMV_Theta_2,TwoLinkGMV_Theta_2_r'

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_simpar.txt version [49dd11c4f0].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system TwoLinkGMV (TwoLinkGMV_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=30.0
DT=0.2
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_simpar.txt_old version [49dd11c4f0].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system TwoLinkGMV (TwoLinkGMV_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=30.0
DT=0.2
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_sspar.r version [5689628a58].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (TwoLinkGMV_sspar.r)
% Generated by MTT at Tue Apr 14 08:47:47 BST 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Steady-state states
MTTX1 := 	0; % TwoLinkGMV_spec_1 (c_s)
MTTX2 := 	0; % TwoLinkGMV_spec_1 (j_s)
MTTX3 := 	0; % TwoLinkGMV_spec_2 (c_s)
MTTX4 := 	0; % TwoLinkGMV_spec_2 (j_s)
MTTX5 := 	0; % TwoLinkGMV_system_rod1 (J)
MTTX6 := 	0; % TwoLinkGMV_system_rod1_th (3)
MTTX7 := 	0; % TwoLinkGMV_system_rod2 (J)
MTTX8 := 	0; % TwoLinkGMV_system_rod2_th (3)
MTTX9 := 	0; % TwoLinkGMV_model_rod1_J (i)
MTTX10 := 	0; % TwoLinkGMV_model_rod1_th_c (c)
MTTX11 := 	0; % TwoLinkGMV_model_rod2_J (i)
MTTX12 := 	0; % TwoLinkGMV_model_rod2_th_c (c)
% Steady-state inputs
MTTU1 := 	1; % TwoLinkGMV (Ref_1)
MTTU2 := 	1; % TwoLinkGMV (Ref_2)
MTTU3 := 	0; % TwoLinkGMV (Tau_1)
MTTU4 := 	0; % TwoLinkGMV (Tau_2)
MTTU5 := 	0; % TwoLinkGMV_model_rod1_J (X)
MTTU6 := 	0; % TwoLinkGMV_model_rod1_th_c (X)
MTTU7 := 	0; % TwoLinkGMV_model_rod2_J (X)
MTTU8 := 	0; % TwoLinkGMV_model_rod2_th_c (X)
;;END;

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkGMV_state.txt version [73974e101a].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkGMV_state.txt)
# Generated by MTT at Tue Apr 14 08:54:28 BST 1998

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

global ObserverGain;

# Set the states
x(1) =	 0 ; # TwoLinkGMV_spec_1 (c_s)
x(2) =	 0 ; # TwoLinkGMV_spec_1 (j_s)
x(3) =	 0 ; # TwoLinkGMV_spec_2 (c_s)
x(4) =	 0 ; # TwoLinkGMV_spec_2 (j_s)
x(5) =	 0 ; # TwoLinkGMV_system_rod1 (J)
x(6) =	 pi/4 ; # TwoLinkGMV_system_rod1_th (3)
x(7) =	 0 ; # TwoLinkGMV_system_rod2 (J)
x(8) =	 0 ; # TwoLinkGMV_system_rod2_th (3)
x(9) =	 0 ; # TwoLinkGMV_model_rod1_J (i)
x(10) =	 0 ; # TwoLinkGMV_model_rod1_th_c (c)
x(11) =	 0 ; # TwoLinkGMV_model_rod2_J (i)
x(12) =	 0 ; # TwoLinkGMV_model_rod2_th_c (c)

# Observer design
[A,B,C] = TwoLinkP_sm;		# Get the linearised system
sigma = 0.1;			# Measurement noise variance (pretend)
k = lqe(A,eye(4),C,eye(4),sigma*eye(2))
ObserverGain = k*C;		# This system happens to have a linear output

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkPX_abg.fig version [9ab26d89d5].

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
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








































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 1125 485 485 8550 1125 8730 1575
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 5625 485 485 8550 5625 9035 6110
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3468 1128 3738 1128
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4593 2703 4863 2703
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 1128 4728 2703 4953 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4502 5492 4502 5762
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5627 4502 5627 4277 5852
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 7426 4951 7201
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3472 8647 3742 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4597 8647 4867 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5724 8649 5994 8649
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4730 8645 4730 10220 4955 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5855 8645 5855 10220 6080 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3826 3601 7426 3826 7201
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3826 5851 7426 6076 7201
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 8775 6525 7200 2925 7200 2925 8775 6525 8775
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 6435 6525 4860 2925 4860 2925 6435 6525 6435
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 11250 6525 9675 2925 9675 2925 11250 6525 11250
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 11475 9450 225 180 225 180 11475 9450 11475
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 8622 3600 10197 3825 9972
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 9675 8775 6075 8325 6075 8325 9675 8775 9675
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 7650 450 9405 450 9405 675 7650 675 7650 450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 3285 1575 3285 1800 3510
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3195 8055 1620 8055 1845 8280
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 3150 1350 2025 1575 2250
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 8325 1350 9450 1575 9225
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 7875 1350 3600 1575 3825
4 1 -1 0 0 0 20 0.0000 4 255 810 3603 948 SS:v_x\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4683 5718 0\001
4 1 -1 0 0 0 20 0.0000 4 255 840 3608 10673 SS:F_x\001
4 1 -1 0 0 0 20 0.0000 4 255 840 4733 10673 SS:F_a\001
4 1 -1 0 0 0 20 0.0000 4 255 840 5903 10673 SS:F_y\001
4 1 -1 0 0 0 20 0.0000 4 195 1335 4729 3379 RODaX:rod1\001
4 1 -1 0 0 0 20 0.0000 4 195 1335 4731 8196 RODaX:rod2\001
4 1 4 0 0 0 20 0.0000 4 255 1410 4771 946 SS:[Joint_1]\001
4 0 1 1 0 3 20 0.0000 4 210 720 6795 3375 Link 1\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 5760 Joint 2\001
4 0 1 1 0 3 20 0.0000 4 210 720 6750 8190 Link 2\001
4 0 1 1 0 3 20 0.0000 4 270 375 6750 10485 Tip\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 1260 Joint 1\001
4 1 4 0 0 0 16 0.0000 4 225 900 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5850 2970 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3605 7835 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4730 7835 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5855 7835 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3607 8512 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4733 8513 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5859 8514 [y_b]\001
4 1 -1 0 0 0 20 0.0000 4 255 810 5850 945 SS:v_y\001
4 2 4 0 0 0 20 0.0000 4 255 1410 2882 5717 SS:[Joint_2]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 675 3510 3375 [alpha]\001
4 1 4 0 0 0 16 0.0000 4 225 675 3555 8145 [alpha]\001
4 0 -1 0 0 0 20 0.0000 4 195 135 1308 8193 1\001
4 1 4 0 0 0 20 0.0000 4 255 1530 1397 1892 SS:[Theta_1]\001
4 1 4 0 0 0 20 0.0000 4 255 1530 1352 9767 SS:[Theta_2]\001
4 0 -1 0 0 0 20 0.0000 4 195 135 1263 3468 0\001

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkPX_desc.tex version [df58265a5a].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TwoLinkPX (TwoLinkPX_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/19 14:20:07  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkPX} is
   displayed in Figure \Ref{TwoLinkPX_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkPX_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkPX_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses the compound components: {\bf ROD}.  {\bf
ROD} is essentially as described in Figure 10.2.
There is no gravity included in this model.

This system has a number of dynamic elements (those corresponding to translation
motion) in derivative causality, thus the system is represnted as a
Differential-Algebraic Equation (Section
\Ref{sec:TwoLinkPX_dae.tex}). Hovever, this is of contrained-state form and
therfore can be written as a set of constrained-state equations (Section
\Ref{sec:TwoLinkPX_cse.tex}). The corresponding ordinary differential
equation is complicated due to the trig functions involved in
inverting the E matrix.

As well as the standard representation the ``robot-form'' equations
appear in Section  \Ref{sec:TwoLinkPX_rfe}. 

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkPX_lbl.txt version [fbab683c87].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLinkPX: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (TwoLinkPX_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/12/05  12:39:49  peterg
% %% Documentation
% %%
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - uniform rods
rod1	none	l_r;l_r;j_r;m_r
rod2	none	l_r;l_r;j_r;m_r

%Zero velocity sources
v_x	SS     internal,0
v_y	SS     internal,0


%Zero force/torque sources
F_x	SS	   0,internal
F_a	SS	   0,internal
F_y	SS	   0,internal

%Named ports
[Joint_1]		SS	external,internal
[Joint_2]		SS	external,internal
[Theta_1]		SS	external,0
[Theta_2]		SS	external,0

%Torque/velocity at joints
%f_a1	SS	 external,external
%f_a2	SS	 external,external


Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkP_abg.fig version [44cfade14b].

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
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








































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 1125 485 485 8550 1125 8730 1575
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 5625 485 485 8550 5625 9035 6110
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3468 1128 3738 1128
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4593 2703 4863 2703
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 1128 4728 2703 4953 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4502 5492 4502 5762
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5627 4502 5627 4277 5852
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 7426 4951 7201
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3472 8647 3742 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4597 8647 4867 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5724 8649 5994 8649
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4730 8645 4730 10220 4955 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5855 8645 5855 10220 6080 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3826 3601 7426 3826 7201
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3826 5851 7426 6076 7201
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 8775 6525 7200 2925 7200 2925 8775 6525 8775
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 6435 6525 4860 2925 4860 2925 6435 6525 6435
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 11250 6525 9675 2925 9675 2925 11250 6525 11250
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 11475 9450 225 180 225 180 11475 9450 11475
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 8622 3600 10197 3825 9972
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 9675 8775 6075 8325 6075 8325 9675 8775 9675
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 7650 450 9405 450 9405 675 7650 675 7650 450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 3285 1575 3285 1800 3510
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3195 8055 1620 8055 1845 8280
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 3150 1350 2025 1575 2250
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 8325 1350 9450 1575 9225
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 7875 1350 3600 1575 3825
4 1 -1 0 0 0 20 0.0000 4 255 810 3603 948 SS:v_x\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4683 5718 0\001
4 1 -1 0 0 0 20 0.0000 4 255 840 3608 10673 SS:F_x\001
4 1 -1 0 0 0 20 0.0000 4 255 840 4733 10673 SS:F_a\001
4 1 -1 0 0 0 20 0.0000 4 255 840 5903 10673 SS:F_y\001
4 1 -1 0 0 0 20 0.0000 4 195 1335 4729 3379 RODa:rod1\001
4 1 -1 0 0 0 20 0.0000 4 195 1335 4731 8196 RODa:rod2\001
4 1 4 0 0 0 20 0.0000 4 255 1410 4771 946 SS:[Joint_1]\001
4 0 1 1 0 3 20 0.0000 4 210 720 6795 3375 Link 1\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 5760 Joint 2\001
4 0 1 1 0 3 20 0.0000 4 210 720 6750 8190 Link 2\001
4 0 1 1 0 3 20 0.0000 4 270 375 6750 10485 Tip\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 1260 Joint 1\001
4 1 4 0 0 0 16 0.0000 4 225 900 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5850 2970 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3605 7835 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4730 7835 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5855 7835 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3607 8512 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4733 8513 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5859 8514 [y_b]\001
4 1 -1 0 0 0 20 0.0000 4 255 810 5850 945 SS:v_y\001
4 2 4 0 0 0 20 0.0000 4 255 1410 2882 5717 SS:[Joint_2]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 675 3510 3375 [alpha]\001
4 1 4 0 0 0 16 0.0000 4 225 675 3555 8145 [alpha]\001
4 0 -1 0 0 0 20 0.0000 4 195 135 1308 8193 1\001
4 1 4 0 0 0 20 0.0000 4 255 1530 1397 1892 SS:[Theta_1]\001
4 1 4 0 0 0 20 0.0000 4 255 1530 1352 9767 SS:[Theta_2]\001
4 0 -1 0 0 0 20 0.0000 4 195 135 1263 3468 0\001

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkP_cr.txt version [981cde0c6a].

1
2
3



-
-
-
lcos
lin
lsin

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkP_desc.tex version [6d2b3ecef6].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TwoLinkP (TwoLinkP_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/19 14:20:07  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkP} is
   displayed in Figure \Ref{TwoLinkP_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkP_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkP_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses the compound components: {\bf ROD}.  {\bf
ROD} is essentially as described in Figure 10.2.
There is no gravity included in this model.

This system has a number of dynamic elements (those corresponding to translation
motion) in derivative causality, thus the system is represnted as a
Differential-Algebraic Equation (Section
\Ref{sec:TwoLinkP_dae.tex}). Hovever, this is of contrained-state form and
therfore can be written as a set of constrained-state equations (Section
\Ref{sec:TwoLinkP_cse.tex}). The corresponding ordinary differential
equation is complicated due to the trig functions involved in
inverting the E matrix.

As well as the standard representation the ``robot-form'' equations
appear in Section  \Ref{sec:TwoLinkP_rfe}. 

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkP_lbl.txt version [a70a30e484].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLinkP: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (TwoLinkP_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/12/05  12:39:49  peterg
% %% Documentation
% %%
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - uniform rods
rod1	none	l_r;l_r;j_r;m_r
rod2	none	l_r;l_r;j_r;m_r

%Zero velocity sources
v_x	SS     internal,0
v_y	SS     internal,0


%Zero force/torque sources
F_x	SS	   0,internal
F_a	SS	   0,internal
F_y	SS	   0,internal

%Named ports
[Joint_1]		SS	external,internal
[Joint_2]		SS	external,internal
[Theta_1]		SS	external,0
[Theta_2]		SS	external,0

%Torque/velocity at joints
%f_a1	SS	 external,external
%f_a2	SS	 external,external


Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkP_obspar.r version [ea44a77131].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce  GPC observability function parameters for system TwoLinkP (TwoLinkP_obspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MTTGPCNy := 2;
MTTGPCNu := 0;
Matrix MTTdU(5,1);
MTTdU(1,1) := MTTdU1;
MTTdU(2,1) := MTTdU2;
MTTdU(3,1) := MTTdU3;
MTTdU(4,1) := MTTdU4;
MTTdU(5,1) := MTTdU5;
Matrix MTTUU(2,5);
MTTUU(1,1) := MTTu1;
MTTUU(1,2) := MTTu11;
MTTUU(1,3) := MTTu12;
MTTUU(1,4) := MTTu13;
MTTUU(1,5) := MTTu14;
MTTUU(2,1) := MTTu2;
MTTUU(2,2) := MTTu21;
MTTUU(2,3) := MTTu22;
MTTUU(2,4) := MTTu23;
MTTUU(2,5) := MTTu24;
END;

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/TwoLinkP_subs.r version [87b1a943f2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce  substitution statements for system TwoLinkPX (TwoLinkPX_subs.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/03/22 20:13:25  peterg
% %% Trig simplification added
% %%
% %% Revision 1.1  1998/03/22 20:12:51  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

END;

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/msdP_abg.fig version [783d02bd00].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 4050 4950 4050 4725 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 4275 3600 5400 3825 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 4050 3375 4050 3150 4275
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 6975 8325 1125 1125 1125 1125 6975 8325 6975
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 4050 6525 4050 6300 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3825 5175 2700 5400 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3825 3600 2700 3825 2925
4 1 -1 0 0 0 20 0.0000 4 195 135 3600 4185 1\001
4 2 4 0 0 0 20 0.0000 4 240 810 2160 4140 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 480 3600 5715 I:j_s\001
4 1 1 1 0 0 20 0.0000 4 255 5355 4815 6345 Mass-spring-damper system (position output)\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 4140 0\001
4 0 4 0 0 0 20 0.0000 4 240 960 6660 4140 SS:[out]\001
4 1 -1 0 0 0 20 0.0000 4 255 615 3600 2565 R:r_s\001
4 1 -1 0 0 0 20 0.0000 4 255 630 5175 2565 C:c_s\001

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/msdP_desc.tex version [be83adfdb1].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system msdP (msdP_desc.tex)
% Generated by MTT on Thu Nov 13 09:38:17 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{msdP} is
   displayed in Figure \Ref{msdP_abg} and its label
   file is listed in Section \Ref{sec:msdP_lbl}.
   The subsystems are listed in Section \Ref{sec:msdP_sub}.


 \textbf{msdP} is a simple Mass-Spring-Damper system with 
 force input and position output. It is set up to provide a specification system
 for each link of the two-link maipulator. This is appropriate because
 \begin{itemize}
 \item  it has compatible physical behaviour with the system itself,
 \item it specifies two decoupled systems,
 \item it has linear behaviour and
 \item it has a simple performance interpretation in terms of system
   rise-time and overshoot.
 \end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/GMV/TwoLinkGMV/msdP_lbl.txt version [dee478e657].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY msdP
%DESCRIPTION <Detailed description here>
%% Label file for system msdP (msdP_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_s		lin	effort,c_s

% Component type I
	j_s		lin	flow,j_s

% Component type R
	r_s		lin	flow,r_s

% Component type SS
	[in]		SS	external,internal
	[out]		SS	external,0

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/INTFX_abg.fig version [d546a8c405].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1801 3151 2701 3151 2476 3376
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3151 4501 3151 4276 3376
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 2926 4726 2026 4951 2251
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 3151 5851 3151 5626 3376
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6975 4050 6975 1350 450 1350 450 4050 6975 4050
4 1 -1 0 0 0 20 0.0000 4 195 375 3151 3241 AF\001
4 1 -1 0 0 0 20 0.0000 4 195 135 4726 3241 0\001
4 1 -1 0 0 0 20 0.0000 4 195 600 4726 1891 CX:c\001
4 1 -1 0 0 0 20 0.0000 4 240 810 1306 3241 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 240 960 6346 3241 SS:[out]\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/INTFX_desc.tex version [9521268b12].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system INTFX (INTFX_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:16 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/08/24 11:20:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{INTFX} is
   displayed in Figure \Ref{INTFX_abg} and its label
   file is listed in Section \Ref{sec:INTFX_lbl}.
   The subsystems are listed in Section \Ref{sec:INTFX_sub}.

\textbf{INTFX} is a two-port component where the effort on port [out]
   is the integral of the flow on port [in].

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/INTFX_lbl.txt version [795adc6745].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY INTFX
%DESCRIPTION <Detailed description here>
%% Label file for system INTFX (INTFX_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type CX
	c		lin	effort,1

% Component type SS
	[in]		SS	external,external
	[out]		SS	external,external

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/RODaX_abg.fig version [69d5bf8861].

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
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
123
124




























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 4950 1800 3375 1800 3600
4 1 -1 0 0 0 20 0.0000 4 195 135 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000 4 195 270 6933 5268 IX:J\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000 4 255 660 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000 4 255 660 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000 4 195 135 3603 5313 0\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 585 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000 4 195 960 4681 5266 INTFX:th\001
4 1 1 1 0 0 20 0.0000 4 195 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000 4 135 180 5580 9990 a\001
4 1 1 1 0 0 20 0.0000 4 195 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 345 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000 4 210 345 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000 4 255 990 2971 1216 SS:[x_a]\001
4 1 4 0 0 0 20 0.0000 4 255 990 2971 9361 SS:[x_b]\001
4 1 4 0 0 0 20 0.0000 4 255 990 8372 1217 SS:[y_a]\001
4 1 4 0 0 0 20 0.0000 4 255 990 8417 9362 SS:[y_b]\001
4 1 4 0 0 0 20 0.0000 4 255 1485 5671 1216 SS:[alpha_a]\001
4 1 4 0 0 0 20 0.0000 4 255 1485 5671 9361 SS:[alpha_b]\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000 4 195 1380 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 9855 Tip b\001
4 1 4 0 0 0 20 0.0000 4 255 1215 1756 3286 SS:[alpha]\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/RODaX_desc.tex version [df20b89acf].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system RODaX (RODaX_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/04/12 15:25:35  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  09:41:19  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{RODaX} is
   displayed in Figure \Ref{RODaX_abg} and its label
   file is listed in Section \Ref{sec:RODaX_lbl}.
   The subsystems are listed in Section \Ref{sec:RODaX_sub}.

{\bf RODaX} is essentially as described in Figure 10.2 of
``Metamodelling''. It has an additional port ``[angle]'' to provide
access to the rod angle.

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/RODaX_lbl.txt version [1c79a51b36].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	RODaX: rigid rod in two dimensions - angle port.
%DESCRIPTION	Port [alpha_a]:	Angular torque/velocity - end a
%DESCRIPTION	Port [alpha_b]:	Angular torque/velocity - end b
%DESCRIPTION	Port [x_a]:	x force/velocity - end a
%DESCRIPTION	Port [x_b]:	x force/velocity - end b
%DESCRIPTION	Port [y_a]:	y force/velocity - end a
%DESCRIPTION	Port [y_b]:	y force/velocity - end b
%DESCRIPTION	Port [alpha]:	rod angle
%DESCRIPTION
%DESCRIPTION	Parameter 1:	length from end 1 to mass centre
%DESCRIPTION	Parameter 2:	length from end 2 to mass centre
%DESCRIPTION	Parameter 3:	inertia about mass centre
%DESCRIPTION	Parameter 4:	mass
%DESCRIPTION	See Section 10.2 of "Metamodelling"


%% Label file for system RODaX (RODaX_lbl.txt)




% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.1  1998/04/12 15:24:06  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,$3
m_x	lin	flow,$4
m_y	lin	flow,$4

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,$1
s2	lsin	flow,$2
c1	lcos	flow,$1
c2	lcos	flow,$2

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/Sensor_abg.fig version [8f5341f4f9].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 2025 3825 2025 3600 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 2025 5850 2025 5625 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 3600 7875 3600 7650 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 1800 2475 2295
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6075 3375 6075 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5850 1800 5850 2295
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 3600 3825 3600 3600 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 3600 6075 3600 5850 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 3330 6300 2205 6525 2430
4 2 4 0 0 0 20 0.0000 4 240 720 2385 2115 SS:[v]\001
4 1 -1 0 0 0 20 0.0000 4 195 420 4140 2115 GY\001
4 1 -1 0 0 0 20 0.0000 4 195 840 6345 2070 AE:tau\001
4 1 -1 0 0 0 20 0.0000 4 195 135 6300 3690 1\001
4 2 4 0 0 0 20 0.0000 4 255 720 2475 3690 SS:[p]\001
4 0 4 0 0 0 20 0.0000 4 240 690 8055 3645 SS:[s]\001
4 1 -1 0 0 0 20 0.0000 4 195 390 4050 3690 AE\001
4 2 4 0 0 0 20 0.0000 4 240 405 5760 1755 [in]\001
4 2 4 0 0 0 20 0.0000 4 240 555 6255 2565 [out]\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/Sensor_lbl.txt version [c79dfd35bb].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Sensor
%DESCRIPTION <Detailed description here>
%% Label file for system Sensor (Sensor_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type AE
	tau		lin	tau

% Component type SS
	[p]		SS	external,external
	[s]		SS	external,external
	[v]		SS	external,external

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_abg.fig version [0183aa4021].

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
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






























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 8550 9225 8550 9000 8775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 8325 9225 8775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 9450 9225 9450 9000 9675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 9225 9225 9675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 8325 5625 8775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 9225 5625 9675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 3825 5625 3825 8550 5625 8550 5400 8775
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 3375 6525 3375 9450 5625 9450 5400 9675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 5400 9225 5400 9000 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 5175 9225 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 6300 9225 6300 9000 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 6075 9225 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 5400 5625 5400 5400 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 5175 5625 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 6300 5625 6300 5400 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 6075 5625 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 5400 3600 5400 3375 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3600 5175 3600 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 6300 3150 6300 2925 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 6075 3150 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 2250 9225 2250 9000 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 2025 9225 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 3150 9225 3150 9000 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9225 2925 9225 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 2250 5625 2250 5400 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 2025 5625 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 3150 5625 3150 5400 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 2925 5625 3375
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11475 3915 2475 3915 2475 1350 11475 1350 11475 3915
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11475 7020 2475 7020 2475 4500 11475 4500 11475 7020
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11475 10215 2475 10215 2475 7650 11475 7650 11475 10215
4 0 -1 0 0 22 20 0.0000 4 270 1935 9315 8640 SS:Theta_1_m\001
4 0 -1 0 0 22 20 0.0000 4 270 1935 9315 9540 SS:Theta_2_m\001
4 1 -1 0 0 22 20 0.0000 4 210 2640 6750 9090 TwoLinkPSX:model\001
4 0 4 0 0 22 20 0.0000 4 270 1230 7920 8415 [Theta_1]\001
4 0 4 0 0 22 20 0.0000 4 270 1230 7920 9315 [Theta_2]\001
4 2 4 0 0 22 20 0.0000 4 270 1140 5535 8415 [Joint_1]\001
4 2 4 0 0 22 20 0.0000 4 270 1140 5535 9315 [Joint_2]\001
4 1 1 1 0 3 26 0.0000 4 270 1005 6750 10080 Model\001
4 1 -1 0 0 22 20 0.0000 4 270 2610 6750 5940 TwoLinkPS:system\001
4 0 4 0 0 22 20 0.0000 4 270 1230 7920 5265 [Theta_1]\001
4 0 4 0 0 22 20 0.0000 4 270 1230 7920 6165 [Theta_2]\001
4 0 -1 0 0 22 20 0.0000 4 270 1530 9315 5490 SS:Theta_1\001
4 0 -1 0 0 22 20 0.0000 4 270 1530 9315 6390 SS:Theta_2\001
4 2 4 0 0 22 20 0.0000 4 270 1140 5535 5265 [Joint_1]\001
4 2 4 0 0 22 20 0.0000 4 270 1140 5535 6165 [Joint_2]\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3825 5490 0\001
4 2 -1 0 0 22 20 0.0000 4 270 1275 1935 6390 SS:Tau_2\001
4 2 -1 0 0 22 20 0.0000 4 270 1275 1980 5490 SS:Tau_1\001
4 1 -1 0 0 22 20 0.0000 4 195 150 3375 6390 0\001
4 1 1 1 0 3 26 0.0000 4 360 1110 6705 6885 System\001
4 0 -1 0 0 22 20 0.0000 4 270 1785 9315 2340 SS:Theta_1_r\001
4 0 -1 0 0 22 20 0.0000 4 270 1785 9315 3240 SS:Theta_2_r\001
4 1 1 1 0 3 26 0.0000 4 360 2055 6705 3735 Specification\001
4 1 -1 0 0 22 20 0.0000 4 270 1860 6795 2340 msdP:spec_1\001
4 1 -1 0 0 22 20 0.0000 4 270 1860 6795 3195 msdP:spec_2\001
4 2 -1 0 0 22 20 0.0000 4 270 1260 4005 2340 SS:Ref_1\001
4 2 -1 0 0 22 20 0.0000 4 270 1260 3960 3240 SS:Ref_2\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_desc.tex version [98eee8129d].

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
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















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system TwoLinkGPC (TwoLinkGPC_desc.tex)
% Generated by MTT on Wed Apr 15 18:15:23 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/04/15 18:41:58  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkGPC} is
   displayed in Figure \Ref{TwoLinkGPC_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkGPC_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkGPC_sub}.
   
   This example provides an illustration of nonlinear generalised
   predictive control (GPC) (continuous-time) operating on a twolink
   manipulator with a modified sensor.  The  sensor is modified in a
   rather contrived way to give a nonlinear system with an
   \emph{unstable} inverse. The idea is that the sensor approximates a
   pure delay of $\tau$ as:
   \begin{equation}
     e^{-s\tau} \approx 1 - s \tau
   \end{equation}
   
   The example contrasts GPC with GMV, which can also be interpreted
   as:
\begin{itemize}
\item the exact linearisation (by feedback) followed by a
  pole-placement design on the resulting linear system and
\item a special case of generalised predictive control (GPC) were the
  prediction horizon is zero and the $P(s)$ polynomial is the same as
  the system relative degree and
\end{itemize}


The composite system of Figure \Ref{TwoLinkGPC_abg} has three
(visible) parts:
\begin{enumerate}
\item a linear decoupled \emph{specification} system that describes the desired
  closed-loop system in terms of a physical system (two decoupled
  mass-spring-damper systems),
\item the system itself (a two-link manipulator) representing the
  system to be controlled, more details are given in Sections
  \Ref{sec:TwoLinkP_ode.tex} and \Ref{sec:TwoLinkP_rfe.tex}.
\item a model of the system with additional state inputs to be used as
  a state observer.
\end{enumerate}
The invisible parts are implemented in the text file
``TwoLinkGPC\_input.txt'' (see Section \Ref{sec:TwoLinkGPC_input.txt}).
These parts are:
\begin{itemize}
\item the reference signal (joint angles)
  \begin{equation}
    w(t) = 
    \begin{cases}
      \begin{pmatrix}
        \pi \\
        0
      \end{pmatrix} & 0 \ge t > 10 \\
      \begin{pmatrix}
        2\pi \\
        0
      \end{pmatrix} & 10 \ge t > 15 \\
      \begin{pmatrix}
        2\pi \\
        \pi
      \end{pmatrix} & 15 \ge t > 30 \\
    \end{cases}
  \end{equation}
\item The control signal (joint torques) being the solution of 
  \begin{equation}
    \phi^*(t) = O_o(\hat x(t)) + O_h(\hat x(t)) u(t) = w(t)
  \end{equation}
where $\hat x$ is the observed state.
\item The observer feedback signal
  \begin{equation}
    u_x = K ( y - \hat y)
  \end{equation}
where $K$ is the observer gain matrix and $y$ and $\hat y$ are the
system and model outputs respectively.
\end{itemize}
The observer gain is set up on the basis of the \emph{linearised}
system using LQ theory. This is implemented in the text file
``TwoLinkGPC\_state.txt'' (see Section \Ref{sec:TwoLinkGPC_state.txt})
using the Octave function ``lqe'' together with the MTT-generated
linearised system ``TwoLink\_sm''.


The system was simulated using Octave under MTT with the results given
in Figures
\Ref{fig:TwoLinkGPC_odeso.ps-TwoLinkGPC-Theta-1,TwoLinkGPC-Theta-1-r}
and
\Ref{fig:TwoLinkGPC_odeso.ps-TwoLinkGPC-Theta-2,TwoLinkGPC-Theta-2-r}
giving the actual and specification angles for joints 1 and 2
respectively.

The initial \emph{system} state was zero except that the angle of the
first rod was $\frac{\pi}{4}$. The initial \emph{observer} state was
(erroneously but deliberately) set at zero. This explains the
(decaying) discrepancy between the actual and specification angles.
Simulations with zero initial state gave precise matching.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_input.tex version [96bb3408b5].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Tex file (TwoLinkGPC_input.txt)
%% Generated by MTT at Wed Apr 29 11:21:32 BST 1998
\begin{verbatim}
# Numerical parameter file (TwoLinkGPC_input.txt)
# Generated by MTT at Mon Apr 13 11:02:37 BST 1998

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

global ObserverGain;

if t<10
  tau = 0;
elseif t<20
  tau = 0.1;
else
  tau = 0.2;
end

# Reference signals
Period = 20;
u(1) =	 -pi*sign(cos(2*pi*t/Period))*(t>5); # TwoLinkGPC (Ref_1)
u(2) =	 pi*sign(sin(2*pi*t/Period)); # TwoLinkGPC (Ref_2)
w = u(1:2);			      # Reference signal

# Control signals
x_model = x(9:12);		# Observed states
[O_o, O_h] = TwoLinkPS_obs(x_model) #GPC O function (affine case)
[spec_n,spec_d] = msdP_tf;	# Spec transfer function
P = spec_d(3:-1:1);		# P poly with ascending coeffs
PP = [eye(2)*P(1) eye(2)*P(2) eye(2)*P(3)]; # Matrix version
PO_o = PP*O_o;			# Compute Py with u zero
PO_h = PP*O_h;			# Coefficient of u
u_control =  PO_h\(w - PO_o);	# GMV control signal

u(3:4) = u_control;		# TwoLinkGPC (Tau_1)

# Observer
x_system = x(5:8);		# System states
error = x_system-x_model;	# Error in states
ObserverInput = ObserverGain*error;
u(5:8) = ObserverInput;		# Set the state-input to the observer

\end{verbatim}

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_input.txt version [cc63da7250].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkGPC_input.txt)
# Generated by MTT at Mon Apr 13 11:02:37 BST 1998

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

global ObserverGain;

if t<10
  tau = 0;
else
  tau = 0.1;
end

# Reference signals
Period = 20;
u(1) =	 -pi*sign(cos(2*pi*t/Period))*(t>5); # TwoLinkGPC (Ref_1)
u(2) =	 pi*sign(sin(2*pi*t/Period)); # TwoLinkGPC (Ref_2)
w = u(1:2);			      # Reference signal

# Control signals
x_model = x(9:12);		# Observed states
[O_o, O_h] = TwoLinkPS_obs(x_model) #GPC O function (affine case)
[spec_n,spec_d] = msdP_tf;	# Spec transfer function
P = spec_d(3:-1:1);		# P poly with ascending coeffs
PP = [eye(2)*P(1) eye(2)*P(2) eye(2)*P(3)]; # Matrix version
PO_o = PP*O_o;			# Compute Py with u zero
PO_h = PP*O_h;			# Coefficient of u
u_control =  PO_h\(w - PO_o);	# GMV control signal

u(3:4) = u_control;		# TwoLinkGPC (Tau_1)

# Observer
x_system = x(5:8);		# System states
error = x_system-x_model;	# Error in states
ObserverInput = ObserverGain*error;
u(5:8) = ObserverInput;		# Set the state-input to the observer

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_lbl.txt version [8c71877011].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLinkGPC - GPC control of two-link manipulator with delay
%DESCRIPTION This composite system provides an illustration
%DESCRIPTION of nonlinear GPC (Generalised Predictive Control) control
%DESCRIPTION (continuous-time) operating on a twolink manipulator. 

%% Label file for system TwoLinkGPC (TwoLinkGPC_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/04/29 09:01:43  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type SS
	Ref_1		SS	external,internal
	Ref_2		SS	external,internal
	Tau_1		SS	external,internal
	Tau_2		SS	external,internal
	Theta_1		SS	external,0
	Theta_2		SS	external,0
	Theta_1_m	SS	external,0
	Theta_2_m	SS	external,0
	Theta_1_r	SS	external,0
	Theta_2_r	SS	external,0

% Component type msdP
	spec_1
	spec_2

% Component type TwoLinkP
	system

% Component type TwoLinkPX
	model

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_numpar.txt version [de52e6ae7d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkGPC_numpar.txt)
# Generated by MTT at Mon Apr 13 10:57:02 BST 1998

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

# Parameters
c_s = 	1.0; # msdP
j_s = 	1.0; # msdP
r_s = 	2.0; # msdP
tau =   0.1; # msdP
l_r = 	0.5; # TwoLinkP,TwoLinkPX
m_r = 	1.0; # TwoLinkP,TwoLinkPX
j_r = 	m_r*l_r*l_r/3; # TwoLinkP,TwoLinkPX

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_obspar.r version [9796c5f718].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce  GPC observability function parameters for system TwoLinkGPC (TwoLinkGPC_obspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MTTGPCNy := 2;
MTTGPCNu := 0;
Matrix MTTdU(5,1);
MTTdU(1,1) := MTTdU1;
MTTdU(2,1) := MTTdU2;
MTTdU(3,1) := MTTdU3;
MTTdU(4,1) := MTTdU4;
MTTdU(5,1) := MTTdU5;
Matrix MTTUU(2,5);
MTTUU(1,1) := MTTu1;
MTTUU(1,2) := MTTu11;
MTTUU(1,3) := MTTu12;
MTTUU(1,4) := MTTu13;
MTTUU(1,5) := MTTu14;
MTTUU(2,1) := MTTu2;
MTTUU(2,2) := MTTu21;
MTTUU(2,3) := MTTu22;
MTTUU(2,4) := MTTu23;
MTTUU(2,5) := MTTu24;
END;

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_rep.txt version [68da84bc7f].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TwoLinkGPC (TwoLinkGPC_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt TwoLinkGPC abg tex
mtt TwoLinkGPC struc tex
mtt TwoLinkGPC sympar tex

mtt TwoLinkPS struc tex
mtt TwoLinkPS rfe tex
mtt TwoLinkPS ode tex
mtt TwoLinkPS obs tex

mtt TwoLinkPS ss tex
mtt TwoLinkPS sm tex

mtt msdP tf tex

mtt TwoLinkGPC numpar txt
mtt TwoLinkGPC state txt
mtt TwoLinkGPC input txt

mtt TwoLinkGPC odeso ps 'TwoLinkGPC_Theta_1,TwoLinkGPC_Theta_1_r'
mtt TwoLinkGPC odeso ps 'TwoLinkGPC_Theta_2,TwoLinkGPC_Theta_2_r'



Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_simpar.txt version [85c8e666bb].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system TwoLinkGPC (TwoLinkGPC_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=30
DT=0.1
STEPFACTOR=2

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_simpar.txt_old version [85c8e666bb].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system TwoLinkGPC (TwoLinkGPC_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=30
DT=0.1
STEPFACTOR=2

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkGPC_state.txt version [50c9fbc84f].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkGPC_state.txt)
# Generated by MTT at Thu Apr 23 09:10:43 BST 1998

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

global ObserverGain;

# Set the states
x(1) =	 0 ; # TwoLinkGPC_spec_1 (c_s)
x(2) =	 0 ; # TwoLinkGPC_spec_1 (j_s)
x(3) =	 0 ; # TwoLinkGPC_spec_2 (c_s)
x(4) =	 0 ; # TwoLinkGPC_spec_2 (j_s)
x(5) =	 0 ; # TwoLinkGPC_system_rod1 (J)
x(6) =	 0 ; # TwoLinkGPC_system_rod1_th (3)
x(7) =	 0 ; # TwoLinkGPC_system_rod2 (J)
x(8) =	 0 ; # TwoLinkGPC_system_rod2_th (3)
x(9) =	 0 ; # TwoLinkGPC_model_rod1_J (i)
x(10) =	 0 ; # TwoLinkGPC_model_rod1_th_c (c)
x(11) =	 0 ; # TwoLinkGPC_model_rod2_J (i)
x(12) =	 0 ; # TwoLinkGPC_model_rod2_th_c (c)

# Observer design
[A,B,C] = TwoLinkPS_sm;		# Get the linearised system
sigma = 0.1;			# Measurement noise variance (pretend)
k = lqe(A,eye(4),C,eye(4),sigma*eye(2))
ObserverGain = k*C;		# This system happens to have a linear output

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPSX_abg.fig version [9ab26d89d5].

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
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








































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 1125 485 485 8550 1125 8730 1575
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 5625 485 485 8550 5625 9035 6110
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3468 1128 3738 1128
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4593 2703 4863 2703
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 1128 4728 2703 4953 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4502 5492 4502 5762
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5627 4502 5627 4277 5852
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 7426 4951 7201
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3472 8647 3742 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4597 8647 4867 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5724 8649 5994 8649
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4730 8645 4730 10220 4955 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5855 8645 5855 10220 6080 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3826 3601 7426 3826 7201
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3826 5851 7426 6076 7201
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 8775 6525 7200 2925 7200 2925 8775 6525 8775
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 6435 6525 4860 2925 4860 2925 6435 6525 6435
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 11250 6525 9675 2925 9675 2925 11250 6525 11250
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 11475 9450 225 180 225 180 11475 9450 11475
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 8622 3600 10197 3825 9972
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 9675 8775 6075 8325 6075 8325 9675 8775 9675
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 7650 450 9405 450 9405 675 7650 675 7650 450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 3285 1575 3285 1800 3510
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3195 8055 1620 8055 1845 8280
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 3150 1350 2025 1575 2250
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 8325 1350 9450 1575 9225
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 7875 1350 3600 1575 3825
4 1 -1 0 0 0 20 0.0000 4 255 810 3603 948 SS:v_x\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4683 5718 0\001
4 1 -1 0 0 0 20 0.0000 4 255 840 3608 10673 SS:F_x\001
4 1 -1 0 0 0 20 0.0000 4 255 840 4733 10673 SS:F_a\001
4 1 -1 0 0 0 20 0.0000 4 255 840 5903 10673 SS:F_y\001
4 1 -1 0 0 0 20 0.0000 4 195 1335 4729 3379 RODaX:rod1\001
4 1 -1 0 0 0 20 0.0000 4 195 1335 4731 8196 RODaX:rod2\001
4 1 4 0 0 0 20 0.0000 4 255 1410 4771 946 SS:[Joint_1]\001
4 0 1 1 0 3 20 0.0000 4 210 720 6795 3375 Link 1\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 5760 Joint 2\001
4 0 1 1 0 3 20 0.0000 4 210 720 6750 8190 Link 2\001
4 0 1 1 0 3 20 0.0000 4 270 375 6750 10485 Tip\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 1260 Joint 1\001
4 1 4 0 0 0 16 0.0000 4 225 900 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5850 2970 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3605 7835 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4730 7835 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5855 7835 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3607 8512 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4733 8513 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5859 8514 [y_b]\001
4 1 -1 0 0 0 20 0.0000 4 255 810 5850 945 SS:v_y\001
4 2 4 0 0 0 20 0.0000 4 255 1410 2882 5717 SS:[Joint_2]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 675 3510 3375 [alpha]\001
4 1 4 0 0 0 16 0.0000 4 225 675 3555 8145 [alpha]\001
4 0 -1 0 0 0 20 0.0000 4 195 135 1308 8193 1\001
4 1 4 0 0 0 20 0.0000 4 255 1530 1397 1892 SS:[Theta_1]\001
4 1 4 0 0 0 20 0.0000 4 255 1530 1352 9767 SS:[Theta_2]\001
4 0 -1 0 0 0 20 0.0000 4 195 135 1263 3468 0\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPSX_desc.tex version [61db22c233].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TwoLinkPSX (TwoLinkPSX_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/19 14:20:07  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkPSX} is
   displayed in Figure \Ref{TwoLinkPSX_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkPSX_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkPSX_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses the compound components: {\bf ROD}.  {\bf
ROD} is essentially as described in Figure 10.2.
There is no gravity included in this model.

This system has a number of dynamic elements (those corresponding to translation
motion) in derivative causality, thus the system is represnted as a
Differential-Algebraic Equation (Section
\Ref{sec:TwoLinkPSX_dae.tex}). Hovever, this is of contrained-state form and
therfore can be written as a set of constrained-state equations (Section
\Ref{sec:TwoLinkPSX_cse.tex}). The corresponding ordinary differential
equation is complicated due to the trig functions involved in
inverting the E matrix.

As well as the standard representation the ``robot-form'' equations
appear in Section  \Ref{sec:TwoLinkPSX_rfe}. 

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPSX_lbl.txt version [b2d7b7efd0].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLinkPSX: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (TwoLinkPSX_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/12/05  12:39:49  peterg
% %% Documentation
% %%
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - uniform rods
rod1	none	l_r;l_r;j_r;m_r
rod2	none	l_r;l_r;j_r;m_r

%Zero velocity sources
v_x	SS     internal,0
v_y	SS     internal,0


%Zero force/torque sources
F_x	SS	   0,internal
F_a	SS	   0,internal
F_y	SS	   0,internal

%Named ports
[Joint_1]		SS	external,internal
[Joint_2]		SS	external,internal
[Theta_1]		SS	external,0
[Theta_2]		SS	external,0

%Torque/velocity at joints
%f_a1	SS	 external,external
%f_a2	SS	 external,external


Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPS_abg.fig version [7c9d2b5819].

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
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
123
124
125
126






























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 11700 1800 485 485 11700 1800 11880 2250
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 11700 6300 485 485 11700 6300 12185 6785
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11745 11925 11745 450 45 450 45 11925 11745 11925
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5
	 7650 900 4725 900 4725 3375 3375 3375 3600 3600
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4950 8505 4950 4230 5175 4455
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 6300 4052 6302 3827 6527
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 4275 6525 4275 8325 3150 8325 3375 8550
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 6300 7652 6300 7427 6525
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6618 1803 6888 1803
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8870 1805 9140 1805
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7743 3378 8013 3378
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7878 1125 7878 3378 8103 3153
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7652 6167 7652 6437
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7876 6526 7876 8101 8101 7876
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6622 9322 6892 9322
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7747 9322 8017 9322
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8874 9324 9144 9324
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7880 9320 7880 10895 8105 10670
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9005 9320 9005 10895 9230 10670
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6751 4501 6751 8101 6976 7876
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9001 4501 9001 8101 9226 7876
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9675 9450 9675 7875 6075 7875 6075 9450 9675 9450
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9675 7110 9675 5535 6075 5535 6075 7110 9675 7110
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9675 11925 9675 10350 6075 10350 6075 11925 9675 11925
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6753 1803 6753 3378 6978 3153
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9003 1803 9003 3378 9228 3153
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7876 4501 7876 6076 8101 5851
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9675 4725 6075 4725 6075 3150 9675 3150 9675 4725
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 9297 6750 10872 6975 10647
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11925 5850 11925 2250 11475 2250 11475 5850 11925 5850
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11925 10350 11925 6750 11475 6750 11475 10350 11925 10350
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 10800 1125 12555 1125 12555 1350 10800 1350 10800 1125
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9630 2745 9630 1170 6030 1170 6030 2745 9630 2745
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8910 900 8145 900 8370 1125
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2790 3735 2115 3735 2340 3960
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4725 3960 3330 3960 3555 4185
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 3960 5040 3960 5265 4185
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2700 8550 2025 8550 2250 8775
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 8775 3150 8775 3375 9000
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7200 8775 4905 8775 5130 9000
4 0 -1 0 0 0 20 0.0000 4 195 135 4863 4053 0\001
4 2 4 0 0 0 20 0.0000 4 255 1410 2702 6392 SS:[Joint_2]\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4188 6393 1\001
4 1 -1 0 0 0 20 0.0000 4 255 810 6753 1623 SS:v_x\001
4 0 -1 0 0 0 20 0.0000 4 195 135 7833 6393 0\001
4 1 -1 0 0 0 20 0.0000 4 255 840 6758 11348 SS:F_x\001
4 1 -1 0 0 0 20 0.0000 4 255 840 7883 11348 SS:F_a\001
4 1 -1 0 0 0 20 0.0000 4 255 840 9053 11348 SS:F_y\001
4 0 1 1 0 3 20 0.0000 4 210 720 9945 4050 Link 1\001
4 0 1 1 0 3 20 0.0000 4 225 795 9900 6435 Joint 2\001
4 0 1 1 0 3 20 0.0000 4 210 720 9900 8865 Link 2\001
4 0 1 1 0 3 20 0.0000 4 270 375 9900 11160 Tip\001
4 0 1 1 0 3 20 0.0000 4 225 795 9900 1935 Joint 1\001
4 1 4 0 0 0 16 0.0000 4 225 900 7875 3645 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 6750 4455 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 7875 4455 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 9000 4455 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 495 9000 3645 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 495 6755 8510 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 7880 8510 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 6757 9187 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 7883 9188 [alpha_b]\001
4 1 -1 0 0 0 20 0.0000 4 255 810 9000 1620 SS:v_y\001
4 1 4 0 0 0 16 0.0000 4 210 495 6750 3645 [x_a]\001
4 0 -1 0 0 0 20 0.0000 4 195 135 7788 993 1\001
4 0 4 0 0 0 20 0.0000 4 255 1410 9046 991 SS:[Joint_1]\001
4 2 4 0 0 0 20 0.0000 4 255 1530 1892 3827 SS:[Theta_1]\001
4 1 4 0 0 0 16 0.0000 4 210 240 2700 3555 [s]\001
4 1 -1 0 0 0 20 1.5708 4 195 780 3154 3731 Sensor\001
4 1 4 0 0 0 16 0.0000 4 225 270 3420 3825 [p]\001
4 1 4 0 0 0 16 0.0000 4 210 270 3330 3195 [v]\001
4 1 -1 0 0 0 20 0.0000 4 195 1335 7879 4009 RODa:rod1\001
4 1 4 0 0 0 16 0.0000 4 225 675 6885 4005 [alpha]\001
4 1 4 0 0 0 16 0.0000 4 210 270 3375 8235 [v]\001
4 1 4 0 0 0 16 0.0000 4 210 240 2655 8460 [s]\001
4 1 -1 0 0 0 20 1.5708 4 195 780 3064 8546 Sensor\001
4 2 4 0 0 0 20 0.0000 4 255 1530 1937 8642 SS:[Theta_2]\001
4 1 4 0 0 0 16 0.0000 4 225 270 3375 8730 [p]\001
4 1 4 0 0 0 16 0.0000 4 225 495 8780 8510 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 225 510 8739 9189 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 675 7065 8820 [alpha]\001
4 1 -1 0 0 0 20 0.0000 4 195 1335 8061 8826 RODa:rod2\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4593 8823 1\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPS_desc.tex version [72bea7d311].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TwoLinkPS (TwoLinkPS_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/19 14:20:07  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkPS} is
   displayed in Figure \Ref{TwoLinkPS_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkPS_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkPS_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses the compound components: {\bf ROD}.  {\bf
ROD} is essentially as described in Figure 10.2.
There is no gravity included in this model.

This system has a number of dynamic elements (those corresponding to translation
motion) in derivative causality, thus the system is represnted as a
Differential-Algebraic Equation (Section
\Ref{sec:TwoLinkPS_dae.tex}). Hovever, this is of contrained-state form and
therfore can be written as a set of constrained-state equations (Section
\Ref{sec:TwoLinkPS_cse.tex}). The corresponding ordinary differential
equation is complicated due to the trig functions involved in
inverting the E matrix.

As well as the standard representation the ``robot-form'' equations
appear in Section  \Ref{sec:TwoLinkPS_rfe}. 

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPS_lbl.txt version [23b89fb091].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLinkPS: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (TwoLinkPS_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/12/05  12:39:49  peterg
% %% Documentation
% %%
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - uniform rods
rod1	none	l_r;l_r;j_r;m_r
rod2	none	l_r;l_r;j_r;m_r

%Zero velocity sources
v_x	SS     internal,0
v_y	SS     internal,0


%Zero force/torque sources
F_x	SS	   0,internal
F_a	SS	   0,internal
F_y	SS	   0,internal

%Named ports
[Joint_1]		SS	external,internal
[Joint_2]		SS	external,internal
[Theta_1]		SS	external,0
[Theta_2]		SS	external,0

%Torque/velocity at joints
%f_a1	SS	 external,external
%f_a2	SS	 external,external


Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPS_obspar.r version [887f4afee4].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce  GPC observability function parameters for system TwoLinkPS (TwoLinkPS_obspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MTTGPCNy := 2;
MTTGPCNu := 0;
Matrix MTTdU(5,1);
MTTdU(1,1) := MTTdU1;
MTTdU(2,1) := MTTdU2;
MTTdU(3,1) := MTTdU3;
MTTdU(4,1) := MTTdU4;
MTTdU(5,1) := MTTdU5;
Matrix MTTUU(2,5);
MTTUU(1,1) := MTTu1;
MTTUU(1,2) := MTTu11;
MTTUU(1,3) := MTTu12;
MTTUU(1,4) := MTTu13;
MTTUU(1,5) := MTTu14;
MTTUU(2,1) := MTTu2;
MTTUU(2,2) := MTTu21;
MTTUU(2,3) := MTTu22;
MTTUU(2,4) := MTTu23;
MTTUU(2,5) := MTTu24;
END;

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPS_simp.r version [5fa9cf5d7f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce commands to simplify output for system TwoLinkP (TwoLinkP_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LET cos(mttx2) = c_2;
LET sin(mttx2) = s_2;

LET cos(mttx4) = c_4;
LET sin(mttx4) = s_4;

LET cos(mttx2-mttx4) = c;
LET sin(mttx2-mttx4) = s;

END;

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/TwoLinkPS_subs.r version [47554050fc].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce  substitution statements for system TwoLinkPSX (TwoLinkPSX_subs.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/03/22 20:13:25  peterg
% %% Trig simplification added
% %%
% %% Revision 1.1  1998/03/22 20:12:51  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

END;

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/msdPS_abg.fig version [9434c7d473].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 4050 4950 4050 4725 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 4275 3600 5400 3825 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 4050 3375 4050 3150 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 4050 6525 4050 6300 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3825 5175 2700 5400 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3825 3600 2700 3825 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 4050 8100 4050 7875 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9000 4050 10125 4050 9900 4275
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11475 6975 11475 1125 1125 1125 1125 6975 11475 6975
4 1 -1 0 0 0 20 0.0000 4 195 135 3600 4185 1\001
4 2 4 0 0 0 20 0.0000 4 240 810 2160 4140 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 480 3600 5715 I:j_s\001
4 1 1 1 0 0 20 0.0000 4 255 7035 4815 6345 Mass-spring-damper system (position output with extra lag)\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 4140 0\001
4 1 -1 0 0 0 20 0.0000 4 255 615 3600 2565 R:r_s\001
4 1 -1 0 0 0 20 0.0000 4 255 630 5175 2565 C:c_s\001
4 1 -1 0 0 0 20 0.0000 4 195 390 6750 4140 AE\001
4 1 -1 0 0 0 20 0.0000 4 195 690 8550 4140 RC:rc\001
4 0 4 0 0 0 20 0.0000 4 240 960 10260 4140 SS:[out]\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/msdPS_abg.fig.bak version [783d02bd00].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 4050 4950 4050 4725 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 4275 3600 5400 3825 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 4050 3375 4050 3150 4275
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 6975 8325 1125 1125 1125 1125 6975 8325 6975
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 4050 6525 4050 6300 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3825 5175 2700 5400 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3825 3600 2700 3825 2925
4 1 -1 0 0 0 20 0.0000 4 195 135 3600 4185 1\001
4 2 4 0 0 0 20 0.0000 4 240 810 2160 4140 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 480 3600 5715 I:j_s\001
4 1 1 1 0 0 20 0.0000 4 255 5355 4815 6345 Mass-spring-damper system (position output)\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 4140 0\001
4 0 4 0 0 0 20 0.0000 4 240 960 6660 4140 SS:[out]\001
4 1 -1 0 0 0 20 0.0000 4 255 615 3600 2565 R:r_s\001
4 1 -1 0 0 0 20 0.0000 4 255 630 5175 2565 C:c_s\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/msdPS_desc.tex version [c342c284c0].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system msdPS (msdPS_desc.tex)
% Generated by MTT on Thu Nov 13 09:38:17 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{msdPS} is
   displayed in Figure \Ref{msdPS_abg} and its label
   file is listed in Section \Ref{sec:msdPS_lbl}.
   The subsystems are listed in Section \Ref{sec:msdPS_sub}.


 \textbf{msdPS} is a simple Mass-Spring-Damper system with 
 force input and position output. It is set up to provide a specification system
 for each link of the two-link maipulator. This is appropriate because
 \begin{itemize}
 \item  it has compatible physical behaviour with the system itself,
 \item it specifies two decoupled systems,
 \item it has linear behaviour and
 \item it has a simple performance interpretation in terms of system
   rise-time and overshoot.
 \end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/msdPS_lbl.txt version [79760470ab].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY msdPS
%DESCRIPTION <Detailed description here>
%% Label file for system msdPS (msdPS_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_s		lin	effort,c_s

% Component type I
	j_s		lin	flow,j_s

% Component type R
	r_s		lin	flow,r_s

% Component type RC
	rc		none	tau;1

% Component type SS
	[in]		SS	external,internal
	[out]		SS	external,0

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/msdP_abg.fig version [783d02bd00].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 4050 4950 4050 4725 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 4275 3600 5400 3825 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 4050 3375 4050 3150 4275
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 6975 8325 1125 1125 1125 1125 6975 8325 6975
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 4050 6525 4050 6300 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3825 5175 2700 5400 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3825 3600 2700 3825 2925
4 1 -1 0 0 0 20 0.0000 4 195 135 3600 4185 1\001
4 2 4 0 0 0 20 0.0000 4 240 810 2160 4140 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 480 3600 5715 I:j_s\001
4 1 1 1 0 0 20 0.0000 4 255 5355 4815 6345 Mass-spring-damper system (position output)\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 4140 0\001
4 0 4 0 0 0 20 0.0000 4 240 960 6660 4140 SS:[out]\001
4 1 -1 0 0 0 20 0.0000 4 255 615 3600 2565 R:r_s\001
4 1 -1 0 0 0 20 0.0000 4 255 630 5175 2565 C:c_s\001

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/msdP_desc.tex version [be83adfdb1].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system msdP (msdP_desc.tex)
% Generated by MTT on Thu Nov 13 09:38:17 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{msdP} is
   displayed in Figure \Ref{msdP_abg} and its label
   file is listed in Section \Ref{sec:msdP_lbl}.
   The subsystems are listed in Section \Ref{sec:msdP_sub}.


 \textbf{msdP} is a simple Mass-Spring-Damper system with 
 force input and position output. It is set up to provide a specification system
 for each link of the two-link maipulator. This is appropriate because
 \begin{itemize}
 \item  it has compatible physical behaviour with the system itself,
 \item it specifies two decoupled systems,
 \item it has linear behaviour and
 \item it has a simple performance interpretation in terms of system
   rise-time and overshoot.
 \end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/GPC/TwoLinkGPC/msdP_lbl.txt version [dee478e657].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY msdP
%DESCRIPTION <Detailed description here>
%% Label file for system msdP (msdP_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_s		lin	effort,c_s

% Component type I
	j_s		lin	flow,j_s

% Component type R
	r_s		lin	flow,r_s

% Component type SS
	[in]		SS	external,internal
	[out]		SS	external,0

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/Fixed_abg.fig version [59be0b9ae0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 1800 5400 1800 5175 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4230 2700 5355 2700 5130 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 1575 5400 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 2475 5400 2925
4 0 0 100 0 18 20 0.0000 4 225 810 5625 1890 SS:z1\001
4 0 0 100 0 18 20 0.0000 4 240 810 5625 2790 SS:z2\001
4 2 4 100 0 18 20 0.0000 4 285 1305 4140 1890 SS:[y_in]\001
4 2 4 100 0 18 20 0.0000 4 285 1860 4140 2790 SS:[theta_in]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/Fixed_lbl.txt version [2f6cde2cc7].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Fixed (Fixed_lbl.txt)
%SUMMARY Fixed
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	y_in,theta_in

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[theta_in]	SS		external,external
	[y_in]		SS		external,external
	z1		SS		internal,0
	z2		SS		internal,0

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/Free_abg.fig version [c03c8c2488].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 1800 5400 1800 5175 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4230 2700 5355 2700 5130 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 1575 5400 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 2475 5400 2925
4 2 0 100 0 18 20 0.0000 4 225 810 4140 1890 SS:z1\001
4 2 0 100 0 18 20 0.0000 4 240 810 4140 2790 SS:z2\001
4 0 4 100 0 18 20 0.0000 4 285 1500 5490 1890 SS:[y_out]\001
4 0 4 100 0 18 20 0.0000 4 285 2055 5445 2790 SS:[theta_out]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/Free_lbl.txt version [517bb24436].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Free (Free_lbl.txt)
%SUMMARY Free
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	out	y_out,theta_out

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[theta_out]	SS		external,external
	[y_out]		SS		external,external
	z1		SS		0,internal
	z2		SS		0,internal



Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/Make_figures.m version [7ca19d2a8a].

1
2
3
4




-
-
-
-
#!/bin/sh
## Script file Make_figures.

ppp_1("PPPCantileverBeam",1:2,[1 2;1 3]); # 2 inputs; modes 1 2 and 1 and 3

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/PPPCantileverBeam_abg.fig version [3a565598a0].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1125 2700 2250 2700 2025 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 8775 2700 9900 2700 9675 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 2700 3825 2700 3600 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4230 2700 5355 2700 5130 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4095 6300 4095 4500 4320 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3870 4500 4320 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5850 2700 6975 2700 6750 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7380 2700 8505 2700 8280 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7245 6300 7245 4500 7470 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 7020 4500 7470 4500
4 1 0 100 0 18 20 1.5708 4 225 630 1035 2700 Free\001
4 1 0 100 0 18 20 1.5708 4 225 780 10260 2700 Fixed\001
4 1 0 100 0 18 20 1.5708 4 285 3690 8775 2700 BernoulliEuler:Chunk_3*3\001
4 1 0 100 0 18 20 1.5708 4 285 3690 2610 2700 BernoulliEuler:Chunk_1*3\001
4 1 0 100 0 18 20 1.5708 4 300 3480 4140 2700 pBernoulliEuler:Patch_1\001
4 1 4 100 0 18 16 0.0000 4 240 900 4095 4455 [torque]\001
4 1 0 100 0 18 20 0.0000 4 285 1275 4050 6660 SS:tau_1\001
4 1 0 100 0 18 20 1.5708 4 285 3690 5760 2700 BernoulliEuler:Chunk_2*8\001
4 1 0 100 0 18 20 1.5708 4 300 3480 7290 2700 pBernoulliEuler:Patch_2\001
4 1 4 100 0 18 16 0.0000 4 240 900 7245 4455 [torque]\001
4 1 0 100 0 18 20 0.0000 4 285 1275 7200 6660 SS:tau_2\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/PPPCantileverBeam_desc.tex version [c5991e9114].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system PPPCantileverBeam (PPPCantileverBeam_desc.tex)
% Generated by MTT on Mon Apr 19 07:04:54 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/05/18 04:01:50  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The acausal bond graph of system \textbf{PPPCantileverBeam} is displayed in
Figure \Ref{fig:PPPCantileverBeam_abg.ps} and its label file is listed in
Section \Ref{sec:PPPCantileverBeam_lbl}.  The subsystems are listed in Section
\Ref{sec:PPPCantileverBeam_sub}.
   
This example represents the dynamics of a uniform beam with one fixed
and one free end.  The beam is approximated by 16 equal lumps using
the Bernoulli-Euler approximation with damping. The ouputs are taken
to be the 16 lump velocities, the two inputs are taken to be torques
applied to lumps 3 away from each end; this approximates the effect of
two piezoelectric patches.

The system parameters are given in Section
\Ref{sec:PPPCantileverBeam_numpar.tex}.
The system has 32 states (16 modes of vibration), 2 inputs and 12
outputs.
The first 8 modal frequencies are given in Table \ref{tab:modes}.
\begin{table}[htbp]
  \begin{center}
    \begin{tabular}{||c|c||c|c||}
      \hline
      Mode & $\omega_i$ & Mode & $\omega_i$\\
      \hline
      \hline
      1 & 0.0079504 & 5 & 0.4352376\\
      2 & 0.0498140 & 6 & 0.6338899\\
      3 & 0.1386209 & 7 & 0.8573604\\
      4 & 0.2682835 & 8 & 1.0976942\\
      \hline
    \end{tabular}
    \caption{Modal frequencies}
    \label{tab:modes}
  \end{center}
\end{table}

Figure \Ref{fig:PPPCantileverBeam_lmfr.ps} shows the log modulus of the frequency
response and Figure \Ref{fig:PPPCantileverBeam_pppy0.ps} shows the system transient
reponse with no control and an initial unit twist.

Figure \Ref{fig:PPPCantileverBeam_pppy.ps} shows closed loop reponse when
controlled by a PPP controller attempting to damp modes 1 and 2 from
input 1 and modes 1 and three from input 2. Figure
\Ref{fig:PPPCantileverBeam_pppy.ps} shows the corresponding control signals.







Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/PPPCantileverBeam_input.txt version [d4ae1b0a98].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (PPPCantileverBeam_input.txt)
# Generated by MTT at Thu Apr 22 00:12:54 BST 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the inputs
mttu(1) = exp(-t/0.1); 	# tau (PPPCantileverBeam)

# Set the switches

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/PPPCantileverBeam_lbl.txt version [5eda0fc64e].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system PPPCantileverBeam (PPPCantileverBeam_lbl.txt)
%SUMMARY PPPCantileverBeam
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Declare some variables
%VAR Area
%VAR AreaMoment
%VAR BeamLength
%VAR BeamThickness
%VAR BeamWidth
%VAR Density
%VAR N
%VAR Youngs
%VAR EI
%VAR rhoA

% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type BenoulliEuler
  Chunk_1
  Patch_1
  Chunk_2
  Patch_2
  Chunk_3


% Component type SS
	tau_1	SS		external,external
	tau_2	SS		external,external

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/PPPCantileverBeam_numpar.txt version [7458335000].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (PPPCantileverBeam_numpar.txt)
# Generated by MTT at Mon Apr 19 06:24:08 BST 1999

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

# Parameters
N = 16;
BeamLength = 0.58;
BeamWidth = 0.05;
BeamThickness = 0.005;
Youngs = 1e6;
Density = 1e5;
Area = BeamWidth*BeamThickness;
AreaMoment = (BeamThickness*BeamWidth^2)/12;


EI= 58.6957			# from Reza
rhoA= 0.7989			# from Reza
 
dz = BeamLength/N;		# Incremental length
dm = rhoA*dz;			# Incremental mass
dk = EI/dz;			# Incremental stiffness
dr = 1e-2;			# Damping

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/PPPCantileverBeam_rep.txt version [49cce86377].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system PPPCantileverBeam (PPPCantileverBeam_rep.txt)
## Generated by MTT on" Mon Apr 19 06:43:08 BST 1999.

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

mtt PPPCantileverBeam abg tex			# The system description
## mtt PPPCantileverBeam cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt PPPCantileverBeam struc tex	        # The system structure
## mtt PPPCantileverBeam dae tex	        # The system dae
## mtt PPPCantileverBeam ode tex	        # The system ode 
## mtt PPPCantileverBeam sspar tex		# Steady-state parameters
## mtt PPPCantileverBeam ss tex 		# Steady state
## mtt PPPCantileverBeam dm tex		# Descriptor matrices (of linearised system)
## mtt PPPCantileverBeam sm tex		# State matrices (of linearised system)
## mtt PPPCantileverBeam tf tex		# Transfer function (of linearised system)
mtt PPPCantileverBeam simpar tex		# Simulation parameters
mtt PPPCantileverBeam numpar tex		# Numerical simulation parameters
## mtt PPPCantileverBeam input tex		# Simulation input
## mtt PPPCantileverBeam odeso ps		# Simulation output
mtt PPPCantileverBeam lmfr ps		# log modulus of frequency response (of linearised system)

mtt PPPCantileverBeam pppy ps		# PPP output
mtt PPPCantileverBeam pppu ps		# PPP input
mtt PPPCantileverBeam pppy0 ps		# PPP open-loop op

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/PPPCantileverBeam_simpar.txt version [7c1db12c6b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system PPPCantileverBeam (PPPCantileverBeam_simpar.txt)
# Generated by MTT on Mon Apr 19 06:32:42 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 1.0;       # Last time in simulation
DT          = 0.01;        # Print interval
STEPFACTOR  = 10;          # Integration steps per print interval
WMIN        = 1;         # Minimum frequency = 10^WMIN
WMAX        = 4;          # Maximum frequency = 10^WMAX
WSTEPS      = 500;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/PPPCantileverBeam_simpar.txt_old version [df1ea30bc7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system PPPCantileverBeam (PPPCantileverBeam_simpar.txt)
# Generated by MTT on Mon Apr 19 06:32:42 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 1.0;       # Last time in simulation
DT          = 0.01;        # Print interval
STEPFACTOR  = 10;          # Integration steps per print interval
METHOD      = Implicit;   # Integration method
WMIN        = 1;         # Minimum frequency = 10^WMIN
WMAX        = 4;          # Maximum frequency = 10^WMAX
WSTEPS      = 500;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/ppp_1.m version [4acd8828e7].

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
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
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
173
174
175
176
















































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function  ppp_1(Name,Inputs,Modes);

# Name = "CantileverBeam"
# Inputs = 1:2
# Modes = [1 2;1 3]

  path(path,"~/Research/CGPC/PPP");  
  
  Name,Inputs,Modes

  ## System
  system(sprintf("mtt -q %s numpar m", Name));
  system(sprintf("mtt -q %s sm m", Name));
  par = eval(sprintf("%s_numpar;",Name));
  eval(sprintf("[A,B,C,D]=%s_sm(par);",Name));
  [n_x,n_u,n_y] = abcddim(A,B,C,D)


  ## Change B
  B = B(:,Inputs);
  [junk,n_u]=size(B);
  n_u

  ## Redo C and D to reveal ALL velocities
   n_y = n_x/2
   C = zeros(n_y,n_x);
   for i = 1:n_y
     C(i,2*i-1) = 1;
   endfor

  ## Sort out D
  D = zeros(n_y,n_u);

  e = eig(A);			# Eigenvalues
  N = length(e);
  frequencies = sort(imag(e));
  frequencies = frequencies(N/2+1:N); # Modal frequencies

  ## Controller
  ## Controller design parameters
  t = [0.9:0.01:1.0];		# Optimisation horizon

  ## Specify input basis functions 
  ##  - damped sinusoids with same frequencies as beam
  damping_ratio = [0.1 0.1];		# Damping ratio of inputs
  A_u=[];
#   Modes = [1  3  
# 	   1  2];		# Choose modes to be controlled by each input 
  if n_u == 1			# Put all modes on each input
    Modes = [Modes; Modes];
  endif
  
  Modes

  for i=Inputs
    A_ui = damped_matrix(frequencies(Modes(i,:)),damping_ratio(i)*ones(size(Modes(i,:))));
    A_u = [A_u;A_ui];
    u_0 = ones(n_x,1);		# Initial conditions
  endfor
  

  A_w = 0;			# Setpoint
  Q = ones(n_y,1);		# Output weighting

  ## Design 
  disp("Control design - unconstrained");
  [k_x,k_w,K_x,K_w,Us0,J_uu,J_ux,J_uw] = ppp_lin  (A,B,C,D,A_u,A_w,t); # Unconstrained design

  ## Organise some plots
   dt = 0.002;		# Time increment
#   T =  0:dt:t(length(t));	# Time starting at zero but past horizon
   T =  0:dt:1.0;		# Time 

  ## Set up an "typical" initial condition
  x_0 = zeros(n_x,1);
  x_0(2:2:n_x) = ones(1,n_x/2);	# Set initial twist to 1.
#  disp("Computing OL response");
#  [Ys,Us] = ppp_transient (T,A_u,-(K_x*x_0)',u_0,A,B,C,D,x_0); # Compute open-loop control
  
  
  disp("Computing OL response (no control)");
  [Y_0] = ppp_sm2sr(A, B, C, D, T, zeros(n_u,1), x_0); # Compute Closed-loop control
  title("Y (no control)");
  xlabel("Time")
  grid; 
  plot(T,Y_0);
  psfig(sprintf("%s_pppy0",Name));

  disp("Computing Unconstrained CL response");
  [y_u,X_u] = ppp_sm2sr(A-B*k_x, B, C, D, T, zeros(n_u,1), x_0);
  u_u = -k_x*X_u';


  title("Unconstrained closed-loop control - y");
  xlabel("Time")
  grid; 
  plot(T,y_u);
  psfig(sprintf("%s_pppy",Name));

  title("Unconstrained closed-loop control - u");
  xlabel("Time")
  grid; 
  plot(T,u_u);
  psfig(sprintf("%s_pppu",Name));

#   ## Constrained version
  
#   ## Constraints - u
#   Tau_u = [0:0.01:1];
#   one = ones(size(Tau_u));
#   limit = 1e10;
#   Min_u = -limit*one;
#   Max_u =  limit*one;
#   Order_u = 0*one;

#   ## Constraints - y
#   Tau_y = [];
#   one = ones(size(Tau_y));
#   limit = 1e5; 
#   Min_y = -limit*one;
#   Max_y =  limit*one;
#   Order_y = 0*one;

#   ## Simulation

#   ## Constrained - open-loop
#   Gamma = [];
#   gamma = [];
#   for i=1:n_u			# Put same constraints on each input
#     [Gamma_i,gamma_i] = ppp_input_constraint (A_u,Tau_u,Min_u,Max_u,Order_u,i,n_u);
#     Gamma = [Gamma; Gamma_i];
#     gamma = [gamma; gamma_i];
#   endfor


#   disp("Open-loop simulations...");
#   ## Constrained OL simulation
#   W = zeros(n_y,1);
#   [u,U] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,Gamma,gamma);
#   T = [0:t(2)-t(1):t(length(t))];
#   [ys,us] = ppp_ystar (A,B,C,D,x_0,A_u,U,T);

#   title("Constrained y*");
#   xlabel("t");
#   grid;
#   plot(T,ys)

#   ## Unconstrained OL simulation
#   [uu,Uu] = ppp_qp (x_0,W,J_uu,J_ux,J_uw,Us0,[],[]); 
#   [ysu,usu] = ppp_ystar (A,B,C,D,x_0,A_u,Uu,T);

#   title("Unconstrained y*");
#   xlabel("t");
#   grid;
#   plot(T,ysu)

#   ## Non-linear - closed-loop
#   disp("Closed-loop simulation");
#   Tc = [0:4e-4:1.0];	
#   Delta_ol = 1.0;
#   [yc,uc,J] = ppp_qp_sim (A,B,C,D,A_u,A_w,t,Q, T, Tau_u,Min_u,Max_u,Order_u, Tau_y,Min_y,Max_y,Order_y,W,x_0,Delta_ol);

#   title("y,y*,u and u*");
#   xlabel("t");
#   grid;
#   plot(T1,y,T,ys,T1,u,T,us);

endfunction








Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/pppu_rep.make version [111a3668c7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Make file for the ppp output rep
## Symlinked to:
##	pppy
##	pppy0
##	pppu

all: $(SYS)_pppy.ps $(SYS)_pppy0.ps $(SYS)_pppu.ps

$(SYS)_pppy.ps: Make_figures.m ppp_1.m $(SYS)_sm.m $(SYS)_numpar.m
	octave Make_figures.m
$(SYS)_pppy0.ps: $(SYS)_pppy.ps
	touch $(SYS)_pppy0.ps
$(SYS)_pppu.ps: $(SYS)_pppy.ps
	touch $(SYS)_pppu.ps

$(SYS)_sm.m: 
	mtt $(SYS) sm m

$(SYS)_numpar.m: 
	mtt $(SYS) numpar m

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/pppy0_rep.make version [111a3668c7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Make file for the ppp output rep
## Symlinked to:
##	pppy
##	pppy0
##	pppu

all: $(SYS)_pppy.ps $(SYS)_pppy0.ps $(SYS)_pppu.ps

$(SYS)_pppy.ps: Make_figures.m ppp_1.m $(SYS)_sm.m $(SYS)_numpar.m
	octave Make_figures.m
$(SYS)_pppy0.ps: $(SYS)_pppy.ps
	touch $(SYS)_pppy0.ps
$(SYS)_pppu.ps: $(SYS)_pppy.ps
	touch $(SYS)_pppu.ps

$(SYS)_sm.m: 
	mtt $(SYS) sm m

$(SYS)_numpar.m: 
	mtt $(SYS) numpar m

Deleted mttroot/mtt/lib/examples/Control/PPP/Linear/PPPCantileverBeam/pppy_rep.make version [111a3668c7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Make file for the ppp output rep
## Symlinked to:
##	pppy
##	pppy0
##	pppu

all: $(SYS)_pppy.ps $(SYS)_pppy0.ps $(SYS)_pppu.ps

$(SYS)_pppy.ps: Make_figures.m ppp_1.m $(SYS)_sm.m $(SYS)_numpar.m
	octave Make_figures.m
$(SYS)_pppy0.ps: $(SYS)_pppy.ps
	touch $(SYS)_pppy0.ps
$(SYS)_pppu.ps: $(SYS)_pppy.ps
	touch $(SYS)_pppu.ps

$(SYS)_sm.m: 
	mtt $(SYS) sm m

$(SYS)_numpar.m: 
	mtt $(SYS) numpar m

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/AE3_abg.fig version [06166c49e9].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4747 5175 6097 5175 5872 5400
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7447 5175 8797 5175 8572 5400
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2677 5175 4027 5175 3802 5400
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6772 3375 6772 4725 6997 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 6750 6750 5400 6975 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 8550 6750 7200 6975 7425
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 1575 6750 2925 6975 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9472 5175 10822 5175 10597 5400
4 1 0 100 0 18 20 0.0000 4 225 405 6750 3240 AE\001
4 1 0 100 0 18 20 0.0000 4 225 405 6750 7110 AE\001
4 1 0 100 0 18 20 0.0000 4 225 405 4365 5265 AE\001
4 1 4 100 0 18 20 0.0000 4 285 975 2115 5265 SS:[in]\001
4 1 4 100 0 18 20 0.0000 4 285 1335 6795 1485 SS:[mod]\001
4 1 4 100 0 18 20 0.0000 4 285 1500 6705 8820 SS:[smod]\001
4 1 0 100 0 18 30 0.0000 4 330 660 6750 5265 R:r\001
4 1 4 100 0 18 14 0.0000 4 210 270 5985 4995 [1]\001
4 1 4 100 0 18 14 0.0000 4 210 270 7560 4995 [2]\001
4 1 4 100 0 18 14 0.0000 4 210 270 6570 4590 [3]\001
4 1 4 100 0 18 14 0.0000 4 210 270 6570 5625 [4]\001
4 1 0 100 0 18 20 0.0000 4 225 405 9135 5265 AE\001
4 1 4 100 0 18 20 0.0000 4 285 1170 11475 5265 SS:[out]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/AE3_lbl.txt version [d1dfd6ef4f].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system AE3 (AE3_lbl.txt)
%SUMMARY AE3
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	mod	mod
%ALIAS	out	out
%ALIAS	smod	smod

% Argument aliases
%ALIAS	$1	l

% CR aliases
%ALIAS	$1	slsin


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type R
	r		slsin	-1*l

% Component type SS
	[in]	SS		external,external
	[mod]	SS		external,external
	[out]	SS		external,external
	[smod]	SS		external,external




Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/AF3_abg.fig version [bbf355643a].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4747 5175 6097 5175 5872 5400
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7447 5175 8797 5175 8572 5400
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2677 5175 4027 5175 3802 5400
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6772 3375 6772 4725 6997 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 6750 6750 5400 6975 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 8550 6750 7200 6975 7425
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 1575 6750 2925 6975 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9472 5175 10822 5175 10597 5400
4 1 0 100 0 18 20 0.0000 4 225 405 6750 3240 AE\001
4 1 0 100 0 18 20 0.0000 4 225 405 6750 7110 AE\001
4 1 4 100 0 18 20 0.0000 4 285 975 2115 5265 SS:[in]\001
4 1 4 100 0 18 20 0.0000 4 285 1335 6795 1485 SS:[mod]\001
4 1 4 100 0 18 20 0.0000 4 285 1500 6705 8820 SS:[smod]\001
4 1 0 100 0 18 30 0.0000 4 330 660 6750 5265 R:r\001
4 1 4 100 0 18 14 0.0000 4 210 270 5985 4995 [1]\001
4 1 4 100 0 18 14 0.0000 4 210 270 7560 4995 [2]\001
4 1 4 100 0 18 14 0.0000 4 210 270 6570 4590 [3]\001
4 1 4 100 0 18 14 0.0000 4 210 270 6570 5625 [4]\001
4 1 0 100 0 18 20 0.0000 4 225 390 4365 5310 AF\001
4 1 0 100 0 18 20 0.0000 4 225 390 9135 5265 AF\001
4 1 4 100 0 18 20 0.0000 4 285 1170 11610 5265 SS:[out]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/AF3_lbl.txt version [fe6985b952].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system AE3 (AE3_lbl.txt)
%SUMMARY AE3
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	mod	mod
%ALIAS	out	out
%ALIAS	smod	smod

% Argument aliases
%ALIAS	$1	l

% CR aliases
%ALIAS	$1	slsin


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type R
	r		slsin	l

% Component type SS
	[in]	SS		external,external
	[mod]	SS		external,external
	[out]	SS		external,external
	[smod]	SS		external,external

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/Cart_abg.fig version [dd76f4c478].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3600 4275 4950 4275 4725 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 5400 3600 5400 3825 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4950 5175 4950 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3015 3150 4365 3150 4140 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4815 3150 6165 3150 5940 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4590 2925 4590 1575 4815 1800
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4815 1575 4365 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4793 2934 6153 1574 6153 1893
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4387 2947 3027 1587 3346 1587
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7650 3150 9000 3150 8775 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3600 4050 3600 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5400 5400 6750 5400 6525 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6750 5175 6750 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5400 4275 6750 4275 6525 4500
4 2 0 100 0 18 18 0.0000 4 270 2130 3510 4365 Sf:zero_velocity\001
4 1 1 101 0 3 18 0.0000 4 255 1125 5310 4725 y-velocity\001
4 1 1 101 0 3 18 0.0000 4 255 1155 5265 3735 x-velocity\001
4 1 1 101 0 3 18 0.0000 4 255 1905 5175 5940 angular-velocity\001
4 2 0 100 0 18 18 0.0000 4 270 720 3555 5490 R:r_p\001
4 1 0 100 0 18 18 0.0000 4 195 150 4590 3240 1\001
4 1 4 100 0 18 18 0.0000 4 270 765 6390 1440 SS:[x]\001
4 1 0 100 0 18 18 0.0000 4 270 870 4635 1440 IS:m_c\001
4 1 0 100 0 18 18 0.0000 4 270 690 2880 1440 R:r_c\001
4 1 4 100 0 18 18 0.0000 4 270 1290 2250 3240 SS:[drive]\001
4 0 0 100 0 18 18 0.0000 4 210 1560 9090 3240 De:Position\001
4 1 0 100 0 18 18 0.0000 4 210 1035 6975 3240 INTFS:x\001
4 1 0 100 0 18 18 0.0000 4 195 150 5175 5490 1\001
4 1 4 100 0 18 18 0.0000 4 270 780 7245 5490 SS:[a]\001
4 1 0 100 0 18 18 0.0000 4 195 150 5175 4365 1\001
4 1 4 100 0 18 18 0.0000 4 270 765 7245 4365 SS:[y]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/Cart_lbl.txt version [53f4dac4d3].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Cart (Cart_lbl.txt)
%SUMMARY Cart
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	drive
%ALIAS	pendulum|out	x,y,a

% Argument aliases
%ALIAS	$1	m_c
%ALIAS	$2	r_c
%ALIAS	$3	r_p

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type IS
	m_c		lin	flow,m_c;v_0

% Component type R
	r_c		lin	flow,r_c
	r_p		lin	flow,r_p

% Component type INTFS
	x               none    x_0

% Component type SS
	[a]	SS		internal,0
	[drive]	SS		external,internal
	[x]	SS		0,internal
	[y]	SS		0,internal

% Component type De
	Position		SS	external

% Component type Sf
	zero_velocity		SS	0




Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/DCS_abg.fig version [b47c5c7578].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3330 1305 3870 1395
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3375 1350 3825 1350
-6
6 7965 2475 8505 2565
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8010 2520 8460 2520
-6
6 3330 2475 3420 3015
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3375 2520 3375 2970
-6
6 9810 2475 9900 3015
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 9855 2520 9855 2970
-6
6 7965 2430 8055 2970
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8010 2475 8010 2925
-6
6 3735 2430 3825 2970
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3780 2475 3780 2925
-6
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 4860 4730 4860 494 2293 494 2293 4730 4860 4730
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2036 2724 3371 2724 3063 2947
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3576 2501 3576 1342 3833 1609
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3782 2724 5116 2724 4808 2947
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3576 2947 3576 4106 3833 3839
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6656 2724 7991 2724 7683 2947
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8196 2947 8196 4106 8453 3839
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8453 2724 9788 2724 9480 2947
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9480 4730 9480 494 6913 494 6913 4730 9480 4730
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 12150 5175 45 5175 45 316 12150 316 12150 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8190 2501 8190 1341 8447 1609
4 2 4 0 0 0 18 0.0000 4 240 1605 1980 2790 SS:[Electrical]\001
4 1 -1 0 0 0 18 0.0000 4 195 135 3525 2858 1\001
4 1 -1 0 0 0 18 0.0000 4 255 945 5938 2813 GY:k_m\001
4 1 -1 0 0 0 18 0.0000 4 195 135 8196 2813 1\001
4 1 -1 0 0 0 18 0.0000 4 255 630 3525 1252 IS:l_a\001
4 1 -1 0 0 0 18 0.0000 4 255 600 3628 4463 R:r_a\001
4 1 -1 0 0 0 18 0.0000 4 255 735 8248 4463 R:b_m\001
4 1 1 1 0 0 18 0.0000 4 195 1065 3576 5043 Electrical\001
4 1 1 1 0 0 18 0.0000 4 195 1290 8196 5043 Mechanical\001
4 1 1 1 0 0 18 0.0000 4 195 600 10404 3170 Shaft\001
4 1 1 1 0 0 18 0.0000 4 195 1155 1472 3170 Terminals\001
4 0 4 0 0 0 18 0.0000 4 240 1830 9945 2835 SS:[Mechanical]\001
4 1 -1 0 0 0 18 0.0000 4 255 585 8235 1215 I:j_m\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/DCS_lbl.txt version [085bf103ca].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY DCS: DCS motor 
%DESCRIPTION A special for the inverted pendulum system
%DESCRIPTION Derivative causality on the  shaft
%DESCRIPTION No aliased parameters
%DESCRIPTION Built in causality - speeds things up
%DESCRIPTION Only the armature state and shaft resistance are variable

%ALIAS in	Electrical
%ALIAS out	Mechanical


%% Label file for system DCS (DCS_lbl.txt)


%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Motor gain
k_m	lin		flow,k_m

% Electrical components
%Inductance
l_a	lin		flow,l_a;i_0

%Resistance
r_a	lin		flow,r_a

% Mechanical components
%Inertia
j_m	lin		flow,j_m

%Friction
b_m	lin		flow,b_m

% Ports
	[Electrical]	SS	external,external
	[Mechanical]	SS	external,external

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/DriveCart_abg.fig version [7ddc7b16cb].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3555 4005 3645 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3600 4050 3600 4500
-6
6 6255 4005 6345 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6300 4050 6300 4500
-6
2 4 0 2 1 7 101 0 -1 0.000 0 0 7 0 0 5
	 7650 4725 5850 4725 5850 3825 7650 3825 7650 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 4275 3600 4275 3375 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 4275 6300 4275 6075 4500
2 4 0 2 1 7 101 0 -1 0.000 0 0 7 0 0 5
	 5175 4725 3375 4725 3375 3825 5175 3825 5175 4725
2 4 0 2 1 7 101 0 -1 0.000 0 0 7 0 0 5
	 2610 4725 585 4725 585 3825 2610 3825 2610 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7425 4275 8775 4275 8550 4500
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 10125 4950 10125 2025 225 2025 225 4950 10125 4950
4 1 0 100 0 18 20 0.0000 4 360 1815 1620 4410 OpenLoop\001
4 1 0 100 0 18 20 0.0000 4 285 960 4320 4410 Drive\001
4 1 0 100 0 18 20 0.0000 4 285 765 6795 4410 Cart\001
4 1 0 100 0 18 20 0.0000 4 285 810 9225 4410 Zero\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/DriveCart_input.txt version [b342c864df].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (DriveCart_input.txt)
# Generated by MTT at Thu Aug  5 09:17:30 BST 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the inputs
#mttu(1) = 1.0*(t<1) -1.0*((t>=1)&&(t<2)); 	# u (DriveCart_F)
mttu(1) = 1;
mttu(2) = 0;
mttu(3) = 0;
mttu(4) = 0;

# Set the switches

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/DriveCart_lbl.txt version [3e401170aa].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system DriveCart (DriveCart_lbl.txt)
%SUMMARY DriveCart
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%VAR l_p		#Pendulum length

% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----






Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/DriveCart_numpar.txt version [9986736335].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91



























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (DriveCart_numpar.txt)
# Generated by MTT at Wed Aug 25 22:57:05 BST 1999

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

# Parameters
j_m = 	3.87e-7;		# Motor inertia
k_m = 	0.00767;		# Motor constant
r_a = 	2.6;			# Armature resistance
l_a = 	0.18e-3;		# Armature inductance

k_g = 	1/3.7;			# Internal gear ratio 
r = 	0.635e-2;		# Motor gear radius

m_c = 	0.455;			# Cart mass

b_m = 	0.0;			# Motor friction
r_c = 	1.5;			# Cart friction

# l_p =   0.61;			# Pendulum length
# m_p =   0.210;			# Pendulum mass
# r_p = 	0.0;			# Pendulum friction

# j_p = m_p*(l_p*l_p)/12;		# Pendulum inertia about cm.

# g = 9.81;			# Gravity


## Sensitivity parameters
# m_cs = 0;			# Cart mass
# b_ms = 0;			# Motor friction 
# r_cs = 0;			# Cart friction
# r_ps = 0;			# Pendulum friction


## Control parameters
k_1 = 1;
k_2 = 0;
k_3 = 0;

## States
i_0 = 0;			# Initial armature current
v_0 = 0;			# Initial cart velocity
x_0 = 0;			# Initial cart position

# omega_0 = 0;			# Initial pendulum velocity
# theta_0 = 0;			# Initial pendulum angle

## Control sensitivity parameters
# k_1s = 0;
# k_2s = 0;
# k_3s = 0;

# ## Argument list
# if (mtt_n_parameters>1)
#   r_cs= mtt_parameters(1);
#   r_c = mtt_parameters(2);
# endif;

# if (mtt_n_parameters>3)
#   m_cs= mtt_parameters(3);
#   m_c = mtt_parameters(4);
# endif;

# if (mtt_n_parameters>5)
#   k_1s= mtt_parameters(5);
#   k_1 = mtt_parameters(6);
# endif;

# if (mtt_n_parameters>7)
#   k_2s= mtt_parameters(7);
#   k_2 = mtt_parameters(8);
# endif;

# if (mtt_n_parameters>9)
#   k_3s= mtt_parameters(9);
#   k_3 = mtt_parameters(10);
# endif;







Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/DriveCart_rep.txt version [1cbbe15de1].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system DriveCart (DriveCart_rep.txt)
## Generated by MTT on" Fri Oct 22 09:03:14 EST 1999.

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

mtt DriveCart abg tex			# The system description
mtt DriveCart cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt DriveCart struc tex	        # The system structure
mtt DriveCart dae tex	        # The system dae
## mtt DriveCart ode tex	        # The system ode 
## mtt DriveCart sspar tex		# Steady-state parameters
## mtt DriveCart ss tex 		# Steady state
## mtt DriveCart dm tex		# Descriptor matrices (of linearised system)
mtt DriveCart sm tex		# State matrices (of linearised system)
## mtt DriveCart tf tex		# Transfer function (of linearised system)
## mtt DriveCart lmfr ps		# log modulus of frequency response (of linearised system)
mtt DriveCart simpar tex		# Simulation parameters
mtt DriveCart numpar tex		# Numerical simulation parameters
mtt DriveCart input tex		# Simulation input
mtt -c DriveCart odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/DriveCart_simpar.txt version [c95de2a7c5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system DriveCart (DriveCart_simpar.txt)
# Generated by MTT on Thu Aug 5 09:17:05 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 10.0;      # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 1000;		# Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/Drive_abg.fig version [12e17c139d].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 2475 3825 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 2700 3825 2700 3600 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5625 2700 6975 2700 6750 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 8325 2700 9675 2700 9450 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 10575 2700 11925 2700 11700 2925
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 14400 4725 14400 675 225 675 225 4725 14400 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6975 2475 6975 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 11925 2475 11925 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 9675 2475 9675 2925
4 1 1 101 0 3 20 0.0000 4 255 1530 4590 3330 DC motor\001
4 1 1 101 0 3 20 0.0000 4 330 2745 2205 3330 Power supply unit\001
4 2 4 100 0 18 18 0.0000 4 270 1845 2430 2790 SS:[Electrical]\001
4 1 0 100 0 18 18 0.0000 4 210 1470 4725 2790 DCS:motor\001
4 1 0 100 0 18 18 0.0000 4 270 915 7695 2790 TF:k_g\001
4 1 0 100 0 18 18 0.0000 4 210 540 10125 2790 TF:r\001
4 0 4 100 0 18 18 0.0000 4 270 2115 12015 2790 SS:[Mechanical]\001
4 1 1 101 0 3 20 0.0000 4 330 2010 7515 3330 Internal gear\001
4 1 1 101 0 3 20 0.0000 4 330 1710 10080 3330 Motor gear\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/Drive_lbl.txt version [99fb16d915].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Drive (Drive_lbl.txt)
%SUMMARY Drive
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Electrical
%ALIAS	out	Mechanical

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type DC
	motor

% Component type SS
	[Electrical]	SS		external,external
	[Mechanical]	SS		external,external

% Component type TF
	k_g		lin	flow,k_g
	r		lin	flow,r

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/INTFS_abg.fig version [0f2cfc3a7b].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3376 3151 4276 3151 4051 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 2926 4501 2026 4726 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3151 5626 3151 5401 3376
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 10575 4950 45 4950 45 1350 10575 1350 10575 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1575 3150 2475 3150 2250 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6526 3150 7426 3150 7201 3375
4 1 -1 0 0 0 20 0.0000 4 255 180 4501 3241 0\001
4 1 -1 0 0 0 20 0.0000 4 255 1110 4501 1891 CS:unit\001
4 2 4 0 0 0 20 0.0000 4 315 1455 1530 3240 SS:[Flow]\001
4 1 -1 0 0 0 20 0.0000 4 255 825 2925 3240 AF:af\001
4 1 -1 0 0 0 20 0.0000 4 255 900 6075 3240 AE:ae\001
4 0 4 0 0 0 20 0.0000 4 330 3045 7470 3240 SS:[Integrated_flow]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/INTFS_lbl.txt version [566f080c2f].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system INTFS (INTFS_lbl.txt)
%SUMMARY	INTFS: flow integrator
%DESCRIPTION	Port [in]:	Flow to be integrated
%DESCRIPTION	Port [out]:	Effort = integral of flow on port [in]


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/07/16 07:35:10  peterg
% %% Aliased version
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Flow
%ALIAS	out	Integrated_flow

% Argument aliases
%ALIAS	$1 x_0	

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----


% Component type CS
	unit			lin		effort,1;x_0

% Component type AE
	ae			lin		1

% Component type AF
	af			lin		1

% Component type SS
	[Flow]			SS		external,external
	[Integrated_flow]	SS		external,external

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/IS_abg.fig version [833b9d0b1e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2340 3915 2610 4185
4 1 0 100 0 18 20 0.0000 4 270 195 2475 4185 0\001
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3825 2475 2475 2700 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 5625 2475 4275 2700 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4050 4050 4050 3825 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 3825 4050 4275
4 1 0 100 0 18 20 0.0000 4 285 315 2475 2295 I:i\001
4 0 0 100 0 18 20 0.0000 4 360 1035 4185 4185 Sf:f_0\001
4 1 4 100 0 18 20 0.0000 4 360 1185 2475 6030 SS:[in]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/IS_lbl.txt version [fd9f48ad6f].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system IS (IS_lbl.txt)
%SUMMARY IS I component with initial state


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in

% Argument aliases
%ALIAS	$1	flow,i
%ALIAS	$2	f_0

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type I
	i		lin	flow,i

% Component type SS
	[in]	 SS	external,external

% Component type Sf
	f_0		SS	f_0


Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_abg.fig version [f7dd4e7606].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3555 4005 3645 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3600 4050 3600 4500
-6
6 6255 4005 6345 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6300 4050 6300 4500
-6
2 4 0 2 1 7 101 0 -1 0.000 0 0 7 0 0 5
	 7650 4725 5850 4725 5850 3825 7650 3825 7650 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 4275 3600 4275 3375 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 4275 6300 4275 6075 4500
2 4 0 2 1 7 101 0 -1 0.000 0 0 7 0 0 5
	 5175 4725 3375 4725 3375 3825 5175 3825 5175 4725
2 4 0 2 1 7 101 0 -1 0.000 0 0 7 0 0 5
	 2610 4725 585 4725 585 3825 2610 3825 2610 4725
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9675 4950 9675 2025 225 2025 225 4950 9675 4950
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 3825 7705 2870 7705 3189
2 1 0 2 1 7 101 0 -1 0.000 0 0 -1 0 0 5
	 6952 3487 8347 2092 8527 2272 7177 3622 6997 3442
4 1 0 100 0 18 20 0.0000 4 360 1815 1620 4410 OpenLoop\001
4 1 0 100 0 18 20 0.0000 4 285 960 4320 4410 Drive\001
4 1 0 100 0 18 20 0.0000 4 285 3255 7830 2835 InvertedPendulum\001
4 1 0 100 0 18 20 0.0000 4 285 765 6795 4410 Cart\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_desc.tex version [bf8d448bf0].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system InvertedPendulumOnCart (InvertedPendulumOnCart_desc.tex)
% Generated by MTT on Thu Aug 5 10:38:16 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{InvertedPendulumOnCart} is
   displayed in Figure \Ref{fig:InvertedPendulumOnCart_abg.ps} and its label
   file is listed in Section \Ref{sec:InvertedPendulumOnCart_lbl}.
   The subsystems are listed in Section \Ref{sec:InvertedPendulumOnCart_sub}.

This is a one input, two output nonlinear system comprising an
inverted pendulum attached by a hinge to a cart constrained to move in
the horizontal direction. The input is the horizontal force acting on
the cart, and the two outputs are the horizontal position and the
pendulum angle respectively.

The bond graph in Figure \Ref{InvertedPendulumOnCartPPP_abg} is augmented with the {\em
open-loop\/} controller comprising
\begin{itemize}
\item two effort source \textbf{Se} components ``u1'' and ``u2''
\item two effort amplifier \textbf{AE} components ``ppp\_1'' and `ppp\_2''
\end{itemize}

This is a \emph{nonlinear} system and it is used to illustate
\emph{nonlinear} PPP control. Section
\Ref{sec:InvertedPendulumOnCartPPP_nppp.ps} shows the cart position
$x$ and the pendulum angle $\theta$  when the pendulum starts from the
initial condition of  $\theta = \frac{\pi}{2}$ (ie the pendulum is
horizontal).
 

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_input.txt version [e48379ad1c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (InvertedPendulumOnCartPPP_input.txt)
# Generated by MTT at Thu Aug  5 09:17:30 BST 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the inputs
#mttu(1) = 1.0*(t<1) -1.0*((t>=1)&&(t<2)); 	# u (InvertedPendulumOnCartPPP_F)
mttu(1) = 1;
mttu(2) = 0;
mttu(3) = 0;
mttu(4) = 0;

# Set the switches

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_lbl.txt version [a0840e2c8b].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system InvertedPendulumOnCartPPP (InvertedPendulumOnCartPPP_lbl.txt)
%SUMMARY InvertedPendulumOnCartPPP
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%VAR l_p		#Pendulum length

% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----






Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_nppp.m version [95e3aca505].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141













































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Figures.m
## Makes figures for the InvertedPendulumOnCart_PPP exasmple.
## $Log$
## Revision 1.4  2000/08/17 12:34:58  peterg
## *** empty log message ***
##
## Revision 1.3  2000/08/11 16:01:27  peterg
## Fixed documentation error
##
## Revision 1.2  2000/05/21 06:39:40  peterg
## Parameterised _sm
##
## Revision 1.1  2000/05/20 11:30:41  peterg
## Initial revision
##
## Revision 1.2  2000/05/17 16:59:57  peterg
## Revised for Inverted pendulum - it works !!!!
##
## Revision 1.1  2000/05/17 14:07:53  peterg
## Initial revision
##
## Revision 1.1  2000/05/17 09:14:37  peterg
## Initial revision
##
system_name = "InvertedPendulumOnCartPPP";

## Uncomment the following the first time
## (Or do ./Make InvertedPendulumOnCartPPP in this directory)

## MTT stuff for the system simulation
##system("Make InvertedPendulumOnCartPPP");

t_s=1.0*[0:0.1:10];
u = [ones(4,length(t_s))];
x_0 = InvertedPendulumOnCartPPP_state;
par  = InvertedPendulumOnCartPPP_numpar;

## Simulate the system
tick=time;
[y,x] = InvertedPendulumOnCartPPP_sim(x_0,u,t_s,par);
Elapsed = time-tick
plot(t_s,y, t_s,x);

## Simulate the system to give just the final few points
t_s1 = 10*[9:0.1:10];
tick=time;
[y,x] = InvertedPendulumOnCartPPP_sim(x_0,u,t_s1,par);
Elapsed = time-tick
plot(t_s1,y,t_s1,x);

## Sensitivity system simulation parameters
x_0s = sInvertedPendulumOnCartPPP_state;
pars  = sInvertedPendulumOnCartPPP_numpar;
sympars  = sInvertedPendulumOnCartPPP_sympar;

## Simulate the sensitivity system
sensitivities = [sympars.ppp_1s,sympars.ppp_2s,sympars.r_cs]
tick=time;
[y,ys] = sInvertedPendulumOnCartPPP_sim(x_0s,u,t_s,pars,sensitivities);
Elapsed = time-tick
plot(t_s,y,t_s,ys);

### PPP parameters
A_w = [0;0];
A_u = laguerre_matrix(4,20); # Specify basis functions: constant &
			     # exp(-5t)
tau = 0.5*[0.9:0.01:1];             # Optimisation interval
t_ol =0.5*[0:0.01:0.2];            # Open-loop interval
N = 20;                          # Number of open-loop intervals in simulation
w = [0;0];                         # Setpoint

## Linear system
## Linear system
[A,B,C,D] = InvertedPendulumOnCartPPP_sm(par);
Q = [1;1];
ppp_lin_plot (A,B(:,1),C,D(:,1),A_u,A_w,tau,Q,w,x_0);
psfig("InvertedPendulumOnCartPPP_lin");

## Simulate non-linear PPP (on this nonlinear system)
extras.U_initial = "zero";
extras.U_next = "continuation";
extras.criterion = 1e-5;
extras.max_iterations = 10;
extras.v = 0;
extras.verbose = 0;

# ##  -- with no optimisation using linear PPP with continuation
# extras.U_initial = "linear";
# extras.U_next = "continuation";
# extras.criterion = 1e-5;
# extras.max_iterations = 0;
# [y_c,x,u_c,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);

# ##  -- with no optimisation using linear PPP at each step
# extras.U_initial = "linear";
# extras.U_next = "linear";
# extras.criterion = 1e-5;
# extras.max_iterations = 0;
# [y_l,x,u_l,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);

##  -- with optimisation using nonlinear PPP with continuation
extras.U_initial = "zero";
extras.U_next = "continuation";
extras.criterion = 1e-4;
extras.max_iterations = 100;
extras.v = 1e-3;
extras.verbose = 0;
[y,x,u,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);


## Plots
title("");

## U, U_c and U_l
I = 1:N;
IU1 = [I' U(1,:)'];
IU1_c = [I' U_c(1,:)'];
IU1_l = [I' U_l(1,:)'];
gset grid; xlabel "Interval"
gplot IU1 title "U_1", IU1_c title "U_c1", IU1_l title "U_l1"
psfig("InvertedPendulumOnCartPPP_U1");

IU2 = [I' U(2,:)'];
IU2_c = [I' U_c(2,:)'];
IU2_l = [I' U_l(2,:)'];
gset grid; xlabel "Interval "
gplot IU2 title "U_2", IU2_c title "U_c2", IU2_l title "U_l2"
psfig("InvertedPendulumOnCartPPP_U2");

## y & u
gset grid; xlabel "Time (sec)"
tu =  [t' u']; 
gplot tu title "Output"
psfig("InvertedPendulumOnCartPPP_u");

gset grid; xlabel "Time (sec)"
ty_th = [t' y(1,:)'] ;
ty_x = [t' y(2,:)'] ;
gplot ty_th title "Theta",ty_x title "x"
psfig("InvertedPendulumOnCartPPP_nppp");

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_numpar.txt version [9aa45f03b2].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (sInvertedPendulumOnCart_numpar.txt)
# Generated by MTT at Tue Apr 18 18:07:52 BST 2000

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

## Default parameters
b_m = 	0.0; # sDCS
c = 	0.0; # sC,sC,sCS,sCS
e_0 = 	0.0; # sCS,sCS
e_s = 	0.0; # Se,Se,Se,sSe,sSe,sSe
f_0 = 	0.0; # sIS,sIS,sIS
f_s = 	0.0; # Sf,Sf,Sf,sSf,sSf,sSf
g = 	0.0; # AFe,AFe,sInvertedPendulum,sROD
i = 	0.0; # sI,sI,sI,sI,sI,sI,sIS,sIS,sIS
i_0 = 	0.0; # sDCS
j_m = 	0.0; # sDCS,sROD
j_p = 	0.0; # sInvertedPendulum
ppp_1 = 	1.0; # sOpenLoop
ppp_2 = 	0.0; # sOpenLoop
ppp_3 = 	0.0; # sOpenLoop
ppp_4 = 	0.0; # sOpenLoop
k_g = 	0.0; # sDrive
k_m = 	0.0; # sDCS
l_a = 	0.0; # sDCS,sROD
l_b = 	0.0; # sROD
l_p = 	0.0; # sInvertedPendulum,sInvertedPendulumOnCart
m = 	0.0; # sROD
m_c = 	0.0; # sCart
m_p = 	0.0; # sInvertedPendulum
m_t = 	0.0; # sInvertedPendulum
omega_0 = 	0.0; # sInvertedPendulum,sROD
r = 	0.0; # sDrive,sR,sR
r_a = 	0.0; # sDCS
r_c = 	0.0; # sCart
r_p = 	0.0; # sCart
theta_0 = 	0.0; # sInvertedPendulum,sROD
v_0 = 	0.0; # sCart
x_0 = 	0.0; # sCart,sINTFS,sINTFS


## Pysical Parameters
j_m = 	3.87e-7;		# Motor inertia
k_m = 	0.00767;		# Motor constant
r_a = 	2.6;			# Armature resistance
l_a = 	0.18e-3;		# Armature inductance

k_g = 	1/3.7;			# Internal gear ratio 
r = 	0.635e-2;		# Motor gear radius

m_c = 	0.455;			# Cart mass

b_m = 	0.0;			# Motor friction
r_c = 	1.5;			# Cart friction

l_p =   0.61;			# Pendulum length
m_p =   0.210;			# Pendulum mass
r_p = 	0.0;			# Pendulum friction

j_p = m_p*(l_p*l_p)/12;		# Pendulum inertia about cm.

g = 9.81;			# Gravity

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_rep.txt version [e2801170d5].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system InvertedPendulumOnCartPPP (InvertedPendulumOnCartPPP_rep.txt)
## Generated by MTT on" Fri Oct 22 09:03:14 EST 1999.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  2000/08/29 13:57:23  peterg
## Zapped some steps which prevent ppp from working ????
##
## Revision 1.2  2000/05/20 17:45:38  peterg
## Tidied
##
## Revision 1.1  2000/05/20 17:43:40  peterg
## Initial revision
##
###############################################################

mtt InvertedPendulumOnCartPPP abg tex # The system description
mtt InvertedPendulumOnCartPPP cbg ps # The causal bond graph
mtt InvertedPendulumOnCartPPP struc tex	# The system structure
mtt InvertedPendulumOnCartPPP dae tex # The system dae
# mtt InvertedPendulumOnCartPPP sm tex # State matrices (of linearised system)

# mtt InvertedPendulumOnCartPPP simpar tex # Simulation parameters
# mtt InvertedPendulumOnCartPPP numpar tex # Numerical simulation parameters
# mtt InvertedPendulumOnCartPPP input tex	# Simulation input
# mtt -c InvertedPendulumOnCartPPP odeso ps # Simulation output

mtt InvertedPendulumOnCartPPP nppp m # How its done
mtt InvertedPendulumOnCartPPP nppp ps # The PPP output

mtt InvertedPendulumOnCartPPP rep txt # The report outline



Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_simpar.txt version [6ec8d445cd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system InvertedPendulumOnCartPPP (InvertedPendulumOnCartPPP_simpar.txt)
# Generated by MTT on Thu Aug 5 09:17:05 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 10.0;      # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 1;		# Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulumOnCartPPP_state.txt version [009c83cce5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Initial state  file (InvertedPendulumOnCartPPP_state.txt)
# Generated by MTT at Thu May  4 16:13:13 BST 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the states
mttx(1) 	= 0.0; 	# i (InvertedPendulumOnCartPPP_mtt2_motor_l_a)
mttx(2) 	= 0.0; 	# i (InvertedPendulumOnCartPPP_mtt3_rod_J)
mttx(3) 	= -pi/2; 	# c (InvertedPendulumOnCartPPP_mtt3_rod_th_unit)
mttx(4) 	= 0.0; 	# i (InvertedPendulumOnCartPPP_mtt4_m_c)
mttx(5) 	= 0.0; 	# c (InvertedPendulumOnCartPPP_mtt4_x_unit)

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulum_abg.fig version [66be544a7f].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91



























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3555 5085 6345 5310
4 1 4 100 0 18 14 0.0000 4 210 510 3825 5265 [x_b]\001
4 1 4 100 0 18 14 0.0000 4 210 525 4950 5265 [y_b]\001
4 1 4 100 0 18 14 0.0000 4 210 525 6075 5265 [a_b]\001
-6
6 3555 4545 6345 4770
4 1 4 100 0 18 14 0.0000 4 210 495 3825 4725 [x_a]\001
4 1 4 100 0 18 14 0.0000 4 210 510 4950 4725 [y_a]\001
4 1 4 100 0 18 14 0.0000 4 210 510 6075 4725 [a_a]\001
-6
6 5805 5355 6345 5445
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5850 5400 6300 5400
-6
6 3600 4455 4140 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3645 4500 4095 4500
-6
6 4635 4455 5175 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4680 4500 5130 4500
-6
6 5805 4455 6345 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5850 4500 6300 4500
-6
6 8505 4680 8595 5220
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8550 4725 8550 5175
-6
6 4770 2790 5040 3060
4 1 0 100 0 18 20 0.0000 4 270 195 4905 3060 1\001
-6
6 3690 2790 3960 3060
4 1 0 100 0 18 20 0.0000 4 270 195 3825 3060 1\001
-6
6 3555 2655 4095 2745
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3600 2700 4050 2700
-6
6 4680 2655 5220 2745
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4725 2700 5175 2700
-6
6 4950 2520 5355 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5008 2552 5327 2870
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6525 4950 8550 4950 8325 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 2700 4950 1350 5175 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 2700 3825 1350 4050 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 5143 2687 6098 1732 6098 2050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3600 6750 4050 6750
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4725 6750 5175 6750
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 6750 3825 5400 4050 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 6750 4950 5400 5175 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 6750 6075 5400 6300 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 4500 6075 3150 6300 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 4500 4950 3150 5175 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 4500 3825 3150 4050 3375
4 1 0 100 0 18 20 0.0000 4 285 1515 4964 5040 ROD:rod\001
4 1 0 100 0 18 18 0.0000 4 270 885 6030 3015 Se:a_0\001
4 1 4 100 0 18 20 0.0000 4 360 1050 3780 7155 SS:[x]\001
4 1 4 100 0 18 20 0.0000 4 360 1080 4950 7155 SS:[y]\001
4 1 4 100 0 18 20 0.0000 4 360 1065 6075 7155 SS:[a]\001
4 1 4 100 0 18 14 0.0000 4 210 270 6300 4995 [a]\001
4 0 0 100 0 18 20 0.0000 4 285 1515 8685 5085 De:theta\001
4 1 0 100 0 18 18 0.0000 4 270 675 4995 1170 I:m_y\001
4 1 0 100 0 18 18 0.0000 4 270 675 3870 1170 I:m_x\001
4 0 0 100 0 18 20 0.0000 4 360 1110 6120 1800 Se:mg\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/InvertedPendulum_lbl.txt version [ff2b5f8890].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system InvertedPendulum (InvertedPendulum_lbl.txt)
%SUMMARY InvertedPendulum
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	x,y,a


% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----


% Component type I
        m_x     lin             flow,m_t
        m_y     lin             flow,m_t

% Component type Se
	mg			SS		m_t*g

% Component type De
	theta			SS	external

% Component type SS
	[a]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type Se
	a_0	 SS	0

% Component type gRod
	rod	 none		l_p;l_p;j_p;m_p;g;omega_0;theta_0
 

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/Make version [e246f48d9d].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## Makes the files needed for Figures.m
## Copyright (C) 2000 by Peter J. Gawthrop

if [ -z "$1" ]; then
    echo Usage ./Make system_name
    exit
else
    echo "Making simulation for system $1 (for use in Figures.m)"
fi

## System
mtt -q -c -stdin $1 ode2odes out
mtt -q -c -stdin $1 sim m
mtt -q  $1 state m
mtt -q  $1 sympar m
mtt -q  $1 numpar m

## Sensitivity system
mtt -q -c -stdin -s s$1 ode2odes out
mtt -q -c -stdin -s s$1 sim m
mtt -q  -s s$1 state m
mtt -q  -s s$1 sympar m
mtt -q  -s s$1 numpar m

## Additional system reps for PPP
mtt -q  $1 sm m
mtt -q  $1 def m
mtt -q  -s s$1 def m

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/OpenLoop_abg.fig version [014e1e18a1].

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
68
69
70
71
72








































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 6570 1530 7200 1935
4 1 1 101 0 3 20 0.0000 4 270 495 6885 1845 u ( )\001
4 1 1 101 0 0 20 0.0000 4 135 150 6840 1800 *\001
4 1 1 101 0 32 20 0.0000 4 150 135 7065 1845 t\001
-6
6 1800 1530 2520 2025
4 1 1 101 0 3 20 0.0000 4 270 555 2160 1845 U ( )\001
4 1 1 101 0 3 16 0.0000 4 165 120 2070 2025 1\001
4 1 1 101 0 0 20 0.0000 4 135 150 2115 1800 *\001
4 1 1 101 0 32 20 0.0000 4 150 135 2340 1845 t\001
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6345 2250 7695 2250 7470 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4500 2250 5850 2250 5625 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1575 5400 2925 5400 2700 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4545 5400 5895 5400 5670 5625
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 5175 6075 4050 6300 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1575 3825 2925 3825 2700 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4545 3825 5895 3825 5670 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 3600 6075 2475 6300 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1575 6975 2925 6975 2700 7200
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4545 6975 5895 6975 5670 7200
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 6750 6075 5625 6300 5850
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1575 2250 2925 2250 2700 2475
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9000 7875 9000 1125 225 1125 225 7875 9000 7875
4 2 0 100 0 18 20 0.0000 4 300 1170 1485 2340 Se:Us_1\001
4 1 0 100 0 18 20 0.0000 4 300 1035 3735 2340 AE:U_1\001
4 1 0 100 0 18 20 0.0000 4 210 165 6075 2340 1\001
4 1 0 100 0 18 20 0.0000 4 300 1035 3735 5490 AE:U_3\001
4 2 0 100 0 18 20 0.0000 4 300 1170 1530 5535 Se:Us_3\001
4 1 0 100 0 18 20 0.0000 4 210 165 6075 5535 1\001
4 1 0 100 0 18 20 0.0000 4 300 1035 3735 3915 AE:U_2\001
4 2 0 100 0 18 20 0.0000 4 300 1170 1530 3960 Se:Us_2\001
4 1 0 100 0 18 20 0.0000 4 210 165 6075 3960 1\001
4 1 0 100 0 18 20 0.0000 4 300 1035 3735 7065 AE:U_4\001
4 2 0 100 0 18 20 0.0000 4 300 1170 1530 7110 Se:Us_4\001
4 1 0 100 0 18 20 0.0000 4 210 165 6075 7110 1\001
4 1 1 101 0 3 20 0.0000 4 270 555 2160 3420 U ( )\001
4 1 1 101 0 3 16 0.0000 4 165 120 2070 3600 2\001
4 1 1 101 0 0 20 0.0000 4 135 150 2115 3375 *\001
4 1 1 101 0 32 20 0.0000 4 150 135 2340 3420 t\001
4 1 1 101 0 3 20 0.0000 4 270 555 2160 4995 U ( )\001
4 1 1 101 0 3 16 0.0000 4 165 120 2070 5175 3\001
4 1 1 101 0 0 20 0.0000 4 135 150 2115 4950 *\001
4 1 1 101 0 32 20 0.0000 4 150 135 2340 4995 t\001
4 1 1 101 0 3 20 0.0000 4 270 555 2160 6570 U ( )\001
4 1 1 101 0 3 16 0.0000 4 165 120 2070 6750 4\001
4 1 1 101 0 0 20 0.0000 4 135 150 2115 6525 *\001
4 1 1 101 0 32 20 0.0000 4 150 135 2340 6570 t\001
4 0 4 100 0 18 20 0.0000 4 300 1005 7830 2340 SS:[us]\001
4 1 1 101 0 3 20 0.0000 4 285 2370 3825 7695 Open-loop control\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/OpenLoop_lbl.txt version [da3b550155].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system OpenLoop (OpenLoop_lbl.txt)
%SUMMARY OpenLoop
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	out	us

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AE
	U_1	 lin		ppp_1
	U_2	 lin		ppp_2
	U_3	 lin		ppp_3
	U_4	 lin		ppp_4

% Component type SS
	[us]	SS		external,external

% Component type Se
	Us_1		SS	external
	Us_2		SS	external
	Us_3		SS	external
	Us_4		SS	external


Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/ROD_abg.fig version [9da8669d9a].

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
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
123
124
125
126
127































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8550 5400 9225 6075 8955 6075
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8685 5265 8415 5535
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 5175 2025 3825 2250 3825
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 4950 8550 5400
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 4950 2700 5400
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 6525 3150 7650 3150 7425
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5425 5419 4750 6094 4750 5869
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4273 3823 3148 2698 3373 2698
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 4950 4725 4275 4950 4275
4 1 -1 0 0 0 20 0.0000 4 255 180 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000 4 255 570 6933 5268 IS:J\001
4 1 -1 0 0 0 20 0.0000 4 255 180 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000 4 255 180 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000 4 255 180 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000 4 255 180 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000 4 255 180 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000 4 255 180 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000 4 330 870 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000 4 330 900 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000 4 255 1440 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000 4 255 1440 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000 4 255 1425 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000 4 255 1425 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000 4 255 180 3603 5313 0\001
4 1 26 0 0 0 16 0.0000 4 240 675 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000 4 255 1425 4681 5266 INTFS:th\001
4 1 1 1 0 0 20 0.0000 4 255 270 2925 10035 X\001
4 1 1 1 0 32 20 0.0000 4 195 240 5580 9990 a\001
4 1 1 1 0 0 20 0.0000 4 255 240 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000 4 240 675 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000 4 240 675 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000 4 240 675 3960 6210 [mod]\001
4 1 4 0 0 0 20 0.0000 4 330 1785 2971 1216 SS:[xTip_a]\001
4 1 4 0 0 0 20 0.0000 4 330 1800 2971 9361 SS:[xTip_b]\001
4 1 4 0 0 0 20 0.0000 4 330 1755 8372 1217 SS:[yTip_a]\001
4 1 4 0 0 0 20 0.0000 4 330 1770 8417 9362 SS:[yTip_b]\001
4 1 4 0 0 0 20 0.0000 4 330 2700 5671 1216 SS:[angularTip_a]\001
4 1 4 0 0 0 20 0.0000 4 330 2715 5671 9361 SS:[angularTip_b]\001
4 1 1 1 0 0 20 0.0000 4 330 765 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000 4 255 1800 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000 4 330 780 1350 9855 Tip b\001
4 1 -1 0 0 0 20 0.0000 4 330 930 9360 6345 Se:mg\001
4 2 4 0 0 0 20 0.0000 4 330 1515 1935 3735 SS:[angle]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/ROD_lbl.txt version [02fb4fd7ae].

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
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





































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	ROD: rigid rod in two dimensions - with gravity and angle port
%DESCRIPTION	See Section 10.2 of "Metamodelling"
%DESCRIPTION	Gravity term added at centre

%ALIAS $1	l_a	# length from end a to mass centre
%ALIAS $2	l_b	# length from end b to mass centre
%ALIAS $3	j_m	# inertia about mass centre
%ALIAS $4	m	# mass
%ALIAS $5	g	# gravity

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS in|Tip_a		xTip_a,angularTip_a,yTip_a 	
%ALIAS out|Tip_b	xTip_b,angularTip_b,yTip_b 	

%ALIAS x_a		xTip_a # Force/velocity at tip a in x direction
%ALIAS y_a		yTip_a # Force/velocity at tip a in y direction
%ALIAS alpha_a|a_a	angularTip_a # Torque/angular velocity at tip a

%ALIAS x_b		xTip_b # Force/velocity at tip b in x direction
%ALIAS y_b		yTip_b # Force/velocity at tip b in y direction
%ALIAS alpha_b|a_b	angularTip_b # Torque/angular velocity at tip b

%ALIAS angle|a		angle	# Angle port

%ALIAS INTF	General/INTF # The flow integration component.

%% Label file for system ROD (ROD_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/10/22 02:01:45  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1999/08/05 08:04:40  peterg
% %% Initial revision
% %%
% %% Revision 1.3  1998/11/30 10:47:53  peterg
% %% Added extra a_a and a_b aliases
% %%
% %% Revision 1.2  1998/11/25 13:55:42  peterg
% %% Added missig attribute field m*g,internal
% %%
% %% Revision 1.1  1998/11/25 10:48:34  peterg
% %% Initial revision
% %%
% %% Revision 1.5  1998/07/27 12:27:27  peterg
% %% Added vector port aliases
% %%
% %% Revision 1.4  1998/07/27 10:51:20  peterg
% %% Aliased INTF as well.
% %%
% %% Revision 1.3  1998/07/27 10:49:10  peterg
% %% Major revision to include aliases etc
% %%
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,j_m;omega_0
m_x	lin	flow,m
m_y	lin	flow,m

%Integrate angular velocity to get angle
th	none	   theta_0

%Modulated transformers
s1	lsin	flow,l_a
s2	lsin	flow,l_b
c1	lcos	flow,l_a
c2	lcos	flow,l_b


% Component type Se
	mg			SS		m*g

% Component type SS
	[angularTip_a]		SS		external,external
	[angularTip_b]		SS		external,external
	[xTip_a]		SS		external,external
	[xTip_b]		SS		external,external
	[yTip_a]		SS		external,external
	[yTip_b]		SS		external,external
	[angle]			SS		external,external


	

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/Zero_abg.fig version [10a50da953].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 2700 4050 2700 3825 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 3375 4050 3375 3825 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4050 4050 4050 3825 4275
4 1 4 100 0 18 18 0.0000 4 270 765 2160 2790 SS:[x]\001
4 1 0 100 0 18 18 0.0000 4 210 570 4545 2790 Se:x\001
4 1 4 100 0 18 18 0.0000 4 270 765 2160 3465 SS:[y]\001
4 1 0 100 0 18 18 0.0000 4 270 570 4545 3465 Se:y\001
4 1 4 100 0 18 18 0.0000 4 270 780 2160 4140 SS:[a]\001
4 1 0 100 0 18 18 0.0000 4 210 525 4545 4140 Sf:a\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/Zero_lbl.txt version [651d1a7e40].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Zero (Zero_lbl.txt)
%SUMMARY Zero
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	x,y,a

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	[a]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type Se
	x	SS		0
	y	SS		0

% Component type Sf
	a	SS		external


Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sCart_lbl.txt version [825772b7ca].

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



























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sCart (sCart_lbl.txt)
%SUMMARY sCart
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	        drive_1,drive_2
%ALIAS	pendulum|out	x_1,x_2,y_1,y_2,a_1,a_2

% Argument aliases
%ALIAS	$1	m_c
%ALIAS	$2	r_c
%ALIAS	$3	r_p

%ALIAS	$4	m_cs
%ALIAS	$5	r_cs
%ALIAS	$6	r_ps

%ALIAS  $7	v_0
%ALIAS  $8	v_0s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type I
	m_c		lin	flow,m_c;v_0;m_cs;v_0s

% Component type R
	r_c		lin	flow,r_c;r_cs
	r_p		lin	flow,r_p;r_ps

% Component type sINTFS
	x               none    x_0;x_0s

% Component type SS
	[a]	SS		external,external
	[drive]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type De
	Position		SS	external;external

% Component type Sf
	zero_velocity		SS	0;0



Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sDCS_lbl.txt version [8f818cd526].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY sDCS: DC motor - sensitivity 
%DESCRIPTION A special for the inverted pendulum system
%DESCRIPTION Derivative causality on the  shaft
%DESCRIPTION No aliased parameters
%DESCRIPTION Built in causality - speeds things up
%DESCRIPTION Only the armature state and shaft resistance are variable

%ALIAS in	Electrical_1,Electrical_2
%ALIAS out	Mechanical_1,Mechanical_2


%% Label file for system sDCS (sDCS_lbl.txt)


%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Motor gain
k_m	lin		flow,k_m;0

% Electrical components
%Inductance
l_a	lin		flow,l_a;i_0;0;i_0s

%Resistance
r_a	lin		flow,r_a;0

% Mechanical components
%Inertia
j_m	lin		flow,j_m;0

%Friction
b_m	lin		flow,b_m;b_ms

% Ports
	[Electrical]	SS	external,external
	[Mechanical]	SS	external,external

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sDriveCart_identify.m version [6868c24a26].

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
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













































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function sDriveCart_identify ()

  ## usage:  sDriveCart_identify ()
  ##
  ## 

  ## Identify the Drive/cart friction
  ## 	$Id$	

  system_name = "sDriveCart";	# Name of this system
  input_name = sprintf("%s_input.dat", system_name);
  ## disp("Create programs");
  ## system(sprintf("mtt -q -c -s -stdin %s ode2odes out", system_name)); # Create sim. code
  ## system(sprintf("mtt -q -c -s -stdin %s numpar m", system_name)); # Create sim. code
  ## system(sprintf("mtt -q -c -s -stdin %s def m", system_name)); # Create sim. code

  ## Optimisation parameters
  crite = 1e-5;			# Convergence criterion
  alpha = 0.5;			# Step reduction factor
  max = 30;			# Maximum iterations
  View = 1			# View the optimisation process

  ## Parameters
  global mtt_n_parameters
  mtt_n_parameters = 0;

  eval(sprintf("%s_numpar;", system_name));

  alpha = 0.75;
  criterion = 1e-9;
  max_iterations = 20;

  ## Real data
  disp("Loading data");
  load -force data_020999.dat;
  [N_data,M_data] = size(data_020999);
  M = 10;
  t = data_020999(1:M:N_data,1);
  u = data_020999(1:M:N_data,2);
  y = data_020999(1:M:N_data,3)/100; # convert from cm to m

  gset grid
  gset title ""
  gset xlabel "Time (sec)"
  tu = [t u];
  ty = [t y];
  gplot tu title "input (V)", ty title "output (m)"
  psfig("sDriveCart_yu");


  y_s = [u y];			# u is first o/p of system.
  ## Start time at zero
  t = t-t(1)*ones(size(t));
  
  T_last = 40;
  DT = t(2)-t(1);

  tu = [t u u u u];		# Put same signal on all inputs (only
				# first used
  save -ascii junk.dat tu
  ## zap the octave comments
  system(sprintf("grep -v \'#\' junk.dat > %s; rm -f junk.dat", input_name));

  ## Set up theta
  control = [1 0 0 0];		# Initial control parameters
  unused = 0;			# Unused parameter slot
  r_c = 0;
  parameters = [r_c m_c unused unused unused];
  i_r = 4+1;
  i_m = 4+2;
  state = [0 unused unused 0 0];
  i_v = 4+5+4;
  i_x = 4+5+5;
  i_i = 4+5+1;
  theta_0 = [control parameters state]';

  ## Weighting function - select output, not input
  weight = ones(size(t))*[0 1];

  ## Estimate r only
  free = [i_r i_i i_v i_x];
  disp("Estimate cart friction ...");
  [theta,Theta,Error,Y] = mtt_optimise(system_name,y_s,theta_0,"time",\
				       free,weight,crite,max,alpha,View);

  ## Plot results
#   ix = [its Theta(i_x,:)'];
#   iv = [its Theta(i_v,:)'];
#   ii = [its Theta(i_i,:)'];

#   gplot \
#       ix with linespoints title "x_0",\
#       iv with linespoints title "p_0",\
#       ii with linespoints title "i_0"

#   psfig("sDriveCart_ident_x");

  [N_th,M_th] = size(Theta);
  its = [0:M_th-1]';
  gset grid
  gset title ""
  gset xlabel "Iterations"
  ir = [its Theta(i_r,:)'];
  gplot ir with linespoints title "r"
  psfig("sDriveCart_ident_r");

  r_c = theta(i_r)

endfunction

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sDriveCart_numpar.txt version [1efc3b6766].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200








































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (sInvertedPendulumOnCart_numpar.txt)
# Generated by MTT at Wed Aug 25 22:57:05 BST 1999

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1999/12/03 00:50:28  peterg
# %% Initial revision
# %%
# %% Revision 1.1  1999/11/12 06:47:50  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

## Same as sInvertedpendulumOnCart with pendulum stuff removed.

# Parameters
j_m = 	3.87e-7;		# Motor inertia
k_m = 	0.00767;		# Motor constant
r_a = 	2.6;			# Armature resistance
l_a = 	0.18e-3;		# Armature inductance

k_g = 	1/3.7;			# Internal gear ratio 
r = 	0.635e-2;		# Motor gear radius

m_c = 	0.455;			# Cart mass

b_m = 	0.0;			# Motor friction
r_c = 	5.0;			# Cart friction

# l_p =   0.61;			# Pendulum length
# m_p =   0.210;			# Pendulum mass
# r_p = 	0.0;			# Pendulum friction
# j_p = m_p*(l_p*l_p)/12;		# Pendulum inertia about cm.

# g = +9.81;			# Gravity

# m_t = 0.0; # Tip mass

## Sensitivity parameters
m_cs = 0;			# Cart mass
b_ms = 0;			# Motor friction 
r_cs = 0;			# Cart friction

# j_ps = 0;			# Pendulum inertia
# m_ps = 0;			# Pendulum mass
# r_ps = 0;			# Pendulum friction

# m_ts = 0;			# Tip mass

## Initial states
i_0 = 0;			# Initial armature current
# omega_0 = 0;			# Initial pendulum velocity
# theta_0 = 0;			# Initial pendulum angle
v_0 = 0;			# Initial cart velocity
x_0 = 0;			# Initial cart position

## Sensitivity parameters
i_0s = 0;			# Initial armature current
# omega_0s = 0;			# Initial pendulum velocity
# theta_0s = 0;			# Initial pendulum angle
v_0s = 0;			# Initial cart velocity
x_0s = 0;			# Initial cart position

## Control parameters
k_1 = 1;
k_2 = 0;
k_3 = 0;
k_4 = 0;

## Control sensitivity parameters
k_1s = 0;
k_2s = 0;
k_3s = 0;
k_4s = 0;


## Which sensitivity function? NB all other sens. coeffs MUST be zero -
## see above
if (mtt_n_parameters>=1)
  mtti = mtt_parameters(1);

  if mtti==1
    k_1s = 1;
  endif
  
  if mtti==2
    k_2s = 1;
  endif
  
  if mtti==3
    k_3s = 1;
  endif

  if mtti==4
    k_4s = 1;
  endif

  if mtti==5
    r_cs = 1;
  endif
  
  if mtti==6
    m_cs = 1;
  endif

#   if mtti==7
#     r_ps = 1;
#   endif

#   if mtti==8
#     m_ts = 1;
#   endif

#   if mtti==9
#     j_ps = 1;
#   endif
  
  if mtti==10
    i_0s = 1;			# Initial armature current
  endif
  
#   if mtti==11
#     omega_0s = 1;		# Initial pendulum velocity
#   endif
  
#   if mtti==12
#     theta_0s = 1;		# Initial pendulum position
#   endif
  
  if mtti==13
    v_0s = 1;			# Initial cart velocity
  endif
  
  if mtti==14
    x_0s = 1;			# Initial cart angle
  endif
  
endif;

## Control parameters

if (mtt_n_parameters>=2)
  k_1 = mtt_parameters(2);
endif;

if (mtt_n_parameters>=3)
  k_2 = mtt_parameters(3);
endif;

if (mtt_n_parameters>=4)
  k_3 = mtt_parameters(4);
endif;

if (mtt_n_parameters>=5)
  k_4 = mtt_parameters(5);
endif;

## Physical parameters
if (mtt_n_parameters>=6)
  r_c = mtt_parameters(6);
endif;

if (mtt_n_parameters>=7)
  m_c = mtt_parameters(7);
endif;

# if (mtt_n_parameters>=8)
#   r_p = mtt_parameters(8);
# endif;

# if (mtt_n_parameters>=9)
#   m_t = mtt_parameters(9);
# endif;

# if (mtt_n_parameters>=10)
#   j_p = mtt_parameters(10);
# endif;

## Initial condition parameters - states are read in
if (mtt_n_parameters>=15)	# 
  i_0 = mtt_parameters(11); # Initial armature current
#   omega_0 = mtt_parameters(12); # Initial cart velocity
#   theta_0 = mtt_parameters(13);	# Initial cart position
  v_0 = mtt_parameters(14); # Initial pendulum velocity
  x_0 = mtt_parameters(15); # Initial pendulum angle
endif;

## Simulation stuff

if (mtt_n_parameters>=16)
  LAST = mtt_parameters(16);
endif;
if (mtt_n_parameters>=17)
  DT = mtt_parameters(17);
endif;

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sDriveCart_simpar.txt version [66769d1708].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system sDriveCart (sDriveCart_simpar.txt)
# Generated by MTT on Fri Dec 3 10:30:48 EST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 40.0;       # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sDrive_lbl.txt version [5a461fb90b].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sDrive (sDrive_lbl.txt)
%SUMMARY sDrive
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Electrical_1,Electrical_2
%ALIAS	out	Mechanical_1,Mechanical_2

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type sDCS
	motor

% Component type SS
	[Electrical]	SS		external,external
	[Mechanical]	SS		external,external

% Component type sTF
	k_g		lin	flow,k_g;0
	r		lin	flow,r;0



Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sEMTF_abg.fig version [06c2007d04].

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
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







































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2205 3555 2295 4095
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2250 3600 2250 4050
-6
6 2205 3555 2295 4095
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2250 3600 2250 4050
-6
6 2205 7155 2295 7695
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2250 7200 2250 7650
-6
6 3510 4005 4050 4095
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4005 4050 3555 4050
-6
6 3645 5850 4185 5940
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4140 5895 3690 5895
-6
6 8730 5355 9270 5445
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 9225 5400 8775 5400
-6
6 3600 7155 4140 7245
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4095 7200 3645 7200
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 7425 3600 7425 3375 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 7425 5400 7425 5175 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7425 7425 8775 7425 8550 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9225 7425 10575 7425 10350 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 3825 3600 3825 3375 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 3825 5400 3825 5175 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7425 3825 8775 3825 8550 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9225 3825 10575 3825 10350 4050
2 1 0 2 -1 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 5895 9000 7200 9000 6975
2 1 0 2 -1 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9006 5873 3831 7178 3831 6953
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6300 450 6300 1800 6525 1575
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6300 2250 6300 3600 6525 3375
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6075 1800 6525 1800
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 4
	 6075 2025 4275 2025 4275 5400 4500 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 4050 3825 5400 4050 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 9000 4050 9000 5400 9225 5175
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6525 2250 6525 7200 6750 6975
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 4
	 6525 2025 8550 2025 8550 5400 8775 5175
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 4
	 6525 8550 9225 8550 9225 5850 9450 6075
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 4
	 6075 8550 3600 8550 3600 5850 3375 6075
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6300 10125 6300 8775 6525 9000
2 1 0 2 5 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6075 8775 6525 8775
4 1 4 100 0 18 20 0.0000 4 285 2415 6210 360 SS:[Actual_mod]\001
4 1 5 100 0 18 20 0.0000 4 210 165 6300 2115 0\001
4 1 4 100 0 18 20 0.0000 4 285 1845 1215 7515 SS:[Sens_in]\001
4 1 0 100 0 18 20 0.0000 4 210 165 3825 7515 1\001
4 1 0 100 0 18 20 0.0000 4 225 1590 6435 7515 EMTF:sens\001
4 1 0 100 0 18 20 0.0000 4 210 165 9000 7515 0\001
4 1 4 100 0 18 20 0.0000 4 285 2040 11790 7515 SS:[Sens_out]\001
4 1 4 100 0 18 20 0.0000 4 285 2055 1215 3915 SS:[Actual_in]\001
4 1 0 100 0 18 20 0.0000 4 210 165 3825 3915 1\001
4 1 0 100 0 18 20 0.0000 4 225 1785 6435 3915 EMTF:actual\001
4 1 0 100 0 18 20 0.0000 4 210 165 9000 3915 0\001
4 1 4 100 0 18 20 0.0000 4 285 2250 11790 3915 SS:[Actual_out]\001
4 1 0 100 0 18 20 0.0000 4 225 1170 8955 5715 AE3:ae3\001
4 1 0 100 0 18 20 0.0000 4 225 1095 3825 5715 AF3:af3\001
4 2 4 100 0 18 14 0.0000 4 210 600 6255 3600 [mod]\001
4 2 4 100 0 18 14 0.0000 4 210 600 6435 7155 [mod]\001
4 1 4 100 0 18 20 0.0000 4 285 2205 6300 10395 SS:[Sens_mod]\001
4 1 5 100 0 18 20 0.0000 4 210 165 6345 8640 0\001
4 2 4 100 0 18 14 0.0000 4 210 720 3420 5985 [smod]\001
4 0 4 100 0 18 14 0.0000 4 210 720 9540 5940 [smod]\001
4 2 4 100 0 18 14 0.0000 4 210 600 8505 5355 [mod]\001
4 0 4 100 0 18 14 0.0000 4 210 600 4455 5400 [mod]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sEMTF_lbl.txt version [740377120d].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sEMTF (sEMTF_lbl.txt)
%SUMMARY sEMTF Effort modulated TF - sensitivity version
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Actual_in,Sens_in
%ALIAS	out	Actual_out,Sens_out
%ALIAS	mod	Actual_mod,Sens_mod


% Argument aliases
%ALIAS	$1	l

% CR aliases
%ALIAS	$1	lsin
%ALIAS	$2	slsin

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type EMTF
	actual		lsin	flow,l
	sens		lsin	flow,l

% Component type AE3 (????NB NEGATIVE GAIN HERE!!!!)
	ae3             slsin   l

% Component type AF3
	af3             slsin   l

% Component type SS
	[Actual_in]	SS		external,external
	[Actual_out]	SS		external,external
	[Actual_mod]	SS		external,internal
	[Sens_in]	SS		external,external
	[Sens_out]	SS		external,external
	[Sens_mod]	SS		external,internal



Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sINTFS_abg.fig version [3690b29bfb].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3376 3151 4276 3151 4051 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 2926 4501 2026 4726 2251
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3151 5626 3151 5401 3376
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 10575 4950 45 4950 45 1350 10575 1350 10575 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1575 3150 2475 3150 2250 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6526 3150 7426 3150 7201 3375
4 1 6 0 0 0 20 0.0000 4 256 181 4502 3242 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 255 180 4502 3241 0\001
4 1 -1 0 0 0 20 0.0000 4 255 1110 4501 1891 sCS:unit\001
4 2 6 0 0 0 20 0.0000 4 316 1456 1531 3241 [1,2]\001
4 2 4 0 0 0 20 0.0000 4 315 1455 1531 3240 SS:[Flow]\001
4 1 -1 0 0 0 20 0.0000 4 255 825 2925 3240 sAF:af\001
4 1 -1 0 0 0 20 0.0000 4 255 900 6075 3240 sAE:ae\001
4 0 6 0 0 0 20 0.0000 4 331 3046 7471 3241 [1,2]\001
4 0 4 0 0 0 20 0.0000 4 330 3045 7471 3240 SS:[Integrated_flow]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sINTFS_lbl.txt version [04b43b7e2f].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sINTFS (sINTFS_lbl.txt)
%SUMMARY	sINTFS: flow integrator
%DESCRIPTION	Port [in]:	Flow to be integrated
%DESCRIPTION	Port [out]:	Effort = integral of flow on port [in]


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/07/16 07:35:10  peterg
% %% Aliased version
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Flow_1,Flow_2
%ALIAS	out	Integrated_flow_1,Integrated_flow_2

% Argument aliases
%ALIAS	$1 x_0	
%ALIAS	$2 x_0s	

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% CS
	unit			SS		effort,1;x_0;0;x_0s

% Component type AE
	ae			lin		1;0

% Component type AF
	af			lin		1;0


% Component type SS
	[Flow]			SS		external,external
	[Integrated_flow]	SS		external,external

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sIS_abg.fig version [917d2513e9].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2340 3915 2610 4185
4 1 6 100 0 18 20 0.0000 4 271 196 2476 4186 [1,2]\001
4 1 0 100 0 18 20 0.0000 4 270 195 2476 4185 0\001
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3825 2475 2475 2700 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 5625 2475 4275 2700 4500
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 4050 4050 4050 3825 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 3825 4050 4275
4 1 0 100 0 18 20 0.0000 4 285 315 2475 2295 sI:i\001
4 0 0 100 0 18 20 0.0000 4 360 1035 4185 4185 sSf:f_0\001
4 1 6 100 0 18 20 0.0000 4 361 1186 2476 6031 [1,2]\001
4 1 4 100 0 18 20 0.0000 4 360 1185 2476 6030 SS:[in]\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sIS_lbl.txt version [9a121bfbfe].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sIS (sIS_lbl.txt)
%SUMMARY sIS
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Port aliases
%ALIAS	in	in_1,in_2

% Argument aliases
%ALIAS	$1	flow,i
%ALIAS	$2	f_0
%ALIAS	$3	i_s
%ALIAS	$4	f_0s

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[in]	SS		external,external

% Component type sI
	i       lin             flow,i;i_s

% Component type sSf
	f_0     SS	        f_0;f_0s

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sInvertedPendulumOnCartPPP_numpar.txt version [7f13064103].

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
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




























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (sInvertedPendulumOnCart_numpar.txt)
# Generated by MTT at Tue Apr 18 18:07:52 BST 2000

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

## Default parameters
b_m = 	0.0; # sDCS
b_ms = 	0.0; # sDCS
c = 	0.0; # sC,sC,sCS,sCS
c_s = 	0.0; # sCS,sCS
e_0 = 	0.0; # sCS,sCS
e_0s = 	0.0; # sCS,sCS
e_s = 	0.0; # Se,Se,Se,sSe,sSe,sSe
f_0 = 	0.0; # sIS,sIS,sIS
f_0s = 	0.0; # sIS,sIS,sIS
f_s = 	0.0; # Sf,Sf,Sf,sSf,sSf,sSf
g = 	0.0; # AFe,AFe,sInvertedPendulum,sROD
i = 	0.0; # sI,sI,sI,sI,sI,sI,sIS,sIS,sIS
i_0 = 	0.0; # sDCS
i_0s = 	0.0; # sDCS
i_s = 	0.0; # sIS,sIS,sIS
j_m = 	0.0; # sDCS,sROD
j_p = 	0.0; # sInvertedPendulum
j_ps = 	0.0; # sInvertedPendulum
j_s = 	0.0; # sROD
k = 	0.0; # sAE,sAE,sAE,sAF,sAF,sGY,sTF
ppp_1 = 	1.0; # sOpenLoop
ppp_1s = 	0.0; # sOpenLoop
ppp_2 = 	0.0; # sOpenLoop
ppp_2s = 	0.0; # sOpenLoop
ppp_3 = 	0.0; # sOpenLoop
ppp_3s = 	0.0; # sOpenLoop
ppp_4 = 	0.0; # sOpenLoop
ppp_4s = 	0.0; # sOpenLoop
k_g = 	0.0; # sDrive
k_m = 	0.0; # sDCS
k_s = 	0.0; # sAE,sAE,sAE,sAF,sAF,sC,sC,sGY,sI,sI,sI,sI,sI,sI,sR,sR,sSe,sSe,sSe,sSf,sSf,sSf,sTF
l = 	0.0; # AE3,AF3,sEMTF
l_a = 	0.0; # sDCS,sROD
l_b = 	0.0; # sROD
l_p = 	0.0; # sInvertedPendulum,sInvertedPendulumOnCart
m = 	0.0; # sROD
m_c = 	0.0; # sCart
m_cs = 	0.0; # sCart
m_p = 	0.0; # sInvertedPendulum
m_ps = 	0.0; # sInvertedPendulum
m_s = 	0.0; # sROD
m_t = 	0.0; # sInvertedPendulum
m_ts = 	0.0; # sInvertedPendulum
omega_0 = 	0.0; # sInvertedPendulum,sROD
omega_0s = 	0.0; # sInvertedPendulum,sROD
r = 	0.0; # sDrive,sR,sR
r_a = 	0.0; # sDCS
r_c = 	0.0; # sCart
r_cs = 	0.0; # sCart
r_p = 	0.0; # sCart
r_ps = 	0.0; # sCart
theta_0 = 	0.0; # sInvertedPendulum,sROD
theta_0s = 	0.0; # sInvertedPendulum,sROD
v_0 = 	0.0; # sCart
v_0s = 	0.0; # sCart
x_0 = 	0.0; # sCart,sINTFS,sINTFS
x_0s = 	0.0; # sCart,sINTFS,sINTFS


## Pysical Parameters
j_m = 	3.87e-7;		# Motor inertia
k_m = 	0.00767;		# Motor constant
r_a = 	2.6;			# Armature resistance
l_a = 	0.18e-3;		# Armature inductance

k_g = 	1/3.7;			# Internal gear ratio 
r = 	0.635e-2;		# Motor gear radius

m_c = 	0.455;			# Cart mass

b_m = 	0.0;			# Motor friction
r_c = 	1.5;			# Cart friction

l_p =   0.61;			# Pendulum length
m_p =   0.210;			# Pendulum mass
r_p = 	0.0;			# Pendulum friction

j_p = m_p*(l_p*l_p)/12;		# Pendulum inertia about cm.

g = 9.81;			# Gravity

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sInvertedPendulumOnCartPPP_state.txt version [3b214e7bb5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Initial state  file (sInvertedPendulumOnCartPPP_state.txt)
# Generated by MTT at Thu May  4 14:57:10 BST 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the states
mttx(1) 	= 0.0; 	# i_1 (sInvertedPendulumOnCartPPP_mtt2_motor_l_a_i)
mttx(2) 	= 0.0; 	# i_2 (sInvertedPendulumOnCartPPP_mtt2_motor_l_a_i)
mttx(3) 	= 0.0; 	# i_1 (sInvertedPendulumOnCartPPP_mtt3_rod_J_i)
mttx(4) 	= 0.0; 	# i_2 (sInvertedPendulumOnCartPPP_mtt3_rod_J_i)
mttx(5) 	= pi/2; 	# c_1 (sInvertedPendulumOnCartPPP_mtt3_rod_th_unit_c)
mttx(6) 	= 0.0; 	# c_2 (sInvertedPendulumOnCartPPP_mtt3_rod_th_unit_c)
mttx(7) 	= 0.0; 	# i_1 (sInvertedPendulumOnCartPPP_mtt4_m_c_i)
mttx(8) 	= 0.0; 	# i_2 (sInvertedPendulumOnCartPPP_mtt4_m_c_i)
mttx(9) 	= 0.0; 	# c_1 (sInvertedPendulumOnCartPPP_mtt4_x_unit_c)
mttx(10) 	= 0.0; 	# c_2 (sInvertedPendulumOnCartPPP_mtt4_x_unit_c)

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sInvertedPendulumOnCart_input.txt version [c3ea90775c].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (sInvertedPendulumOnCart_input.txt)
# Generated by MTT at Thu Aug  5 09:17:30 BST 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the inputs
# mttu(1) = 1.0*(t<1) -1.0*((t>=1)&&(t<2)); 	# u (sInvertedPendulumOnCart_F)

  ## Doing control
#   if (mtt_n_parameters>=1)	
#     if (mtt_parameters(1)<5)
      mttu(1) = exp(-0.0*t);
      mttu(2) = exp(-2.0*t);
      mttu(3) = exp(-5.0*t);
      mttu(4) = exp(-10.0*t);

#       mttu(1) = 1;
#       mttu(2) = exp(-0.5*t);;
#       mttu(3) = exp(-t);
#       mttu(4) = exp(-2*t);

#       mttu(1) = (t<0.1);
#       mttu(2) = ((t>=0.1)&&(t<0.2));
#       mttu(3) = ((t>=0.2)&&(t<0.3));
#       mttu(4) = ((t>=0.3)&&(t<0.4));
#     else			
#       ## Identification 
#       mttu(1) = (-1*((t>=3.37966)&&(t<= 5.36946)) + ((t>=10.36896)&&(t<=12.36876))); 
#     endif
#   endif


Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sInvertedPendulumOnCart_lbl.txt version [6c0ec1a387].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sInvertedPendulumOnCart (sInvertedPendulumOnCart_lbl.txt)
%SUMMARY sInvertedPendulumOnCart
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%VAR l_p		#Pendulum length

% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----


Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sInvertedPendulumOnCart_rep.txt version [7cce77e715].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system sInvertedPendulumOnCart (sInvertedPendulumOnCart_rep.txt)
## Generated by MTT on" Fri Oct 22 09:03:14 EST 1999.

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

mtt sInvertedPendulumOnCart abg tex			# The system description
mtt sInvertedPendulumOnCart cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt sInvertedPendulumOnCart struc tex	        # The system structure
mtt sInvertedPendulumOnCart dae tex	        # The system dae
## mtt sInvertedPendulumOnCart ode tex	        # The system ode 
## mtt sInvertedPendulumOnCart sspar tex		# Steady-state parameters
## mtt sInvertedPendulumOnCart ss tex 		# Steady state
## mtt sInvertedPendulumOnCart dm tex		# Descriptor matrices (of linearised system)
mtt sInvertedPendulumOnCart sm tex		# State matrices (of linearised system)
## mtt sInvertedPendulumOnCart tf tex		# Transfer function (of linearised system)
## mtt sInvertedPendulumOnCart lmfr ps		# log modulus of frequency response (of linearised system)
mtt sInvertedPendulumOnCart simpar tex		# Simulation parameters
mtt sInvertedPendulumOnCart numpar tex		# Numerical simulation parameters
mtt sInvertedPendulumOnCart input tex		# Simulation input
mtt -c -cse sInvertedPendulumOnCart odeso ps		# Simulation output

mtt sInvertedPendulumOnCart ppp ps		# PPP control

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sInvertedPendulumOnCart_simpar.txt version [2fbcb7b3c6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system sInvertedPendulumOnCart (sInvertedPendulumOnCart_simpar.txt)
# Generated by MTT on Thu Aug 5 09:17:05 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 1.0;      # Last time in simulation
DT          = 0.05;		# Print interval
STEPFACTOR  = 1;		# Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input


Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sInvertedPendulum_lbl.txt version [19c18e9e54].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sInvertedPendulum (sInvertedPendulum_lbl.txt)
%SUMMARY sInvertedPendulum
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	x_1,x_2,y_1,y_2,a_1,a_2


% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type I
        m_x     lin             flow,m_t;m_ts
        m_y     lin             flow,m_t;m_ts

% Component type Se
	mg			SS		m_t*g;0

% Component type De
	theta			SS	external;external



% Component type SS
	[a]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type Se
	a_0	 SS	0;0

% Component type ROD
	rod	 none		l_p;l_p;j_p;m_p;g;omega_0;theta_0;j_ps;m_ps;omega_0s;theta_0s
 

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sOpenLoop_lbl.txt version [6832b95589].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sOpenLoop (sOpenLoop_lbl.txt)
%SUMMARY sOpenLoop
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	out	us_1,us_2

% Argument aliases
%ALIAS	$1	U_1
%ALIAS	$2	U_1s
%ALIAS	$3	U_2
%ALIAS	$4	U_2s
%ALIAS	$5	U_3
%ALIAS	$6	U_3s
%ALIAS	$7	U_4
%ALIAS	$8	U_4s
%ALIAS	$9	us
%ALIAS	$10	uss
%ALIAS	$11	Us_1
%ALIAS	$12	Us_1s
%ALIAS	$13	Us_2
%ALIAS	$14	Us_2s
%ALIAS	$15	Us_3
%ALIAS	$16	Us_3s
%ALIAS	$17	Us_4
%ALIAS	$18	Us_4s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	[us]	SS		external,external

% Component type AE
	U_1	lin		ppp_1;ppp_1s
	U_2	lin		ppp_2;ppp_2s
	U_3	lin		ppp_3;ppp_3s
	U_4	lin		ppp_4;ppp_4s

% Component type Se
	Us_1	SS		external;0
	Us_2	SS		external;0
	Us_3	SS		external;0
	Us_4	SS		external;0

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sROD_lbl.txt version [710dd08bb5].

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
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










































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	sROD: rigid rod in two dimensions - with gravity and angle port
%DESCRIPTION	See Section 10.2 of "Metamodelling"
%DESCRIPTION	Gravity term added at centre

%ALIAS $1	l_a	# length from end a to mass centre
%ALIAS $2	l_b	# length from end b to mass centre
%ALIAS $3	j_m	# inertia about mass centre
%ALIAS $4	m	# mass
%ALIAS $5	g	# gravity

%ALIAS $6	omega_0 # Initial angular velocity 
%ALIAS $7	theta_0 # Initial angular velocity 

## Sensitivities
%ALIAS $8	j_s 
%ALIAS $9	m_s 

%ALIAS $10	omega_0s # Initial angular velocity 
%ALIAS $11	theta_0s # Initial angular velocity 


%ALIAS in|Tip_a		xTip_a_1,xTip_a_2,angularTip_a_1,angularTip_a_2,yTip_a_1,yTip_a_2 	
%ALIAS out|Tip_b	xTip_b_1,xTip_b_2,angularTip_b_1,angularTip_b_2,yTip_b_1,yTip_b_2 	

%ALIAS x_a		xTip_a_1,xTip_a_2 # Force/velocity at tip a in x direction
%ALIAS y_a		yTip_a_1,yTip_a_2 # Force/velocity at tip a in y direction
%ALIAS alpha_a|a_a	angularTip_a_1,angularTip_a_2 # Torque/angular velocity at tip a

%ALIAS x_b		xTip_b_1,xTip_b_2 # Force/velocity at tip b in x direction
%ALIAS y_b		yTip_b_1,yTip_b_2 # Force/velocity at tip b in y direction
%ALIAS alpha_b|a_b	angularTip_b_1,angularTip_b_2 # Torque/angular velocity at tip b

%ALIAS angle|a		angle_1,angle_2	# Angle port

%ALIAS INTF	General/INTF # The flow integration component.

%% Label file for system sROD (sROD_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/10/22 02:01:45  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1999/08/05 08:04:40  peterg
% %% Initial revision
% %%
% %% Revision 1.3  1998/11/30 10:47:53  peterg
% %% Added extra a_a and a_b aliases
% %%
% %% Revision 1.2  1998/11/25 13:55:42  peterg
% %% Added missig attribute field m*g,internal
% %%
% %% Revision 1.1  1998/11/25 10:48:34  peterg
% %% Initial revision
% %%
% %% Revision 1.5  1998/07/27 12:27:27  peterg
% %% Added vector port aliases
% %%
% %% Revision 1.4  1998/07/27 10:51:20  peterg
% %% Aliased INTF as well.
% %%
% %% Revision 1.3  1998/07/27 10:49:10  peterg
% %% Major revision to include aliases etc
% %%
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,j_m;omega_0;j_s;omega_0s
m_x	lin	flow,m;m_s
m_y	lin	flow,m;m_s

%Integrate angular velocity to get angle
th	   none	   theta_0;theta_0s

%Modulated transformers
s1	lsin;slsin	l_a
s2	lsin;slsin	l_b
c1	lcos;slcos	l_a
c2	lcos;slcos	l_b


% Component type Se
	mg			SS		m*g;0

% Component type SS
	[angularTip_a]		SS		external,external
	[angularTip_b]		SS		external,external
	[xTip_a]		SS		external,external
	[xTip_b]		SS		external,external
	[yTip_a]		SS		external,external
	[yTip_b]		SS		external,external
	[angle]			SS		external,external

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/InvertedPendulumOnCartPPP/sZero_lbl.txt version [c03b79280f].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sZero (sZero_lbl.txt)
%SUMMARY sZero
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	x_1,x_2,y_1,y_2,a_1,a_2


%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	[a]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type Se
	x	SS		0;0
	y	SS		0;0

% Component type Sf
	a	SS		0;0

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/MacroMicroPPP_abg.fig version [bb4e1ded8d].

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
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
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
173
174
175
176
177
178
179
180
181
182
183























































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Inches
A4      
100.00
Single
-2
1200 2
6 8550 825 13500 3375
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12595 1725 11695 1725 11845 1875
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12595 1350 11695 1350 11845 1500
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12595 975 11695 975 11845 1125
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12595 2100 11695 2100 11845 2250
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12595 2475 11695 2475 11845 2625
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12595 2850 11695 2850 11845 3000
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12595 3225 11695 3225 11845 3375
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 10200 2100 9300 2100 9450 2250
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
	 10200 975 8700 975 8700 1875 8550 1725
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
	 10200 1275 9000 1275 9000 1875 8850 1725
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
	 10200 1725 9300 1725 9300 1875 9150 1725
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
	 10200 3225 8700 3225 8700 2325 8550 2475
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
	 10200 2925 9000 2925 9000 2325 8850 2475
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
	 10200 2475 9300 2475 9300 2325 9150 2475
4 1 -1 0 0 0 20 0.0000 4 285 1230 10950 2175 AE:ppp_4\001
4 1 -1 0 0 0 20 0.0000 4 285 810 13050 1800 Se:u_3\001
4 1 -1 0 0 0 20 0.0000 4 285 1230 10950 1800 AE:ppp_3\001
4 1 -1 0 0 0 20 0.0000 4 285 810 13050 1425 Se:u_2\001
4 1 -1 0 0 0 20 0.0000 4 285 1230 10950 1425 AE:ppp_2\001
4 1 -1 0 0 0 20 0.0000 4 285 810 13050 1050 Se:u_1\001
4 1 -1 0 0 0 20 0.0000 4 285 1230 10950 1050 AE:ppp_1\001
4 1 -1 0 0 0 20 0.0000 4 285 1230 10950 2550 AE:ppp_5\001
4 1 -1 0 0 0 20 0.0000 4 285 1230 10950 2925 AE:ppp_6\001
4 1 -1 0 0 0 20 0.0000 4 285 1230 10950 3300 AE:ppp_7\001
4 1 -1 0 0 0 20 0.0000 4 285 810 13050 2550 Se:u_5\001
4 1 -1 0 0 0 20 0.0000 4 285 810 13050 2925 Se:u_6\001
4 1 -1 0 0 0 20 0.0000 4 285 810 13050 3300 Se:u_7\001
4 1 -1 0 0 0 20 0.0000 4 285 810 13050 2175 Se:u_4\001
4 1 -1 0 0 0 20 0.0000 4 210 150 9000 2175 1\001
-6
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2706 7206 3606 7206 3456 7356
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2406 7506 2406 8406 2556 8256
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3906 7506 3906 8406 4056 8256
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7208 7208 8108 7208 7958 7358
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8708 7208 9608 7208 9458 7358
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8408 7508 8408 8408 8558 8258
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7208 6908 8108 6008 8108 6233
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8708 6008 9608 6908 9383 6908
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9909 7509 9909 8409 10059 8259
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6908 7508 6908 8408 7058 8258
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11407 7507 11407 8407 11557 8257
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11406 5706 11406 4806 11556 4956
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4206 7206 5106 7206 4956 7356
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5406 7506 5406 8406 5556 8256
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4206 6906 5106 6006 5106 6231
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5405 5705 5405 4805 5555 4955
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2405 5705 2405 4805 2555 4955
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11707 7207 12607 7207 12457 7357
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11707 6007 12607 6907 12382 6907
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2105 4205 2105 3305 2255 3455
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2705 4205 2705 3305 2855 3455
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5706 7206 6606 7206 6456 7356
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5706 6006 6606 6906 6381 6906
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2704 6004 3604 6904 3379 6904
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1208 7208 2108 7208 1958 7358
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1208 6908 2108 6008 2108 6233
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 681 6006 1131 6006
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 906 6906 906 6006 1056 6156
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12905 6905 12905 6005 13055 6155
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10207 7207 11107 7207 10957 7357
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10207 6907 11107 6007 11107 6232
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8400 5700 8625 5700
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 12900 6000 13125 6000
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 12675 6000 12900 6000
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8175 5700 8400 5700
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 1501 7801 301 7801 301 5401 1501 5401 1501 7801
2 2 1 2 1 7 1 0 -1 6.000 1 0 0 0 0 5
	 1502 2852 3302 2852 3302 5777 1502 5777 1502 2852
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 4501 9001 3301 9001 3301 6301 4501 6301 4501 9001
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 6000 9000 4800 9000 4800 4200 6000 4200 6000 9000
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 7501 9001 6301 9001 6301 6301 7501 6301 7501 9001
2 4 1 2 1 7 2 0 -1 6.000 0 0 7 0 0 5
	 9000 9000 7800 9000 7800 4200 9000 4200 9000 9000
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 10501 9001 9301 9001 9301 6301 10501 6301 10501 9001
2 4 1 2 1 -1 1 0 -1 6.000 0 0 7 0 0 5
	 12000 9000 10800 9000 10800 4200 12000 4200 12000 9000
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 13501 7801 12301 7801 12301 5401 13501 5401 13501 7801
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 4
	 8700 2100 8400 2100 8400 5700 8550 5550
2 2 1 2 1 7 101 0 -1 6.000 0 0 -1 0 0 5
	 8100 600 13800 600 13800 3600 8100 3600 8100 600
4 1 -1 0 0 0 20 0.0000 4 210 150 2406 7281 0\001
4 1 -1 0 0 0 20 0.0000 4 285 690 3906 8781 I:m_1\001
4 1 -1 0 0 0 20 0.0000 4 285 705 2405 8780 R:b_1\001
4 1 -1 0 0 0 20 0.0000 4 210 150 2405 6080 0\001
4 1 -1 0 0 0 20 0.0000 4 210 150 3906 7281 1\001
4 1 -1 0 0 0 20 0.0000 4 210 150 8408 7283 0\001
4 1 -1 0 0 0 20 0.0000 4 210 150 8408 6083 0\001
4 1 -1 0 0 0 20 0.0000 4 285 705 8483 8783 R:b_3\001
4 1 -1 0 0 0 20 0.0000 4 285 690 9906 8781 I:m_3\001
4 1 -1 0 0 0 20 0.0000 4 285 690 6905 8780 I:m_2\001
4 1 -1 0 0 0 20 0.0000 4 210 150 11407 7282 0\001
4 1 -1 0 0 0 20 0.0000 4 210 150 11407 6082 0\001
4 1 -1 0 0 0 20 0.0000 4 285 645 11406 4581 C:k_t\001
4 1 -1 0 0 0 20 0.0000 4 285 645 11482 8782 R:b_t\001
4 1 -1 0 0 0 20 0.0000 4 210 150 5406 7281 0\001
4 1 -1 0 0 0 20 0.0000 4 210 150 5406 6081 0\001
4 1 -1 0 0 0 20 0.0000 4 285 705 5481 8781 R:b_2\001
4 1 -1 0 0 0 20 0.0000 4 210 150 12909 7284 1\001
4 1 -1 0 0 0 20 0.0000 4 210 150 6908 7283 1\001
4 1 -1 0 0 0 20 0.0000 4 210 150 2404 4579 1\001
4 1 -1 0 0 0 20 0.0000 4 285 705 2779 3154 C:p_1\001
4 1 -1 0 0 0 20 0.0000 4 285 705 2104 3154 R:d_1\001
4 1 -1 0 0 0 20 0.0000 4 210 150 910 7285 1\001
4 1 -1 0 0 0 20 0.0000 4 285 765 902 5777 Sf:v_b\001
4 1 -1 0 0 0 20 0.0000 4 285 735 12905 5780 De:f_t\001
4 1 -1 0 0 0 20 0.0000 4 210 150 9909 7284 1\001
4 1 -1 0 0 0 20 0.0000 4 285 705 5405 4580 C:k_2\001
4 1 1 1 0 3 20 0.0000 4 210 1515 3901 9301 Macro mass\001
4 1 1 1 0 3 20 0.0000 4 210 1770 2401 2776 Macro control\001
4 1 1 1 0 3 20 0.0000 4 210 1470 900 8100 Macro base\001
4 1 1 1 0 3 20 0.0000 4 285 1845 5400 4050 Compliant link\001
4 1 1 1 0 3 20 0.0000 4 210 1425 6901 9301 Micro mass\001
4 1 1 1 0 3 20 0.0000 4 210 1860 8475 4050 Micro actuator\001
4 1 1 1 0 3 20 0.0000 4 285 1095 9901 9301 Tip mass\001
4 1 1 1 0 3 20 0.0000 4 285 2940 11400 4050 Compliant environment\001
4 1 1 1 0 3 20 0.0000 4 285 1275 12901 8101 Tip sensor\001
4 1 1 1 0 3 20 0.0000 4 285 2370 6750 1275 Open-loop control\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/MacroMicroPPP_desc.tex version [4de8b8a9c3].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system MacroMicroPPP (MacroMicroPPP_desc.tex)
% Generated by MTT on Tue Dec 9 17:55:41 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/05/21 16:10:07  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{MacroMicroPPP} is
   displayed in Figure \Ref{MacroMicroPPP_abg} and its label
   file is listed in Section \Ref{sec:MacroMicroPPP_lbl}.
   The subsystems are listed in Section \Ref{sec:MacroMicroPPP_sub}.

This is a Bond Graph model of the macro-micro manipulation system
discussed by Sharon in his thesis and BY Sharon, Hogan and Hardt in
various papers.

It can be regarded as a single-input single-output system with input
$e_1$ and output $e_2$.  The bond graph in Figure \Ref{rcPPP_abg} is
augmented with the {\em open-loop\/} controller comprising
\begin{itemize}
\item seven effort source \textbf{Se} components ``u1'' to``u7''
\item seven effort amplifier \textbf{AE} components ``ppp\_1'' to `ppp\_7''
\end{itemize}
This allows up to 7 input basis functions.

This is a \emph{linear} system; but it is used to illustate
\emph{nonlinear} PPP control. 
Section \Ref{sec:rcPPP_nppp.ps} compares
\begin{itemize}
\item linear open-loop PPP control
\item linear closed-loop PPP control
\item nonlinear PPP control
\end{itemize}
as linear open and closed-loop control.

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/MacroMicroPPP_lbl.txt version [1618b01e61].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85





















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system MacroMicroPPP (MacroMicroPPP_lbl.txt)
%SUMMARY MacroMicroPPP
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/05/21 16:05:48  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases
%ALIAS	$1	ppp_1
%ALIAS	$2	ppp_2
%ALIAS	$3	ppp_3
%ALIAS	$4	ppp_4
%ALIAS	$5	k_2
%ALIAS	$6	k_t
%ALIAS	$7	p_1
%ALIAS	$8	f_t
%ALIAS	$9	m_1
%ALIAS	$10	m_2
%ALIAS	$11	m_3
%ALIAS	$12	b_1
%ALIAS	$13	b_2
%ALIAS	$14	b_3
%ALIAS	$15	b_t
%ALIAS	$16	d_1
%ALIAS	$17	u_1
%ALIAS	$18	u_2
%ALIAS	$19	u_3
%ALIAS	$20	u_4
%ALIAS	$21	v_b

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	ppp_1	lin		ppp_1
	ppp_2	lin		ppp_2
	ppp_3	lin		ppp_3
	ppp_4	lin		ppp_4
	ppp_5	lin		ppp_5
	ppp_6	lin		ppp_6
	ppp_7	lin		ppp_7

% Component type C
	k_2	lin		state,k_2
	k_t	lin		state,k_t
	p_1	lin		state,p_1

% Component type De
	f_t	SS		external

% Component type I
	m_1	lin		flow,m_1
	m_2	lin		flow,m_2
	m_3	lin		flow,m_3

% Component type R
	b_1	lin		flow,b_1
	b_2	lin		flow,b_2
	b_3	lin		flow,b_3
	b_t	lin		flow,b_t
	d_1	lin		flow,d_1

% Component type Se
	u_1	SS		external
	u_2	SS		external
	u_3	SS		external
	u_4	SS		external
	u_5	SS		external
	u_6	SS		external
	u_7	SS		external

% Component type Sf
	v_b	SS		0

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/MacroMicroPPP_nppp.m version [cfbc4c4ad7].

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
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
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


























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## MacroMicroPPP_nppp.m
## Makes figures for the MacroMicro_PPP exasmple.
## $Log$
## Revision 1.4  2000/05/21 16:11:53  peterg
## 7 basis funs.
##
## Revision 1.3  2000/05/21 15:59:34  peterg
## Made into _nppp.m file
## Parameterised _sm
##
## Revision 1.2  2000/05/17 17:01:39  peterg
## Modified for Macro Micro example -- works!!
##
## Revision 1.1  2000/05/17 10:03:04  peterg
## Initial revision
##
## Revision 1.1  2000/05/17 09:14:37  peterg
## Initial revision
##
system_name = "MacroMicroPPP";

## Uncomment the following the first time
## (Or do ./Make MacroMicroPPP in this directory)

## MTT stuff for the system simulation
##system("Make MacroMicroPPP");



t_s=0.1*[0:0.01:1];
u = [ones(7,length(t_s))];
x_0 = MacroMicroPPP_state;
par  = MacroMicroPPP_numpar;

## Simulate the system
tick=time;
[y] = MacroMicroPPP_sim(x_0,u,t_s,par);
Elapsed = time-tick
plot(t_s,y)

## Simulate the system to give just the final few point
t_s1 = 0.1*[0.91:0.01:1];
tick=time;
[y,x] = MacroMicroPPP_sim(x_0,u,t_s1,par);
Elapsed = time-tick
plot(t_s1,y,t_s1,x);

## Sensitivity system simulation parameters
x_0s = sMacroMicroPPP_state;
pars  = sMacroMicroPPP_numpar;
sympars  = sMacroMicroPPP_sympar;

## Simulate the sensitivity system
sensitivities = \
    [sympars.ppp_1s,\
     sympars.ppp_2s,\
     sympars.ppp_3s,\
     sympars.ppp_4s,\
     sympars.ppp_5s,\
     sympars.ppp_6s,\
     sympars.ppp_7s]
tick=time;
[y,ys] = sMacroMicroPPP_sim(x_0s,u,t_s,pars,sensitivities);
Elapsed = time-tick
plot(t_s,y,t_s,ys);


### PPP parameters
A_w = 0;
A_u = ppp_aug(A_w,laguerre_matrix(6,25)); # Specify basis functions

tau = 0.5*[0.9:0.01:1];         # Optimisation interval
t_ol = 0.5*[0:0.01:0.1];	# Open-loop interval
N = 10;                          # Number of open-loop intervals in simulation
w = 1;                          # Setpoint

## Linear system
[A,B,C,D] = MacroMicroPPP_sm(par);
Q = 1;
w = 1;
ppp_lin_plot (A,B(:,1),C(1,:),D(1,1),A_u,A_w,tau,Q,w,x_0);
psfig("MacroMicroPPP_lin");

## Simulate non-linear PPP (on this linear system)
extras.U_initial = "zero";
extras.U_next = "continuation";
extras.criterion = 1e-8;
extras.max_iterations = 10;
extras.v = 0.1;
extras.verbose = 0;

##  -- with no optimisation using linear PPP with continuation
extras.U_initial = "linear";
extras.U_next = "continuation";
extras.criterion = 1e-5;
extras.max_iterations = 0;

[y_c,x,u_c,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);

##  -- with no optimisation using linear PPP at each step
extras.U_initial = "linear";
extras.U_next = "linear";
extras.criterion = 1e-5;
extras.max_iterations = 0;
[y_l,x,u_l,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);

##  -- with optimisation using nonlinear PPP with continuation
extras.U_initial = "zero";
extras.U_next = "continuation";
extras.criterion = 1e-5;
extras.max_iterations=100;
extras.verbose = 0;
extras.v = 1e-5;
disp("Non-linear optimisation ....");
[y,x,u,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);


## Plots
title("");

## U, U_c and U_l
I = 1:N;
IU1 = [I' U(1,:)'];
IU1_c = [I' U_c(1,:)'];
IU1_l = [I' U_l(1,:)'];
gset grid; xlabel "Interval"
gplot IU1 title "U_1", IU1_c title "U_c1", IU1_l title "U_l1"
psfig("MacroMicroPPP_U1");

IU2 = [I' U(2,:)'];
IU2_c = [I' U_c(2,:)'];
IU2_l = [I' U_l(2,:)'];
gset grid; xlabel "Interval "
gplot IU2 title "U_2", IU2_c title "U_c2", IU2_l title "U_l2"
psfig("MacroMicroPPP_U2");

## y & u
gset grid; xlabel "Time (sec)"
ty = [t' y'] ; tu =  [t' u']; 
gplot ty title "Output", tu title "Input"

psfig("MacroMicroPPP_yu");

title("");
gset grid; xlabel "Time (sec)"
ty_c = [t' y_c'] ; 
ty_l = [t' y_l'] ; 
ty = [t' y'] ; 
tu =  [t' u']; 
gplot ty_c title "Continuation", ty_l title "Linear", ty title "Optimisation"
psfig("MacroMicroPPP_nppp");



Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/MacroMicroPPP_numpar.txt version [7601b7d25d].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Dummies
b_1 = 0.0;
b_2 = 0.0;
b_3 = 0.0;
b_t = 0.0;
d_1 = 0.0;
e_s = 0.0;
f_s = 0.0;
k_2 = 0.0;
k_t = 0.0;
m_1 = 0.0;
m_2 = 0.0;
m_3 = 0.0;
p_1 = 0.0;
ppp_1 = 0.0;
ppp_2 = 0.0;
ppp_3 = 0.0;
ppp_4 = 0.0;
ppp_5 = 0.0;
ppp_6 = 0.0;
ppp_7 = 0.0;

m_1 = 0.0169;		# m_1;
m_2 = 0.0169;		# m_2;
b_1 = 0.13;		# b_1;
b_2 = 0.013;		# b_2;
k_2 = 24;	        # k_2;
k_t = 150;		# k_t;
b_t = 0.16;		# b_t;
b_3 = 0.13;		# b_3;
m_3 = 0.005;		# m_3;
p_1 = 10;		# p_1;
d_1 = 0.9;		# d_1;


ppp_1 = 1.0;

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/MacroMicroPPP_rep.txt version [24152c31ed].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system MacroMicroPPP (MacroMicroPPP_rep.txt)
## Generated by MTT on" Wed May 10 09:22:52 BST 2000.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/05/20 17:44:47  peterg
## Initial revision
##
###############################################################

mtt MacroMicroPPP abg tex		# The system description
#mtt -s sMacroMicroPPP abg tex		# The system description

mtt MacroMicroPPP struc tex	        # The system structure
mtt -s sMacroMicroPPP struc tex	        # The system structure

mtt MacroMicroPPP nppp m		# How its done
mtt MacroMicroPPP nppp ps	        # PPP output

mtt MacroMicroPPP rep txt	        # The report.

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/Make version [e246f48d9d].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## Makes the files needed for Figures.m
## Copyright (C) 2000 by Peter J. Gawthrop

if [ -z "$1" ]; then
    echo Usage ./Make system_name
    exit
else
    echo "Making simulation for system $1 (for use in Figures.m)"
fi

## System
mtt -q -c -stdin $1 ode2odes out
mtt -q -c -stdin $1 sim m
mtt -q  $1 state m
mtt -q  $1 sympar m
mtt -q  $1 numpar m

## Sensitivity system
mtt -q -c -stdin -s s$1 ode2odes out
mtt -q -c -stdin -s s$1 sim m
mtt -q  -s s$1 state m
mtt -q  -s s$1 sympar m
mtt -q  -s s$1 numpar m

## Additional system reps for PPP
mtt -q  $1 sm m
mtt -q  $1 def m
mtt -q  -s s$1 def m

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/sMacroMicroPPP_lbl.txt version [510a291607].

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
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







































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sMacroMicroPPP (sMacroMicroPPP_lbl.txt)
%SUMMARY sMacroMicroPPP
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases
%ALIAS	$1	ppp_1
%ALIAS	$2	ppp_1s
%ALIAS	$3	ppp_2
%ALIAS	$4	ppp_2s
%ALIAS	$5	ppp_3
%ALIAS	$6	ppp_3s
%ALIAS	$7	ppp_4
%ALIAS	$8	ppp_4s
%ALIAS	$9	k_2
%ALIAS	$10	k_2s
%ALIAS	$11	k_t
%ALIAS	$12	k_ts
%ALIAS	$13	p_1
%ALIAS	$14	p_1s
%ALIAS	$15	f_t
%ALIAS	$16	f_ts
%ALIAS	$17	m_1
%ALIAS	$18	m_1s
%ALIAS	$19	m_2
%ALIAS	$20	m_2s
%ALIAS	$21	m_3
%ALIAS	$22	m_3s
%ALIAS	$23	b_1
%ALIAS	$24	b_1s
%ALIAS	$25	b_2
%ALIAS	$26	b_2s
%ALIAS	$27	b_3
%ALIAS	$28	b_3s
%ALIAS	$29	b_t
%ALIAS	$30	b_ts
%ALIAS	$31	d_1
%ALIAS	$32	d_1s
%ALIAS	$33	u_1
%ALIAS	$34	u_1s
%ALIAS	$35	u_2
%ALIAS	$36	u_2s
%ALIAS	$37	u_3
%ALIAS	$38	u_3s
%ALIAS	$39	u_4
%ALIAS	$40	u_4s
%ALIAS	$41	v_b
%ALIAS	$42	v_bs

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	ppp_1	lin		ppp_1;ppp_1s
	ppp_2	lin		ppp_2;ppp_2s
	ppp_3	lin		ppp_3;ppp_3s
	ppp_4	lin		ppp_4;ppp_4s
	ppp_5	lin		ppp_5;ppp_5s
	ppp_6	lin		ppp_6;ppp_6s
	ppp_7	lin		ppp_7;ppp_7s

% Component type C
	k_2	lin		state,k_2;k_2s
	k_t	lin		state,k_t;k_ts
	p_1	lin		state,p_1;p_1s

% Component type De
	f_t	SS		external

% Component type I
	m_1	lin		flow,m_1;m_1s
	m_2	lin		flow,m_2;m_2s
	m_3	lin		flow,m_3;m_3s

% Component type R
	b_1	lin		flow,b_1;b_1s
	b_2	lin		flow,b_2;b_2s
	b_3	lin		flow,b_3;b_3s
	b_t	lin		flow,b_t;b_ts
	d_1	lin		flow,d_1;d_1s

% Component type Se
	u_1	SS		external;u_1s
	u_2	SS		external;u_2s
	u_3	SS		external;u_3s
	u_4	SS		external;u_4s
	u_5	SS		external;u_5s
	u_6	SS		external;u_6s
	u_7	SS		external;u_7s

% Component type Sf
	v_b	SS		0;0

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/MacroMicroPPP/sMacroMicroPPP_numpar.txt version [cc73edbaf8].

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
68
69
70






































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Dummies
b_1 = 0.0;
b_1s = 0.0;
b_2 = 0.0;
b_2s = 0.0;
b_3 = 0.0;
b_3s = 0.0;
b_t = 0.0;
b_ts = 0.0;
c = 0.0;
d_1 = 0.0;
d_1s = 0.0;
e_s = 0.0;
f_s = 0.0;
g = 0.0;
i = 0.0;
k = 0.0;
k_2 = 0.0;
k_2s = 0.0;
k_s = 0.0;
k_t = 0.0;
k_ts = 0.0;
m_1 = 0.0;
m_1s = 0.0;
m_2 = 0.0;
m_2s = 0.0;
m_3 = 0.0;
m_3s = 0.0;
p_1 = 0.0;
p_1s = 0.0;
ppp_1 = 0.0;
ppp_1s = 0.0;
ppp_2 = 0.0;
ppp_2s = 0.0;
ppp_3 = 0.0;
ppp_3s = 0.0;
ppp_4 = 0.0;
ppp_4s = 0.0;
ppp_5 = 0.0;
ppp_5s = 0.0;
ppp_6 = 0.0;
ppp_6s = 0.0;
ppp_7 = 0.0;
ppp_7s = 0.0;
r = 0.0;
u_1s = 0.0;
u_2s = 0.0;
u_3s = 0.0;
u_4s = 0.0;
u_5s = 0.0;
u_6s = 0.0;
u_7s = 0.0;

## Physical parameters
m_1 = 0.0169;		# m_1;
m_2 = 0.0169;		# m_2;
b_1 = 0.13;		# b_1;
b_2 = 0.013;		# b_2;
k_2 = 24;	        # k_2;
k_t = 150;		# k_t;
b_t = 0.16;		# b_t;
b_3 = 0.13;		# b_3;
m_3 = 0.005;		# m_3;
p_1 = 10;		# p_1;
d_1 = 0.9;		# d_1;

## First gain
ppp_1 = 1.0;


Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/Figures.m version [0d87023b1f].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
















































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Figures.m
## Makes figures for the rc_PPP exasmple.
## $Log$
## Revision 1.2  2000/05/17 17:02:58  peterg
## Fixed documentation
##
## Revision 1.1  2000/05/17 09:14:37  peterg
## Initial revision
##
system_name = "rcPPP";

## Uncomment the following the first time
## (Or do ./Make rcPPP in this directory)

## MTT stuff for the system simulation
##system("Make rcPPP");

# ## System info
par  = rcPPP_numpar;
simpar  = rcPPP_simpar;
x_0 = rcPPP_state(par);

# ## Set up the input
# t = [0:simpar.dt:simpar.last];
# A_w = 0;
# A_u = ppp_aug(A_w,laguerre_matrix(1,2.0)) # Specify basis functions: constant & exp(-t/T)
# u = ppp_ustar(A_u,1,t,0,0);

# ## Simulate the system
# tick=time;
# [y,x] = rcPPP_sim(x_0,par,simpar,u);
# Elapsed = time-tick
# plot(t,y)

## Sensitivity system simulation parameters
simpars  = srcPPP_simpar;
sympars  = srcPPP_sympar;
pars  = srcPPP_numpar;
x_0s = srcPPP_state(pars);

t = [0:simpars.dt:simpars.last];
A_w = 0;
A_u = ppp_aug(A_w,laguerre_matrix(1,2.0)) # Specify basis functions: constant & exp(-t/T)
u = ppp_ustar(A_u,1,t,0,0);


## Setup the indices of the adjustable stuff
i_ppp = [sympars.ppp_1, sympars.ppp_1s
	 sympars.ppp_2, sympars.ppp_2s]; # PPP params
i_par = [sympars.x_0,  sympars.x_0s
	 sympars.r,    sympars.rs]; # State and r component

## Simulate the sensitivity system
sensitivities = [i_ppp(:,2); i_par(:,2)]
u = ppp_ustar(A_u,1,t,0,0); 
tick=time;
[y,ys,x] = srcPPP_ssim(x_0s,pars,simpars,u,sensitivities);
Elapsed = time-tick
plot(t,y,t,ys);

### PPP parameters
tau = [0.9:0.01:1];		# Optimisation interval
t_ol = [0:0.01:0.2];		# Open-loop interval
N = 10;				# Number of open-loop intervals in simulation
w = 1;				# Setpoint
w_s = w*ones(10,1);                  # The setpoint witnin the horizon

## Linear system
n_Tau = round(simpars.last/simpars.dt);
dtau = simpars.dt;
Tau = [0:n_Tau-1]'*dtau;
[n_tau,n_w] = size(w_s);
tau = Tau(n_Tau-n_tau+1:n_Tau)
[A,B,C,D] = rcPPP_sm(par);
Q = 1;
w = 1;
ppp_lin_plot (A,B(:,1),C(1,:),D(1,1),A_u,A_w,tau',Q,w);
psfig("rcPPP_lin");

## Simulate non-linear PPP (on this linear system)
extras.U_initial = "zero";
extras.U_next = "continuation";
extras.criterion = 1e-5;
extras.max_iterations = 10;
extras.alpha = 0.1;
extras.verbose = 0;
extras.v = 1e-5;

##  -- with no optimisation using linear PPP with continuation
extras.U_initial = "linear";
extras.U_next = "continuation";
extras.criterion = 1e-5;
extras.max_iterations = 0;
[y_c,x,u_c,t,U,U_c,U_l] = ppp_nlin_sim (system_name,i_ppp,i_par,A_u,w_s,N,extras);

##  -- with no optimisation using linear PPP at each step
extras.U_initial = "linear";
extras.U_next = "linear";
extras.criterion = 1e-5;
extras.max_iterations = 0;
[y_l,x,u_l,t,U,U_c,U_l] = ppp_nlin_sim (system_name,i_ppp,i_par,A_u,w_s,N,extras);

##  -- with optimisation using nonlinear PPP with continuation
extras.U_initial = "zero";
extras.U_next = "continuation";
extras.criterion = 1e-5;
extras.max_iterations = 100;
[y,x,u,t,U,U_c,U_l] = ppp_nlin_sim (system_name,i_ppp,i_par,A_u,w_s,N,extras);


## Plots
title("");

## U, U_c and U_l
I = [1:N]';
IU1 = [I U(:,1)];
IU1_c = [I U_c(:,1)];
IU1_l = [I U_l(:,1)];
gset grid; xlabel "Interval"
gplot IU1 title "U_1", IU1_c title "U_c1", IU1_l title "U_l1"
psfig("rcPPP_U1");

IU2 = [I U(:,2)];
IU2_c = [I U_c(:,2)];
IU2_l = [I U_l(:,2)];
gset grid; xlabel "Interval "
gplot IU2 title "U_2", IU2_c title "U_c2", IU2_l title "U_l2"
psfig("rcPPP_U2");

## y & u
gset grid; xlabel "Time (sec)"
ty = [t y] ; tu =  [t u]; 
gplot ty title "Output", tu title "Input"

psfig("rcPPP_yu");

gset grid; xlabel "Time (sec)"
ty_c = [t y_c] ; 
ty_l = [t y_l] ; 
ty = [t y] ; 
tu =  [t u]; 
gplot ty_c title "Continuation", ty_l title "Linear", ty title "Optimisation"
psfig("rcPPP_ylco");
 

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/Make version [37eadad62c].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh

## Makes the files needed for Figures.m
## Copyright (C) 2000 by Peter J. Gawthrop

sys=$1

if [ -z "$2" ]; then
    code=oct
else
    code=$2
fi

if [ -z "$1" ]; then
    echo 'Usage ./Make system_name [m|oct]'
    exit
else
    echo "Making sensitivity simulation for system ${sys} (code ${code})"
fi

if [ "${code}" == "oct" ]; then
    oct='-oct'
fi

echo Switches ${oct}

## System
mtt -q ${sys} sympar m
mtt -q ${sys} simpar m
mtt -q ${sys} numpar m
mtt -q ${sys} state m


## Sensitivity system
mtt -q -stdin -s s${sys} ssim m
mtt -q -stdin -s s${sys} sympar m
mtt -q -stdin -s s${sys} simpar m
mtt -q -stdin ${oct} -s s${sys} input ${code}
mtt -q -stdin ${oct} -s s${sys} ode2odes ${code}
mtt -q -stdin ${oct} -s s${sys} state ${code}
mtt -q -stdin ${oct} -s s${sys} numpar ${code}

## Additional system reps for PPP
mtt -q -stdin  ${sys} sm m
mtt -q -stdin  ${sys} def m
mtt -q -stdin  -s s${sys} def m

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/rcPPP_abg.fig version [34f1b0eb45].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 3600 1125 162 162 3600 1125 3690 1260
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4952 4277 5852 4277 5627 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6302 4277 7202 4277 6977 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 4051 4726 3151 4951 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6076 4051 6076 3151 6301 3376
2 2 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 4275 585 5175 585 5175 765 4275 765 4275 585
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5850 1215 6300 1215
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5850 1080 6300 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3600 675 4275 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5175 675 7200 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 6075 675 6075 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 6075 1215 6075 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3600 1575 7200 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3600 945 3600 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3600 1575 3600 1260
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 7200 1530 7200 765
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3866 3414 4502 4050 4184 4050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3870 5130 4505 4494 4505 4812
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1802 3375 2702 3375 2477 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1802 5175 2702 5175 2477 5400
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8550 5625 8550 225 900 225 900 5625 8550 5625
4 1 -1 0 0 0 20 0.0000 4 210 150 4727 4367 1\001
4 1 -1 0 0 0 20 0.0000 4 210 150 6077 4367 0\001
4 1 -1 0 0 0 20 0.0000 4 285 540 7787 4367 De:y\001
4 1 -1 0 0 0 20 0.0000 4 210 375 4726 2926 R:r\001
4 1 -1 0 0 0 20 0.0000 4 210 555 6076 2926 CS:c\001
4 0 1 1 0 0 20 0.0000 4 150 120 4680 450 r\001
4 0 1 1 0 0 20 0.0000 4 150 135 6480 1215 c\001
4 0 1 1 0 0 20 0.0000 4 150 135 7425 1170 e\001
4 0 1 1 0 0 20 0.0000 4 210 150 7515 1305 2\001
4 0 1 1 0 0 20 0.0000 4 150 135 3060 1170 e\001
4 0 1 1 0 0 20 0.0000 4 210 150 3150 1305 1\001
4 1 1 1 0 0 20 0.0000 4 285 1425 5400 4995 Bond graph\001
4 1 1 1 0 0 20 0.0000 4 210 1275 5400 2025 Schematic\001
4 1 -1 0 0 0 20 0.0000 4 285 930 3285 5265 AE:ppp_2\001
4 1 -1 0 0 0 20 0.0000 4 285 930 3285 3465 AE:ppp_1\001
4 1 -1 0 0 0 20 0.0000 4 210 660 1440 3465 Se:u1\001
4 1 -1 0 0 0 20 0.0000 4 210 660 1440 5265 Se:u2\001

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/rcPPP_desc.tex version [89911249a1].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system rcPPP (rcPPP_desc.tex)
% Generated by MTT on Sun Aug 24 11:03:55 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/08/24 10:27:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The acausal bond graph of system \textbf{rcPPP} is
displayed in Figure \Ref{rcPPP_abg} and its label
file is listed in Section \Ref{sec:rcPPP_lbl}.
The subsystems are listed in Section \Ref{sec:rcPPP_sub}.
The system \textbf{rcPPP} is based on the simple electrical rc circuit shown in
Figure \Ref{rcPPP_abg}. 

It can be regarded as a single-input
single-output system with input $e_1$ and output $e_2$.
The bond graph in Figure \Ref{rcPPP_abg} is augmented with the {\em
open-loop\/} controller comprising
\begin{itemize}
\item two effort source \textbf{Se} components ``u1'' and ``u2''
\item two effort amplifier \textbf{AE} components ``ppp\_1'' and `ppp\_2''
\end{itemize}

This is a \emph{linear} system; but it is used to illustate
\emph{nonlinear} PPP control. Not surprisingly, the \emph{nonlinear}
PPP control gives nearly the same result (Section \Ref{sec:rcPPP_nppp.ps})
as linear open and closed-loop control.





Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/rcPPP_lbl.txt version [3a358dce4f].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system rcPPP (rcPPP_lbl.txt)
%SUMMARY rcPPP
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases
%ALIAS	$1	ppp_1
%ALIAS	$2	ppp_2
%ALIAS	$3	c
%ALIAS	$4	y
%ALIAS	$5	r
%ALIAS	$6	u1
%ALIAS	$7	u2

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	ppp_1	lin		ppp_1
	ppp_2	lin		ppp_2

% Component type CS
	c	lin	        effort,c;q_0		

% Component type De
	y	SS		external

% Component type R
	r	lin		flow,r

% Component type Se
	u1	SS		external
	u2	SS		external

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/rcPPP_nppp.m version [df8a9ed25f].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146


















































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Figures.m
## Makes figures for the rc_PPP exasmple.
## $Log$
## Revision 1.3  2000/08/12 10:39:33  peterg
## Levenberg-Marquardt version
##
## Revision 1.2  2000/05/21 06:39:23  peterg
## Parameterised _sm
##
## Revision 1.1  2000/05/19 13:15:38  peterg
## Initial revision
##
## Revision 1.2  2000/05/17 17:02:58  peterg
## Fixed documentation
##
## Revision 1.1  2000/05/17 09:14:37  peterg
## Initial revision
##
system_name = "rcPPP";

## Uncomment the following the first time
## (Or do ./Make rcPPP in this directory)

## MTT stuff for the system simulation
##system("Make rcPPP");



t_s=[0:0.1:10];
u = [ones(1,length(t_s));ones(1,length(t_s))];
x_0 = rcPPP_state;
par  = rcPPP_numpar;

## Simulate the system
tick=time;
[y,x] = rcPPP_sim(x_0,u,t_s,par);
Elapsed = time-tick
plot(t_s,y,t_s,x);

## Simulate the system to give just the final few point
t_s1 = [9:0.1:10];
tick=time;
[y,x] = rcPPP_sim(x_0,u,t_s1,par);
Elapsed = time-tick
plot(t_s1,y,t_s1,x);

## Sensitivity system simulation parameters
x_0s = srcPPP_state;
pars  = srcPPP_numpar
sympars  = srcPPP_sympar;

## Simulate the sensitivity system
sensitivities = [sympars.ppp_1s,sympars.ppp_2s,sympars.rs]
tick=time;
[y,ys] = srcPPP_sim(x_0s,u,t_s,[sympars.r,2.0],sensitivities);
Elapsed = time-tick
plot(t_s,y,t_s,ys);

### PPP parameters
A_w = 0;
A_u = ppp_aug(A_w,laguerre_matrix(1,10)); # Specify basis functions: constant & exp(-5t)
tau = [0.9:0.01:1];		# Optimisation interval
t_ol = [0:0.01:0.2];		# Open-loop interval
N = 5;				# Number of open-loop intervals in simulation
w = 1;				# Setpoint

## Linear system
[A,B,C,D] = rcPPP_sm(par);
Q = 1;
w = 1;
ppp_lin_plot (A,B(:,1),C(1,:),D(1,1),A_u,A_w,tau,Q,w,x_0);
psfig("rcPPP_lin");

## Simulate non-linear PPP (on this linear system)
extras.U_initial = "zero";
extras.U_next = "continuation";
extras.criterion = 1e-5;
extras.max_iterations = 10;
extras.v = 0;
extras.verbose = 0;

##  -- with no optimisation using linear PPP with continuation
disp("Linear PPP at time zero with continuation trajectories")
extras.U_initial = "linear";
extras.U_next = "continuation";
extras.criterion = 1e-5;
extras.v = 0;
extras.max_iterations = 0;
[y_c,x,u_c,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);

##  -- with no optimisation using linear PPP at each step
disp("Linear PPP at each step")
extras.U_initial = "linear";
extras.U_next = "linear";
extras.criterion = 1e-5;
extras.max_iterations = 0;
extras.v = 0;
[y_l,x,u_l,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);

##  -- with optimisation using nonlinear PPP with continuation
disp("Nonlinear PPP");
extras.U_initial = "zero";
extras.U_next = "continuation";
extras.v = 1e-5;
extras.criterion = 1e-5;
extras.max_iterations = 100;
extras.verbose = 0;
[y,x,u,t,U,U_c,U_l] = ppp_nlin_sim (system_name,A_u,tau,t_ol,N,w,extras);


## Plots
title("");

## U, U_c and U_l
I = 1:N;
IU1 = [I' U(1,:)'];
IU1_c = [I' U_c(1,:)'];
IU1_l = [I' U_l(1,:)'];
gset grid; xlabel "Interval"
gplot IU1 title "U_1", IU1_c title "U_c1", IU1_l title "U_l1"
psfig("rcPPP_U1");

IU2 = [I' U(2,:)'];
IU2_c = [I' U_c(2,:)'];
IU2_l = [I' U_l(2,:)'];
gset grid; xlabel "Interval "
gplot IU2 title "U_2", IU2_c title "U_c2", IU2_l title "U_l2"
psfig("rcPPP_U2");

## y & u
gset grid; xlabel "Time (sec)"
ty = [t' y'] ; tu =  [t' u']; 
gplot ty title "Output", tu title "Input"

psfig("rcPPP_yu");

title("");
gset grid; xlabel "Time (sec)"
ty_c = [t' y_c'] ; 
ty_l = [t' y_l'] ; 
ty = [t' y'] ; 
tu =  [t' u']; 
gplot ty_c title "Continuation", ty_l title "Linear", ty title "Optimisation"
psfig("rcPPP_nppp");
 

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/rcPPP_numpar.txt version [e921254017].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (rcPPP_numpar.txt)
# Generated by MTT at Tue Apr 18 18:53:40 BST 2000

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  2000/12/28 17:31:27  peterg
# %% To RCS
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Parameters
c = 	1.0; # CS,rcPPP
## Removed by MTT on Sat May 26 07:46:29 BST 2001: e_0 = 	1.0; # CS
## Removed by MTT on Sat May 26 07:46:29 BST 2001: e_s = 	1.0; # Se

ppp_1 = 	1.0; # rcPPP
ppp_2 = 	0.0; # rcPPP

## Physical parameters
c =     1.0;
q_0 =   0.0;
r =     1.0;

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/rcPPP_rep.txt version [11b8899772].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system rcPPP (rcPPP_rep.txt)
## Generated by MTT on" Wed May 10 09:22:52 BST 2000.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/05/20 17:44:47  peterg
## Initial revision
##
###############################################################

mtt rcPPP abg tex		# The system description
#mtt -s srcPPP abg tex		# The system description

mtt rcPPP struc tex	        # The system structure
mtt -s srcPPP struc tex	        # The system structure

mtt rcPPP nppp m		# How its done
mtt rcPPP nppp ps	        # PPP output

mtt rcPPP rep txt	        # PPP output

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/srcPPP_input.txt version [10068bd604].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (srcPPP_input.txt)
# Generated by MTT at Fri Apr 14 17:44:36 BST 2000
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the inputs
mttu(1) = 1.0; 	# u (srcPPP_u1_se_1)
mttu(2) = 0.0;#exp(-mttt); 	# u (srcPPP_u2_se_1)

# Set the switches

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/srcPPP_lbl.txt version [bea2eabf2a].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system srcPPP (srcPPP_lbl.txt)
%SUMMARY srcPPP
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 17:31:27  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases
%ALIAS	$1	ppp_1
%ALIAS	$2	ppp_1s
%ALIAS	$3	ppp_2
%ALIAS	$4	ppp_2s
%ALIAS	$5	c
%ALIAS	$6	cs
%ALIAS	$7	y
%ALIAS	$8	ys
%ALIAS	$9	r
%ALIAS	$10	rs
%ALIAS	$11	u1
%ALIAS	$12	u1s
%ALIAS	$13	u2
%ALIAS	$14	u2s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
% Component type Ae
	ppp_1	slin		ppp_1;ppp_1s
	ppp_2	slin		ppp_2;ppp_2s

% Component type CS
	c	slin		effort,c;x_0;cs;x_0s

% Component type De
	y	SS		external

% Component type R
	r	slin		flow,r;rs

% Component type Se
	u1	SS		external;0
	u2	SS		external;0


Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/srcPPP_numpar.txt version [00ff26769b].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System srcPPP, representation numpar, language txt; 
## File srcPPP_numpar.txt; 
## Generated by MTT on Sat May 26 08:47:19 BST 2001; 


## Parameters
c	= 1.0;
r	= 1.0;

## PPP coefficients
ppp_1	= 0.0; # Default
ppp_2	= 1.0; # Default

## State
x_0	= 0.0; # Default

## Sensitivities
cs	= 0.0; # Default
ppp_1s	= 0.0; # Default
ppp_2s	= 0.0; # Default
rs	= 0.0; # Default
x_0s	= 0.0; # Default

Deleted mttroot/mtt/lib/examples/Control/PPP/Nonlinear/rcPPP/srcPPP_simpar.txt version [370b8dff18].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system srcPPP (srcPPP_simpar.txt)
# Generated by MTT on Fri Apr 14 17:43:36 BST 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 17:31:27  peterg
## To RCS
##
###############################################################


FIRST        = 0.0;       # Last time in simulation
LAST        = 2.0;       # Last time in simulation
DT          = 0.01;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Cruise/Cruise_abg.fig version [b1632d46ab].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1125 2475 2475 2475 2250 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2835 2250 2835 900 3060 1125
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2835 2700 2835 4050 3060 3825
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 2250 2475 2700
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 4725 4500 4725 450 225 450 225 4500 4725 4500
4 2 -1 0 0 0 20 0.0000000 4 210 570 1035 2565 SS:u\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2835 2565 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 435 2880 4365 R:b\001
4 1 -1 0 0 0 20 0.0000000 4 210 435 2880 765 I:m\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Cruise/Cruise_desc.tex version [f6267dbda0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Cruise (Cruise_desc.tex)
% Generated by MTT on Mon Jan 12 16:00:15 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Cruise} is
   displayed in Figure \Ref{Cruise_abg} and its label
   file is listed in Section \Ref{sec:Cruise_lbl}.
   The subsystems are listed in Section \Ref{sec:Cruise_sub}.


This is a simple teaching example to illustrare compensator design via
observer/state-feedback methods.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Cruise/Cruise_lbl.txt version [c6eb913146].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Cruise: <brief description here>
%DESCRIPTION <Detailed description here>
%% Label file for system Cruise (Cruise_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/05/20 16:26:30  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	m		lin	flow,m

% Component type R
	b		lin	flow,b

% Component type SS
	u		SS	external,external

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Cruise/Cruise_numpar.txt version [52092fa333].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Cruise_numpar.txt)
# Generated by MTT at Mon Jan 12 15:43:19 GMT 1998

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

# Parameters
b = 	1.0; # Parameter b for Cruise
b_m = 	1.0; # Parameter b_m for Cruise
j = 	1.0; # Parameter j for Cruise
j_m = 	1.0; # Parameter j_m for Cruise
k = 	1.0; # Parameter k for Cruise
k_m = 	1.0; # Parameter k_m for Cruise
l = 	1.0; # Parameter l for Cruise
l_a = 	1.0; # Parameter l_a for Cruise
l_m = 	1.0; # Parameter l_m for Cruise
r = 	1.0; # Parameter r for Cruise
r_a = 	1.0; # Parameter r_a for Cruise
r_m = 	1.0; # Parameter r_m for Cruise

# Initial states
x(1) = 	0.0; # Initial state for Cruise_motor (l_a)
x(2) = 	0.0; # Initial state for Cruise_motor (j_m)

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Cruise/Cruise_params.r version [27872281d7].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
%% Parameter file for system Cruise (Cruise_params.r)
%% This file provides symbolic parameters for simplification

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Cruise/Cruise_rep.txt version [58f8bc4e60].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Cruise (Cruise_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt Cruise abg tex

mtt -o Cruise sm tex
mtt -o Cruise tf tex

mtt -o Cruise smc tex
mtt -o Cruise ssk tex

mtt -o Cruise smo tex
mtt -o Cruise ssl tex

mtt -o Cruise ctf tex



Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Cruise/Cruise_simp.r version [8ae10835d9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system Cruise (Cruise_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% System
%J_m := 1; L_m := 0.1; k_m := 1; b_m := 0.1; r_m := 1;

% Controller - poles at -2 and -10
%alpha_c1 := 12; alpha_c2 := 20;

% Observer -  poles at -10 -50
%alpha_o1 := 60; alpha_o2 := 500;

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Cruise/Cruise_sspar.r version [08e36df648].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for Cruise (Cruise_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/CruiseP_abg.fig version [d7820cb52a].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1125 2475 2475 2475 2250 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2835 2250 2835 900 3060 1125
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2835 2700 2835 4050 3060 3825
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 2250 2475 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 2475 4500 2475 4275 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 2475 6750 2475 6525 2700
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 7650 4455 7650 450 225 450 225 4455 7650 4455
4 1 -1 0 0 0 20 0.0000000 4 210 150 2835 2565 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 435 2880 4365 R:b\001
4 1 -1 0 0 0 20 0.0000000 4 210 435 2880 765 I:m\001
4 0 -1 0 0 0 20 0.0000000 4 270 570 6930 2565 SS:y\001
4 2 -1 0 0 0 20 0.0000000 4 210 570 1035 2565 SS:u\001
4 1 -1 0 0 0 20 0.0000000 4 210 1080 4950 2565 INTF:int\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/CruiseP_desc.tex version [6888f94b02].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system CruiseP (CruiseP_desc.tex)
% Generated by MTT on Mon Jan 12 16:00:15 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This is a simple teaching example to illustrate compensator design via
observer/state-feedback methods.

The system represents a simple model of a vehicle moving along a road.
The vehicle
\begin{itemize}
\item has mass $m$
\item is driven by a force $u=F$
\item has velocity $v$ 
\item has momentum $p=mv$ 
\item has a distance along the road $y=d$
\item The system states are taken to be:
  \begin{equation}
    x = 
    \begin{pmatrix}
      p \\ d
    \end{pmatrix}
  \end{equation}\end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/CruiseP_lbl.txt version [78c0dfb69d].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CruiseP: <brief description here>
%DESCRIPTION <Detailed description here>
%% Label file for system CruiseP (CruiseP_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	m		lin	flow,m

% Component type INTF
	int		lin	flow,int

% Component type R
	b		lin	flow,b

% Component type SS
	u		SS	external,internal
	y		SS	external,0

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/CruiseP_numpar.txt version [8f4fd9371e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (CruiseP_numpar.txt)
# Generated by MTT at Fri Feb 13 17:15:12 GMT 1998

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

# Parameters
b = 	1.0; # CruiseP
int = 	1.0; # CruiseP
m = 	1.0; # CruiseP

# Initial states
x(1) = 	0.0; # CruiseP (m)
x(2) = 	0.0; # CruiseP_int (3)

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/CruiseP_pic.fig version [7cbcc3e0e1].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Inches
1200 2
1 3 0 2 -1 7 0 0 -1 0.0000000 1 0.000 3900 3900 309 309 3900 3900 4209 4209
1 3 0 2 -1 7 0 0 -1 0.0000000 1 0.000 2700 3900 309 309 2700 3900 3009 4209
2 2 0 2 -1 7 0 0 -1 0.000 0 0 0 0 0 5
	 2400 2400 4200 2400 4200 3600 2400 3600 2400 2400
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 4500 2700 5700 2700
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 1200 3000 2400 3000
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 3900 1800 2700 1800
4 0 -1 0 0 3 20 0.0000000 4 270 1380 5700 2400 v (velocity)\001
4 0 -1 0 0 3 20 0.0000000 4 270 1095 525 2700 u (force)\001
4 0 -1 0 0 3 20 0.0000000 4 270 1425 5700 3150 y (position)\001
4 0 -1 0 0 3 20 0.0000000 4 255 1155 2700 3075 m (mass)\001
4 0 -1 0 0 3 20 0.0000000 4 270 2235 3150 1575 bv (friction force)\001
4 0 -1 0 0 3 16 0.0000000 4 195 2490 2325 5100 states:  p=momentum=mv\001
4 0 -1 0 0 3 16 0.0000000 4 210 1725 2325 5442             y=position\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/CruiseP_pic.tex version [e76f40dd94].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
\makebox[5.541in][l]{
  \vbox to 3.458in{
    \vfill
    \special{psfile=CruiseP_pic.ps}
  }
  \vspace{-\baselineskip}
}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/CruiseP_rep.tex version [863e452b9f].

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
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












































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


\section{\textbf{CruiseP}: representation \textbf{abg}, language \textbf{tex}}
\label{sec:CruiseP_abg.tex}
\index{\textbf{CruiseP} -- abg}


MTT command:
\begin{verbatim}
mtt CruiseP abg tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_abg.tex}


\section{\textbf{CruiseP}: representation \textbf{ode}, language \textbf{tex}}
\label{sec:CruiseP_ode.tex}
\index{\textbf{CruiseP} -- ode}


MTT command:
\begin{verbatim}
mtt -o CruiseP ode tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_ode.tex}


\section{\textbf{CruiseP}: representation \textbf{sm}, language \textbf{tex}}
\label{sec:CruiseP_sm.tex}
\index{\textbf{CruiseP} -- sm}


MTT command:
\begin{verbatim}
mtt -o CruiseP sm tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_sm.tex}


\section{\textbf{CruiseP}: representation \textbf{tf}, language \textbf{tex}}
\label{sec:CruiseP_tf.tex}
\index{\textbf{CruiseP} -- tf}


MTT command:
\begin{verbatim}
mtt -o CruiseP tf tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_tf.tex}


\section{\textbf{CruiseP}: representation \textbf{smc}, language \textbf{tex}}
\label{sec:CruiseP_smc.tex}
\index{\textbf{CruiseP} -- smc}


MTT command:
\begin{verbatim}
mtt -o CruiseP smc tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_smc.tex}


\section{\textbf{CruiseP}: representation \textbf{ssk}, language \textbf{tex}}
\label{sec:CruiseP_ssk.tex}
\index{\textbf{CruiseP} -- ssk}


MTT command:
\begin{verbatim}
mtt -o CruiseP ssk tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_ssk.tex}


\section{\textbf{CruiseP}: representation \textbf{smo}, language \textbf{tex}}
\label{sec:CruiseP_smo.tex}
\index{\textbf{CruiseP} -- smo}


MTT command:
\begin{verbatim}
mtt -o CruiseP smo tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_smo.tex}


\section{\textbf{CruiseP}: representation \textbf{ssl}, language \textbf{tex}}
\label{sec:CruiseP_ssl.tex}
\index{\textbf{CruiseP} -- ssl}


MTT command:
\begin{verbatim}
mtt -o CruiseP ssl tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_ssl.tex}


\section{\textbf{CruiseP}: representation \textbf{ctf}, language \textbf{tex}}
\label{sec:CruiseP_ctf.tex}
\index{\textbf{CruiseP} -- ctf}


MTT command:
\begin{verbatim}
mtt -o CruiseP ctf tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruiseP/MTT_work/CruiseP_ctf.tex}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/CruiseP_rep.txt version [5d5e21401e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system CruiseP (CruiseP_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt CruiseP abg tex

mtt -o CruiseP ode tex
mtt -o CruiseP sm tex
mtt -o CruiseP tf tex

mtt -o CruiseP smc tex
mtt -o CruiseP ssk tex

mtt -o CruiseP smo tex
mtt -o CruiseP ssl tex

mtt -o CruiseP ctf tex


Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruiseP/Makefile version [02aec829a2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#
# TransFig makefile
#

all: CruiseP_pic.tex 

# translation into ps

CruiseP_pic.tex: CruiseP_pic.ps Makefile
	fig2ps2tex CruiseP_pic.ps >CruiseP_pic.tex
clean::
	rm -f CruiseP_pic.tex

CruiseP_pic.ps: CruiseP_pic.fig Makefile
	fig2dev -L ps CruiseP_pic.fig > CruiseP_pic.ps
clean::
	rm -f CruiseP_pic.ps

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_abg.fig version [d7820cb52a].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1125 2475 2475 2475 2250 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2835 2250 2835 900 3060 1125
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2835 2700 2835 4050 3060 3825
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 2250 2475 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 2475 4500 2475 4275 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 2475 6750 2475 6525 2700
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 7650 4455 7650 450 225 450 225 4455 7650 4455
4 1 -1 0 0 0 20 0.0000000 4 210 150 2835 2565 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 435 2880 4365 R:b\001
4 1 -1 0 0 0 20 0.0000000 4 210 435 2880 765 I:m\001
4 0 -1 0 0 0 20 0.0000000 4 270 570 6930 2565 SS:y\001
4 2 -1 0 0 0 20 0.0000000 4 210 570 1035 2565 SS:u\001
4 1 -1 0 0 0 20 0.0000000 4 210 1080 4950 2565 INTF:int\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_desc.tex version [820fce3156].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system CruisePN (CruisePN_desc.tex)
% Generated by MTT on Mon Jan 12 16:00:15 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This is a simple teaching example to illustrate compensator design via
observer/state-feedback methods. The equations are presented in
numerical (as opposed to symbolic) form.

The system represents a simple model of a vehicle moving along a road.
The vehicle
\begin{itemize}
\item has mass $m$
\item is driven by a force $u=F$
\item has velocity $v$ 
\item has momentum $p=mv$ 
\item has a distance along the road $y=d$
\item The system states are taken to be:
  \begin{equation}
    x = 
    \begin{pmatrix}
      p \\ d
    \end{pmatrix}
  \end{equation}\end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_lbl.txt version [59330369ec].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CruisePN: <brief description here>
%DESCRIPTION <Detailed description here>
%% Label file for system CruisePN (CruisePN_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	m		lin	flow,m

% Component type INTF
	int		lin	flow,int

% Component type R
	b		lin	flow,b

% Component type SS
	u		SS	external,internal
	y		SS	external,0

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_numpar.txt version [b93d73c639].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (CruisePN_numpar.txt)
# Generated by MTT at Fri Feb 13 17:15:12 GMT 1998

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

# Parameters
b = 	1.0; # CruisePN
int = 	1.0; # CruisePN
m = 	1.0; # CruisePN

# Initial states
x(1) = 	0.0; # CruisePN (m)
x(2) = 	0.0; # CruisePN_int (3)

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_pic.fig version [7cbcc3e0e1].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Inches
1200 2
1 3 0 2 -1 7 0 0 -1 0.0000000 1 0.000 3900 3900 309 309 3900 3900 4209 4209
1 3 0 2 -1 7 0 0 -1 0.0000000 1 0.000 2700 3900 309 309 2700 3900 3009 4209
2 2 0 2 -1 7 0 0 -1 0.000 0 0 0 0 0 5
	 2400 2400 4200 2400 4200 3600 2400 3600 2400 2400
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 4500 2700 5700 2700
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 1200 3000 2400 3000
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 3900 1800 2700 1800
4 0 -1 0 0 3 20 0.0000000 4 270 1380 5700 2400 v (velocity)\001
4 0 -1 0 0 3 20 0.0000000 4 270 1095 525 2700 u (force)\001
4 0 -1 0 0 3 20 0.0000000 4 270 1425 5700 3150 y (position)\001
4 0 -1 0 0 3 20 0.0000000 4 255 1155 2700 3075 m (mass)\001
4 0 -1 0 0 3 20 0.0000000 4 270 2235 3150 1575 bv (friction force)\001
4 0 -1 0 0 3 16 0.0000000 4 195 2490 2325 5100 states:  p=momentum=mv\001
4 0 -1 0 0 3 16 0.0000000 4 210 1725 2325 5442             y=position\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_pic.tex version [c999a1fdcd].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
\makebox[5.541in][l]{
  \vbox to 3.458in{
    \vfill
    \special{psfile=CruisePN_pic.ps}
  }
  \vspace{-\baselineskip}
}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_rep.tex version [dd5b960981].

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
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












































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


\section{\textbf{CruisePN}: representation \textbf{abg}, language \textbf{tex}}
\label{sec:CruisePN_abg.tex}
\index{\textbf{CruisePN} -- abg}


MTT command:
\begin{verbatim}
mtt CruisePN abg tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_abg.tex}


\section{\textbf{CruisePN}: representation \textbf{ode}, language \textbf{tex}}
\label{sec:CruisePN_ode.tex}
\index{\textbf{CruisePN} -- ode}


MTT command:
\begin{verbatim}
mtt -o CruisePN ode tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_ode.tex}


\section{\textbf{CruisePN}: representation \textbf{sm}, language \textbf{tex}}
\label{sec:CruisePN_sm.tex}
\index{\textbf{CruisePN} -- sm}


MTT command:
\begin{verbatim}
mtt -o CruisePN sm tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_sm.tex}


\section{\textbf{CruisePN}: representation \textbf{tf}, language \textbf{tex}}
\label{sec:CruisePN_tf.tex}
\index{\textbf{CruisePN} -- tf}


MTT command:
\begin{verbatim}
mtt -o CruisePN tf tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_tf.tex}


\section{\textbf{CruisePN}: representation \textbf{smc}, language \textbf{tex}}
\label{sec:CruisePN_smc.tex}
\index{\textbf{CruisePN} -- smc}


MTT command:
\begin{verbatim}
mtt -o CruisePN smc tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_smc.tex}


\section{\textbf{CruisePN}: representation \textbf{ssk}, language \textbf{tex}}
\label{sec:CruisePN_ssk.tex}
\index{\textbf{CruisePN} -- ssk}


MTT command:
\begin{verbatim}
mtt -o CruisePN ssk tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_ssk.tex}


\section{\textbf{CruisePN}: representation \textbf{smo}, language \textbf{tex}}
\label{sec:CruisePN_smo.tex}
\index{\textbf{CruisePN} -- smo}


MTT command:
\begin{verbatim}
mtt -o CruisePN smo tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_smo.tex}


\section{\textbf{CruisePN}: representation \textbf{ssl}, language \textbf{tex}}
\label{sec:CruisePN_ssl.tex}
\index{\textbf{CruisePN} -- ssl}


MTT command:
\begin{verbatim}
mtt -o CruisePN ssl tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_ssl.tex}


\section{\textbf{CruisePN}: representation \textbf{ctf}, language \textbf{tex}}
\label{sec:CruisePN_ctf.tex}
\index{\textbf{CruisePN} -- ctf}


MTT command:
\begin{verbatim}
mtt -o CruisePN ctf tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/CruisePN/MTT_work/CruisePN_ctf.tex}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_rep.txt version [d9e7301ff2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system CruisePN (CruisePN_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt CruisePN abg tex

mtt -o CruisePN ode tex
mtt -o CruisePN sm tex
mtt -o CruisePN tf tex

mtt -o CruisePN smc tex
mtt -o CruisePN ssk tex

mtt -o CruisePN smo tex
mtt -o CruisePN ssl tex

mtt -o CruisePN ctf tex


Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_simp.r version [87a70b56bc].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system CruisePN (CruisePN_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


m  := 1;
b := 0;

alpha_o1 := 4;
alpha_o2 := 4;

alpha_c1 := 2;
alpha_c2 := 1;

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruisePN_sspar.r version [269881705f].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for CruisePN (CruisePN_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/CruiseP_pic.tex version [e76f40dd94].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
\makebox[5.541in][l]{
  \vbox to 3.458in{
    \vfill
    \special{psfile=CruiseP_pic.ps}
  }
  \vspace{-\baselineskip}
}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/CruisePN/Makefile version [c3cd8e3dfa].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#
# TransFig makefile
#

all: CruisePN_pic.tex 

# translation into ps

CruisePN_pic.tex: CruisePN_pic.ps Makefile
	fig2ps2tex CruisePN_pic.ps >CruisePN_pic.tex
clean::
	rm -f CruisePN_pic.tex

CruisePN_pic.ps: CruisePN_pic.fig Makefile
	fig2dev -L ps CruisePN_pic.fig > CruisePN_pic.ps
clean::
	rm -f CruisePN_pic.ps

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DC_abg.fig version [3daa31e601].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 4050 4500 4050 225 1800 225 1800 4500 4050 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1575 2475 2745 2475 2475 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 2250 2925 1080 3150 1350
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3105 2475 4275 2475 4005 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 2700 2925 3870 3150 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 2475 6795 2475 6525 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 2295 6975 1125 7200 1395
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 2700 6975 3870 7200 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7200 2475 8370 2475 8100 2700
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8100 4500 8100 225 5850 225 5850 4500 8100 4500
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 4950 225 4950 225 45 9450 45 9450 4950
4 1 -1 0 0 0 20 0.0000 4 195 135 2880 2610 1\001
4 1 -1 0 0 0 20 0.0000 4 255 990 4995 2565 GY:k_m\001
4 1 -1 0 0 0 20 0.0000 4 195 135 6975 2565 1\001
4 1 4 0 0 0 20 0.0000 4 240 810 1080 2565 SS:[in]\001
4 1 -1 0 0 0 20 0.0000 4 255 510 2880 990 I:l_a\001
4 1 -1 0 0 0 20 0.0000 4 255 600 7065 990 I:j_m\001
4 1 -1 0 0 0 20 0.0000 4 255 645 2970 4230 R:r_a\001
4 1 -1 0 0 0 20 0.0000 4 255 765 7020 4230 R:b_m\001
4 1 1 1 0 0 20 0.0000 4 195 1095 2925 4815 Electrical\001
4 1 1 1 0 0 20 0.0000 4 195 1335 6975 4815 Mechanical\001
4 1 1 1 0 0 20 0.0000 4 195 630 8910 2925 Shaft\001
4 1 1 1 0 0 20 0.0000 4 195 1170 1080 2925 Terminals\001
4 1 4 0 0 0 20 0.0000 4 240 960 8910 2565 SS:[out]\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DC_desc.tex version [77c4d38d75].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system DC (DC_desc.tex)
% Generated by MTT on Thu Sep 11 10:09:58 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{DC} is
   displayed in Figure \Ref{DC_abg} and its label
   file is listed in Section \Ref{sec:DC_lbl}.
   The subsystems are listed in Section \Ref{sec:DC_sub}.

   \begin{table}[htbp]
     \begin{center}
       \leavevmode
       \begin{tabular}{|l|l|}
        \hline
        Index & Parameter\\
        \hline
         1 & Motor gain ($k_m$) \\
         2 & Armature inductance ($l_a$) \\
         3 & Armature resistance ($r_a$) \\
         4 & Inertia ($j_m$) \\
         5 & Friction coefficient ($b_m$) \\
        \hline
       \end{tabular}
       \caption{DC motor parameters}
       \label{tab:DC_components}
     \end{center}
   \end{table}
{\bf DC} is a two-port component representing a DC motor. It has the 5
parameters listed in Table \Ref{tab:DC_components}.


Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DC_lbl.txt version [bd004f0f0a].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY DC: DC motor (or generator)
%DESCRIPTION Port [in]: Electrical (in)
%DESCRIPTION Port [out]: Mechanical (out)
%DESCRIPTION Parameter 1: Motor gain (k_m)
%DESCRIPTION Parameter 2: Armature inductance (l_a)
%DESCRIPTION Parameter 3: Armature resistance (r_a)
%DESCRIPTION Parameter 4: Inertia (j_m)
%DESCRIPTION Parameter 5: Friction coefficient (b_m)


%% Label file for system DC (DC_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/12/04  16:01:42  peterg
% %% Documantation added.
% %%
% %% Revision 1.1  1996/12/04  16:00:56  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Motor gain
k_m	lin	flow,$1

% Electrical components
%Inductance
l_a	lin	effort,$2
%Resistance
r_a	lin	flow,$3

% Mechanical components
%Inertia
j_m	lin	flow,$4
%Friction
b_m	lin	flow,$5

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_abg.fig version [d436a5df4d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1125 2475 2475 2475 2250 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 2475 5175 2475 4950 2700
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6075 3150 6075 1800 225 1800 225 3150 6075 3150
4 1 -1 0 0 0 20 0.0000000 4 210 1230 3195 2565 DC:motor\001
4 0 -1 0 0 0 20 0.0000000 4 210 570 5310 2565 SS:v\001
4 2 -1 0 0 0 20 0.0000000 4 210 555 1035 2565 SS:e\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_args.new version [5936bc7523].

1

-
 

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_desc.tex version [9905aeccc5].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system DCexample (DCexample_desc.tex)
% Generated by MTT on Mon Jan 12 16:00:15 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This is a simple teaching example to illustrate compensator design via
observer/state-feedback methods.

The system represents a simple model of a DC motor including armature
resistance $r_m$, armature inductance $l_m$, motor constant $k_m$,
inertia $j_m$ and friction $b_m$.

The DC motor has
\begin{itemize}
\item output angular velocity $y = \omega$
\item input voltage $u = v$
\item $\lambda = Li$ where $i$ is the armature current
\item angular momentum $p=j_m \omega$.
\item system states given by
  \begin{equation}
    x = 
    \begin{pmatrix}
      \lambda \\ \omega
    \end{pmatrix}
  \end{equation}
\end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_lbl.txt version [ee4ead091c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY DCexample: <brief description here>
%DESCRIPTION <Detailed description here>
%% Label file for system DCexample (DCexample_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type DC
	motor		lin	k_m;l_m;r_m;j_m;b_m

% Component type SS
	e		SS	external,internal
	v		SS	0,external

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_numpar.txt version [515bf1c141].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (DCexample_numpar.txt)
# Generated by MTT at Mon Jan 12 15:43:19 GMT 1998

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

# Parameters
b = 	1.0; # Parameter b for DCexample
b_m = 	1.0; # Parameter b_m for DCexample
j = 	1.0; # Parameter j for DCexample
j_m = 	1.0; # Parameter j_m for DCexample
k = 	1.0; # Parameter k for DCexample
k_m = 	1.0; # Parameter k_m for DCexample
l = 	1.0; # Parameter l for DCexample
l_a = 	1.0; # Parameter l_a for DCexample
l_m = 	1.0; # Parameter l_m for DCexample
r = 	1.0; # Parameter r for DCexample
r_a = 	1.0; # Parameter r_a for DCexample
r_m = 	1.0; # Parameter r_m for DCexample

# Initial states
x(1) = 	0.0; # Initial state for DCexample_motor (l_a)
x(2) = 	0.0; # Initial state for DCexample_motor (j_m)

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_params.r version [336c7256e5].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
%% Parameter file for system DCexample (DCexample_params.r)
%% This file provides symbolic parameters for simplification

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_pic.fig version [6593ec6ec8].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Inches
1200 2
6 3900 1725 7575 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 4801 1801 5701 1801
2 2 0 2 -1 7 0 0 -1 0.000 0 0 0 0 0 5
	 5701 1726 6601 1726 6601 1876 5701 1876 5701 1726
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 1 0 3
	1 1 2.00 120.00 240.00
	 6601 1801 7501 1801 7501 2401
2 2 0 2 -1 7 0 0 -1 0.000 0 0 0 0 0 5
	 3901 1726 4801 1726 4801 1876 3901 1876 3901 1726
-6
1 3 0 2 -1 7 0 0 -1 0.0000000 1 0.000 7500 2700 270 270 7500 2700 7650 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 3000 1800 3900 1800
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 1 0 3
	1 1 2.00 120.00 240.00
	 7500 3000 7500 3600 3000 3600
2 2 0 2 -1 7 0 0 -1 0.000 0 0 0 0 0 5
	 7950 2625 10800 2625 10800 2775 7950 2775 7950 2625
2 2 0 2 -1 7 0 0 -1 0.000 0 0 0 0 0 5
	 10800 1200 11400 1200 11400 4200 10800 4200 10800 1200
4 0 -1 0 0 3 20 0.0000000 4 150 135 3000 2775 v\001
4 0 -1 0 0 3 20 0.0000000 4 210 90 3300 1650 i\001
4 2 -1 0 0 3 20 0.0000000 4 255 540 6675 2775 k_m\001
4 2 -1 0 0 32 20 0.0000000 4 135 210 6975 2775 w\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_pic.tex version [274fd15af3].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
\makebox[7.055in][l]{
  \vbox to 2.555in{
    \vfill
    \special{psfile=DCexample_pic.ps}
  }
  \vspace{-\baselineskip}
}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_rep.tex version [03d36bd17b].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84




















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


\section{\textbf{DCexample}: representation \textbf{abg}, language \textbf{tex}}
\label{sec:DCexample_abg.tex}
\index{\textbf{DCexample} -- abg}


MTT command:
\begin{verbatim}
mtt DCexample abg tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/DCexample/MTT_work/DCexample_abg.tex}


\section{\textbf{DCexample}: representation \textbf{sm}, language \textbf{tex}}
\label{sec:DCexample_sm.tex}
\index{\textbf{DCexample} -- sm}


MTT command:
\begin{verbatim}
mtt -o DCexample sm tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/DCexample/MTT_work/DCexample_sm.tex}


\section{\textbf{DCexample}: representation \textbf{tf}, language \textbf{tex}}
\label{sec:DCexample_tf.tex}
\index{\textbf{DCexample} -- tf}


MTT command:
\begin{verbatim}
mtt -o DCexample tf tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/DCexample/MTT_work/DCexample_tf.tex}


\section{\textbf{DCexample}: representation \textbf{smc}, language \textbf{tex}}
\label{sec:DCexample_smc.tex}
\index{\textbf{DCexample} -- smc}


MTT command:
\begin{verbatim}
mtt -o DCexample smc tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/DCexample/MTT_work/DCexample_smc.tex}


\section{\textbf{DCexample}: representation \textbf{ssk}, language \textbf{tex}}
\label{sec:DCexample_ssk.tex}
\index{\textbf{DCexample} -- ssk}


MTT command:
\begin{verbatim}
mtt -o DCexample ssk tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/DCexample/MTT_work/DCexample_ssk.tex}


\section{\textbf{DCexample}: representation \textbf{smo}, language \textbf{tex}}
\label{sec:DCexample_smo.tex}
\index{\textbf{DCexample} -- smo}


MTT command:
\begin{verbatim}
mtt -o DCexample smo tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/DCexample/MTT_work/DCexample_smo.tex}


\section{\textbf{DCexample}: representation \textbf{ssl}, language \textbf{tex}}
\label{sec:DCexample_ssl.tex}
\index{\textbf{DCexample} -- ssl}


MTT command:
\begin{verbatim}
mtt -o DCexample ssl tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/DCexample/MTT_work/DCexample_ssl.tex}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_rep.txt version [9e1428c8ee].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system DCexample (DCexample_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt DCexample abg tex

mtt -o DCexample sm tex
mtt -o DCexample tf tex

mtt -o DCexample smc tex
mtt -o DCexample ssk tex

mtt -o DCexample smo tex
mtt -o DCexample ssl tex


Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_simp.r version [f380d89b00].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system DCexample (DCexample_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% System
%J_m := 1; L_m := 0.1; k_m := 1; b_m := 0.1; r_m := 1;

% Controller - poles at -2 and -10
%alpha_c1 := 12; alpha_c2 := 20;

% Observer -  poles at -10 -50
%alpha_o1 := 60; alpha_o2 := 500;

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/DCexample_sspar.r version [559cfc0faa].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for DCexample (DCexample_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/DCexample/Makefile version [902affeab5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#
# TransFig makefile
#

all: DCexample_pic.tex 

# translation into ps

DCexample_pic.tex: DCexample_pic.ps Makefile
	fig2ps2tex DCexample_pic.ps >DCexample_pic.tex
clean::
	rm -f DCexample_pic.tex

DCexample_pic.ps: DCexample_pic.fig Makefile
	fig2dev -L ps DCexample_pic.fig > DCexample_pic.ps
clean::
	rm -f DCexample_pic.ps

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Differential/Differential_abg.fig version [6c87d44baf].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2880 2655 2970 3195
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2925 2700 2925 3150
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 2700 3150 1350 3375 1575
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3172 3172 3172 4522 3397 4297
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1575 2925 2925 2925 2700 3150
4 1 0 100 0 18 18 0.0000 4 195 150 3150 3015 0\001
4 1 0 100 0 18 18 0.0000 4 270 540 3195 1215 I:j_1\001
4 1 0 100 0 18 18 0.0000 4 270 540 3150 4860 I:j_2\001
4 1 0 100 0 18 18 0.0000 4 270 750 990 3015 SS:yu\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Differential/Differential_rep.txt version [00561dcbde].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system Differential (Differential_rep.txt)
## Generated by MTT on" Wed Jan 26 10:13:44 GMT 2000.

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

mtt Differential abg tex			# The system description
mtt Differential cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt Differential struc tex	        # The system structure
## mtt Differential dae tex	        # The system dae
mtt Differential ode tex	        # The system ode 
## mtt Differential sspar tex		# Steady-state parameters
## mtt Differential ss tex 		# Steady state
## mtt Differential dm tex		# Descriptor matrices (of linearised system)
mtt Differential sm tex		# State matrices (of linearised system)
mtt Differential tf tex		# Transfer function (of linearised

## mtt Differential lmfr ps		# log modulus of frequency response (of linearised system)
## mtt Differential simpar tex		# Simulation parameters
## mtt Differential numpar tex		# Numerical simulation parameters
## mtt Differential input tex		# Simulation input
mtt Differential odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/InvertedPendulumT_abg.fig version [d065af5e98].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.0000000 1 0.000 8550 1125 485 485 8550 1125 8730 1575
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 1128 4728 2703 4953 2478
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 7650 450 9405 450 9405 675 7650 675 7650 450
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 8100 9450 225 855 225 855 8100 9450 8100
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3871 3600 5446 3825 5221
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 3871 5850 5446 6075 5221
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3465 3870 3735 3870
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4590 3825 4860 3825
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5715 3870 5985 3870
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3465 1125 3735 1125
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4635 2700 4905 2700
4 1 -1 0 0 0 20 0.0000000 4 240 870 3603 948 SS:v_x\001
4 1 4 0 0 0 16 0.0000000 4 195 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000000 4 210 885 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000000 4 195 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 900 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 495 5850 2970 [y_a]\001
4 1 -1 0 0 0 20 0.0000000 4 270 870 5850 945 SS:v_y\001
4 1 -1 0 0 0 20 0.0000000 4 210 1110 4729 3379 ROD:rod\001
4 1 -1 0 0 0 20 0.0000000 4 240 825 3510 5760 SS:f_x\001
4 1 -1 0 0 0 20 0.0000000 4 270 825 5760 5760 SS:f_y\001
4 1 -1 0 0 0 20 0.0000000 4 240 810 4635 5760 SS:f_a\001
4 0 1 1 0 3 20 0.0000000 4 240 720 6750 1260 Joint \001
4 0 1 1 0 3 20 0.0000000 4 210 495 6795 3375 Rod\001
4 1 -1 0 0 0 20 0.0000000 4 210 570 4771 946 SS:u\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/InvertedPendulumT_desc.tex version [7fb9ed2fd5].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system InvertedPendulumT (InvertedPendulumT_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/19 14:20:07  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{InvertedPendulumT} is
   displayed in Figure \Ref{InvertedPendulumT_abg} and its label
   file is listed in Section \Ref{sec:InvertedPendulumT_lbl}.
   The subsystems are listed in Section \Ref{sec:InvertedPendulumT_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses the compound components: {\bf ROD}.  {\bf
ROD} is essentially as described in Figure 10.2.
There is no gravity included in this model.

This system has a number of dynamic elements (those corresponding to translation
motion) in derivative causality, thus the system is represnted as a
Differential-Algebraic Equation (Section
\Ref{sec:InvertedPendulumT_dae.tex}). Hovever, this is of contrained-state form and
therfore can be written as a set of constrained-state equations (Section
\Ref{sec:InvertedPendulumT_cse.tex}). The corresponding ordinary differential
equation is complicated due to the trig functions involved in
inverting the E matrix.

As well as the standard representation the ``robot-form'' equations
appear in Section  \Ref{sec:InvertedPendulumT_rfe}. 

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/InvertedPendulumT_input.txt version [1c6fb421ed].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (InvertedPendulumT_input.txt)
# Generated by MTT at Fri Jun 13 16:56:09 BST 1997

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

# Set the inputs
u(1) =	(t<1.0);
u(2) =	0.0; # 
u(3) =	0.0; # gravity

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/InvertedPendulumT_lbl.txt version [66a8b967a4].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY InvertedPendulumT: Pendulum with torque input at lower end

%% Label (InvertedPendulumT_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/12/05  12:39:49  peterg
% %% Documentation
% %%
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - uniform rods
rod	none	l_1;l_1;j_1;m_1

%Zero velocity sources
v_x	SS     internal,0
v_y	SS     internal,0


%Zero force/torque sources
f_x	SS	   0,internal
f_a	SS	   0,internal
f_y	SS	   0,internal


%Torque/velocity at joint
u	SS	 external,internal


Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/InvertedPendulumT_numpar.txt version [43ee56016c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (InvertedPendulumT_numpar.txt)
# Generated by MTT at Mon Jan 19 13:53:15 GMT 1998

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

# Parameters
j_1 = 	1.0; # Parameter j_1 for InvertedPendulumT
j_2 = 	1.0; # Parameter j_2 for InvertedPendulumT
l_1 = 	1.0; # Parameter l_1 for InvertedPendulumT
l_2 = 	1.0; # Parameter l_2 for InvertedPendulumT
m_1 = 	1.0; # Parameter m_1 for InvertedPendulumT
m_2 = 	1.0; # Parameter m_2 for InvertedPendulumT

# Initial states
x(1) = 	0.0; # Initial state for InvertedPendulumT_rod1 (J)
x(2) = 	0.0; # Initial state for InvertedPendulumT_rod1_th (3)
x(3) = 	0.0; # Initial state for InvertedPendulumT_rod2 (J)
x(4) = 	0.0; # Initial state for InvertedPendulumT_rod2_th (3)

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/InvertedPendulumT_rep.txt version [074582e484].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system InvertedPendulumT (InvertedPendulumT_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt InvertedPendulumT abg tex

mtt -o InvertedPendulumT ode tex
mtt -o InvertedPendulumT sm tex
mtt -o InvertedPendulumT tf tex

mtt -o InvertedPendulumT smc tex
mtt -o InvertedPendulumT ssk tex

mtt -o InvertedPendulumT smo tex
mtt -o InvertedPendulumT ssl tex


Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/InvertedPendulumT_simp.r version [5cb387141c].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system InvertedPendulumT (InvertedPendulumT_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;


m_1 := m;
l_1 := l;
j_1 := j;
mg := m*g;
j := m*l*l/12;

%l:=1;

alpha_c1 := 2;
alpha_c2 := 1;

alpha_o1 := 20;
alpha_o2 := 100;


ORDER s,m,g;


END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/InvertedPendulumT_sspar.r version [37046d7f6d].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for InvertedPendulumT (InvertedPendulumT_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MTTx1 := 0;
MTTx2 := 0;

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/ROD_abg.fig version [afa8c63279].

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
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
123
124
125
126
127
128
129
130
131
132
133





































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 8550 7650
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8685 5265 8415 5535
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1372 3490 1372 3172 3375 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1507 3037 1237 3307
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9180 5724 9180 6042 8544 5406
4 1 -1 0 0 0 20 0.0000000 4 210 150 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 315 6933 5268 I:J\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000000 4 270 735 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000000 4 240 735 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000000 4 210 1170 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1170 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000000 4 210 1155 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1155 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000000 4 210 150 3603 5313 0\001
4 1 26 0 0 0 16 0.0000000 4 195 330 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 330 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 570 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000000 4 210 990 4681 5266 INTF:th\001
4 1 1 1 0 0 20 0.0000000 4 210 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000000 4 135 195 5580 9990 a\001
4 1 1 1 0 0 20 0.0000000 4 210 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000000 4 195 570 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000000 4 195 570 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000000 4 195 570 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000000 4 195 330 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000000 4 195 330 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000000 4 240 1065 2971 1216 SS:[x_a]\001
4 1 4 0 0 0 20 0.0000000 4 240 1080 2971 9361 SS:[x_b]\001
4 1 4 0 0 0 20 0.0000000 4 270 1065 8372 1217 SS:[y_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 1080 8417 9362 SS:[y_b]\001
4 1 4 0 0 0 20 0.0000000 4 270 1575 5671 1216 SS:[alpha_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 1590 5671 9361 SS:[alpha_b]\001
4 1 1 1 0 0 20 0.0000000 4 270 630 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000000 4 240 1470 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000000 4 270 645 1350 9855 Tip b\001
4 1 -1 0 0 0 20 0.0000000 4 270 810 9225 6300 SS:mg\001
4 2 -1 0 0 0 20 0.0000000 4 210 1020 1395 3060 SS:theta\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/ROD_desc.tex version [58e21e2b67].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system ROD (ROD_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/08/15  09:41:19  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ROD} is
   displayed in Figure \Ref{ROD_abg} and its label
   file is listed in Section \Ref{sec:ROD_lbl}.
   The subsystems are listed in Section \Ref{sec:ROD_sub}.

{\bf ROD} is essentially as described in Figure 10.2 of
``Metamodelling''.

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/InvertedPendulumT/ROD_lbl.txt version [03080ab3ad].

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


























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	ROD: rigid rod in two dimensions
%DESCRIPTION	Port [alpha_a]:	Angular torque/velocity - end a
%DESCRIPTION	Port [alpha_b]:	Angular torque/velocity - end b
%DESCRIPTION	Port [x_a]:	x force/velocity - end a
%DESCRIPTION	Port [x_b]:	x force/velocity - end b
%DESCRIPTION	Port [y_a]:	y force/velocity - end a
%DESCRIPTION	Port [y_b]:	y force/velocity - end b
%DESCRIPTION
%DESCRIPTION	Parameter 1:	length from end 1 to mass centre
%DESCRIPTION	Parameter 2:	length from end 2 to mass centre
%DESCRIPTION	Parameter 3:	inertia about mass centre
%DESCRIPTION	Parameter 4:	mass
%DESCRIPTION	See Section 10.2 of "Metamodelling"


%% Label file for system ROD (ROD_lbl.txt)



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,$3
m_x	lin	flow,$4
m_y	lin	flow,$4

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,$1
s2	lsin	flow,$2
c1	lcos	flow,$1
c2	lcos	flow,$2

%Gravity
mg	mg	internal

% Angle
theta	external	0

	

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Satellite/Satellite_abg.fig version [3da14bbf94].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1125 2475 2475 2475 2250 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 2475 4500 2475 4275 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5872 2497 7222 2497 6997 2722
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2835 2250 2835 900 3060 1125
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8145 3150 8145 450 270 450 270 3150 8145 3150
4 1 -1 0 0 0 20 0.0000000 4 210 1080 5265 2565 INTF:int\001
4 2 -1 0 0 0 20 0.0000000 4 210 570 1035 2565 SS:u\001
4 0 -1 0 0 0 20 0.0000000 4 270 570 7380 2565 SS:y\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2835 2565 1\001
4 1 -1 0 0 0 20 0.0000000 4 270 285 2880 765 I:j\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Satellite/Satellite_desc.tex version [f32b0f51ab].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Satellite (Satellite_desc.tex)
% Generated by MTT on Mon Jan 12 16:00:15 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Satellite} is
   displayed in Figure \Ref{Satellite_abg} and its label
   file is listed in Section \Ref{sec:Satellite_lbl}.
   The subsystems are listed in Section \Ref{sec:Satellite_sub}.


This is a simple teaching example to illustrare compensator design via
observer/state-feedback methods.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Satellite/Satellite_lbl.txt version [782e83919f].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Satellite: <brief description here>
%DESCRIPTION <Detailed description here>
%% Label file for system Satellite (Satellite_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	j		lin	flow,1

% Component type INTF
	int		

% Component type SS
	u		SS	external,internal
	y		SS	external,0

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Satellite/Satellite_numpar.txt version [1f955bd38c].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Satellite_numpar.txt)
# Generated by MTT at Mon Jan 12 15:43:19 GMT 1998

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

# Parameters
b = 	1.0; # Parameter b for Satellite
b_m = 	1.0; # Parameter b_m for Satellite
j = 	1.0; # Parameter j for Satellite
j_m = 	1.0; # Parameter j_m for Satellite
k = 	1.0; # Parameter k for Satellite
k_m = 	1.0; # Parameter k_m for Satellite
l = 	1.0; # Parameter l for Satellite
l_a = 	1.0; # Parameter l_a for Satellite
l_m = 	1.0; # Parameter l_m for Satellite
r = 	1.0; # Parameter r for Satellite
r_a = 	1.0; # Parameter r_a for Satellite
r_m = 	1.0; # Parameter r_m for Satellite

# Initial states
x(1) = 	0.0; # Initial state for Satellite_motor (l_a)
x(2) = 	0.0; # Initial state for Satellite_motor (j_m)

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Satellite/Satellite_rep.txt version [0143a6f353].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Satellite (Satellite_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt Satellite abg tex

mtt -o Satellite ode tex
mtt -o Satellite sm tex
mtt -o Satellite tf tex

mtt -o Satellite smc tex
mtt -o Satellite ssk tex

mtt -o Satellite smo tex
mtt -o Satellite ssl tex
mtt -o Satellite ctf tex


Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Satellite/Satellite_simp.r version [6ee2a71759].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system Satellite (Satellite_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% System

% Controller - poles -1
alpha_c1 := 2; alpha_c2 := 1;

% Observer -  poles at -1 
alpha_o1 := 2; alpha_o2 := 1;

ON FACTOR;

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/Satellite/Satellite_sspar.r version [0ae589b8c8].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for Satellite (Satellite_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/Makefile version [57b513cffa].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#
# TransFig makefile
#

all: TwoTanks_pic.tex 

# translation into ps

TwoTanks_pic.tex: TwoTanks_pic.ps Makefile
	fig2ps2tex TwoTanks_pic.ps >TwoTanks_pic.tex
clean::
	rm -f TwoTanks_pic.tex

TwoTanks_pic.ps: TwoTanks_pic.fig Makefile
	fig2dev -L ps TwoTanks_pic.fig > TwoTanks_pic.ps
clean::
	rm -f TwoTanks_pic.ps

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_abg.fig version [c6ae3ce4c5].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1351 4276 2701 4276 2476 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 4501 3826 5401 3601 5401
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2971 4051 3871 3151 3871 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 3150 5625 3150 5400 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 5400 5625 5400 5400 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4051 2925 4051 1575 4276 1800
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 5670 4050 7020 4275 6795
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 2880 5850 1530 6075 1755
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 5670 5850 7020 6075 6795
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 3150 7425 3150 7200 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 5400 7425 5400 7200 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 3150 8775 4050 8505 4050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 5400 8775 4500 8775 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9001 4275 10351 4275 10126 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1350 4050 1350 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9000 4050 9000 4500
4 1 -1 0 0 0 20 0.0000000 4 210 150 2926 4366 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 4096 5491 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 4096 3241 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 5895 3240 1\001
4 1 -1 0 0 0 20 0.0000000 4 240 690 5895 1440 R:r_1\001
4 1 -1 0 0 0 20 0.0000000 4 240 720 4050 1440 C:c_1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 5850 5490 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 375 7650 3240 AF\001
4 1 -1 0 0 0 20 0.0000000 4 210 375 7695 5490 AF\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8775 4365 0\001
4 0 -1 0 0 0 20 0.0000000 4 240 825 10620 4320 SS:f_2\001
4 2 -1 0 0 0 20 0.0000000 4 240 825 1260 4365 SS:f_1\001
4 1 -1 0 0 0 20 0.0000000 4 240 720 4005 7335 C:c_2\001
4 1 -1 0 0 0 20 0.0000000 4 240 690 5850 7335 R:r_2\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_desc.tex version [fc1416584e].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TwoTanks (TwoTanks_desc.tex)
% Generated by MTT on Mon Jan 12 16:00:15 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This is a simple teaching example to illustrate compensator design via
observer/state-feedback methods.

\begin{itemize}
\item Each tank is identical and of unit cross section.
\item Each tank has an identical inflow $f_1 = u$
\item Each outflow is different and given by $\sigma_i v_i$ for $i=1$
  and $i=2$ where $v_i$ is the volume of liquid in tank i and
  $\sigma_i$ the corresponding discharge coefficient. The net outflow
  is thus $y = f_2 = \sigma_1 v_1 + \sigma_2 v_2$.
\item The system states are taken to be:
  \begin{equation}
    x = 
    \begin{pmatrix}
      v_1 \\ v_2
    \end{pmatrix}
  \end{equation}
\end{itemize}




%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_lbl.txt version [c838a1da5c].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoTanks: <brief description here>
%DESCRIPTION <Detailed description here>
%% Label file for system TwoTanks (TwoTanks_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_1		lin	effort,1
	c_2		lin	effort,1

% Component type R
	r_1		lin	effort,sigma_1
	r_2		lin	effort,sigma_2

% Component type SS
	f_1		SS	internal,external
	f_2		SS	0,external

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_params.r version [e6fd98b650].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
%% Parameter file for system TwoTanks (TwoTanks_params.r)
%% This file provides symbolic parameters for simplification

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_pic.fig version [9031f3f49a].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Inches
1200 2
6 2099 1799 3974 3974
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2100 1800 2100 3900 3900 3900
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3300 1800 3300 3600 3900 3600
-6
6 5025 1800 6900 3975
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6899 1801 6899 3901 5099 3901
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5699 1801 5699 3601 5099 3601
-6
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 3
	1 1 2.00 120.00 240.00
	 3600 3750 4200 3750 4200 4800
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 3
	1 1 2.00 120.00 240.00
	 5400 3750 4800 3750 4800 4800
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 3
	1 1 2.00 120.00 240.00
	 1800 1050 2400 1050 2400 2100
2 1 1 2 -1 7 0 0 -1 6.000 0 0 -1 1 0 3
	1 1 2.00 120.00 240.00
	 7200 1050 6600 1050 6600 2100
4 0 -1 0 0 3 20 0.0000000 4 270 2610 3225 5250 y=total outflow = f_2\001
4 0 -1 0 0 3 20 0.0000000 4 270 405 1950 900 f_1\001
4 0 -1 0 0 3 20 0.0000000 4 270 405 6825 900 f_1\001
4 0 -1 0 0 3 20 0.0000000 4 270 3525 2775 1500 u= inflow to each tank = f_1\001

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_pic.tex version [d9789ea80b].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
\makebox[4.569in][l]{
  \vbox to 3.861in{
    \vfill
    \special{psfile=TwoTanks_pic.ps}
  }
  \vspace{-\baselineskip}
}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_rep.tex version [c0c0a0dc5d].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84




















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


\section{\textbf{TwoTanks}: representation \textbf{abg}, language \textbf{tex}}
\label{sec:TwoTanks_abg.tex}
\index{\textbf{TwoTanks} -- abg}


MTT command:
\begin{verbatim}
mtt TwoTanks abg tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/TwoTanks/MTT_work/TwoTanks_abg.tex}


\section{\textbf{TwoTanks}: representation \textbf{sm}, language \textbf{tex}}
\label{sec:TwoTanks_sm.tex}
\index{\textbf{TwoTanks} -- sm}


MTT command:
\begin{verbatim}
mtt -o TwoTanks sm tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/TwoTanks/MTT_work/TwoTanks_sm.tex}


\section{\textbf{TwoTanks}: representation \textbf{tf}, language \textbf{tex}}
\label{sec:TwoTanks_tf.tex}
\index{\textbf{TwoTanks} -- tf}


MTT command:
\begin{verbatim}
mtt -o TwoTanks tf tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/TwoTanks/MTT_work/TwoTanks_tf.tex}


\section{\textbf{TwoTanks}: representation \textbf{smc}, language \textbf{tex}}
\label{sec:TwoTanks_smc.tex}
\index{\textbf{TwoTanks} -- smc}


MTT command:
\begin{verbatim}
mtt -o TwoTanks smc tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/TwoTanks/MTT_work/TwoTanks_smc.tex}


\section{\textbf{TwoTanks}: representation \textbf{ssk}, language \textbf{tex}}
\label{sec:TwoTanks_ssk.tex}
\index{\textbf{TwoTanks} -- ssk}


MTT command:
\begin{verbatim}
mtt -o TwoTanks ssk tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/TwoTanks/MTT_work/TwoTanks_ssk.tex}


\section{\textbf{TwoTanks}: representation \textbf{smo}, language \textbf{tex}}
\label{sec:TwoTanks_smo.tex}
\index{\textbf{TwoTanks} -- smo}


MTT command:
\begin{verbatim}
mtt -o TwoTanks smo tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/TwoTanks/MTT_work/TwoTanks_smo.tex}


\section{\textbf{TwoTanks}: representation \textbf{ssl}, language \textbf{tex}}
\label{sec:TwoTanks_ssl.tex}
\index{\textbf{TwoTanks} -- ssl}


MTT command:
\begin{verbatim}
mtt -o TwoTanks ssl tex 
\end{verbatim}
  \input{/home/peterg/Research/Modelling/Control/StateSpace/TwoTanks/MTT_work/TwoTanks_ssl.tex}

Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_rep.txt version [6dfe1f9e05].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TwoTanks (TwoTanks_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt TwoTanks abg tex

mtt -o TwoTanks sm tex
mtt -o TwoTanks tf tex

mtt -o TwoTanks smc tex
mtt -o TwoTanks ssk tex

mtt -o TwoTanks smo tex
mtt -o TwoTanks ssl tex


Deleted mttroot/mtt/lib/examples/Control/SimpleStateSpace/TwoTanks/TwoTanks_simp.r version [6a85134c77].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system TwoTanks (TwoTanks_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Electrical/rc/rc_abg.fig version [cf0ab5e284].

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































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 1800 1125 162 162 1800 1125 1890 1260
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1802 4277 2702 4277 2477 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 4277 4052 4277 3827 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4502 4277 5402 4277 5177 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 4051 2926 3151 3151 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 4051 4276 3151 4501 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 4276 2701 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5401 4051 5401 4276
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5401 4276 5401 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 4051 2701 4276
2 2 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 2475 585 3375 585 3375 765 2475 765 2475 585
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4050 1215 4500 1215
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4050 1080 4500 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 675 2475 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3375 675 5400 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4275 675 4275 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4275 1215 4275 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 1575 5400 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 945 1800 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 1575 1800 1260
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 5400 1530 5400 765
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6750 5625 6750 225 675 225 675 5625 6750 5625
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 4367 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 4277 4367 0\001
4 1 -1 0 0 0 20 0.0000 4 195 660 5987 4367 SS:e2\001
4 1 -1 0 0 0 20 0.0000 4 195 375 2926 2926 R:r\001
4 1 -1 0 0 0 20 0.0000 4 195 390 4276 2926 C:c\001
4 1 -1 0 0 0 20 0.0000 4 195 660 1395 4365 SS:e1\001
4 0 1 1 0 0 20 0.0000 4 135 105 2880 450 r\001
4 0 1 1 0 0 20 0.0000 4 135 120 4680 1215 c\001
4 0 1 1 0 0 20 0.0000 4 135 120 5625 1170 e\001
4 0 1 1 0 0 20 0.0000 4 195 135 5715 1305 2\001
4 0 1 1 0 0 20 0.0000 4 135 120 1260 1170 e\001
4 0 1 1 0 0 20 0.0000 4 195 135 1350 1305 1\001
4 1 1 1 0 0 20 0.0000 4 255 1350 3600 4995 Bond graph\001
4 1 1 1 0 0 20 0.0000 4 195 1200 3600 2025 Schematic\001

Deleted mttroot/mtt/lib/examples/Electrical/rc/rc_desc.tex version [9fdb693fc1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system rc (rc_desc.tex)
% Generated by MTT on Sun Aug 24 11:03:55 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/08/24 10:27:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{rc} is
   displayed in Figure \Ref{rc_abg} and its label
   file is listed in Section \Ref{sec:rc_lbl}.
   The subsystems are listed in Section \Ref{sec:rc_sub}.

The system \textbf{rc} is the simple electrical rc circuit shown in
Figure \Ref{rc_abg}. It can be regarded as a single-input
single-output system with input $e_1$ and output $e_2$.

Deleted mttroot/mtt/lib/examples/Electrical/rc/rc_lbl.txt version [1e103cde3b].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system rc (rc_lbl.txt)
%SUMMARY rc
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases
%ALIAS	$1	c
%ALIAS	$2	r

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	c	lin		effort,c

% Component type R
	r	lin		flow,r

% Component type SS
	e1	SS		external,internal
	e2	SS		external,0

Deleted mttroot/mtt/lib/examples/Electrical/rc/rc_rep.txt version [4385a614cf].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Outline report file for system rc (rc_rep.txt)
mtt rc abg tex
mtt rc struc tex
mtt rc cbg ps
mtt rc ode tex
mtt rc sm tex
mtt rc tf tex
mtt rc sro ps
mtt rc lmfr ps
mtt rc nyfr ps

mtt rc numpar txt
mtt rc input txt

## Octave .m form
mtt  rc odeso ps

## Octave .oct form
mtt  -oct rc odeso ps

## c form
mtt  -c rc odeso ps

mtt rc rep txt


Deleted mttroot/mtt/lib/examples/Electromechanical/Electrostatic/Electrostatic_abg.fig version [a81a2c225b].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 900 2925 2475 2925 2250 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2970 2925 4545 2925 4320 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2700 2700 2700 1125 2925 1350
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 2700 2475 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 2925 7200 2925 6975 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7447 2722 7447 1147 7672 1372
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7650 2925 9225 2925 9000 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7650 2700 7650 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7425 3150 7425 4725 7650 4500
4 1 -1 0 0 0 20 0.0000 4 195 135 2700 3015 1\001
4 2 -1 0 0 0 20 0.0000 4 195 615 855 3015 SS:V\001
4 1 -1 0 0 0 20 0.0000 4 195 375 2745 990 R:r\001
4 1 -1 0 0 0 20 0.0000 4 195 870 5130 3015 CM:cm\001
4 1 -1 0 0 0 20 0.0000 4 195 135 7425 3015 1\001
4 1 -1 0 0 0 20 0.0000 4 195 405 7425 1035 C:k\001
4 0 -1 0 0 0 20 0.0000 4 195 540 9495 3015 SS:v\001
4 1 -1 0 0 0 20 0.0000 4 195 405 7380 5040 R:d\001

Deleted mttroot/mtt/lib/examples/Electromechanical/Electrostatic/Electrostatic_desc.tex version [fb1246fe80].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Electrostatic (Electrostatic_desc.tex)
% Generated by MTT on Fri Sep 19 18:07:08 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Electrostatic} is
   displayed in Figure \Ref{Electrostatic_abg} and its label
   file is listed in Section \Ref{sec:Electrostatic_lbl}.
   The subsystems are listed in Section \Ref{sec:Electrostatic_sub}.

This is a simple electrostatic speaker using the \textbf{CM}
transducer component together with an electrical \textbf{R} and a
mechanical \textbf{R} and \textbf{C} components to model a compliant
support for the moving plate. See Karnopp, Margolis and Rosenberg
Section 8.2 for a similar example.

Deleted mttroot/mtt/lib/examples/Electromechanical/Electrostatic/Electrostatic_input.txt version [f997874330].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Electrostatic_input.txt)
# Generated by MTT at Fri Sep 19 17:34:53 BST 1997

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

# Set the inputs
u(1) =	1.0; # V (Default value)

Deleted mttroot/mtt/lib/examples/Electromechanical/Electrostatic/Electrostatic_lbl.txt version [f7c965ed2d].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Electrostatic: Simple electrostatic speaker model (uses CM)
%DESCRIPTION See Karnopp, Margolis & Rosenberg Section 8.2
%% Label file for system Electrostatic (Electrostatic_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	k		lin	state,k	

% Component type CM
	cm		none	c_0;x_0;m	

% Component type R
	d		lin	flow,d
	r		lin	flow,r

% Component type SS
	V		SS	external,internal
	v		SS	0,external

Deleted mttroot/mtt/lib/examples/Electromechanical/Electrostatic/Electrostatic_numpar.txt version [5c1dbfcaba].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Electrostatic_numpar.txt)
# Generated by MTT at Fri Sep 19 17:43:25 BST 1997

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

# Parameters
c_0 = 	1.0; # Parameter c_0 for Electrostatic
d = 	1.0; # Parameter d for Electrostatic
k = 	100.0; # Parameter k for Electrostatic
m = 	1.0; # Parameter m for Electrostatic
r = 	1.0; # Parameter r for Electrostatic
x_0 = 	1.0; # Parameter x_0 for Electrostatic

# Initial states
x(1) = 	0.0; # Initial state for Electrostatic (k)
x(2) = 	0.0; # Initial state for Electrostatic_cm (transducer)
x(3) = 	1.0; # Initial state for Electrostatic_cm (transducer)
x(4) = 	0.0; # Initial state for Electrostatic_cm (mass)

Deleted mttroot/mtt/lib/examples/Electromechanical/Electrostatic/Electrostatic_rep.txt version [aec852c6bc].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Electrostatic (Electrostatic_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt Electrostatic abg tex
mtt Electrostatic struc tex
mtt Electrostatic ode tex
mtt Electrostatic numpar txt
mtt Electrostatic input txt
mtt Electrostatic simpar txt
mtt -c Electrostatic odeso ps

Deleted mttroot/mtt/lib/examples/Electromechanical/Electrostatic/Electrostatic_simp.r version [d5350ddac2].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system Electrostatic (Electrostatic_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Electromechanical/Electrostatic/Electrostatic_state.txt version [d1fa5b1a0b].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System Electrostatic, representation state, language txt; 
## File Electrostatic_state.txt; 
## Generated by MTT on Mon Feb  5 16:40:35 GMT 2001; 



Electrostatic_cm_1_mass	= 0.0; # Default
Electrostatic_cm_1_transducer	= 0.0; # Default
Electrostatic_cm_1_transducer_2	= 1.0; #  plate displacement
Electrostatic_k	= 0.0; # Default

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/MotorGenerator_abg.fig version [41ab75b11d].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 6930 405 13770 3600
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8328 2028 9903 2028 9903 2928 8328 2928 8328 2028
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 2475 8190 2475 7965 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11475 2250 11475 1035 11700 1260
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11700 2475 12915 2475 12690 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 12915 2250 12915 2700
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 12150 3150 10800 3150 10800 450 12150 450 12150 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10035 2475 11250 2475 11025 2700
4 1 -1 0 0 0 20 0.0000 4 255 1110 9138 2568 DC:gener\001
4 1 1 1 0 3 20 0.0000 4 255 1575 9225 3510 DC generator\001
4 1 -1 0 0 0 20 0.0000 4 195 135 11475 2610 0\001
4 1 -1 0 0 0 20 0.0000 4 195 675 13410 2610 SS:v2\001
4 1 -1 0 0 0 20 0.0000 4 255 585 11475 900 R:r_l\001
4 1 1 1 0 3 20 0.0000 4 210 1575 11475 3510 Resistive load\001
-6
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1170 2475 2385 2475 2160 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4186 2476 5401 2476 5176 2701
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 13185 4275 13185 225 45 225 45 4275 13185 4275
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 2476 2026 4051 2026 4051 2926 2476 2926 2476 2026
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 7245 2925 4950 2925 4950 2025 7245 2025 7245 2925
4 1 -1 0 0 0 20 0.0000 4 195 1170 3286 2566 DC:motor\001
4 1 1 1 0 3 20 0.0000 4 195 1155 3285 3510 DC motor\001
4 1 -1 0 0 0 20 0.0000 4 195 1275 6120 2520 Shaft:shaft\001
4 1 1 1 0 3 20 0.0000 4 270 1605 6165 3510 Flexible shaft\001
4 1 4 100 0 18 14 0.0000 4 210 1110 2250 1890 [Electrical]\001
4 1 4 100 0 18 14 0.0000 4 210 1110 10170 1980 [Electrical]\001
4 1 4 100 0 18 14 0.0000 4 210 1335 4140 1890 [Mechanical]\001
4 1 4 100 0 18 14 0.0000 4 210 1335 8325 1980 [Mechanical]\001
4 1 -1 0 0 0 20 0.0000 4 195 885 675 2565 PSU:v1\001

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/MotorGenerator_desc.tex version [3ad4972bd4].

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
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





















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system MotorGenerator (MotorGenerator_desc.tex)
% Generated by MTT on Thu Nov 16 13:11:36 GMT 2000.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 17:43:16  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{MotorGenerator} is
   displayed in Figure \Ref{fig:MotorGenerator_abg.ps} and its label
   file is listed in Section \Ref{sec:MotorGenerator_lbl}.
   The subsystems are listed in Section \Ref{sec:MotorGenerator_sub}.

This example illustates:
\begin{itemize}
\item The reuse of the DC model as both a motor and a generator
\item The assignment of a \emph{domain} and \emph{units} to component ports.
\end{itemize}

The command:
\begin{verbatim}
mtt -I MotorGenerator ese r
\end{verbatim}
gives the following output (irrelevant parts ommitted)
\begin{verbatim}
MTT (Model Transformation Tools) version 4.8
($Date$)
This is free software with ABSOLUTELY NO WARRANTY.
Type `mtt warranty' for details.

Creating MotorGenerator_rbg.m
Creating MotorGenerator_cmp.m
Creating MotorGenerator_fig.fig
Creating MotorGenerator_sabg.fig
Creating MotorGenerator_alias.txt
Creating MotorGenerator_alias.m
Creating MotorGenerator_sub.sh
Copying DC from /home/peterg/mtt_new/mtt-lib/comp/compound/Electromechanical/DC to .
Creating DC_rbg.m
Creating DC_cmp.m
Creating DC_fig.fig
Creating DC_sabg.fig
Creating DC_alias.txt
Creating DC_alias.m
Creating DC_sub.sh
Creating DC_abg.m
Checking port domains and units
     domains and units are OK

...

Creating PSU_rbg.m
Creating PSU_cmp.m
Creating PSU_fig.fig
Creating PSU_sabg.fig
Creating PSU_alias.txt
Creating PSU_alias.m
Creating PSU_sub.sh
Copying Se from /home/peterg/mtt_new/mtt-lib/comp/compound/General/Se to .
Creating Se_rbg.m
Creating Se_cmp.m
Creating Se_fig.fig
Creating Se_sabg.fig
Creating Se_alias.txt
Creating Se_alias.m
Creating Se_sub.sh
Creating Se_abg.m
Checking port domains and units
  no domains or units declared
.... 

Creating PSU_abg.m
Checking port domains and units
     domains and units are OK
...

Creating Shaft_rbg.m
Creating Shaft_cmp.m
Creating Shaft_fig.fig
Creating Shaft_sabg.fig
Creating Shaft_alias.txt
Creating Shaft_alias.m
Creating Shaft_sub.sh
Creating Shaft_abg.m
Checking port domains and units
     domains and units are OK
....

Creating MotorGenerator_abg.m
Checking port domains and units
  no domains or units declared

Creating MotorGenerator_cbg.m (maximise integral causality)
Creating MotorGenerator_type.sh
 .....
Creating MotorGenerator_ese.r
Creating MotorGenerator_def.r
Creating MotorGenerator_struc.txt
...
INFORMATION: Component MotorGenerator connects ports with units volt and volt
INFORMATION: Component MotorGenerator connects ports with units amp and amp
...
INFORMATION: Component MotorGenerator connects ports with units N*m and N*m
INFORMATION: Component MotorGenerator connects ports with units radians/s and radians/s
...
INFORMATION: Component MotorGenerator connects ports with units N*m and N*m
INFORMATION: Component MotorGenerator connects ports with units radians/s and radians/s
Creating MotorGenerator_aliased.txt
Copying MotorGenerator_ese.r

\end{verbatim}

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/MotorGenerator_input.txt version [b15a7f6b3b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (MotorGenerator_input.txt)
# Generated by MTT at Wed Dec 10 08:30:11 GMT 1997

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

# Set the inputs
## Removed by MTT on Wed Nov 15 10:11:43 GMT 2000: u(1) =	1.0; # v1 (Default value)
## Removed by MTT on Thu Nov 16 12:43:01 GMT 2000: motorgenerator_v1	= 1.0; # Added by MTT on Wed Nov 15 10:11:47 GMT 2000
## Removed by MTT on Thu Nov 16 12:44:08 GMT 2000: motorgenerator_mtt2_1_v_1_u	= 1.0; # Added by MTT on Thu Nov 16 12:43:05 GMT 2000
## Removed by MTT on Thu Nov 16 12:46:31 GMT 2000: motorgenerator_v_1_v_1_u	= 1.0; # Added by MTT on Thu Nov 16 12:44:12 GMT 2000
## Removed by MTT on Mon Dec  4 14:40:32 GMT 2000: motorgenerator_v1_1_v	= 1.0; # Added by MTT on Thu Nov 16 12:46:34 GMT 2000
motorgenerator_v1_1_v_1_u	= 1.0; # Added by MTT on Mon Dec 04 14:40:46 GMT 2000

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/MotorGenerator_lbl.txt version [d4522ab96a].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY MotorGenerator: Motor-generator example
%DESCRIPTION A simple example of DC motor driving a generator via
%DESCRIPTION a flexible shaft

%% Label file for system MotorGenerator (MotorGenerator_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/11/16 09:58:49  peterg
% %% Initial revision
% %%
% %% Revision 1.3  2000/05/20 16:38:40  peterg
% %% New SS foramt
% %%
% %% Revision 1.2  1998/04/04 10:51:59  peterg
% %% New version using port coercion
% %%
% %% Revision 1.1  1996/12/04  16:24:01  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Voltage in
v1	SS	external,internal

% Voltage out
v2	SS	external,0

%Motor
motor		lin	k_m;l_m;r_m;j_m;b_m

%Shaft
shaft	        lin     c_s

%Generator
gener		lin	k_g;l_g;r_g;j_g;b_g

% Resistive load
r_l		lin	flow,r_l

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/MotorGenerator_numpar.txt version [6fa5d2a477].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (MotorGenerator_numpar.txt)
# Generated by MTT at Wed Dec 10 08:29:31 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  2000/12/04 14:42:47  peterg
# %% Initial revision
# %%
# %% Revision 1.1  2000/08/01 12:26:48  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Parameters
b_g = 	0.0; # Parameter b_g for MotorGenerator
b_m = 	0.0; # Parameter b_m for MotorGenerator
c_s = 	0.01; # Parameter c_s for MotorGenerator
j_g = 	1.0; # Parameter j_g for MotorGenerator
j_m = 	1.0; # Parameter j_m for MotorGenerator
k_g = 	1.0; # Parameter k_g for MotorGenerator
k_m = 	1.0; # Parameter k_m for MotorGenerator
l_g = 	0.1; # Parameter l_g for MotorGenerator
l_m = 	0.1; # Parameter l_m for MotorGenerator
r_g = 	0.1; # Parameter r_g for MotorGenerator
r_l = 	1.0; # Parameter r_l for MotorGenerator
## Removed by MTT on Mon Dec  4 14:44:19 GMT 2000: r_m_1 = 	0.1; # Parameter r_m for MotorGenerator

r_m	= 0.1; # Added by MTT on Mon Dec 04 14:44:44 GMT 2000

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/MotorGenerator_rep.txt version [e2275ca135].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system MotorGenerator (MotorGenerator_rep.txt)
## Generated by MTT on" Thu Nov 16 13:37:07 GMT 2000.

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

mtt MotorGenerator abg tex			# The system description
mtt MotorGenerator cbg ps 		        # The causal bond graph
mtt MotorGenerator struc tex	        # The system structure
mtt MotorGenerator sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt MotorGenerator dae tex	        # The system dae
mtt MotorGenerator ode tex	        # The system ode 
## mtt MotorGenerator sspar tex		# Steady-state parameters
## mtt MotorGenerator ss tex 		# Steady state
## mtt MotorGenerator dm tex		# Descriptor matrices (of linearised system)
mtt MotorGenerator sm tex		# State matrices (of linearised system)
##mtt MotorGenerator tf tex		# Transfer function (of linearised system)
## mtt MotorGenerator lmfr ps		# log modulus of frequency response (of linearised system)
## mtt MotorGenerator simpar tex		# Simulation parameters
## mtt MotorGenerator numpar tex		# Numerical simulation parameters
## mtt MotorGenerator state tex		# Simulation initial state
## mtt MotorGenerator input tex		# Simulation input
## mtt MotorGenerator logic tex		# Logic control
mtt MotorGenerator odeso ps		# Simulation output

mtt MotorGenerator rep txt		# This file

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/MotorGenerator_simpar.txt version [75937c9851].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system MotorGenerator (MotorGenerator_simpar.txt)
# Generated by MTT on Fri Dec 1 18:03:55 GMT 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


FIRST        = 0.0;       # First time in simulation output
DT          = 0.1;        # Print interval
LAST        = 10.0;       # Last time in simulation
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/PSU_abg.fig version [ee661e106f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3780 1710 4860 2025
4 0 4 100 0 18 18 0.0000 4 270 1065 3780 1935 SS:[out]\001
-6
6 1530 675 4995 3015
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 4950 2970 1575 2970 1575 720 4950 720 4950 2970
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 1845 3600 1845 3375 2070
4 1 0 100 0 18 18 0.0000 4 210 570 1890 1935 Se:v\001

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/PSU_lbl.txt version [0875be2315].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system PSU (PSU_lbl.txt)
%SUMMARY PSU
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%UNITS out electrical volt amp 
% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[out]	SS		external,external

% Component type Se
	v	SS		external

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/Shaft_abg.fig version [7e87b19fce].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 1440 405 4410 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 2250 2925 1035 3150 1260
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1486 2476 2701 2476 2476 2701
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 3600 3150 2250 3150 2250 450 3600 450 3600 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 2475 4365 2475 4140 2700
4 1 -1 0 0 0 20 0.0000 4 195 135 2925 2565 0\001
4 1 -1 0 0 0 20 0.0000 4 255 630 2925 900 C:c_s\001
4 1 1 1 0 3 20 0.0000 4 270 1605 2925 3510 Flexible shaft\001
-6
6 540 2340 1440 2655
4 2 4 100 0 18 18 0.0000 4 270 870 1440 2565 SS:[in]\001
-6
6 4455 2340 5535 2655
4 0 4 100 0 18 18 0.0000 4 270 1065 4455 2565 SS:[out]\001
-6
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 5850 3825 450 3825 450 225 5850 225 5850 3825

Deleted mttroot/mtt/lib/examples/Electromechanical/MotorGenerator/Shaft_lbl.txt version [b9f5e1ab44].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Shaft (Shaft_lbl.txt)
%SUMMARY Shaft
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 17:43:16  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases


% Unit definitions
%UNITS in  rotational N*m radians/s
%UNITS out rotational N*m radians/s

% Argument aliases
%ALIAS	$1	c_s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	c_s	lin		effort,c_s

% Component type SS
	[in]	SS		external,external
	[out]	SS		external,external

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyCylinder_abg.fig version [0983c47273].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 4 1 7 1 0 -1 0.000 0 0 -1 0 0 4
	 2700 2025 7875 2025 7875 9450 2700 9450
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 6525 5625 7875 5850 7650
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 3780 5625 5130 5850 4905
2 2 0 2 1 3 1 0 20 0.000 0 0 0 0 0 5
	 2700 5175 7875 5175 7875 6525 2700 6525 2700 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2835 855 2835 5850 3060 5625
2 2 0 2 1 3 1 0 20 0.000 0 0 0 0 0 5
	 2700 1575 2970 1575 2970 5175 2700 5175 2700 1575
2 1 1 2 1 7 1 0 -1 6.000 0 0 -1 0 0 2
	 2700 585 2700 9855
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 10125 9450 225 1125 225 1125 10125 9450 10125
4 1 4 0 0 0 20 0.0000 4 240 3075 5625 8190 [mechanical,mass,thermal]\001
4 1 -1 0 0 0 30 0.0000 4 300 1950 5625 8595 CG:bottom\001
4 1 4 0 0 0 20 0.0000 4 255 3885 5625 6345 [mechanical_b,mass_b,thermal_b]\001
4 1 -1 0 0 0 30 0.0000 4 405 3345 5625 5940 LeakyPiston:piston\001
4 1 -1 0 0 0 30 0.0000 4 405 1260 5625 3285 CG:top\001
4 1 4 0 0 0 20 0.0000 4 240 3075 5625 3600 [mechanical,mass,thermal]\001
4 1 4 0 0 0 20 0.0000 4 255 3750 5625 5400 [mechanical_t,mass_t,thermal_t]\001
4 1 4 0 0 0 20 0.0000 4 240 750 3375 5895 [shaft]\001
4 0 -1 0 0 0 20 0.0000 4 195 975 2925 900 SS:shaft\001

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyCylinder_desc.tex version [908e83e3d0].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system LeakyCylinder (LeakyCylinder_desc.tex)
% Generated by MTT on Tue Nov 25 17:22:29 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{LeakyCylinder} is
   displayed in Figure \Ref{LeakyCylinder_abg} and its label
   file is listed in Section \Ref{sec:LeakyCylinder_lbl}.
   The subsystems are listed in Section \Ref{sec:LeakyCylinder_sub}.

This example roughly corresponds to the Example in section 12.4.3
(Fig. 12.17) of Karnopp, Margolis and Rosenberg (1990). It is a pseudo bond
graph representation based on the ``thermal acummulator'' of  section
12.4.1 and the ``isentropic nozzle'' of section 12.4.2 of that book.





%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyCylinder_input.txt version [8ad664ff23].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (LeakyCylinder_input.txt)
# Generated by MTT at Tue Nov 25 17:00:09 GMT 1997

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

# Set the inputs
u(1) =	0.0; # shaft

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyCylinder_lbl.txt version [b1e5813551].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY LeakyCylinder: Pseudo bond graph model of compressible gas dynamics

%DESCRIPTION This example roughly corresponds to the Example in
%DESCRIPTION section 12.4.3 (Fig. 12.17) of Karnopp, Margolis and Rosenberg
%DESCRIPTION (1990). It is a pseudo bond graph representation based on the
%DESCRIPTION "thermal acummulator" of section 12.4.1 and the "isentropic
%DESCRIPTION nozzle" of section 12.4.2 of that book.

%% Label file for system LeakyCylinder (LeakyCylinder_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/03/04 09:56:05  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type CG
	bottom		none	c_v;r
	top		none	c_v;r

% Component type LeakyPiston
	piston		none	m_p;a_b;a_t;gamma;r;0

% Component type SS
	shaft		SS	external,external

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyCylinder_numpar.txt version [a322907ca6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (LeakyCylinder_numpar.txt)
# Generated by MTT at Mon Dec  1 08:59:51 GMT 1997

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

# Parameters
a_b = 	1.0; # Parameter a_b for LeakyCylinder
a_l = 	1.0; # Parameter a_l for LeakyCylinder
a_t = 	1.0; # Parameter a_t for LeakyCylinder
c_v = 	1.0; # Parameter c_v for LeakyCylinder
gamma = 	1.0; # Parameter gamma for LeakyCylinder
m_p = 	1.0; # Parameter m_p for LeakyCylinder
r = 	1.0; # Parameter r for LeakyCylinder

# Initial states
x(3) = 	0.0; # Initial state for LeakyCylinder_bottom (cg)
x(6) = 	0.0; # Initial state for LeakyCylinder_top (cg)
x(7) = 	0.0; # Initial state for LeakyCylinder_piston_piston (m_p)

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyCylinder_rep.txt version [9786958767].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system LeakyCylinder (LeakyCylinder_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt LeakyCylinder abg tex
mtt LeakyCylinder struc tex
mtt LeakyCylinder sympar tex
mtt LeakyCylinder ode tex
mtt LeakyCylinder ss tex
mtt LeakyCylinder sm tex
%mtt -c LeakyCylinder odeso ps

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyCylinder_simp.r version [163e4c6595].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system LeakyCylinder (LeakyCylinder_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyCylinder_sspar.r version [e6e5a3aadc].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for LeakyCylinder (LeakyCylinder_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyPiston_abg.fig version [c4c5b004af].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 3375 6300 4725 6525 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7200 3375 7200 4725 7425 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 6075 6300 8122 6525 7897
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7245 6075 7245 8100 7470 7875
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4500 9000 9225 9000
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 450 9000 4050 9000
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 4050 9675 4050 450 450 450 450 9675 4050 9675
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9225 9675 4500 9675 4500 450 9225 450 9225 9675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 2925 6300 1575 6525 1800
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7200 2925 7200 1575 7425 1800
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 2925 3150 1575 3375 1800
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 3375 3150 4725 3375 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2056 4711 1101 3756 1101 4074
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 6075 3150 7425 3375 7200
4 0 4 0 0 0 20 0.0000 4 255 1440 7200 5040 [thermal_in]\001
4 1 4 0 0 0 20 0.0000 4 255 1110 6300 5040 [mass_in]\001
4 1 4 0 0 0 20 0.0000 4 255 1260 6300 5895 [mass_out]\001
4 0 4 0 0 0 20 0.0000 4 255 1590 7200 5895 [thermal_out]\001
4 0 4 0 0 0 20 0.0000 4 255 1755 7155 8505 SS:[thermal_b]\001
4 2 4 0 0 0 20 0.0000 4 255 1425 6255 8505 SS:[mass_b]\001
4 1 1 1 0 0 20 0.0000 4 195 1335 6750 9450 Leak model\001
4 1 1 1 0 0 20 0.0000 4 195 1515 2250 9405 Piston Model\001
4 1 -1 0 0 0 20 0.0000 4 195 135 6300 3240 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 7200 3240 0\001
4 2 4 0 0 0 20 0.0000 4 255 2115 3195 1305 SS:[mechanical_t]\001
4 2 4 0 0 0 20 0.0000 4 255 1380 6345 1305 SS:[mass_t]\001
4 0 4 0 0 0 20 0.0000 4 255 1710 7155 1350 SS:[thermal_t]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3150 3240 0\001
4 1 4 0 0 0 20 0.0000 4 255 540 3150 5040 [top]\001
4 1 4 0 0 0 20 0.0000 4 240 750 2070 5040 [shaft]\001
4 1 4 0 0 0 20 0.0000 4 240 1155 1080 3645 SS:[shaft]\001
4 2 4 0 0 0 20 0.0000 4 255 2160 3150 7785 SS:[mechanical_b]\001
4 1 4 0 0 0 20 0.0000 4 240 990 3150 5940 [bottom]\001
4 1 -1 0 0 0 30 0.0000 4 300 1425 6885 5535 RG:leak\001
4 1 -1 0 0 0 30 0.0000 4 405 2295 2700 5535 Piston:piston\001

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyPiston_desc.tex version [56fe000716].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system LeakyPiston (LeakyPiston_desc.tex)
% Generated by MTT on Fri Nov 28 12:09:15 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{LeakyPiston} is
   displayed in Figure \Ref{LeakyPiston_abg} and its label
   file is listed in Section \Ref{sec:LeakyPiston_lbl}.
   The subsystems are listed in Section \Ref{sec:LeakyPiston_sub}.

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/LeakyPiston_lbl.txt version [61459c1737].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY LeakyPiston: Leaky piston sub model
%DESCRIPTION <Detailed description here>
%% Label file for system LeakyPiston (LeakyPiston_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Piston
	piston		lin	$1;$2;$3

% Component type RG
	leak		lin	$4;$5;$6

% Component type SS
	[mass_b]		external	external
	[mass_t]		external	external
	[mechanical_b]		external	external
	[mechanical_t]		external	external
	[shaft]		external	external
	[thermal_b]		external	external
	[thermal_t]		external	external

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/Piston_abg.fig version [357fe6faa9].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 1575 6075 3150 6300 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 3600 6075 4275 6300 4050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 4636 6075 5311 6300 5086
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 4500 4500 4500 4725 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5905 4281 4950 3326 4950 3645
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 5850 6075 7200 6300 6975
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3375 8100 6975 8100
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6975 8775 6975 900 3375 900 3375 8775 6975 8775
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9945 9225 9945 450 450 450 450 9225 9945 9225
4 1 -1 0 0 0 20 0.0000 4 255 780 6120 3465 TF:a_t\001
4 1 -1 0 0 0 20 0.0000 4 195 135 6075 4590 1\001
4 2 4 0 0 0 20 0.0000 4 240 1155 4905 3240 SS:[shaft]\001
4 1 -1 0 0 0 20 0.0000 4 255 660 4050 4545 I:m_p\001
4 1 -1 0 0 0 20 0.0000 4 255 825 6075 5670 TF:a_b\001
4 2 4 0 0 0 20 0.0000 4 240 1395 6120 7650 SS:[bottom]\001
4 1 1 1 0 0 20 0.0000 4 195 1515 5175 8505 Piston Model\001
4 2 4 0 0 0 20 0.0000 4 255 945 6120 1395 SS:[top]\001

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/Piston_desc.tex version [76d5324126].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Piston (Piston_desc.tex)
% Generated by MTT on Fri Nov 28 12:09:27 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Piston} is
   displayed in Figure \Ref{Piston_abg} and its label
   file is listed in Section \Ref{sec:Piston_lbl}.
   The subsystems are listed in Section \Ref{sec:Piston_sub}.

The two {\bf TF} components convert pressure to force. The {\bf I}
component represents piston inertia.

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/GasDynamics/LeakyCylinder/Piston_lbl.txt version [93daf6da73].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Piston: simple model of the piston
%DESCRIPTION Inludes inertia and pressure effects.
%% Label file for system Piston (Piston_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	m_p		lin	flow,$1

% Component type SS
	[bottom]		external	external
	[shaft]		external	external
	[top]		external	external

% Component type TF
	a_b		lin	flow,$2
	a_t		lin	effort,$3

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_abg.fig version [4d929f234d].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
6 3150 4410 5940 4995
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 3
	 3154 4730 5449 4730 5404 4730
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3379 4730 3154 4955
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3604 4730 3379 4955
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3829 4730 3604 4955
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4054 4730 3829 4955
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4279 4730 4054 4955
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4505 4731 4280 4956
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4730 4731 4505 4956
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4955 4731 4730 4956
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5180 4731 4955 4956
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5405 4731 5180 4956
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 5897 4413 5627 4683
-6
1 3 0 2 1 7 1 0 -1 0.0000000 1 0.000 4276 2206 612 612 4276 2206 4636 2701
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	0 0 2.00 120.00 240.00
	 5176 1531 4906 1801
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 2475 5175 3600 5175 3330
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 2250 2925 2250 3150 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 2250 5625 2250 5400 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 2070 4275 946 4500 1171
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 4050 4275 2475 4500 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4297 4522 4297 5646 4522 5421
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 3600 7875 3600 7650 3825
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 6300 8775 225 225 225 225 6300 8775 6300
4 2 -1 0 0 2 20 0.0000000 4 240 2130 2835 2250 R:air_resistance\001
4 1 -1 0 0 2 20 0.0000000 4 210 150 4276 2341 1\001
4 1 1 1 0 3 20 0.0000000 4 210 525 5176 1441 Ball\001
4 0 -1 0 0 2 20 0.0000000 4 270 1365 5760 2340 SS:gravity\001
4 1 -1 0 0 2 20 0.0000000 4 240 1515 4275 810 I:ball_mass\001
4 1 -1 0 0 2 20 0.0000000 4 270 1710 4320 5940 CSW:ground\001
4 1 1 1 0 3 20 0.0000000 4 210 960 6030 4275 Ground\001
4 1 1 1 0 3 20 0.0000000 4 150 135 4590 3465 v\001
4 1 1 1 0 3 20 0.0000000 4 150 315 4590 5220 -v\001
4 1 -1 0 0 2 20 0.0000000 4 210 150 4275 4365 0\001
4 1 -1 0 0 2 20 0.0000000 4 210 1275 5985 3690 INTF:intf\001
4 0 -1 0 0 2 20 0.0000000 4 210 585 8010 3690 SS:x\001

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_desc.tex version [12a7f8c729].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Bounce (Bounce_desc.tex)
% Generated by MTT on Wed Jul 2 10:55:51 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Bounce}, togehter with a
   schematic diagram is
   displayed in Figure \Ref{Bounce_abg} and its label
   file is listed in Section \Ref{sec:Bounce_lbl}.
   The subsystems are listed in Section \Ref{sec:Bounce_sub}.

The model uses the {\bf CSW} switched {\bf C} element to simulate
contact with the ground. The corresponding switching function (See
Section \ref{sec:Bounce_input.txt}), is based on the height above the
ground $h$ as follows:
\begin{equation}
i_{sw} = 
  \begin{cases}
    0 & \text{if $h > 0$}\\
    -1 & \text{if $h \le 0$}
  \end{cases}
\end{equation}

In other words, the component acts as an ideal spring when the ball is
in contact with the ground yet has no effect when the ball is not in
contact with the ground.

The ball is modelled as a point mass (the \textbf{I} component) and  a
linear resistance to motion (the  (the \textbf{R} component).

The system was simulated for 100 time units and the resultant height
is plotted in Figure \ref{fig:Bounce_odeso.ps}. The ball was released at zero
velocity from a height of ten units. The bounce height decreases due to
the effect of the modelled air resistance.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_input.txt version [31e311af15].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Bounce_input.txt)
# Generated by MTT at Wed Jul  2 10:47:49 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.3  2000/05/18 11:30:14  peterg
# %% Moved switch logic to logic.txt
# %%
# %% Revision 1.2  1998/10/01 19:20:33  peterg
# %% Cahged switch function
# %%
# %% Revision 1.1  1998/07/25 18:35:02  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Set the inputs
## Removed by MTT on Fri Oct  5 10:37:56 BST 2001: mttu(1) = 9.81;


bounce_gravity	= 9.81; # Added by MTT on Fri Oct 05 10:37:59 BST 2001

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_lbl.txt version [3c29396b81].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Bounce: Bouncing ball example (hybrid)
%DESCRIPTION <Detailed description here>
%% Label file for system Bounce (Bounce_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/11 09:54:22  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type INTF
	intf

% Component type CSW
	ground		lin	state,k_g

% Component type I
	ball_mass		lin	flow,m

% Component type R
	air_resistance		lin	flow,r

% Component type SS
	gravity			SS	external,internal
	x			SS	external,0

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_logic.txt version [093819353e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system Bounce (Bounce_logic.txt)
# Generated by MTT on Thu May 18 12:29:15 BST 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/05/18 11:29:58  peterg
## Initial revision
##
###############################################################


# Set the switches
bounce_ground_1_mtt_switch_logic	= (bounce_intf_1_mtt3<0);

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_numpar.txt version [3190429a19].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Bounce_numpar.txt)
# Generated by MTT at Wed Jul  2 10:47:47 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  2000/12/28 17:45:24  peterg
# %% To RCS
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Parameters
k_g = 	100.0; # Ground stiffness
m = 	1.0; # Ball mass
r = 	1.0; # Air resistance

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_rep.txt version [d2abad5353].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Bounce (Bounce_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/05/19 07:09:19  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt Bounce abg tex
mtt Bounce struc tex
mtt Bounce ode tex


mtt Bounce simpar txt
mtt Bounce input txt
mtt Bounce logic txt
mtt Bounce numpar txt

mtt Bounce odeso ps

mtt Bounce rep txt

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_simpar.txt version [17a4ac93f9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Simulation parameters for system Bounce (Bounce_simpar.txt)
# Generated by MTT on Sat Jul 25 15:57:56 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/10/01 19:21:04  peterg
## Initial revision
##
###############################################################
FIRST=0.0;
LAST=10.0;
DT=0.02;
STEPFACTOR=1;

Deleted mttroot/mtt/lib/examples/Hybrid/Bounce/Bounce_state.txt version [340ae7b854].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Initial state  file (Bounce_state.txt)
# Generated by MTT at Sat Jul 25 15:56:57 BST 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/07/25 20:34:05  peterg
## *** empty log message ***
##
## Revision 1.1  1998/07/25 14:59:11  peterg
## Initial revision
##
###############################################################

# Set the states
## Removed by MTT on Fri Oct  5 10:38:29 BST 2001: mttx(1) 	= 10.0;	# 3 (Bounce_intf)
## Removed by MTT on Fri Oct  5 10:38:29 BST 2001: mttx(2) 	= 0.0; 	# MTT_SWITCH (Bounce_ground)
## Removed by MTT on Fri Oct  5 10:38:29 BST 2001: mttx(3) 	= 0.0; 	# ball_mass (Bounce)

bounce_ball_mass	= 0.0; # Added by MTT on Fri Oct 05 10:38:33 BST 2001
bounce_ground_1_mtt_switch	= 0.0; # Added by MTT on Fri Oct 05 10:38:33 BST 2001
bounce_intf_1_mtt3	= 10.0; # Added by MTT on Fri Oct 05 10:38:33 BST 2001

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_abg.fig version [c0c525deaf].

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
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
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

































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
6 3513 9498 8733 9858
6 3513 9498 4953 9813
6 3513 9498 4233 9768
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3514 9724 3739 9499
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3739 9724 3964 9499
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3964 9724 4189 9499
-6
6 4189 9499 4909 9769
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4190 9725 4415 9500
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4415 9725 4640 9500
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4640 9725 4865 9500
-6
-6
6 4864 9499 6304 9814
6 4864 9499 5584 9769
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4865 9725 5090 9500
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5090 9725 5315 9500
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5315 9725 5540 9500
-6
6 5540 9500 6260 9770
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5541 9726 5766 9501
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5766 9726 5991 9501
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5991 9726 6216 9501
-6
-6
6 6214 9499 6934 9769
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 6215 9725 6440 9500
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 6440 9725 6665 9500
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 6665 9725 6890 9500
-6
6 6890 9500 7610 9770
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 6891 9726 7116 9501
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 7116 9726 7341 9501
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 7341 9726 7566 9501
-6
6 7565 9500 8285 9770
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 7566 9726 7791 9501
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 7791 9726 8016 9501
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 8016 9726 8241 9501
-6
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3514 9499 8689 9499
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 8242 9727 8467 9502
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 8467 9727 8692 9502
-6
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4727 2072 4727 3647 4952 3422
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6077 2072 6077 3647 6302 3422
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4502 3647 4952 3647
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5852 3647 6302 3647
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7202 3647 7652 3647
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 8823 4728 10398 4953 10173
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 6571 2926 6571 3151 6796
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2251 6797 2251 8372 2476 8147
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9923 6774 9923 8349 10148 8124
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5851 4771 6301 4771
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 8372 4726 6797 4951 7022
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4501 6346 4501 6796
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7651 6346 7651 6796
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7629 6571 9204 6571 8979 6796
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 6347 4726 4772 4951 4997
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2521 4186 4096 4186 3871 4411
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4096 3961 4096 4411
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 4770 7426 6345 7651 6120
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 6795 7426 8370 7651 8145
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8101 4186 9676 4186 9451 4411
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8101 3961 8101 4411
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 3647 7426 2072 7651 2297
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6076 4772 6076 6347 6301 6122
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 8820 7426 10395 7651 10170
2 2 0 2 1 3 1 0 20 0.000 0 0 0 0 0 5
	 3827 3422 8327 3422 8327 4997 3827 4997 3827 3422
2 1 0 3 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 3.00 180.00 360.00
	 9226 2521 8371 3196
2 1 0 3 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 3.00 180.00 360.00
	 11458 7718 10603 8393
2 1 0 3 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 3.00 180.00 360.00
	 701 7685 1556 8360
4 1 -1 0 0 2 20 0.0000000 4 210 1470 2115 6660 INTF:intfL\001
4 1 -1 0 0 2 20 0.0000000 4 210 1215 6077 4322 ROD:rod\001
4 1 4 0 0 2 20 0.0000000 4 240 360 6077 3962 [p7]\001
4 1 4 0 0 2 20 0.0000000 4 240 360 6077 4637 [p8]\001
4 1 -1 0 0 2 20 0.0000000 4 210 150 4727 6662 1\001
4 1 -1 0 0 2 20 0.0000000 4 210 150 7427 6662 1\001
4 1 -1 0 0 2 20 0.0000000 4 210 150 4728 8688 0\001
4 1 -1 0 0 2 20 0.0000000 4 270 1905 4728 10713 CSW:groundL\001
4 1 -1 0 0 2 20 0.0000000 4 210 150 7428 8688 0\001
4 1 -1 0 0 2 20 0.0000000 4 270 1365 6077 6662 SS:gravity\001
4 1 -1 0 0 2 20 0.0000000 4 210 795 10217 4277 SS:aR\001
4 1 -1 0 0 2 20 0.0000000 4 210 1485 10126 6661 INTF:intfR\001
4 1 -1 0 0 2 20 0.0000000 4 210 795 2251 8641 SS:hL\001
4 1 -1 0 0 2 20 0.0000000 4 210 810 9946 8641 SS:hR\001
4 1 -1 0 0 2 20 0.0000000 4 210 795 6077 1937 SS:xC\001
4 1 -1 0 0 2 20 0.0000000 4 270 1920 7426 10711 CSW:groundR\001
4 1 -1 0 0 2 20 0.0000000 4 210 780 4727 1937 SS:xL\001
4 1 -1 0 0 2 20 0.0000000 4 210 795 7427 1937 SS:xR\001
4 1 4 0 0 2 20 0.0000000 4 240 360 4727 3962 [p3]\001
4 1 4 0 0 2 20 0.0000000 4 240 360 7427 3962 [p4]\001
4 1 4 0 0 2 20 0.0000000 4 240 360 4727 4637 [p5]\001
4 1 4 0 0 2 20 0.0000000 4 240 360 7426 4636 [p6]\001
4 1 -1 0 0 2 20 0.0000000 4 210 780 2026 4276 SS:aL\001
4 1 4 0 0 2 20 0.0000000 4 240 360 4411 4276 [p1]\001
4 1 4 0 0 2 20 0.0000000 4 240 360 7876 4321 [p2]\001
4 0 1 1 0 3 30 0.0000000 4 300 1470 5311 10171 Ground\001
4 0 1 1 0 3 30 0.0000000 4 390 2685 8326 2476 Bouncing Rod\001
4 0 1 1 0 3 30 0.0000000 4 390 3315 11026 7651 Height of right tip\001
4 2 1 1 0 3 30 0.0000000 4 390 3000 1800 7515 Height of left tip\001

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_desc.tex version [a49ffd6db2].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system BouncingRod (BouncingRod_desc.tex)
% Generated by MTT on Sun Jul 6 17:21:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/07/06  16:35:20  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The acausal bond graph of system \textbf{BouncingRod} is displayed in
Figure \Ref{BouncingRod_abg} and its label file is listed in Section
\Ref{sec:BouncingRod_lbl}. 
 The subsystems are listed in Section
\Ref{sec:BouncingRod_sub}.

The system consists of a uniform rod of mass 1kg, length 2m (and
therefore of inertia about the mass centre of $\frac{1}{3}
\text{kgm}^2$. The rod is released at an angle of $\frac{\pi}{4}$ from
the vertical, the mass centre is $10\text{m}$ above the ground and all
velocities are initially zero. The gravitational constant is taken as unity.

The ground is modeled as an ideal compliance in the vertical
direction with compliance of $0.1 \text{mN}^{-1}$ and it is assumed
that contact takes place at the rod tips only. There is no
horizontal resistance to motion. This idealised setup is modeled by a
two {\bf CSW} components, one for each rod tip, modulated by the
height of each rod tip above the ground: each  {\bf CSW} is off when
the corresponding height is positive.

The system was simulated for 100 time units and the resultant height
of each tip is plotted in Figure \ref{fig:BouncingRod_odeso.ps}. The rod was
released at zero velocity from a height of ten units and at an angle
of $\frac{\pi}{4}$ radians to the vertical. The oscillations in height
are due to rod rotation about its mass centre.  The bounce height
changes due to energy transfer to and from the rod rotation about its
mass centre.




%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: "yes"
%%% End: 

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_input.txt version [4009f01498].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (BouncingRod_input.txt)
# Generated by MTT at Fri Jul  4 14:09:14 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1997/07/06 16:17:48  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Set the inputs
## Removed by MTT on Mon Dec  4 08:27:04 GMT 2000: u(1) =	9.81; # gravity (Default value)
bouncingrod_gravity	= 9.81; # Added by MTT on Mon Dec 04 08:27:10 GMT 2000

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_lbl.txt version [60967407da].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY BouncingRod: Two-dimensional bouncing rod (hybrid)
%DESCRIPTION A uniform rod bounces on a compliant surface -- the
%DESCRIPTION CSW component is used.

%% Label file for system BouncingRod (BouncingRod_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.5  2000/12/04 08:36:23  peterg
% %% Declare pi
% %%
% %% Revision 1.4  2000/05/18 10:30:39  peterg
% %% New SS form
% %%
% %% Revision 1.3  1997/09/11 09:55:25  peterg
% %% Added documentation
% %%
% %% Revision 1.2  1997/09/11 08:37:29  peterg
% %% Added description
% %%
% %% Revision 1.1  1997/07/06 16:18:37  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type CSW
	groundL		lin	effort,epsilon
	groundR		lin	effort,epsilon

% Component type INTF
	intfL
	intfR

% Component type ROD
	rod		none	l;l;j;m

% Component type SS
	aL		SS	0,internal
	aR		SS	0,internal
	gravity		SS	external,internal
	hL		SS	external,0
	hR		SS	external,0
	xC		SS	0,internal
	xL		SS	0,internal
	xR		SS	0,internal

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_logic.txt version [c5ab109217].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system BouncingRod (BouncingRod_logic.txt)
# Generated by MTT on Thu May 18 12:14:35 BST 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the switches
## Removed by MTT on Mon Dec  4 08:30:13 GMT 2000: bouncingrod_groundl= (x(3)<=0);
## Removed by MTT on Mon Dec  4 08:30:13 GMT 2000: bouncingrod_groundr= (x(4)<=0);

bouncingrod_groundl_1_mtt_switch_logic	= (x(3)<=0);
bouncingrod_groundr_1_mtt_switch_logic	= (x(4)<=0);

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_numpar.txt version [653e854f15].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (BouncingRod_numpar.txt)
# Generated by MTT at Fri Jul  4 14:09:11 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.2  2000/12/28 17:45:59  peterg
# %% To RCS
# %%
# %% Revision 1.1  1997/07/06 16:17:27  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Parameters
epsilon = 	0.01; 
l = 	1.0; # Default value
m = 	1.0; # Default value
j = 	l*l*m/3;



Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_odes.h version [8e08760d76].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
/*
%% Parameter file for system BouncingRod (BouncingRod_odes.h)
%% This file provides the params for simulation:
*/
#define DT 0.1 /* Time step (for printing) */
#define LAST 99.9 /* Last time */
#define STEPFACTOR 1000 /* Integration steps per time step */

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_rep.txt version [1e32455526].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system BouncingRod (BouncingRod_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  2000/12/28 17:45:59  peterg
% %% To RCS
% %%
% %% Revision 1.1  1997/07/06 16:20:44  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt BouncingRod abg tex
mtt BouncingRod struc tex
mtt BouncingRod ode tex
mtt BouncingRod numpar txt
mtt BouncingRod input txt
mtt BouncingRod logic txt
mtt BouncingRod odeso ps



Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_simpar.txt version [b247367777].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Simulation parameters for system BouncingRod (BouncingRod_simpar.txt)
# Generated by MTT on Sun Jul 26 12:14:17 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1999/12/21 08:07:38  peterg
## Initial revision
##
###############################################################

LAST=20;
DT=0.01;
STEPFACTOR=1;


Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/BouncingRod_state.txt version [28b475ef19].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Initial state  file (BouncingRod_state.txt)
# Generated by MTT at Sun Jul 26 12:19:13 BST 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


# Set the states
## Removed by MTT on Mon Dec  4 08:27:53 GMT 2000: mttx(1) 	= 0.0; 	# MTT_SWITCH (BouncingRod_groundL)
## Removed by MTT on Mon Dec  4 08:27:53 GMT 2000: mttx(2) 	= 0.0; 	# MTT_SWITCH (BouncingRod_groundR)
## Removed by MTT on Mon Dec  4 08:27:53 GMT 2000: mttx(3) 	= 10+sin(pi/4); 	# 3 (BouncingRod_intfL)
## Removed by MTT on Mon Dec  4 08:27:53 GMT 2000: mttx(4) 	= 10-sin(pi/4); 	# 3 (BouncingRod_intfR)
## Removed by MTT on Mon Dec  4 08:27:53 GMT 2000: mttx(5) 	= 0.0; 	# J (BouncingRod_rod)
## Removed by MTT on Mon Dec  4 08:27:53 GMT 2000: mttx(6) 	= 0.0; 	# m_x (BouncingRod_rod)
## Removed by MTT on Mon Dec  4 08:27:53 GMT 2000: mttx(7) 	= 0.0; 	# m_y (BouncingRod_rod)
## Removed by MTT on Mon Dec  4 08:27:53 GMT 2000: mttx(8) 	= pi/4; 	# 3 (BouncingRod_rod_th)
bouncingrod_groundl_1_mtt_switch	= 0.0; # Added by MTT on Mon Dec 04 08:27:59 GMT 2000
bouncingrod_groundr_1_mtt_switch	= 0.0; # Added by MTT on Mon Dec 04 08:27:59 GMT 2000
bouncingrod_intfl_1_mtt3	= 10+sin(pi/4);
bouncingrod_intfr_1_mtt3	= 10-sin(pi/4);
bouncingrod_rod_1_j	= 0.0; # Added by MTT on Mon Dec 04 08:27:59 GMT 2000
bouncingrod_rod_1_m_x	= 0.0; # Added by MTT on Mon Dec 04 08:27:59 GMT 2000
bouncingrod_rod_1_m_y	= 0.0; # Added by MTT on Mon Dec 04 08:27:59 GMT 2000
bouncingrod_rod_1_th_1_mtt3	= pi/4;

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/CSW_lbl.txt version [1a99199c4e].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY ISW: Switched I component
%DESCRIPTION ISW acts as an I component except when the -s -c option is used.
%DESCRIPTION When the -s -c option is used:
%DESCRIPTION   The component label is used as a variable name (eg Name)
%DESCRIPTION   In the ode simulation:
%DESCRIPTION     Name = 1 implies normal I (closed switch)
%DESCRIPTION     Name = 0 implies state=0 (open switch)
%DESCRIPTION     Name = -1 implies state>0 (Diode)

%% Label file for system ISW (ISW_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/06/03 15:26:09  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	MTT_SWITCH		$1	$1

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/ROD_abg.fig version [34663585aa].

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
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
123
124
125





























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 3600 675 2250 675 2250 9675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 4 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 4 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 4 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2700 5625 2700 5400 1800 6300
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 5401 5625 9001 5850 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 7875 2925 9000 3195 8730
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8325 7875 8325 9000 8595 8730
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8550 5400 9450 6300 9225 6300
4 1 -1 0 0 0 20 0.0000 4 195 135 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000 4 195 270 6933 5268 I:J\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000 4 255 660 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000 4 255 660 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000 4 195 1110 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000 4 195 1095 7156 6391 EMTF:s2\001
4 1 -1 0 0 0 20 0.0000 4 240 720 8372 1217 SS:[p5]\001
4 1 -1 0 0 0 20 0.0000 4 240 720 5671 9361 SS:[p2]\001
4 1 -1 0 0 0 20 0.0000 4 240 720 8417 9362 SS:[p6]\001
4 1 5 0 0 0 20 0.0000 4 195 135 3603 5313 0\001
4 1 26 0 0 0 16 0.0000 4 210 270 4501 4456 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 270 4501 3781 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 270 3826 4051 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 270 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 270 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 270 6301 4006 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 270 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 270 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 270 6211 6526 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 270 4591 5896 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 270 4591 6841 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 270 3916 6526 [mod]\001
4 1 -1 0 0 0 20 0.0000 4 240 720 2971 1216 SS:[p3]\001
4 1 -1 0 0 0 20 0.0000 4 240 720 5671 1216 SS:[p1]\001
4 1 -1 0 0 0 20 0.0000 4 240 720 2971 9361 SS:[p4]\001
4 1 26 0 0 0 16 0.0000 4 210 270 4411 5446 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 270 4906 5446 [in]\001
4 1 5 0 0 0 20 0.0000 4 195 960 4681 5266 INTF:th\001
4 1 1 1 0 0 20 0.0000 4 195 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000 4 135 180 5580 9990 a\001
4 1 1 1 0 0 20 0.0000 4 195 210 8280 9990 Y\001
4 1 4 1 0 0 20 0.0000 4 255 390 1350 2700 Tip\001
4 1 4 1 0 0 20 0.0000 4 255 390 1350 9855 Tip\001
4 1 4 1 0 0 20 0.0000 4 195 1380 1080 6120 Mass centre\001
4 1 -1 0 0 0 20 0.0000 4 240 720 1710 6615 SS:[p7]\001
4 1 -1 0 0 0 20 0.0000 4 240 720 9495 6570 SS:[p8]\001

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/ROD_desc.tex version [da144b910f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system ROD (ROD_desc.tex)
% Generated by MTT on Fri Jul 4 10:30:17 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ROD} is
   displayed in Figure \Ref{ROD_abg} and its label
   file is listed in Section \Ref{sec:ROD_lbl}.
   The subsystems are listed in Section \Ref{sec:ROD_sub}.


This is a special version just for this problem.

Deleted mttroot/mtt/lib/examples/Hybrid/BouncingRod/ROD_lbl.txt version [77bb98cc7c].

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




























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	ROD: rigid rod in two dimensions
%DESCRIPTION	Port [1]:	Angular torque/velocity - end 1
%DESCRIPTION	Port [2]:	Angular torque/velocity - end 2
%DESCRIPTION	Port [3]:	x force/velocity - end 1
%DESCRIPTION	Port [4]:	x force/velocity - end 2
%DESCRIPTION	Port [5]:	y force/velocity - end 1
%DESCRIPTION	Port [6]:	y force/velocity - end 2
%DESCRIPTION	Port [7]:	x force/velocity - centre
%DESCRIPTION	Port [8]:	y force/velocity - centre
%DESCRIPTION
%DESCRIPTION	Parameter 1:	length from end 1 to mass centre
%DESCRIPTION	Parameter 2:	length from end 2 to mass centre
%DESCRIPTION	Parameter 3:	inertia about mass centre
%DESCRIPTION	Parameter 4:	mass
%DESCRIPTION	See Section 10.2 of "Metamodelling"


%% Label file for system ROD (ROD_lbl.txt)



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,$3
m_x	lin	flow,$4
m_y	lin	flow,$4

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,$1
s2	lsin	flow,$2
c1	lcos	flow,$1
c2	lcos	flow,$2

% ports
	
[p1]	SS	external,external
[p2]	SS	external,external
[p3]	SS	external,external
[p4]	SS	external,external
[p5]	SS	external,external
[p6]	SS	external,external
[p7]	SS	external,external
[p8]	SS	external,external

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Clutch_abg.fig version [e07876e4d0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 4726 3376 4726 2026 2476 2026 2476 3376 4726 3376
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8101 3376 8101 2026 5851 2026 5851 3376 8101 3376
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11476 3376 11476 2026 9226 2026 9226 3376 11476 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4501 2701 6076 2701 5941 2836
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7876 2701 9451 2701 9316 2836
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1126 2701 2701 2701 2566 2836
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11925 5400 11925 225 225 225 225 5400 11925 5400
4 1 -1 0 0 0 20 0.0000 4 195 1170 3511 2791 DC:motor\001
4 1 -1 0 0 0 20 0.0000 4 195 1140 10306 2791 Load:load\001
4 1 -1 0 0 0 20 0.0000 4 195 1290 7021 2791 Drive:drive\001
4 1 -1 0 0 0 20 0.0000 4 195 525 765 2790 SS:e\001

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Clutch_desc.tex version [2a8a19d9fa].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Clutch (Clutch_desc.tex)
% Generated by MTT on Thu Jul 3 13:57:59 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Clutch} is displayed in
   Figure \Ref{Clutch_abg} and its label file is listed in Section
   \Ref{sec:Clutch_lbl}.  The subsystems are listed in Section
   \Ref{sec:Clutch_sub}.  The details of the DC motor and the load are
   hidden behind a word bond graph so as to focus on the clutch
   mechanism as modelled by the \textbf{CSW} component.
  It is natural to model the clutch shaft by a
compliance to absorb the shock of engaging the clutch; therefore the
drive model contains a \textbf{CSW} component.


Figure \ref{fig:Clutch_odeso.ps}, shows the angular velocities of the motor
and load.  The clutch is engaged from time $t$ given by $0<t<15$; and
a unit input voltage is applied at time $t=0$. All initial conditions
are zero.

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Clutch_input.txt version [5c3d25f7f3].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Clutch_input.txt)
# Generated by MTT at Thu Jul  3 12:17:46 BST 1997

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

# Set the inputs
u(1) =	1.0; # e (Default value)

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Clutch_lbl.txt version [60b6b4f3da].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Clutch: Simple model of a clutch system (Hybrid)
%DESCRIPTION Uses CSW component to model the clutch/flexi shaft
%% Label file for system Clutch (Clutch_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/11 09:38:48  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type DC
	motor		lin	k_m;l_a;r_a;j_m;b_m

% Component type Drive
	drive	

% Component type Load
	load	

% Component type SS
	e		SS	external,internal

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Clutch_logic.txt version [23dc34e214].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system Clutch (Clutch_logic.txt)
# Generated by MTT on Thu May 18 12:29:15 BST 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/05/19 07:11:36  peterg
## Initial revision
##
## Revision 1.1  2000/05/18 11:29:58  peterg
## Initial revision
##
###############################################################

# Set the switches
## Removed by MTT on Fri Oct  5 11:47:34 BST 2001: clutch_drive_clutch= (t>=5)&&(t<15);

clutch_drive_1_clutch_1_mtt_switch_logic	= (t>=5)&&(t<15); # Added by MTT on Fri Oct 05 11:47:40 BST 2001

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Clutch_numpar.txt version [240d38c694].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Clutch_numpar.txt)
# Generated by MTT at Thu Jul  3 12:12:35 BST 1997

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

# Parameters
b_m = 	0.1; # Default value
epsilon = 	0.01;
j_l = 	1.0; # Default value
j_m = 	10.0; # Default value
k_m = 	1.0; # Default value
l_a = 	0.1; # Default value
r_a = 	1.0; # Default value
r_l = 	5.0; # Default value

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Clutch_rep.txt version [334e6789c3].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Clutch (Clutch_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  2000/05/19 07:16:07  peterg
% %% Added logic
% %%
% %% Revision 1.1  1999/02/21 08:18:25  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt  Clutch abg tex
mtt  Clutch struc tex
mtt  Clutch ode tex
mtt  Clutch dm tex

mtt  Clutch simpar txt
mtt  Clutch input txt
mtt  Clutch logic txt
mtt  Clutch numpar txt

mtt  Clutch odeso ps

mtt  Clutch rep txt

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Clutch_simpar.txt version [e28a1ca3b7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Simulation parameters for system Clutch (Clutch_simpar.txt)
# Generated by MTT on Sun Jul 26 13:26:44 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1999/12/21 09:13:19  peterg
## Initial revision
##
###############################################################

LAST=20.0;
DT=0.1;
STEPFACTOR=1;

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Drive_abg.fig version [220398ec6b].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1800 2475 2925 2475 2700 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3397 2497 4522 2497 4297 2722
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4950 2475 6075 2475 5850 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6547 2497 7672 2497 7447 2722
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 2700 3150 3825 3375 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 2700 6300 3825 6525 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4725 2250 4725 1125 4950 1350
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2925 2700 3375 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6030 2700 6525 2700
4 1 -1 0 0 0 20 0.0000 4 195 135 3150 2565 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 6300 2565 1\001
4 1 4 0 0 0 20 0.0000 4 240 810 1305 2565 SS:[in]\001
4 1 4 0 0 0 20 0.0000 4 240 960 8235 2565 SS:[out]\001
4 1 -1 0 0 0 20 0.0000 4 195 675 3150 4185 SS:v1\001
4 1 -1 0 0 0 20 0.0000 4 195 675 6300 4185 SS:v2\001
4 1 -1 0 0 0 20 0.0000 4 195 135 4725 2610 0\001
4 1 -1 0 0 0 20 0.0000 4 195 1410 4725 945 CSW:clutch\001

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Drive_desc.tex version [f20953ff3a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Drive (Drive_desc.tex)
% Generated by MTT on Thu Jul 3 13:58:26 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Drive} is
   displayed in Figure \Ref{Drive_abg} and its label
   file is listed in Section \Ref{sec:Drive_lbl}.
   The subsystems are listed in Section \Ref{sec:Drive_sub}.

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Drive_lbl.txt version [21db5c70a3].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Drive: The clutch/shaft drive subsystem
%DESCRIPTION <Detailed description here>
%% Label file for system Drive (Drive_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/11 09:39:16  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type CSW
	clutch		lin	effort,epsilon

% Component type R
%	r_d		lin	flow,r_d

% Component type SS
	v1		SS	0,external
	v2		SS	0,external


Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Load_abg.fig version [f6ba5521a1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 3376 2926 3376 2701 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 3151 3151 2251 3376 2476
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 3601 3151 4501 3376 4276
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 2476 1801 3826 1801 3826 4951 2476 4951 2476 1801
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 2026 3151 2476 3151 2476 3601 2026 3601 2026 3151
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6075 5400 6075 900 495 900 495 5400 6075 5400
4 1 -1 0 0 0 20 0.0000 4 195 135 3151 3466 1\001
4 1 -1 0 0 0 20 0.0000 4 255 450 3151 2161 I:j_l\001
4 1 -1 0 0 0 20 0.0000 4 255 585 3196 4816 R:r_l\001
4 1 4 0 0 0 20 0.0000 4 240 810 1576 3466 SS:[in]\001
4 1 1 1 0 0 20 0.0000 4 255 4395 3331 1531 Rotating load with inertia and friction\001

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Load_desc.tex version [0e613d5fe7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Load (Load_desc.tex)
% Generated by MTT on Thu Jul 3 13:58:38 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Load} is
   displayed in Figure \Ref{Load_abg} and its label
   file is listed in Section \Ref{sec:Load_lbl}.
   The subsystems are listed in Section \Ref{sec:Load_sub}.

Deleted mttroot/mtt/lib/examples/Hybrid/Clutch/Load_lbl.txt version [96cf47d829].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Load: An inertial/frictional load
%DESCRIPTION <Detailed description here>
%% Label file for system Load (Load_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type I
	j_l		lin	flow,j_l

% Component type R
	r_l		lin	flow,r_l

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weir_abg.fig version [23c0cd3485].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1350 2025 2475 2025 2250 2250
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 1800 2700 675 2925 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2925 2025 4050 2025 3825 2250
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4500 2025 5625 2025 5400 2250
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 1800 4275 675 4500 900
2 4 0 2 31 7 99 0 -1 6.000 0 0 7 0 0 5
	 6975 3600 6975 180 225 180 225 3600 6975 3600
4 1 0 100 0 0 20 0.0000 4 195 150 2700 2115 1\001
4 1 0 100 0 0 20 0.0000 4 210 1065 2700 585 ISW:isw\001
4 1 4 100 0 0 20 0.0000 4 255 870 765 2115 SS:[in]\001
4 1 4 100 0 0 20 0.0000 4 255 1020 6255 2115 SS:[out]\001
4 1 0 100 0 0 20 0.0000 4 195 150 4275 2115 1\001
4 1 0 100 0 0 20 0.0000 4 195 390 4230 585 R:r\001
4 1 1 99 0 1 20 0.0000 4 270 2250 3375 2835 Simple weir model\001

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weir_desc.tex version [3eff224837].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system Weir (Weir_desc.tex)
% Generated by MTT on Tue Mar 2 22:05:29 GMT 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Weir} is
   displayed in Figure \Ref{Weir_abg} and its label
   file is listed in Section \Ref{sec:Weir_lbl}.
   The subsystems are listed in Section \Ref{sec:Weir_sub}.


The weir is modelled by an \textbf{ISW} component in series with an
\textbf{R} component. Physicaly, the former represents the inertia of
the fluid together with the switching effect of the weir; the latter
represents the flow resistance.

The switching logic is on if the level on either side of the weir
reaches the level of the weir.

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weir_lbl.txt version [17d01f59e7].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY Weir
#DESCRIPTION Detailed description here

## System Weir, representation lbl, language txt
## File Weir_lbl.txt
## Generated by MTT on Fri Oct  5 10:50:46 BST 2001

  ###################################### 
  ##### Model Transformation Tools #####
  ######################################
  
  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.2  2001/07/03 22:59:10  gawthrop
  ## Fixed problems with argument passing for CRs
  ##
  ###############################################################

## Port aliases
#ALIAS	in	in
#ALIAS	out	out

## Argument aliases
#ALIAS	$1	i_s
#ALIAS	$2	r

## Each line should be of one of the following forms:
##	     a comment (ie starting with #)
##	     component-name	cr_name	arg1,arg2,..argn
##	     blank

## ---- Component labels ----

## Component type ISW
	isw	lin		flow,i_s

## Component type R
	r	lin		flow,r		

## Component type R
	[in]	SS		external,external		
	[out]	SS		external,external		









Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weirs_abg.fig version [fea78e06f0].

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
68
69
70
71
72
73









































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 6075 2025 4950 2250 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 675 6300 1800 6300 1530 6570
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 6525 2025 7650 2250 7425
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 675 6075 675 6525
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 7650 2250 7650
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 6525 6750 7200 6570 7200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 6300 3375 6300 3105 6570
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 6300 5625 6300 5355 6570
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 6300 7200 6300 6930 6570
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8325 6300 9450 6300 9180 6570
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 6076 5851 4951 6076 5176
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5850 6525 5850 7650 6075 7425
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 7650 6075 7650
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9677 6077 9677 4952 9902 5177
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9675 6525 9675 7650 9900 7425
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9450 7650 9900 7650
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4860 3150 4860 1980
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 7110 3150 7110 1395
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 3
	1 0 2.00 120.00 240.00
	 2610 450 3285 450 3285 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 3
	 3060 675 3060 3150 5760 3150
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 3
	 5985 3150 8955 3150 8955 675
2 1 0 2 1 7 99 0 -1 0.000 0 0 -1 1 0 2
	1 0 1.00 60.00 120.00
	 5850 2925 5850 3600
4 1 -1 0 0 0 20 0.0000 4 195 150 2025 6390 0\001
4 1 -1 0 0 0 20 0.0000 4 210 960 2025 4815 C:tank1\001
4 1 -1 0 0 0 20 0.0000 4 270 720 1980 7965 SS:p1\001
4 1 -1 0 0 0 20 0.0000 4 210 525 315 6390 SS:f\001
4 0 -1 0 0 0 20 0.0000 4 210 795 6300 7515 R:leak\001
4 1 -1 0 0 0 20 0.0000 4 195 1065 3960 6390 Weir:w1\001
4 1 -1 0 0 0 20 0.0000 4 195 1065 7785 6390 Weir:w2\001
4 1 -1 0 0 0 20 0.0000 4 210 960 5851 4816 C:tank2\001
4 1 -1 0 0 0 20 0.0000 4 195 150 5851 6391 0\001
4 1 -1 0 0 0 20 0.0000 4 270 720 5850 7965 SS:p2\001
4 1 -1 0 0 0 20 0.0000 4 195 150 9677 6392 0\001
4 1 -1 0 0 0 20 0.0000 4 210 960 9677 4817 C:tank3\001
4 1 -1 0 0 0 20 0.0000 4 270 720 9630 7965 SS:p3\001
4 1 1 1 0 3 20 0.0000 4 270 105 2970 315 f\001
4 1 1 99 0 1 20 0.0000 4 210 825 3780 2565 Tank 1\001
4 1 1 99 0 1 20 0.0000 4 210 825 5940 2565 Tank 2\001
4 1 1 99 0 1 20 0.0000 4 210 825 8055 2565 Tank 3\001
4 1 1 99 0 1 20 0.0000 4 210 585 5895 3870 Leak\001

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weirs_desc.tex version [f979aa3c3b].

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


































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Weirs (Weirs_desc.tex)
% Generated by MTT on Thu Jul 3 10:27:26 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/09/11  10:31:48  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Weirs} is
   displayed in Figure \Ref{Weirs_abg} and its label
   file is listed in Section \Ref{sec:Weirs_lbl}.
   The subsystems are listed in Section \Ref{sec:Weirs_sub}.

%Each weir is modeled by two {\bf ISW} components: one for flow
%left-right and one for flow right-left. The switching is such that
%they become non-return valves when the left hand (respectively
%right-hand) level reaches an appropriate value. The parameters appear
%in Section \Ref{sec:Weirs_numpar.txt} and the switching conditions in
%Section \Ref{sec:Weirs_input.txt}.

Aircraft fuel tanks are often fitted with baffles to reduce fuel
slosh. A simple model relating to such a system is shown in Figure
\Ref{Weirs_abg} which corresponds to a single tank containing two
dividing weirs. Liquid with flow rate $f$ enters the left-hand
compartment; liquid leaks out of the centre compartment at a flow rate
determined by gravity and the properties of the corresponding orifice.

The Bond Graph appearing in Figure \Ref{Weirs_abg} represents each of
the three compartments by a \textbf{C} component (labelled tank1 to
tank3), the corresponding pressures are measured by the \textbf{SS}
elements p1--p3. The leak is represented by the \textbf{R} component
labelled leak. The flows over the two weirs are represented by the four
\textbf{ISW} components; each weir has a separate \textbf{ISW}
component for each flow direction. Each \textbf{ISW} component is
switched by the appropriate level.

%It could be argued that, when switched on, each \textbf{ISW} component
%corresponds to flow inertia; but it is admitted that ideal
%\textbf{Sw} components would give a simpler approximation in this
%case. So the modeller has the choice of having a simple simulation
%problem but with four extra states, or a complex simulation with model
%switching but without the four extra states.

The system was simulated for 20 time units and the resultant level of
each tank partition is plotted in Figure \Ref{fig:Weirs_odeso.ps}. Each
partition has unit cross section, and the two weir heights are $1$ and
$2$ respectively; the inflow $f$ is given by:
\begin{equation}
  f = 
  \begin{cases}
    1 & \text{if $t \le 10$}\\
    0 & \text{if $t > 10$}
  \end{cases}
\end{equation}
and the leak resistance is linear with flow resistance 5.


%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weirs_input.txt version [bae53c5591].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (Weirs_input.txt)
# Generated by MTT at Tue Mar  2 07:48:04 GMT 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/05/19 07:12:04  peterg
## Initial revision
##
###############################################################

# Set the inputs
## Removed by MTT on Fri Oct  5 10:47:20 BST 2001: mttu(1) = 1.0*(t<10); 	# f (Weirs)



weirs_f	= 1.0*(t<10); # Added by MTT on Fri Oct 05 10:48:01 BST 2001


Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weirs_lbl.txt version [2f0e26ecdf].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Weirs (Weirs_lbl.txt)
%SUMMARY Weirs Double-weir tanks system (hybrid)
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/03/09 00:12:12  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases
%ALIAS	$1	tank1
%ALIAS	$2	tank2
%ALIAS	$3	tank3
%ALIAS	$4	leak

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	tank1		lin	effort,c_1
	tank2		lin	effort,c_2
	tank3		lin	effort,c_3

% Component type R
	leak		lin	flow,r_l

% Component type SS
	f	SS		internal,external
	p1	SS		external,0
	p2	SS		external,0
	p3	SS		external,0

% Component type Weir
	w1      none		epsilon_i;epsilon_r
	w2      none		epsilon_i;epsilon_r

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weirs_logic.txt version [e3936533e3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system Weirs (Weirs_logic.txt)
# Generated by MTT on Thu May 18 12:29:15 BST 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/05/19 07:13:29  peterg
## Initial revision
##
## Revision 1.1  2000/05/18 11:29:58  peterg
## Initial revision
##
###############################################################


# Set the switches
## Removed by MTT on Fri Oct  5 11:28:40 BST 2001: weirs_w1_isw = (mttx(1)>1)|(mttx(2)>1);	# First weir - height 1
## Removed by MTT on Fri Oct  5 11:28:40 BST 2001: weirs_w2_isw = (mttx(2)>2)|(mttx(3)>2);	# Second weir - height 2
weirs_w1_1_isw_1_mtt_switch_logic	= (mttx(1)>1)|(mttx(2)>1); # First weir - height 1
weirs_w2_1_isw_1_mtt_switch_logic	= (mttx(2)>2)|(mttx(3)>2); # Second weir - height 2

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weirs_numpar.txt version [f82fcef096].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (Weirs_numpar.txt)
# Generated by MTT at Tue Mar  2 07:55:47 GMT 1999

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

# Parameters
c_1 = 	1.0; # Weirs
c_2 = 	1.0; # Weirs
c_3 = 	1.0; # Weirs
epsilon_i = 	0.01; # weir
epsilon_r = 	0.1; # weir
r_l = 	5.0; # Weirs

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weirs_rep.txt version [9f4c394b93].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system Weirs (Weirs_rep.txt)
## Generated by MTT on" Tue Mar  2 22:02:59 GMT 1999.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  2000/05/19 07:15:04  peterg
## Added logic
##
## Revision 1.4  1999/12/21 09:24:26  peterg
## Euler integration - compiled
##
## Revision 1.3  1999/03/02 22:19:22  peterg
## Added switch rep
##
## Revision 1.2  1999/03/02 22:09:49  peterg
## Addded switch rep
##
## Revision 1.1  1999/03/02 22:04:11  peterg
## Initial revision
##
###############################################################

mtt Weirs abg tex			# The system description
## mtt Weirs cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt Weirs struc tex	        # The system structure
## mtt Weirs dae tex	        # The system dae
mtt Weirs ode tex	        # The system ode 
mtt Weirs switch txt	        # The system switches 
## mtt Weirs sspar tex		# Steady-state parameters
## mtt Weirs ss tex 		# Steady state
## mtt Weirs dm tex		# Descriptor matrices (of linearised system)
## mtt Weirs sm tex		# State matrices (of linearised system)
## mtt Weirs tf tex		# Transfer function (of linearised system)
## mtt Weirs lmfr ps		# log modulus of frequency response (of linearised system)
mtt Weirs simpar tex		# Simulation parameters
mtt Weirs numpar tex		# Numerical simulation parameters
mtt Weirs input tex		# Simulation input
mtt Weirs logic tex		# Switch logic
mtt Weirs odeso ps		# Simulation output

mtt Weirs rep txt

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/Weirs_simpar.txt version [9ebb65f3fe].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Simulation parameters for system Weirs (Weirs_simpar.txt)
# Generated by MTT on Sun Jul 26 13:55:27 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1999/12/21 09:22:43  peterg
## Initial revision
##
###############################################################


LAST=19.9;
DT=0.01;
STEPFACTOR=1;

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/weir_abg.fig version [9adb302ec2].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1350 2025 2475 2025 2250 2250
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 1800 2700 675 2925 900
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2700 2250 2700 3375 2925 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2925 2025 4050 2025 3825 2250
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4500 2025 5625 2025 5400 2250
4 1 0 100 0 0 20 0.0000 4 195 150 2700 2115 1\001
4 1 0 100 0 0 20 0.0000 4 210 1065 2700 585 ISW:isw\001
4 1 0 100 0 0 20 0.0000 4 195 390 2700 3690 R:r\001
4 1 0 100 0 0 20 0.0000 4 255 870 765 2115 SS:[in]\001
4 1 0 100 0 0 20 0.0000 4 255 1020 6255 2115 SS:[out]\001
4 1 0 100 0 0 20 0.0000 4 195 150 4275 2115 1\001

Deleted mttroot/mtt/lib/examples/Hybrid/Weirs/weir_lbl.txt version [d74bf1486c].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system weir (weir_lbl.txt)
%SUMMARY weir
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	out	out

% Argument aliases
%ALIAS	$1	r

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type ISW
	isw             lin     effort,epsilon_i

% Component type R
	r		lin	flow,epsilon_r

% Component type SS
	[in]	SS		external,external
	[out]	SS		external,external


Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/Cart_abg.fig version [6ec024965a].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 2925 4050 1575 4275 1800
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 3150 5625 3150 5400 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4950 5625 4950 5400 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2475 3825 2475 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3150 3825 3150 3600 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 4950 2475 4950 2700 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 2925 2870 1970 2870 2289
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4288 2957 5243 2002 5243 2320
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6525 3150 7875 3150 7650 3375
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9900 5850 225 5850 225 900 9900 900 9900 5850
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 4050 3825 4050 3600 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4050 5625 4050 5400 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5625 4725 5625 5175
4 1 1 101 0 3 20 0.0000 4 270 1155 4140 3600 x-velocity\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 3240 1\001
4 1 4 100 0 18 20 0.0000 4 270 1320 1710 3240 SS:[drive]\001
4 1 1 101 0 3 20 0.0000 4 270 1125 4185 4500 y-velocity\001
4 1 1 101 0 3 20 0.0000 4 270 1905 4050 5490 angular-velocity\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 5040 1\001
4 1 4 100 0 18 20 0.0000 4 270 825 6165 5040 SS:[a]\001
4 2 0 100 0 18 20 0.0000 4 270 735 2430 5040 R:r_p\001
4 1 0 100 0 18 20 0.0000 4 270 720 2835 1845 R:r_c\001
4 1 4 100 0 18 20 0.0000 4 270 825 4050 1440 SS:[x]\001
4 1 0 100 0 18 20 0.0000 4 270 735 5355 1845 I:m_c\001
4 1 0 100 0 18 20 0.0000 4 210 630 6075 3240 INTF\001
4 0 0 100 0 18 20 0.0000 4 210 1590 8010 3240 De:Position\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 4140 1\001
4 1 4 100 0 18 20 0.0000 4 270 825 6165 4140 SS:[y]\001
4 2 0 100 0 18 20 0.0000 4 270 2190 2430 4140 Sf:zero_velocity\001

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/Cart_lbl.txt version [947eebb4f2].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Cart (Cart_lbl.txt)
%SUMMARY Cart
%DESCRIPTION Simple cart model

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	drive
%ALIAS	pendulum|out	x,y,a
%UNITS  drive     translational N m/s
b%UNITS  x         translational N m/s
%UNITS  y         translational N m/s
%UNITS  a         rotational N*m radian/s


% Argument aliases
%ALIAS	$1	m_c

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type I
	m_c		lin	flow,m_c

% Component type R
	r_c		lin	flow,r_c
	r_p		lin	flow,r_p

% Component type SS
	[a]	SS		external,external
	[drive]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type De
	Position			SS	external

% Component type Sf
	zero_velocity		SS	0



Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/InvertedPendulumOnCart_lbl.txt version [1aacf49abf].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system InvertedPendulumOnCart (InvertedPendulumOnCart_lbl.txt)
%SUMMARY InvertedPendulumOnCart
%DESCRIPTION An Inverted Pendulum on a Cart

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS in   F
%UNITS F    translational  N m/s

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[F]   SS	 external,internal



Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/InvertedPendulum_abg.fig version [df06a3e7f2].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6840 4950 8190 4950 7965 5175
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9675 7425 3150 7425 3150 2475 9675 2475 9675 7425
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 5400 4950 6750 5175 6525
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 5400 6075 6750 6300 6525
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 5400 3825 6750 4050 6525
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 3150 4950 4500 5175 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 3150 6075 4500 6300 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 3150 3825 4500 4050 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 6750 3600 6750
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5175 6750 4725 6750
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6300 5400 5850 5400
4 1 4 100 0 18 20 0.0000 4 270 825 3825 7065 SS:[x]\001
4 1 4 100 0 18 20 0.0000 4 270 825 4950 7065 SS:[y]\001
4 1 4 100 0 18 20 0.0000 4 270 825 6075 7065 SS:[a]\001
4 1 0 100 0 18 20 0.0000 4 270 1545 4964 5040 gRODa:rod\001
4 1 0 100 0 18 20 0.0000 4 270 915 3825 3015 Se:x_0\001
4 1 0 100 0 18 20 0.0000 4 270 915 4950 3015 Se:y_0\001
4 1 0 100 0 18 20 0.0000 4 270 915 6030 3015 Se:a_0\001
4 1 4 100 0 18 14 0.0000 4 210 270 6660 4995 [a]\001
4 1 0 100 0 18 20 0.0000 4 210 1140 8865 5040 De:theta\001
4 1 4 100 0 18 14 0.0000 4 210 495 3825 4725 [x_a]\001
4 1 4 100 0 18 14 0.0000 4 210 510 4950 4725 [y_a]\001
4 1 4 100 0 18 14 0.0000 4 210 510 6075 4725 [a_a]\001
4 1 4 100 0 18 14 0.0000 4 210 510 3825 5265 [x_b]\001
4 1 4 100 0 18 14 0.0000 4 210 525 4950 5265 [y_b]\001
4 1 4 100 0 18 14 0.0000 4 210 525 6075 5265 [a_b]\001

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/InvertedPendulum_lbl.txt version [4d5db894bb].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system InvertedPendulum (InvertedPendulum_lbl.txt)
%SUMMARY InvertedPendulum
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%UNITS  x         translational N m/s
%UNITS  y         translational N m/s
%UNITS  a         rotational N*m radian/s


%ALIAS	in|cart	x,y,a


% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type De
	theta			SS	external

% Component type SS
	[a]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type Se
	a_0	 SS	0
	x_0      SS     0
	y_0      SS     0

% Component type gRod
	rod	 none		l;l;j_r;m_r;g
 

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_abg.fig version [0bf799ade7].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
1 4 0 2 1 7 51 0 -1 0.000 1 0.0000 3700 4909 203 203 3497 4909 3903 4909
1 4 0 2 1 7 51 0 -1 0.000 1 0.0000 4817 4902 203 203 4614 4902 5020 4902
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 4275 3825 4275 3600 4500
2 4 0 2 1 7 101 0 -1 0.000 0 0 7 0 0 5
	 5175 4725 3375 4725 3375 3825 5175 3825 5175 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4050 5230 3095 5230 3414
2 1 0 2 1 7 101 0 -1 0.000 0 0 -1 0 0 5
	 4477 3712 5872 2317 6052 2497 4702 3847 4522 3667
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 6750 5400 1125 5400 1125 2025 6750 2025 6750 5400
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 4050 3825 4500
4 1 0 100 0 18 20 0.0000 4 210 570 4275 4365 Cart\001
4 1 0 100 0 18 20 0.0000 4 210 630 2070 4365 Se:F\001
4 1 0 100 0 18 20 0.0000 4 210 2445 5355 3060 InvertedPendulum\001

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_desc.tex version [aff84db7a3].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system idInvertedPendulumOnCart (InvertedPendulumOnCart_desc.tex)
% Generated by MTT on Thu Aug 5 10:38:16 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/11 15:41:45  gawthrop
% %% New identification example - friction components only
% %%
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{idInvertedPendulumOnCart} is
   displayed in Figure \Ref{fig:InvertedPendulumOnCart_abg.ps} and its label
   file is listed in Section \Ref{sec:InvertedPendulumOnCart_lbl}.
   The subsystems are listed in Section \Ref{sec:InvertedPendulumOnCart_sub}.

This is a one input, two output nonlinear system comprising an
inverted pendulum attached by a hinge to a cart constrained to move in
the horizontal direction. The input is the horizontal force acting on
the cart, and the two outputs are the horizontal position and the
pendulum angle respectively.

The identification procedure estimates the two friction parameters
$r_c$ and $r_c$ together with the cart mass $m_c$.

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_input.txt version [2630e61eae].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System idInvertedPendulumOnCart, representation input, language txt; 
## File idInvertedPendulumOnCart_input.txt; 
## Generated by MTT on Thu Apr  5 15:27:30 BST 2001; 



idInvertedPendulumOnCart_f	= 1.0*(t<1); # Force for 1 sec

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_ippp.m version [b74e24514e].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

## Set up parameters
name = "idInvertedPendulumOnCart";
sim = sidInvertedPendulumOnCart_simpar;		# Simulation parameter
sym = sidInvertedPendulumOnCart_sympar;		# Parameter names
par = sidInvertedPendulumOnCart_numpar;		# Parameter values
x0  = sidInvertedPendulumOnCart_state(par);         # Initial state

## Simulation of "actual" system
t = [0:sim.dt:sim.last]';
one = ones(size(t));
u = 1.0*(t<one);
y_0 = sidInvertedPendulumOnCart_ssim(x0,par,sim,u);

## Initial parameter
par_0 = par;
par_0(sym.r_c) = 0.1;
par_0(sym.r_p) = 0.1;
par_0(sym.m_c) = 1.0;
## Identify
extras.criterion = 1e-5;
extras.max_iterations = 10;
extras.v = 1e-1;		#Cautious initial step
extras.verbose = 1;		# Show what is going on
[par,Par,Error,Y] = ppp_identify (name,u,y_0,["r_c";"r_p";"m_c"],par_0,extras);

par = par

grid;
xlabel("Time")
title("Estimated output");
plot(t,y_0,t,Y);
figfig("idInvertedPendulumOnCart_outputs","pdf");
figfig("idInvertedPendulumOnCart_outputs","ps");

xlabel("Iteration")
title("Estimation error");
plot(Error);
figfig("idInvertedPendulumOnCart_error","pdf");
figfig("idInvertedPendulumOnCart_error","ps");

xlabel("Iteration")
title("Estimated Parameters");
plot(Par([sym.r_c,sym.r_p,sym.m_c],:)');
figfig("idInvertedPendulumOnCart_parameters","pdf");
figfig("idInvertedPendulumOnCart_parameters","ps");





Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_lbl.txt version [6eb2071b1b].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system idInvertedPendulumOnCart (InvertedPendulumOnCart_lbl.txt)
%SUMMARY InvertedPendulumOnCart
%DESCRIPTION An Inverted Pendulum on a Cart

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type Se
	F   SS	 external




Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_numpar.txt version [cff682d8fd].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (InvertedPendulumOnCart_numpar.txt)
# Generated by MTT at Thu Aug  5 10:07:08 BST 1999

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  2000/12/28 18:00:45  peterg
# %% To RCS
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Parameters
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: e_s = 	1.0;			# Se
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: f_s = 	1.0;			# Sf
g = 	1.0;			# Pendulum,gRODa
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: j_m = 	1.0;			# gRODa
j_r = 	1.0;			# Pendulum
l = 	1.0;			# Pendulum
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: l_a = 	1.0;			# gRODa
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: l_b = 	1.0;			# gRODa
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: m = 	1.0;			# gRODa
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: m_c = 	1.0;			# Cart
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: m_r = 	1.0;			# Pendulum
r_c = 	0.1;			# Cart
r_p = 	0.1;			# Cart
m_c	= 1.0; # Added by MTT on Thu Nov 09 17:22:55 GMT 2000
m_r	= 1.0; # Added by MTT on Thu Nov 09 17:22:55 GMT 2000

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_rep.txt version [e8c9cda982].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system idInvertedPendulumOnCart (idRC_rep.txt)
## Generated by MTT on" Thu Apr  5 11:17:27 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2001/04/05 11:57:29  gawthrop
## Identification example
##
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt idInvertedPendulumOnCart abg tex			# The system description
mtt idInvertedPendulumOnCart cbg ps 		        # The causal bond graph
mtt idInvertedPendulumOnCart struc tex	        # The system structure
mtt idInvertedPendulumOnCart sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt idInvertedPendulumOnCart dae tex	        # The system dae
## mtt idInvertedPendulumOnCart ode tex	        # The system ode 
## mtt idInvertedPendulumOnCart sspar tex		# Steady-state parameters
## mtt idInvertedPendulumOnCart ss tex 		# Steady state
## mtt idInvertedPendulumOnCart dm tex		# Descriptor matrices (of linearised system)
## mtt idInvertedPendulumOnCart sm tex		# State matrices (of linearised system)
## mtt idInvertedPendulumOnCart tf tex		# Transfer function (of linearised system)
## mtt idInvertedPendulumOnCart lmfr ps		# log modulus of frequency response (of linearised system)
## mtt idInvertedPendulumOnCart simpar tex		# Simulation parameters
## mtt idInvertedPendulumOnCart numpar tex		# Numerical simulation parameters
## mtt idInvertedPendulumOnCart state tex		# Simulation initial state
## mtt idInvertedPendulumOnCart input tex		# Simulation input
## mtt idInvertedPendulumOnCart logic tex		# Logic control
 mtt -oct idInvertedPendulumOnCart ippp ps

mtt idInvertedPendulumOnCart rep txt		# This file

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_simpar.txt version [3498895858].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system idInvertedPendulumOnCart (InvertedPendulumOnCart_simpar.txt)
# Generated by MTT on Thu Aug 5 09:17:05 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 18:00:45  peterg
## To RCS
##
###############################################################


LAST        = 100.0;      # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idInvertedPendulumOnCart_subs.r version [752962d684].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Default SUBS file
% File InvertedPendulumOnCart_subs.r
% Generated by MTT on Thu Nov  9 18:55:44 GMT 2000.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  2001/04/02 10:57:57  gawthrop
% %% Added missing ;
% %%
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Put algebraic substitution commands here

for all x let cos(x)^2+sin(x)^2 = 1;

FOR ALL x,y LET x^y = pow(x,y); % Use the pow function

ON ROUNDED; % No integer output

END;

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/idRC_rep.txt version [5572b35356].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system idRC (idRC_rep.txt)
## Generated by MTT on" Thu Apr  5 11:17:27 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2001/04/05 11:57:29  gawthrop
## Identification example
##
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt idRC abg tex			# The system description
mtt idRC cbg ps 		        # The causal bond graph
mtt idRC struc tex	        # The system structure
mtt idRC sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt idRC dae tex	        # The system dae
## mtt idRC ode tex	        # The system ode 
## mtt idRC sspar tex		# Steady-state parameters
## mtt idRC ss tex 		# Steady state
## mtt idRC dm tex		# Descriptor matrices (of linearised system)
## mtt idRC sm tex		# State matrices (of linearised system)
## mtt idRC tf tex		# Transfer function (of linearised system)
## mtt idRC lmfr ps		# log modulus of frequency response (of linearised system)
## mtt idRC simpar tex		# Simulation parameters
## mtt idRC numpar tex		# Numerical simulation parameters
## mtt idRC state tex		# Simulation initial state
## mtt idRC input tex		# Simulation input
## mtt idRC logic tex		# Logic control
 mtt -oct idRC odeso ps		# Simulation output
 mtt -oct -i euler idRC ippp ps

mtt idRC rep txt		# This file

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sCart_lbl.txt version [b98ca95cf1].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sCart (sCart_lbl.txt)
%SUMMARY sCart
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/11 15:41:45  gawthrop
% %% New identification example - friction components only
% %%
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in|drive	drive_1,drive_2
%ALIAS	pendulum|out	x_1,x_2,y_1,y_2,a_1,a_2

%ALIAS	x		x_1,x_2
%ALIAS	y		y_1,y_2
%ALIAS	a		a_1,a_2

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[a]	SS		external,external
	[drive]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type De
	Position	SS		external

% Component type I
	m_c	slin		flow,m_c;m_cs

% Component type R
	r_c	slin		flow,r_c;r_cs
	r_p	slin		flow,r_p;r_ps

% Component type Sf
	zero_velocity	SS		0;0




Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sInvertedPendulum_lbl.txt version [7522cf1bad].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sInvertedPendulum (sInvertedPendulum_lbl.txt)
%SUMMARY sInvertedPendulum
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/11 15:41:45  gawthrop
% %% New identification example - friction components only
% %%
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS  in|cart x_1,x_2,y_1,y_2,a_1,a_2

%ALIAS	x	x_1,x_2
%ALIAS	y	y_1,y_2
%ALIAS	a	a_1,a_2

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[a]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type De
	theta	SS		external

% Component type Se
	a_0	SS		0;0
	x_0	SS		0;0
	y_0	SS		0;0

% Component type gRODa
	rod     none		j_p;j_ps;m_p;m_ps;l_p/2;l_p/2;g			

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sgRODa_abg.fig version [ee579d4ee7].

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
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
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
























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4951 6526 5401
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8550 5400 9225 6075 8955 6075
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8685 5265 8415 5535
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 5175 2025 3825 2250 3825
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2700 4950 2700 5400
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8550 4950 8550 5400
4 1 6 0 0 0 20 0.0000 4 240 510 5629 5269 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5629 5268 1\001
4 1 -1 0 0 0 20 0.0000 4 195 375 6933 5268 sI:J\001
4 1 6 0 0 0 20 0.0000 4 240 510 2928 5313 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2928 5312 1\001
4 1 6 0 0 0 20 0.0000 4 240 510 2973 2793 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2973 2792 0\001
4 1 6 0 0 0 20 0.0000 4 240 510 2928 7743 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2928 7742 0\001
4 1 6 0 0 0 20 0.0000 4 240 510 8329 5314 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8329 5313 1\001
4 1 6 0 0 0 20 0.0000 4 240 510 8374 2794 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8374 2793 0\001
4 1 6 0 0 0 20 0.0000 4 240 510 8329 7744 [1,2]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 8329 7743 0\001
4 1 -1 0 0 0 20 0.0000 4 255 765 9676 5266 sI:m_y\001
4 1 -1 0 0 0 20 0.0000 4 255 765 1531 5221 sI:m_x\001
4 1 -1 0 0 0 20 0.0000 4 195 1215 4636 4141 sEMTF:c1\001
4 1 -1 0 0 0 20 0.0000 4 195 1215 4681 6391 sEMTF:c2\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 7156 4141 sEMTF:s1\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 7156 6391 sEMTF:s2\001
4 1 6 0 0 0 20 0.0000 4 240 510 3604 5314 [1,2]\001
4 1 5 0 0 0 20 0.0000 4 195 135 3604 5313 0\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 345 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 585 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000 4 195 1065 4681 5266 sINTF:th\001
4 1 1 1 0 0 20 0.0000 4 195 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000 4 135 180 5580 9990 a\001
4 1 1 1 0 0 20 0.0000 4 195 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000 4 210 585 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000 4 210 345 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000 4 210 465 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000 4 210 345 4365 6030 [in]\001
4 1 6 0 0 0 20 0.0000 4 240 510 2972 1217 [1,2]\001
4 1 4 0 0 0 20 0.0000 4 255 1380 2972 1216 SS:[xTip_a]\001
4 1 6 0 0 0 20 0.0000 4 240 510 2972 9362 [1,2]\001
4 1 4 0 0 0 20 0.0000 4 255 1380 2972 9361 SS:[xTip_b]\001
4 1 6 0 0 0 20 0.0000 4 240 510 8373 1218 [1,2]\001
4 1 4 0 0 0 20 0.0000 4 255 1380 8373 1217 SS:[yTip_a]\001
4 1 6 0 0 0 20 0.0000 4 240 510 8418 9363 [1,2]\001
4 1 4 0 0 0 20 0.0000 4 255 1380 8418 9362 SS:[yTip_b]\001
4 1 6 0 0 0 20 0.0000 4 240 510 5672 1217 [1,2]\001
4 1 4 0 0 0 20 0.0000 4 255 2130 5672 1216 SS:[angularTip_a]\001
4 1 6 0 0 0 20 0.0000 4 240 510 5672 9362 [1,2]\001
4 1 4 0 0 0 20 0.0000 4 255 2130 5672 9361 SS:[angularTip_b]\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000 4 195 1380 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000 4 255 600 1350 9855 Tip b\001
4 2 6 0 0 0 20 0.0000 4 240 510 1936 3736 [1,2]\001
4 2 4 0 0 0 20 0.0000 4 255 1200 1936 3735 SS:[angle]\001
4 1 -1 0 0 0 20 0.0000 4 255 825 9405 6390 sSe:mg\001

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sgRODa_lbl.txt version [7b7643021b].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sgRODa (sgRODa_lbl.txt)
%SUMMARY sgRODa
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/11 15:41:45  gawthrop
% %% New identification example - friction components only
% %%
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	a	angle_1,angle_2
%ALIAS	a_a	angularTip_a_1,angularTip_a_2
%ALIAS	a_b	angularTip_b_1,angularTip_b_2
%ALIAS	x_a	xTip_a_1,xTip_a_2
%ALIAS	x_b	xTip_b_1,xTip_b_2
%ALIAS	y_a	yTip_a_1,yTip_a_2
%ALIAS	y_b	yTip_b_1,yTip_b_2

% Argument aliases
%ALIAS $1 J
%ALIAS $2 Js
%ALIAS $3 m
%ALIAS $4 ms
%ALIAS $5 l_a
%ALIAS $6 l_b
%ALIAS $7 g
 
%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[angle]	SS		external,external
	[angularTip_a]	SS		external,external
	[angularTip_b]	SS		external,external
	[xTip_a]	SS		external,external
	[xTip_b]	SS		external,external
	[yTip_a]	SS		external,external
	[yTip_b]	SS		external,external

% Component type EMTF
s1	lsin;slsin	l_a
s2	lsin;slsin	l_b
c1	lcos;slcos	l_a
c2	lcos;slcos	l_b

% Component type I
	J	slin		flow,J;Js
	m_x	slin		flow,m;ms
	m_y	slin		flow,m;ms
	th			

% Component type Se
	mg	SS		m*g;0


Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sidInvertedPendulumOnCart_desc.tex version [ac7211d6eb].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system sidInvertedPendulumOnCart (InvertedPendulumOnCart_desc.tex)
% Generated by MTT on Thu Aug 5 10:38:16 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{sidInvertedPendulumOnCart} is
   displayed in Figure \Ref{fig:InvertedPendulumOnCart_abg.ps} and its label
   file is listed in Section \Ref{sec:InvertedPendulumOnCart_lbl}.
   The subsystems are listed in Section \Ref{sec:InvertedPendulumOnCart_sub}.

This is a one input, two output nonlinear system comprising an
inverted pendulum attached by a hinge to a cart constrained to move in
the horizontal direction. The input is the horizontal force acting on
the cart, and the two outputs are the horizontal position and the
pendulum angle respectively.

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sidInvertedPendulumOnCart_input.txt version [deeadfdd68].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System sidInvertedPendulumOnCart, representation input, language txt; 
## File sidInvertedPendulumOnCart_input.txt; 
## Generated by MTT on Wed Apr 11 12:03:25 BST 2001; 



sidInvertedPendulumOnCart_F_1_se_1_1_u	= 1.0; # Default

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sidInvertedPendulumOnCart_lbl.txt version [a5fd637ffc].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system idInvertedPendulumOnCart (InvertedPendulumOnCart_lbl.txt)
%SUMMARY InvertedPendulumOnCart
%DESCRIPTION An Inverted Pendulum on a Cart

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type Se
	F   SS	 external;0




Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sidInvertedPendulumOnCart_numpar.txt version [fd11647209].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System sidInvertedPendulumOnCart, representation numpar, language txt; 
## File sidInvertedPendulumOnCart_numpar.txt; 
## Generated by MTT on Wed Apr 11 14:07:41 BST 2001; 


## Physical parameters
m_c = 	0.455;			# Cart mass
r_c = 	1.5;			# Cart friction

l_p =   0.61;			# Pendulum length
m_p =   0.210;			# Pendulum mass
r_p = 	0.5;			# Pendulum friction

j_p = l_p*l_p*m_p/12;
g = 9.81;			# Gravity


## Sensitivity paramenters - all zero
m_cs	= 0.0;
m_ps	= 0.0;
r_cs	= 0.0;
r_ps	= 0.0;

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sidInvertedPendulumOnCart_rep.txt version [b39d92d1c6].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system sidInvertedPendulumOnCart (InvertedPendulumOnCart_rep.txt)
## Generated by MTT on" Fri Oct 22 09:03:14 EST 1999.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 18:00:45  peterg
## To RCS
##
###############################################################

mtt sidInvertedPendulumOnCart abg tex			# The system description
mtt sidInvertedPendulumOnCart cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt sidInvertedPendulumOnCart struc tex	        # The system structure
mtt sidInvertedPendulumOnCart dae tex	        # The system dae
## mtt sidInvertedPendulumOnCart ode tex	        # The system ode 
## mtt sidInvertedPendulumOnCart sspar tex		# Steady-state parameters
## mtt sidInvertedPendulumOnCart ss tex 		# Steady state
## mtt sidInvertedPendulumOnCart dm tex		# Descriptor matrices (of linearised system)
mtt sidInvertedPendulumOnCart sm tex		# State matrices (of linearised system)
## mtt sidInvertedPendulumOnCart tf tex		# Transfer function (of linearised system)
## mtt sidInvertedPendulumOnCart lmfr ps		# log modulus of frequency response (of linearised system)
mtt sidInvertedPendulumOnCart simpar tex		# Simulation parameters
mtt sidInvertedPendulumOnCart numpar tex		# Numerical simulation parameters
mtt sidInvertedPendulumOnCart input tex		# Simulation input
mtt -c sidInvertedPendulumOnCart odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sidInvertedPendulumOnCart_simpar.txt version [be28d724c2].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system sidInvertedPendulumOnCart (InvertedPendulumOnCart_simpar.txt)
# Generated by MTT on Thu Aug 5 09:17:05 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2001/04/11 15:41:45  gawthrop
## New identification example - friction components only
##
## Revision 1.1  2000/12/28 18:00:45  peterg
## To RCS
##
###############################################################


FIRST        = 0.0;      # Last time in simulation
LAST        = 10.0;      # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sidInvertedPendulumOnCart_subs.r version [752962d684].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Default SUBS file
% File InvertedPendulumOnCart_subs.r
% Generated by MTT on Thu Nov  9 18:55:44 GMT 2000.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  2001/04/02 10:57:57  gawthrop
% %% Added missing ;
% %%
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Put algebraic substitution commands here

for all x let cos(x)^2+sin(x)^2 = 1;

FOR ALL x,y LET x^y = pow(x,y); % Use the pow function

ON ROUNDED; % No integer output

END;

Deleted mttroot/mtt/lib/examples/Identification/idInvertedPendulumOnCart/sidInvertedPendulum_lbl.txt version [0a6e4d861b].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sidInvertedPendulum (sidInvertedPendulum_lbl.txt)
%SUMMARY sidInvertedPendulum
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/README version [64f32ec93d].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
This is the example from:
@Article{Gaw00c,
  author =       {Peter J Gawthrop},
  title =        {Sensitivity Bond Graphs},
  journal =      JFI,
  year =         {2000}
}


NB Compile with -i euler

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/conical.cr version [7eab0220f3].

1
2
3
4
5
6
7
8
9









-
-
-
-
-
-
-
-
-
%% CR for conical tank example

OPERATOR conical;
%% State input.
FOR ALL rho,g,V_0,V LET
    conical(rho,g,V_0,effort,1,V,state,1) = rho*g*(12*(V+V_0)/pi)^(1/3);


END;;

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/discharge.cr version [28f3427960].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
%% CR for pipe discharge


OPERATOR discharge;
%% Flow input
FOR ALL alpha,beta,F LET
    discharge(alpha,beta,effort,1,F,flow,1) = beta*F^alpha;

%% Effort input
FOR ALL alpha,beta,P LET
    discharge(alpha,beta,flow,1,P,effort,1) = (P/beta)^(1/alpha);

END;;

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_abg.fig version [62dde3975f].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1575 2925 2745 2925 2520 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 2925 4320 2925 4095 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4725 2925 5895 2925 5670 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6300 2925 7470 2925 7245 3150
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2925 2700 2925 1530 3150 1755
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4500 2700 4500 1530 4725 1755
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 2700 6075 1530 6300 1755
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7650 2700 7650 1530 7875 1755
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 3150 6075 4320 6300 4095
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 1575 2700 1575 3150
4 1 0 100 0 18 20 0.0000 4 270 195 2925 3015 0\001
4 1 0 100 0 18 20 0.0000 4 270 195 4500 3015 1\001
4 1 0 100 0 18 20 0.0000 4 270 195 7650 3015 1\001
4 1 0 100 0 18 20 0.0000 4 285 705 2925 1440 C:t1\001
4 1 0 100 0 18 20 0.0000 4 360 780 4545 1440 R:p1\001
4 1 0 100 0 18 20 0.0000 4 360 780 7695 1440 R:p2\001
4 1 0 100 0 18 20 0.0000 4 285 705 6075 1440 C:t2\001
4 1 0 100 0 18 20 0.0000 4 270 195 6075 3015 0\001
4 1 0 100 0 18 20 0.0000 4 360 825 6075 4680 De:y\001
4 1 0 100 0 18 20 0.0000 4 285 720 1125 3060 Sf:u\001

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_desc.tex version [3e4f2fb3e7].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system idNonlinearTanks (idRC_desc.tex)
% Generated by MTT on Thu Apr 5 11:04:33 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{idNonlinearTanks} is
   displayed in Figure \Ref{fig:idRC_abg.ps} and its label
   file is listed in Section \Ref{sec:idRC_lbl}.
   The subsystems are listed in Section \Ref{sec:idRC_sub}.

   
   This example illustrates the sensitivity approach to model-based
   system identification\footnote{Peter J Gawthrop, \emph{Sensitivity
       Bond Graphs}, Journal Franklin Institute, \textbf{337}, 2000,
     pp 907--922}.

   The system compprises two non-linear tanks (see the paper for details).
   The method identifies four parameters: the two initial states ans
   the two parameters of the non-linear flow resistance.

   To see the results, type: 
\begin{verbatim}
mtt -oct -i euler -pdf idNonlinearTanks ippp view
\end{verbatim}

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_ippp.m version [3864de3022].

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

























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

## Set up parameters
name = "idNonlinearTanks";
sim = sidNonlinearTanks_simpar;	# Simulation parameter
sym = sidNonlinearTanks_sympar;	# Parameter names
par = sidNonlinearTanks_numpar;	# Parameter values
x0  = sidNonlinearTanks_state(par); # Initial state

## Simulation of "actual" system
t = [0:sim.dt:sim.last]';
T = 5;				# Period
u = ones(size(t));
y_0 = sidNonlinearTanks_ssim(x0,par,sim,u,2);

plot(t,y_0);

## The initial parameters
par_0 = par;
par_0(sym.V_1) = 2.0;
par_0(sym.V_2) = 1.0;
par_0(sym.alpha) = 1.0;
par_0(sym.beta) = 2.0;

## Identify
extras.criterion = 1e-5;
extras.max_iterations = 10;
extras.v = 10;			# Use a really big initial value
extras.verbose = 1;		# Show what is going on
[par,Par,Error,Y] = ppp_identify (name,u,y_0,["V_1  ";"V_2  ";"alpha";"beta "],par_0,extras);

par = par

grid;
xlabel("Time")
title("Output");
plot(t,y_0);
figfig("idNonlinearTanks_output","pdf");
figfig("idNonlinearTanks_output","ps");
grid;

xlabel("Time")
title("Estimated output");
plot(t,y_0,t,Y);
figfig("idNonlinearTanks_outputs","pdf");
figfig("idNonlinearTanks_outputs","ps");

xlabel("Iteration")
title("Estimation error");
plot(Error);
figfig("idNonlinearTanks_error","pdf");
figfig("idNonlinearTanks_error","ps");

xlabel("Iteration")
title("Estimated Parameter");
plot(Par');
figfig("idNonlinearTanks_parameters","pdf");
figfig("idNonlinearTanks_parameters","ps");

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_lbl.txt version [833116b223].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system idNonlinearTanks (NonlinearTanks_lbl.txt)
%SUMMARY NonlinearTanks
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Component type C
	t1		conical		rho,g,V_1
	t2		conical		rho,g,V_2

% Component type R
	p1		discharge	alpha,beta
	p2		discharge	alpha,beta

% Component type Sf
        u		SS		external

% Component type De
        y		SS		external

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_numpar.txt version [01084da6b8].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (sNonlinearTanks_numpar.txt)
# Generated by MTT at Mon Nov 29 17:36:54 EST 1999

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

## Parameters

## States 
v_1 = 	0.5;			# Tank 1
v_2 = 	0.25;			# Tank 2

## Tank parameters
g = 	1;			#Gravity
rho = 	1;			# sC,sNonlinearTanks
alpha = 	1.5;

## Pipe parameters
beta = 	1; 


Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_rep.tex version [d07140a9ae].

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
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
123
124
125
126
127
128
129
130
131
132
133





































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


\section{\textbf{abg.tex}: System idNonlinearTanks, representation \textbf{abg}, language \textbf{tex}}
\label{sec:idNonlinearTanks_abg.tex}
\index{\textbf{idNonlinearTanks} -- abg}


MTT command:
\begin{verbatim}
mtt idNonlinearTanks abg tex 
\end{verbatim}
  \input{/home/peterg/Research/Identification/MTT/idNonlinearTanks/MTT_work/idNonlinearTanks_abg.tex}


\section{\textbf{cbg.ps}: System idNonlinearTanks, representation \textbf{cbg}, language \textbf{ps}}
\label{sec:idNonlinearTanks_cbg.ps}
\index{\textbf{idNonlinearTanks} -- cbg}


MTT command:
\begin{verbatim}
mtt idNonlinearTanks cbg ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:idNonlinearTanks_cbg.ps}.
\fig{/home/peterg/Research/Identification/MTT/idNonlinearTanks/MTT_work/idNonlinearTanks_cbg}
    {idNonlinearTanks_cbg.ps}
    {0.9}
    {System \textbf{idNonlinearTanks}, representation cbg}


\section{\textbf{struc.tex}: System idNonlinearTanks, representation \textbf{struc}, language \textbf{tex}}
\label{sec:idNonlinearTanks_struc.tex}
\index{\textbf{idNonlinearTanks} -- struc}


MTT command:
\begin{verbatim}
mtt idNonlinearTanks struc tex 
\end{verbatim}
  \input{/home/peterg/Research/Identification/MTT/idNonlinearTanks/MTT_work/idNonlinearTanks_struc.tex}


\section{\textbf{sympar.tex}: System idNonlinearTanks, representation \textbf{sympar}, language \textbf{tex}}
\label{sec:idNonlinearTanks_sympar.tex}
\index{\textbf{idNonlinearTanks} -- sympar}


MTT command:
\begin{verbatim}
mtt idNonlinearTanks sympar tex 
\end{verbatim}
  \input{/home/peterg/Research/Identification/MTT/idNonlinearTanks/MTT_work/idNonlinearTanks_sympar.tex}


\section{\textbf{odeso.ps}: System sidNonlinearTanks, representation \textbf{odeso}, language \textbf{ps}}
\label{sec:sidNonlinearTanks_odeso.ps}
\index{\textbf{sidNonlinearTanks} -- odeso}


MTT command:
\begin{verbatim}
mtt -oct -s sidNonlinearTanks odeso ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:sidNonlinearTanks_odeso.ps}.
\fig{/home/peterg/Research/Identification/MTT/idNonlinearTanks/MTT_work/sidNonlinearTanks_odeso}
    {sidNonlinearTanks_odeso.ps}
    {0.9}
    {System \textbf{sidNonlinearTanks}, representation odeso}


\section{\textbf{ippp.ps}: System idNonlinearTanks, representation \textbf{ippp}, language \textbf{ps}}
\label{sec:idNonlinearTanks_ippp.ps}
\index{\textbf{idNonlinearTanks} -- ippp}


MTT command:
\begin{verbatim}
mtt -oct -i euler idNonlinearTanks ippp ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:idNonlinearTanks_ippp.ps}.
\fig{/home/peterg/Research/Identification/MTT/idNonlinearTanks/MTT_work/idNonlinearTanks_ippp}
    {idNonlinearTanks_ippp.ps}
    {0.9}
    {System \textbf{idNonlinearTanks}, representation ippp}


\section{\textbf{rep.txt}: System idNonlinearTanks, representation \textbf{rep}, language \textbf{txt}}
\label{sec:idNonlinearTanks_rep.txt}
\index{\textbf{idNonlinearTanks} -- rep}


MTT command:
\begin{verbatim}
mtt idNonlinearTanks rep txt 
\end{verbatim}
  \begin{verbatim}
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system idNonlinearTanks (idRC_rep.txt)
## Generated by MTT on" Thu Apr  5 11:17:27 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt idNonlinearTanks abg tex			# The system description
mtt idNonlinearTanks cbg ps 		        # The causal bond graph
mtt idNonlinearTanks struc tex	        # The system structure
mtt idNonlinearTanks sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt idNonlinearTanks dae tex	        # The system dae
## mtt idNonlinearTanks ode tex	        # The system ode 
## mtt idNonlinearTanks sspar tex		# Steady-state parameters
## mtt idNonlinearTanks ss tex 		# Steady state
## mtt idNonlinearTanks dm tex		# Descriptor matrices (of linearised system)
## mtt idNonlinearTanks sm tex		# State matrices (of linearised system)
## mtt idNonlinearTanks tf tex		# Transfer function (of linearised system)
## mtt idNonlinearTanks lmfr ps		# log modulus of frequency response (of linearised system)
## mtt idNonlinearTanks simpar tex		# Simulation parameters
## mtt idNonlinearTanks numpar tex		# Numerical simulation parameters
## mtt idNonlinearTanks state tex		# Simulation initial state
## mtt idNonlinearTanks input tex		# Simulation input
## mtt idNonlinearTanks logic tex		# Logic control
 mtt -oct -s sidNonlinearTanks odeso ps		# Simulation output
 mtt -oct -i euler idNonlinearTanks ippp ps

mtt idNonlinearTanks rep txt		# This file
  \end{verbatim}

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_rep.txt version [cf637754a5].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system idNonlinearTanks (idRC_rep.txt)
## Generated by MTT on" Thu Apr  5 11:17:27 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt idNonlinearTanks abg tex			# The system description
mtt idNonlinearTanks cbg ps 		        # The causal bond graph
mtt idNonlinearTanks struc tex	        # The system structure
mtt idNonlinearTanks sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt idNonlinearTanks dae tex	        # The system dae
## mtt idNonlinearTanks ode tex	        # The system ode 
## mtt idNonlinearTanks sspar tex		# Steady-state parameters
## mtt idNonlinearTanks ss tex 		# Steady state
## mtt idNonlinearTanks dm tex		# Descriptor matrices (of linearised system)
## mtt idNonlinearTanks sm tex		# State matrices (of linearised system)
## mtt idNonlinearTanks tf tex		# Transfer function (of linearised system)
## mtt idNonlinearTanks lmfr ps		# log modulus of frequency response (of linearised system)
## mtt idNonlinearTanks simpar tex		# Simulation parameters
## mtt idNonlinearTanks numpar tex		# Numerical simulation parameters
## mtt idNonlinearTanks state tex		# Simulation initial state
## mtt idNonlinearTanks input tex		# Simulation input
## mtt idNonlinearTanks logic tex		# Logic control
 mtt -oct -s sidNonlinearTanks odeso ps		# Simulation output
 mtt -oct -i euler idNonlinearTanks ippp ps

mtt idNonlinearTanks rep txt		# This file

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_simpar.txt version [1629ef8da3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system idNonlinearTanks (sidNonlinearTanks_simpar.txt)
# Generated by MTT on Wed Apr 4 15:25:33 BST 2001.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################


FIRST        = 0.0;       # First time in simulation output
DT          = 0.1;        # Print interval
LAST        = 10.0;       # Last time in simulation
STEPFACTOR  = 10;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/idNonlinearTanks_subs.r version [254628ce3b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Default SUBS file
% File idRC_subs.r
% Generated by MTT on Tue Apr  3 09:43:38 BST 2001.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/05 12:00:18  gawthrop
% %% Identification example
% %%
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Put algebraic substitution commands here

%The following is now done automatically
% FOR ALL x,y LET x^y = pow(x,y);
END;

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sC_abg.fig version [28ce05ebfc].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3105 3105 3195 3645
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3150 3150 3150 3600
-6
6 6705 3105 6795 3645
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 6750 3150 6750 3600
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 3375 5400 3375 5625 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 3375 4500 3375 4275 3600
4 1 4 100 0 18 14 0.0000 4 210 270 4410 3105 [1]\001
4 1 4 100 0 18 14 0.0000 4 210 270 5535 3105 [2]\001
4 0 4 100 0 18 18 0.0000 4 270 1935 6840 3465 SS:[sensitivity]\001
4 2 4 100 0 18 18 0.0000 4 270 1410 3060 3465 SS:[actual]\001
4 1 0 100 0 18 18 0.0000 4 210 450 4950 3465 C:c\001

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sC_lbl.txt version [d300c10d36].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sC (sC_lbl.txt)
%SUMMARY sC
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	actual,sensitivity

% Argument aliases
%ALIAS	$1	rho,g,V_0,V_0s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	c	sconical 	rho,g,V_0,V_0s

% Component type SS
	[actual]	SS		external,external
	[sensitivity]	SS		external,external

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sR_abg.fig version [7ee767975f].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 4455 3105 4545 3645
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4500 3150 4500 3600
-6
6 5355 3105 5445 3645
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 3150 5400 3600
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6750 3375 5400 3375 5625 3600
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 3375 4500 3375 4275 3600
4 1 4 100 0 18 14 0.0000 4 210 270 4410 3105 [1]\001
4 1 4 100 0 18 14 0.0000 4 210 270 5535 3105 [2]\001
4 0 4 100 0 18 18 0.0000 4 270 1935 6840 3465 SS:[sensitivity]\001
4 2 4 100 0 18 18 0.0000 4 270 1410 3060 3465 SS:[actual]\001
4 1 0 100 0 18 18 0.0000 4 210 390 4950 3465 R:r\001

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sR_lbl.txt version [663f556b3d].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sR (sR_lbl.txt)
%SUMMARY sR
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	actual,sensitivity

% Argument aliases
%ALIAS	$1	alpha,beta,alpha_s,beta_s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	r	sdischarge 	alpha,beta,alpha_s,beta_s

% Component type SS
	[actual]	SS		external,external
	[sensitivity]	SS		external,external

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sconical.cr version [6e21d13445].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% CR for conical tank example - sensitivity

in "conical.cr";

OPERATOR sconical;
%% The actual port (1) 
FOR ALL rho,g,V_0,V_0s,V,sV LET
    sconical(rho,g,V_0,V_0s,effort,1,
               V,state,1,
               sV,state,2)
    = conical(rho,g,V_0,effort,1,V,state,1);

%% The sensitivity port (2) 
FOR ALL rho,g,V_0,V_0s,V,sV LET
    sconical(rho,g,V_0,V_0s,effort,2,
               V,state,1,
               sV,state,2)
    = df(conical(rho,g,V_0,effort,1,V,state,1),V) * sV
    + df(conical(rho,g,V_0,effort,1,V,state,1),V_0)* V_0s;

END;;

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sdischarge.cr version [8d882eb23f].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% CR file for the sR component. - 2 port.
%% Special version just for this example.

%% CR for non-linear pipe discharge
%% Just do for flow input causality.

in "discharge.cr";

PROCEDURE l_discharge(alpha,beta,P);
BEGIN
  result := sub({x=P},df(discharge(alpha,beta,flow,1,x,effort,1), x));
  return result;
END;

OPERATOR sdischarge;
%% The actual port (1) -- Pressure input
FOR ALL alpha,beta,alpha_s,beta_s,P,sP LET
    sdischarge(alpha,beta,alpha_s,beta_s,flow,1,
               P,effort,1,
               sP,effort,2)
    = discharge(alpha,beta,flow,1,P,effort,1);

%% The sensitivity port (2) -- Pressure input
FOR ALL alpha,beta,alpha_s,beta_s,P,sP LET
    sdischarge(alpha,beta,alpha_s,beta_s,flow,2,
               P,effort,1,
               sP,effort,2)
    =  l_discharge(alpha,beta,P) * sP
    + df(discharge(alpha,beta,flow,1,P,effort,1), alpha)* alpha_s
    + df(discharge(alpha,beta,flow,1,P,effort,1), beta) * beta_s;
END;;

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sidNonlinearTanks_lbl.txt version [fe01918d62].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system NonlinearTanks (NonlinearTanks_lbl.txt)
%SUMMARY NonlinearTanks
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	t1		sconical	rho,g,V_1,V_1s
	t2		sconical	rho,g,V_2,V_2s

% Component type R
	p1		sdischarge	alpha,beta,alphas,betas
	p2		sdischarge	alpha,beta,alphas,betas

% Component type Sf
        u		SS		external;0

% Component type De
        y		SS		external;external

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sidNonlinearTanks_numpar.txt version [e78bd62c33].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (sNonlinearTanks_numpar.txt)
# Generated by MTT at Mon Nov 29 17:36:54 EST 1999

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

## Parameters

## States 
v_1 = 	0.5;			# Tank 1
v_2 = 	0.25;			# Tank 2

## Tank parameters
g = 	1;			#Gravity
rho = 	1;			# sC,sNonlinearTanks
alpha = 	1.5;

## Pipe parameters
beta = 	1; 

## Sensitivity.
v_1s = 	0;			# Tank 1
v_2s = 	0;			# Tank 2

alphas = 	0;
betas  = 	0;

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sidNonlinearTanks_simpar.txt version [a95d2a72de].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system sidNonlinearTanks (sidNonlinearTanks_simpar.txt)
# Generated by MTT on Wed Apr 4 15:25:33 BST 2001.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################


FIRST        = 0.0;       # First time in simulation output
DT          = 0.1;        # Print interval
LAST        = 10.0;       # Last time in simulation
STEPFACTOR  = 10;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Identification/idNonlinearTanks/sidNonlinearTanks_subs.r version [2949fe13a0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Default SUBS file
% File idRC_subs.r
% Generated by MTT on Tue Apr  3 09:43:38 BST 2001.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Put algebraic substitution commands here

FOR ALL x,y LET x^y = pow(x,y); % Use the pow function

ON ROUNDED; % No integer output

END;

Deleted mttroot/mtt/lib/examples/Identification/idRC/RC_abg.fig version [4b121c7814].

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

































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 4277 4052 4277 3827 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4502 4277 5402 4277 5177 4502
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 4051 4276 3151 4501 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 4051 5626 3151 5851 3376
2 2 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 3825 585 4725 585 4725 765 3825 765 3825 585
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5400 1215 5850 1215
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3150 675 3825 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4725 675 6750 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5625 675 5625 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5625 1215 5625 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3150 1575 6750 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 4277 6752 4277 6527 4502
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9225 5625 9225 225 900 225 900 5625 9225 5625
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 5400 1080 5850 1080
2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 2
	 4050 4050 4050 4500
4 2 4 0 0 0 20 0.0000 4 255 2040 3105 4365 SS:[Electrical_in]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 4277 4367 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5627 4367 0\001
4 1 -1 0 0 0 20 0.0000 4 195 375 4276 2926 R:r\001
4 1 -1 0 0 0 20 0.0000 4 195 390 5626 2926 C:c\001
4 0 1 1 0 0 20 0.0000 4 135 105 4230 450 r\001
4 0 1 1 0 0 20 0.0000 4 135 120 6030 1215 c\001
4 1 1 1 0 0 20 0.0000 4 255 1350 4950 4995 Bond graph\001
4 1 1 1 0 0 20 0.0000 4 195 1200 4950 2025 Schematic\001
4 0 4 0 0 0 20 0.0000 4 255 2190 6887 4367 SS:[Electrical_out]\001
4 0 1 1 0 0 20 0.0000 4 135 135 3375 4005 v\001
4 0 1 1 0 0 20 0.0000 4 195 135 3465 4140 1\001
4 0 1 1 0 0 20 0.0000 4 195 75 3375 4590 i\001
4 0 1 1 0 0 20 0.0000 4 195 135 3465 4725 1\001
4 0 1 1 0 0 20 0.0000 4 195 75 6165 4590 i\001
4 0 1 1 0 0 20 0.0000 4 195 135 6255 4725 2\001
4 0 1 1 0 0 20 0.0000 4 135 135 6165 4005 v\001
4 0 1 1 0 0 20 0.0000 4 195 135 6255 4140 2\001
4 0 1 1 0 0 20 0.0000 4 135 135 6660 1170 v\001
4 0 1 1 0 0 20 0.0000 4 195 135 6750 1305 2\001
4 0 1 1 0 0 20 0.0000 4 195 75 6300 450 i\001
4 0 1 1 0 0 20 0.0000 4 195 135 6390 585 2\001
4 0 1 1 0 0 20 0.0000 4 195 75 3375 450 i\001
4 0 1 1 0 0 20 0.0000 4 195 135 3465 585 1\001
4 0 1 1 0 0 20 0.0000 4 135 135 3060 1170 v\001
4 0 1 1 0 0 20 0.0000 4 195 135 3150 1305 1\001

Deleted mttroot/mtt/lib/examples/Identification/idRC/RC_desc.tex version [95bf3e68d1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system RC (RC_desc.tex)
% Generated by MTT on Tue Aug 26 09:43:25 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/08/26 09:28:25  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\textbf{RC} is a Simple two-port RC circuit.  The two ports are [in]
and [out] and the two parameters are c and r respectively

   The acausal bond graph of system \textbf{RC} is
   displayed in Figure \Ref{RC_abg} and its label
   file is listed in Section \Ref{sec:RC_lbl}.
   The subsystems are listed in Section \Ref{sec:RC_sub}.

Deleted mttroot/mtt/lib/examples/Identification/idRC/RC_lbl.txt version [3bdc217d52].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system RC (RC_lbl.txt)
%SUMMARY RC A Simple two-port RC circuit
%DESCRIPTION This simple example is used in the manual.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  2000/09/14 15:13:02  peterg
% %% Changed port CRs to give SISO system when used in isolation
% %%
% %% Revision 1.2  1998/07/27 11:09:36  peterg
% %% Commented the aliases.
% %%
% %% Revision 1.1  1998/07/16 20:16:30  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	Electrical_in	# The left-hand port
%ALIAS	out	Electrical_out	# The right-hand port

% Argument aliases
%ALIAS	$1	c		# Capacitance
%ALIAS	$2	r		# Resistance

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	c		lin	effort,c

% Component type R
	r		lin	flow,r

% Component type SS
	[Electrical_in]		SS		external,internal
	[Electrical_out]	SS		external,0

Deleted mttroot/mtt/lib/examples/Identification/idRC/idRC_abg.fig version [d7e806eb37].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2250 2475 3600 2475 3375 2700
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4500 2475 5850 2475 5625 2700
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 6975 3600 1125 3600 1125 1800 6975 1800 6975 3600
4 1 0 100 0 18 18 0.0000 4 210 600 1800 2565 Se:u\001
4 1 0 100 0 18 18 0.0000 4 210 750 4050 2565 RC:rc\001
4 1 0 100 0 18 18 0.0000 4 270 600 6345 2565 De:y\001

Deleted mttroot/mtt/lib/examples/Identification/idRC/idRC_desc.tex version [a29ed1a75e].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system idRC (idRC_desc.tex)
% Generated by MTT on Thu Apr 5 11:04:33 BST 2001.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{idRC} is
   displayed in Figure \Ref{fig:idRC_abg.ps} and its label
   file is listed in Section \Ref{sec:idRC_lbl}.
   The subsystems are listed in Section \Ref{sec:idRC_sub}.

   
   This example illustrates the sensitivity approach to model-based
   system identification\footnote{Peter J Gawthrop, \emph{Sensitivity
       Bond Graphs}, Journal Franklin Institute, \textbf{337}, 2000,
     pp 907--922}.

   The system is a simple RC circuit with zero initial condition; the
   method identifies the resitance $r$.

   To see the results, type: 
\begin{verbatim}
mtt -oct -i euler -pdf idRC ippp view
\end{verbatim}

Deleted mttroot/mtt/lib/examples/Identification/idRC/idRC_ippp.m version [049931ce5c].

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















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

## Set up parameters
name = "idRC";
sim = sidRC_simpar;		# Simulation parameter
sym = sidRC_sympar;		# Parameter names
par = sidRC_numpar;		# Parameter values
par([sym.us,sym.rs,sym.cs])=0;	# Reset sensitivity params
x0  = sidRC_state(par);         # Initial state

## Simulation of "actual" system
t = [0:sim.dt:sim.last]';
T = 5;				# Period
## u = sin((2*pi/T)*t);
u = ones(size(t));
y_0 = sidRC_ssim(x0,par,sim,u);

## Initial parameter
par_0 = par;
par_0(sym.r) = 1;

## Identify
extras.criterion = 1e-5;
extras.max_iterations = 10;
extras.v = 1e-5;
extras.verbose = 1;		# Show what is going on
[par,Par,Error,Y] = ppp_identify (name,u,y_0,["r"],par_0,extras);

par = par

grid;
xlabel("Time")
title("Estimated output");
plot(t,y_0,t,Y);
figfig("idRC_outputs","pdf");
figfig("idRC_outputs","ps");

xlabel("Iteration")
title("Estimation error");
plot(Error);
figfig("idRC_error","pdf");
figfig("idRC_error","ps");

xlabel("Iteration")
title("Estimated Parameter");
plot(Par([sym.r,sym.c],:)');
figfig("idRC_parameters","pdf");
figfig("idRC_parameters","ps");

Deleted mttroot/mtt/lib/examples/Identification/idRC/idRC_rep.tex version [85839553dd].

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
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
123
124
125
126
127
128
129
130
131
132
133





































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


\section{\textbf{abg.tex}: System idRC, representation \textbf{abg}, language \textbf{tex}}
\label{sec:idRC_abg.tex}
\index{\textbf{idRC} -- abg}


MTT command:
\begin{verbatim}
mtt idRC abg tex 
\end{verbatim}
  \input{/home/peterg/Research/Identification/MTT/idRC/MTT_work/idRC_abg.tex}


\section{\textbf{cbg.ps}: System idRC, representation \textbf{cbg}, language \textbf{ps}}
\label{sec:idRC_cbg.ps}
\index{\textbf{idRC} -- cbg}


MTT command:
\begin{verbatim}
mtt idRC cbg ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:idRC_cbg.ps}.
\fig{/home/peterg/Research/Identification/MTT/idRC/MTT_work/idRC_cbg}
    {idRC_cbg.ps}
    {0.9}
    {System \textbf{idRC}, representation cbg}


\section{\textbf{struc.tex}: System idRC, representation \textbf{struc}, language \textbf{tex}}
\label{sec:idRC_struc.tex}
\index{\textbf{idRC} -- struc}


MTT command:
\begin{verbatim}
mtt idRC struc tex 
\end{verbatim}
  \input{/home/peterg/Research/Identification/MTT/idRC/MTT_work/idRC_struc.tex}


\section{\textbf{sympar.tex}: System idRC, representation \textbf{sympar}, language \textbf{tex}}
\label{sec:idRC_sympar.tex}
\index{\textbf{idRC} -- sympar}


MTT command:
\begin{verbatim}
mtt idRC sympar tex 
\end{verbatim}
  \input{/home/peterg/Research/Identification/MTT/idRC/MTT_work/idRC_sympar.tex}


\section{\textbf{odeso.ps}: System idRC, representation \textbf{odeso}, language \textbf{ps}}
\label{sec:idRC_odeso.ps}
\index{\textbf{idRC} -- odeso}


MTT command:
\begin{verbatim}
mtt -oct idRC odeso ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:idRC_odeso.ps}.
\fig{/home/peterg/Research/Identification/MTT/idRC/MTT_work/idRC_odeso}
    {idRC_odeso.ps}
    {0.9}
    {System \textbf{idRC}, representation odeso}


\section{\textbf{ippp.ps}: System idRC, representation \textbf{ippp}, language \textbf{ps}}
\label{sec:idRC_ippp.ps}
\index{\textbf{idRC} -- ippp}


MTT command:
\begin{verbatim}
mtt -oct -i euler idRC ippp ps 
\end{verbatim}
This representation is given as Figure \Ref{fig:idRC_ippp.ps}.
\fig{/home/peterg/Research/Identification/MTT/idRC/MTT_work/idRC_ippp}
    {idRC_ippp.ps}
    {0.9}
    {System \textbf{idRC}, representation ippp}


\section{\textbf{rep.txt}: System idRC, representation \textbf{rep}, language \textbf{txt}}
\label{sec:idRC_rep.txt}
\index{\textbf{idRC} -- rep}


MTT command:
\begin{verbatim}
mtt idRC rep txt 
\end{verbatim}
  \begin{verbatim}
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system idRC (idRC_rep.txt)
## Generated by MTT on" Thu Apr  5 11:17:27 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt idRC abg tex			# The system description
mtt idRC cbg ps 		        # The causal bond graph
mtt idRC struc tex	        # The system structure
mtt idRC sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt idRC dae tex	        # The system dae
## mtt idRC ode tex	        # The system ode 
## mtt idRC sspar tex		# Steady-state parameters
## mtt idRC ss tex 		# Steady state
## mtt idRC dm tex		# Descriptor matrices (of linearised system)
## mtt idRC sm tex		# State matrices (of linearised system)
## mtt idRC tf tex		# Transfer function (of linearised system)
## mtt idRC lmfr ps		# log modulus of frequency response (of linearised system)
## mtt idRC simpar tex		# Simulation parameters
## mtt idRC numpar tex		# Numerical simulation parameters
## mtt idRC state tex		# Simulation initial state
## mtt idRC input tex		# Simulation input
## mtt idRC logic tex		# Logic control
 mtt -oct idRC odeso ps		# Simulation output
 mtt -oct -i euler idRC ippp ps

mtt idRC rep txt		# This file
  \end{verbatim}

Deleted mttroot/mtt/lib/examples/Identification/idRC/idRC_rep.txt version [2d54c35474].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system idRC (idRC_rep.txt)
## Generated by MTT on" Thu Apr  5 11:17:27 BST 2001.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt idRC abg tex			# The system description
mtt idRC cbg ps 		        # The causal bond graph
mtt idRC struc tex	        # The system structure
mtt idRC sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt idRC dae tex	        # The system dae
## mtt idRC ode tex	        # The system ode 
## mtt idRC sspar tex		# Steady-state parameters
## mtt idRC ss tex 		# Steady state
## mtt idRC dm tex		# Descriptor matrices (of linearised system)
## mtt idRC sm tex		# State matrices (of linearised system)
## mtt idRC tf tex		# Transfer function (of linearised system)
## mtt idRC lmfr ps		# log modulus of frequency response (of linearised system)
## mtt idRC simpar tex		# Simulation parameters
## mtt idRC numpar tex		# Numerical simulation parameters
## mtt idRC state tex		# Simulation initial state
## mtt idRC input tex		# Simulation input
## mtt idRC logic tex		# Logic control
 mtt -oct idRC odeso ps		# Simulation output
 mtt -oct -i euler idRC ippp ps

mtt idRC rep txt		# This file

Deleted mttroot/mtt/lib/examples/Identification/idRC/sRC_lbl.txt version [5c225769b3].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sRC (sRC_lbl.txt)
%SUMMARY sRC Sensitivity version of RC
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in|Electrical_in	Electrical_in_1,Electrical_in_2
%ALIAS	out|Electrical_out	Electrical_out_1,Electrical_out_2

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[Electrical_in]		SS		external,external
	[Electrical_out]	SS		external,external

% Component type C
	c	slin		effort,c;cs

% Component type R
	r	slin		flow,r;rs

Deleted mttroot/mtt/lib/examples/Identification/idRC/sidRC.h version [a7ffc6f8bf].

Deleted mttroot/mtt/lib/examples/Identification/idRC/sidRC_input.txt version [317dc5b945].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System sidRC, representation input, language txt; 
## File sidRC_input.txt; 
## Generated by MTT on Tue Apr  3 10:17:44 BST 2001; 



sidRC_u_1_se_1_1_u	= 1.0; # Default

Deleted mttroot/mtt/lib/examples/Identification/idRC/sidRC_numpar.txt version [96e47a9d0f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System sidRC, representation numpar, language txt; 
## File sidRC_numpar.txt; 
## Generated by MTT on Wed Apr  4 12:11:21 BST 2001; 



c	= 0.1;			# Capacitance
cs	= 0.0;			# Sensitivity
r	= 10.0;			# Resistance
rs	= 0.0;			# Sensitivity
us	= 0.0;			# Sensitivity

Deleted mttroot/mtt/lib/examples/Identification/idRC/sidRC_subs.r version [c8c2752116].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Default SUBS file
% File sidRC_subs.r
% Generated by MTT on Tue Apr  3 09:43:38 BST 2001.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2001/04/05 11:57:29  gawthrop
% %% Identification example
% %%
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Put algebraic substitution commands here


%The following is now done automatically
%FOR ALL x,y LET x^y = pow(x,y); % Use the pow function

%ON ROUNDED; % No integer output

END;

Deleted mttroot/mtt/lib/examples/Inverse/iMacroMicro/Make version [d0363e1a1b].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
%Makes the figures for the paper/report.
mtt macmic cbg ps
mtt imacmic cbg ps
mtt imacmic sm  m
mtt imacmic numpar m

octave figures.m

Deleted mttroot/mtt/lib/examples/Inverse/iMacroMicro/figures.m version [6e0d24fe3b].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Set up the parameters
imacmic_numpar;   

% Range of damping for the macro controller
D_1 = [0:0.1:2];

% Compute the damping factor d and save in arrray DD
% -- uses zeros of system
% $$$ DD = [];
% $$$ for d_1 = D_1
% $$$  [A,B,C,D] = macmic_dm(m_1,m_2,b_1,b_2,k_2,k_t,b_t,b_3,m_3,p_1,d_1);
% $$$  zz = ss2zp(A,B,C,D,1);
% $$$  z = (zz(:,2));
% $$$  re = sort(real(z));
% $$$  im = sort(imag(z));
% $$$  d = -re./sqrt(re.^2 + im.^2);
% $$$  d = sort(d);
% $$$  DD = [DD d];
% $$$ end;
% $$$ 
% $$$ plot(D_1,min(DD)); grid
% $$$ xlabel('Derivative gain');
% $$$ ylabel('Damping factor');
% $$$ 
% $$$ 

% Compute the damping factor d and save in arrray DD
% -- uses poles of inverse system
DD1 = [];
for d_1 = D_1
 [A] = imacmic_sm;
 z = eig(A);

 re = (real(z));
 im = (imag(z));
 d = -re./sqrt(re.^2 + im.^2);
 d = sort(d);
 DD1 = [DD1 d];
end;
minDD1 = min(DD1);

plot(D_1,minDD1); grid
xlabel('Derivative gain');
ylabel('Damping factor');

Maximum_Damping = max(minDD1)
index = minDD1 == Maximum_Damping*ones(size(minDD1));
Opt_gain = index*D_1'

% Plot on disk
set term postscript
set output "damping.ps"
plot(D_1,minDD1); grid


 

Deleted mttroot/mtt/lib/examples/Inverse/iMacroMicro/iMacroMicro_abg.fig version [ee4eafe200].

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
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
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























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Inches
A4      
100.00
Single
-2
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2706 4806 3606 4806 3456 4956
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2406 5106 2406 6006 2556 5856
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3906 5106 3906 6006 4056 5856
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7208 4808 8108 4808 7958 4958
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8708 4808 9608 4808 9458 4958
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8408 5108 8408 6008 8558 5858
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7208 4508 8108 3608 8108 3833
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8708 3608 9608 4508 9383 4508
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9909 5109 9909 6009 10059 5859
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6908 5108 6908 6008 7058 5858
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8405 2405 8405 3305 8555 3155
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11407 5107 11407 6007 11557 5857
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11406 3306 11406 2406 11556 2556
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4206 4806 5106 4806 4956 4956
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5406 5106 5406 6006 5556 5856
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4206 4506 5106 3606 5106 3831
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5405 3305 5405 2405 5555 2555
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2405 3305 2405 2405 2555 2555
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11707 4807 12607 4807 12457 4957
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11707 3607 12607 4507 12382 4507
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2105 1805 2105 905 2255 1055
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2705 1805 2705 905 2855 1055
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5706 4806 6606 4806 6456 4956
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5706 3606 6606 4506 6381 4506
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2704 3604 3604 4504 3379 4504
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1208 4808 2108 4808 1958 4958
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1208 4508 2108 3608 2108 3833
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 681 3606 1131 3606
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 906 4506 906 3606 1056 3756
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12905 4505 12905 3605 13055 3755
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10207 4807 11107 4807 10957 4957
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10207 4507 11107 3607 11107 3832
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8400 3300 8625 3300
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 12900 3600 13125 3600
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 12675 4500 12900 4500
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8175 2400 8400 2400
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 1501 5401 301 5401 301 3001 1501 3001 1501 5401
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 3300 2700 1500 2700 1500 450 3300 450 3300 2700
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 3000 6600 1800 6600 1800 3000 3000 3000 3000 6600
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 4501 6601 3301 6601 3301 3901 4501 3901 4501 6601
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 6000 6600 4800 6600 4800 1800 6000 1800 6000 6600
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 7501 6601 6301 6601 6301 3901 7501 3901 7501 6601
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 9000 6600 7800 6600 7800 1800 9000 1800 9000 6600
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 10501 6601 9301 6601 9301 3901 10501 3901 10501 6601
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 12000 6600 10800 6600 10800 1800 12000 1800 12000 6600
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 13501 5401 12301 5401 12301 3001 13501 3001 13501 5401
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 11700 4575 11700 4800
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 12600 4800 12600 5025
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 10200 4575 10200 4800
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 11100 4800 11100 5025
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 9600 4500 9450 4650
2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8700 3600 8850 3450
4 1 -1 0 0 0 20 0.0000 4 195 150 2406 4881 0\001
4 1 -1 0 0 0 20 0.0000 4 195 585 3906 6381 I:m1\001
4 1 -1 0 0 0 20 0.0000 4 210 585 2405 6380 R:b1\001
4 1 -1 0 0 0 20 0.0000 4 195 150 2405 3680 0\001
4 1 -1 0 0 0 20 0.0000 4 195 150 3906 4881 1\001
4 1 -1 0 0 0 20 0.0000 4 195 150 8408 4883 0\001
4 1 -1 0 0 0 20 0.0000 4 195 150 8408 3683 0\001
4 1 -1 0 0 0 20 0.0000 4 210 585 8483 6383 R:b3\001
4 1 -1 0 0 0 20 0.0000 4 210 675 8407 2182 SS:f2\001
4 1 -1 0 0 0 20 0.0000 4 195 585 9906 6381 I:m3\001
4 1 -1 0 0 0 20 0.0000 4 195 585 6905 6380 I:m2\001
4 1 -1 0 0 0 20 0.0000 4 195 150 11407 4882 0\001
4 1 -1 0 0 0 20 0.0000 4 195 150 11407 3682 0\001
4 1 -1 0 0 0 20 0.0000 4 210 525 11406 2181 C:kt\001
4 1 -1 0 0 0 20 0.0000 4 210 525 11482 6382 R:bt\001
4 1 -1 0 0 0 20 0.0000 4 195 150 5406 4881 0\001
4 1 -1 0 0 0 20 0.0000 4 195 150 5406 3681 0\001
4 1 -1 0 0 0 20 0.0000 4 210 585 5481 6381 R:b2\001
4 1 -1 0 0 0 20 0.0000 4 195 150 12909 4884 1\001
4 1 -1 0 0 0 20 0.0000 4 195 150 6908 4883 1\001
4 1 -1 0 0 0 20 0.0000 4 195 150 2404 2179 1\001
4 1 -1 0 0 0 20 0.0000 4 255 585 2779 754 C:p1\001
4 1 -1 0 0 0 20 0.0000 4 210 585 2104 754 R:d1\001
4 1 -1 0 0 0 20 0.0000 4 195 150 910 4885 1\001
4 1 -1 0 0 0 20 0.0000 4 210 675 902 3377 SS:fb\001
4 1 -1 0 0 0 20 0.0000 4 210 615 12905 3380 SS:ft\001
4 1 -1 0 0 0 20 0.0000 4 195 150 9909 4884 1\001
4 1 -1 0 0 0 20 0.0000 4 210 585 5405 2180 C:k2\001
4 1 1 1 0 3 20 0.0000 4 210 1455 900 5700 Macro base\001
4 1 1 1 0 3 20 0.0000 4 210 1800 2401 376 Macro control\001
4 1 1 1 0 3 20 0.0000 4 195 1950 2400 6900 Macro actuator\001
4 1 1 1 0 3 20 0.0000 4 195 1530 3900 3825 Macro mass\001
4 1 1 1 0 3 20 0.0000 4 195 1470 6900 3825 Micro mass\001
4 1 1 1 0 3 20 0.0000 4 270 1890 5400 1650 Compliant link\001
4 1 1 1 0 3 20 0.0000 4 195 1890 8475 1650 Micro actuator\001
4 1 1 1 0 3 20 0.0000 4 255 1125 9900 3825 Tip mass\001
4 1 1 0 0 3 20 0.0000 4 270 2985 11400 1650 Compliant environment\001
4 1 -1 0 0 0 20 0.0000 4 255 1275 12901 5701 Tip sensor\001

Deleted mttroot/mtt/lib/examples/Inverse/iMacroMicro/iMacroMicro_desc.tex version [52d78b057e].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system iMacroMicro (iMacroMicro_desc.tex)
% Generated by MTT on Tue Dec 9 18:13:04 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/22 22:24:27  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{iMacroMicro} is
   displayed in Figure \Ref{iMacroMicro_abg} and its label
   file is listed in Section \Ref{sec:iMacroMicro_lbl}.
   The subsystems are listed in Section \Ref{sec:iMacroMicro_sub}.

This is a Bond Graph model of the macro-micro manipulation system
discussed by Sharon in his thesis and by Sharon, Hogan and Hardt in
various papers. The micro loop is inverted whilst leaving the macro
control in place. This {\em partial inverse\/} gives information about
the {\em zero dynamics\/} of the micro control system with the
particular macro controller in place and allows desidn of the macro
controller to ease the design of the micro controller.


%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Inverse/iMacroMicro/iMacroMicro_lbl.txt version [eda41e1822].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file (macmic_lbl.txt)
%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Masses
m1	lin	flow,m_1
m2	lin	flow,m_2
m3	lin	flow,m_3

%Springs
k2	lin	state,k_2
kt	lin	state,k_t

%Dampers
b1	lin	flow,b_1
b2	lin	flow,b_2
b3	lin	flow,b_3
bt	lin	flow,b_t

%Source/sensors
f2	SS	external,internal
ft	SS	external,0
fb	SS	internal,0

%Control
p1	lin	flow,p_1
d1	lin	flow,d_1



Deleted mttroot/mtt/lib/examples/Inverse/iMacroMicro/iMacroMicro_numpar.txt version [b385767fcd].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
m_1 = 0.0169;		# m_1;
m_2 = 0.0169;		# m_2;
b_1 = 0.13;		# b_1;
b_2 = 0.013;		# b_2;
k_2 = 24;	        # k_2;
k_t = 150;		# k_t;
b_t = 0.16;		# b_t;
b_3 = 0.13;		# b_3;
m_3 = 0.005;		# m_3;
p_1 = 10;		# p_1;
d_1 = 0.9;		# d_1;

Deleted mttroot/mtt/lib/examples/Inverse/iMacroMicro/iMacroMicro_rep.txt version [2652f3e75e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system iMacroMicro (iMacroMicro_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt iMacroMicro abg tex
mtt iMacroMicro cbg ps
mtt iMacroMicro struc tex
mtt iMacroMicro dae tex
mtt iMacroMicro dm tex
mtt iMacroMicro tf tex
mtt iMacroMicro numpar txt
mtt iMacroMicro lmfr ps 
mtt iMacroMicro lpfr ps 
%mtt iMacroMicro sro ps 
%mtt -c iMacroMicro odeso ps 

Deleted mttroot/mtt/lib/examples/Inverse/iMacroMicro/iMacroMicro_simpar.txt version [1372589ac1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system iMacroMicro (iMacroMicro_simpar.txt)
# Generated by MTT on Wed Nov 18 10:08:20 GMT 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 10.0;       # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -2;         # Minimum frequency = 10^WMIN
WMAX        = 4;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Inverse/iNMP/NMP/NMP_abg.fig version [324d12d6ea].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Inches
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3903 2403 4803 2403 4653 2553
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5403 2403 6303 2403 6153 2553
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 2103 3603 1203 3753 1353
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2702 3002 3302 2402 3302 2627
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3905 4201 4805 4201 4655 4351
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5405 4201 6305 4201 6155 4351
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3605 4501 3605 5401 3755 5251
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2702 3602 3302 4202 3077 4202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7803 3302 8703 3302 8553 3452
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1203 3302 2103 3302 1953 3452
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2101 3076 2101 3301
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2101 3301 2101 3526
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8701 3076 8701 3301
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8701 3301 8701 3526
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5103 2103 5103 1203 5253 1353
2 4 1 2 -1 7 0 0 -1 6.000 0 0 7 0 0 5
	 5700 3000 5700 600 3000 600 3000 3000 5700 3000
2 4 1 2 -1 7 0 0 -1 6.000 0 0 7 0 0 5
	 5700 6000 5700 3600 3000 3600 3000 6000 5700 6000
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 4200 7650 3600 7650 3825
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7052 2402 7652 3002 7427 3002
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5100 4500 5100 5400 5250 5250
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4800 4501 4164 5137 4376 5137
4 1 -1 0 0 0 20 0.0000 4 195 135 3603 2478 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5103 2478 0\001
4 1 -1 0 0 0 20 0.0000 4 255 615 3602 1052 R:r_s\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2402 3377 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3603 4278 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5103 4278 0\001
4 1 -1 0 0 0 20 0.0000 4 195 690 6603 4278 AE:m\001
4 1 -1 0 0 0 20 0.0000 4 255 600 3603 5778 R:r_f\001
4 1 -1 0 0 0 20 0.0000 4 195 135 7577 3377 1\001
4 1 -1 0 0 0 20 0.0000 4 195 660 751 3376 SS:e1\001
4 1 -1 0 0 0 20 0.0000 4 195 660 9151 3376 SS:e2\001
4 1 -1 0 0 0 20 0.0000 4 255 630 5102 1052 C:c_s\001
4 1 -1 0 0 0 20 0.0000 4 255 1440 4200 375 Slow system\001
4 1 -1 0 0 0 20 0.0000 4 255 1350 4200 6450 Fast system\001
4 1 -1 0 0 0 20 0.0000 4 255 600 6678 2478 AE:p\001
4 1 -1 0 0 0 20 0.0000 4 255 615 5104 5779 C:c_f\001
4 1 -1 0 0 0 20 0.0000 4 195 375 4203 5478 R:r\001

Deleted mttroot/mtt/lib/examples/Inverse/iNMP/NMP/NMP_desc.tex version [f95b4585ef].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system NMP (NMP_desc.tex)
% Generated by MTT on Tue Dec 9 17:34:06 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{NMP} is
   displayed in Figure \Ref{NMP_abg} and its label
   file is listed in Section \Ref{sec:NMP_lbl}.
   The subsystems are listed in Section \Ref{sec:NMP_sub}.

This is a simple non-minimum phase system with an inverse-type
response.  It is the standard fast negative and slow positive systems
in parallel. The corresponding inverse system \textbf{iNMP} is
unstable.


Deleted mttroot/mtt/lib/examples/Inverse/iNMP/NMP/NMP_lbl.txt version [a096847791].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system NMP (NMP_lbl.txt)
%SUMMARY NMP A simple non-minimum phase system
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/03/09 00:08:21  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases
%ALIAS	$1	c_f
%ALIAS	$2	c_s
%ALIAS	$3	r_f
%ALIAS	$4	r_s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AE
	m		lin	-1
	p		lin	1

% Component type C
	c_f		lin	effort,c_f
	c_s		lin	effort,c_s

% Component type R
	r		lin	flow,r
	r_f		lin	flow,r_f
	r_s		lin	flow,r_s

% Component type SS
	e1	SS		SS	external,internal
	e2	SS		SS	external,0

Deleted mttroot/mtt/lib/examples/Inverse/iNMP/NMP/NMP_numpar.txt version [1d7033f948].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (NMP_numpar.txt)
# Generated by MTT at Thu Oct  8 09:25:16 BST 1998

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

# Parameters
c_f = 	0.5; # NMP
c_s = 	1.0; # NMP
r = 	1.0; # NMP
r_f = 	1.0; # NMP
r_s = 	1.0; # NMP

Deleted mttroot/mtt/lib/examples/Inverse/iNMP/NMP/NMP_rep.txt version [0e160c8365].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system NMP (NMP_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt NMP abg tex
mtt NMP struc tex
mtt NMP ode tex
mtt NMP sm tex
mtt NMP tf tex

mtt NMP sro ps
mtt NMP lmfr ps
mtt NMP lpfr ps

Deleted mttroot/mtt/lib/examples/Inverse/iNMP/iNMP/iNMP_abg.fig version [e878cdb28c].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Inches
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3903 2403 4803 2403 4653 2553
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5403 2403 6303 2403 6153 2553
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 2103 3603 1203 3753 1353
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2702 3002 3302 2402 3302 2627
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3905 4201 4805 4201 4655 4351
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5405 4201 6305 4201 6155 4351
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3605 4501 3605 5401 3755 5251
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2702 3602 3302 4202 3077 4202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7803 3302 8703 3302 8553 3452
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1203 3302 2103 3302 1953 3452
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2101 3301 2101 3526
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8701 3301 8701 3526
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5103 2103 5103 1203 5253 1353
2 4 1 2 -1 7 0 0 -1 6.000 0 0 7 0 0 5
	 5700 3000 5700 600 3000 600 3000 3000 5700 3000
2 4 1 2 -1 7 0 0 -1 6.000 0 0 7 0 0 5
	 5700 6000 5700 3600 3000 3600 3000 6000 5700 6000
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 4200 7650 3600 7650 3825
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7052 2402 7652 3002 7427 3002
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5100 4500 5100 5400 5250 5250
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4800 4501 4164 5137 4376 5137
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1200 3075 1200 3300
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7800 3075 7800 3300
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6300 2400 6300 2625
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5400 2175 5400 2400
4 1 -1 0 0 0 20 0.0000 4 195 135 3603 2478 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5103 2478 0\001
4 1 -1 0 0 0 20 0.0000 4 255 615 3602 1052 R:r_s\001
4 1 -1 0 0 0 20 0.0000 4 195 135 2402 3377 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3603 4278 1\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5103 4278 0\001
4 1 -1 0 0 0 20 0.0000 4 195 690 6603 4278 AE:m\001
4 1 -1 0 0 0 20 0.0000 4 255 600 3603 5778 R:r_f\001
4 1 -1 0 0 0 20 0.0000 4 195 135 7577 3377 1\001
4 1 -1 0 0 0 20 0.0000 4 195 660 751 3376 SS:e1\001
4 1 -1 0 0 0 20 0.0000 4 195 660 9151 3376 SS:e2\001
4 1 -1 0 0 0 20 0.0000 4 255 630 5102 1052 C:c_s\001
4 1 -1 0 0 0 20 0.0000 4 255 1440 4200 375 Slow system\001
4 1 -1 0 0 0 20 0.0000 4 255 1350 4200 6450 Fast system\001
4 1 -1 0 0 0 20 0.0000 4 255 600 6678 2478 AE:p\001
4 1 -1 0 0 0 20 0.0000 4 255 615 5104 5779 C:c_f\001
4 1 -1 0 0 0 20 0.0000 4 195 375 4203 5478 R:r\001

Deleted mttroot/mtt/lib/examples/Inverse/iNMP/iNMP/iNMP_desc.tex version [183722d9b6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system iNMP (iNMP_desc.tex)
% Generated by MTT on Tue Dec 9 17:34:06 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{iNMP} is
   displayed in Figure \Ref{iNMP_abg} and its label
   file is listed in Section \Ref{sec:iNMP_lbl}.
   The subsystems are listed in Section \Ref{sec:iNMP_sub}.

This is a simple non-minimum phase system with an inverse-type
response.  It is the standard fast negative and slow positive systems
in parallel. The corresponding inverse system \textbf{iiNMP} is
unstable.


Deleted mttroot/mtt/lib/examples/Inverse/iNMP/iNMP/iNMP_lbl.txt version [735e3c8f92].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system iNMP (iNMP_lbl.txt)
%SUMMARY iNMP Inverse simple non-minimum phase system
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/03/09 00:10:07  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases
%ALIAS	$1	c_f
%ALIAS	$2	c_s
%ALIAS	$3	r_f
%ALIAS	$4	r_s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type AE
	m		lin	-1
	p		lin	1

% Component type C
	c_f		lin	effort,c_f
	c_s		lin	effort,c_s

% Component type R
	r		lin	flow,r
	r_f		lin	flow,r_f
	r_s		lin	flow,r_s

% Component type SS
	e1	SS		SS	external,internal
	e2	SS		SS	external,0

Deleted mttroot/mtt/lib/examples/Inverse/iNMP/iNMP/iNMP_numpar.txt version [1d7033f948].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (NMP_numpar.txt)
# Generated by MTT at Thu Oct  8 09:25:16 BST 1998

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

# Parameters
c_f = 	0.5; # NMP
c_s = 	1.0; # NMP
r = 	1.0; # NMP
r_f = 	1.0; # NMP
r_s = 	1.0; # NMP

Deleted mttroot/mtt/lib/examples/Inverse/iNMP/iNMP/iNMP_rep.txt version [1261b95adc].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system iNMP (iNMP_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt iNMP abg tex
mtt iNMP struc tex
mtt iNMP ode tex
mtt iNMP dm tex
mtt iNMP tf tex

mtt iNMP lmfr ps
mtt iNMP lpfr ps

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2c/iRC2c_abg.fig version [88a5a6ef61].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 3600 3375 3600 3150 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3375 5175 2475 5400 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8325 3376 8325 2476 8550 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 3600 4950 3600 4725 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7200 3601 8100 3601 7875 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 3600 4050 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6525 3780 6525 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 3600 6525 3600 6300 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3345 3600 2445 3825 2670
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 3346 6750 2446 6975 2671
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 3780 2475 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 3600 2475 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3465 3375 3780 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 3780 4050 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4995 3375 5310 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8145 3375 8460 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6615 2475 6930 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6525 3600 6525 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7200 3780 7200 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7200 3555 7200 3375
4 0 -1 0 0 2 20 0.0000000 4 210 150 5085 3735 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 3510 3690 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 6660 3691 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 8235 3736 0\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 3465 2250 R:r_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 4995 2250 C:c_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 6525 2250 R:r_2\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 8100 2295 C:c_2\001
4 2 -1 0 0 2 20 0.0000000 4 270 750 2385 3690 SS:uy\001

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2c/iRC2c_desc.tex version [5eddc121b6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system iRC2c (iRC2c_desc.tex)
% Generated by MTT on Mon Apr 6 10:46:00 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{iRC2c} is
   displayed in Figure \Ref{iRC2c_abg} and its label
   file is listed in Section \Ref{sec:iRC2c_lbl}.
   The subsystems are listed in Section \Ref{sec:iRC2c_sub}.

This example gives the inverse of a double RC circuit with
\emph{collocated} sensor/actuator pairing.


Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2c/iRC2c_input.txt version [bae2b6c20a].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (iRC2c_input.txt)
# Generated by MTT at Mon Mar  2 15:42:48 GMT 1998

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

# Set the inputs
u(1) =	 1 ; # iRC2c (u_s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2c/iRC2c_lbl.txt version [970ccd463e].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY iRC2c Inverse of double RC circuit with collocated io
%DESCRIPTION <Detailed description here>
%% Label file for system iRC2c (iRC2c_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_1		lin	effort,c_1
	c_2		lin	effort,c_2

% Component type R
	r_1		lin	flow,r_1
	r_2		lin	flow,r_2

% Component type SS
	uy		SS	external,external


Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2c/iRC2c_numpar.txt version [434e56074d].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (iRC2c_numpar.txt)
# Generated by MTT at Mon Mar  2 15:41:26 GMT 1998

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

# Parameters
c_1 = 	1.0; # iRC2c
c_1s = 	0.1; # iRC2c
c_2 = 	1.0; # iRC2c
c_2s = 	0.1; # iRC2c
r_1 = 	1.0; # iRC2c
r_1s = 	1.0; # iRC2c
r_2 = 	1.0; # iRC2c
r_2s = 	1.0; # iRC2c

# Initial states
x(1) = 	0.0; # iRC2c (c_1)
x(2) = 	0.0; # iRC2c (c_1s)
x(3) = 	0.0; # iRC2c (c_2)
x(4) = 	0.0; # iRC2c (c_2s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2c/iRC2c_rep.txt version [0627609c1c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system iRC2c (iRC2c_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt iRC2c abg tex
mtt iRC2c struc tex
mtt iRC2c dae tex
mtt iRC2c dm tex
mtt iRC2c tf tex


Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2n/iRC2n_abg.fig version [094799a629].

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
68




































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5625 3600 5625 3420
2 1 2 2 1 7 1 0 -1 4.500 0 0 7 0 0 4
	 9585 3465 8325 3465 8190 3375 8190 2565
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 3600 3375 3600 3150 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3375 5175 2475 5400 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8325 3376 8325 2476 8550 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 3600 4950 3600 4725 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7200 3601 8100 3601 7875 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8775 3601 9675 3601 9450 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3465 3375 3780 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5040 2475 5355 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6615 3375 6930 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8190 2475 8505 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 3600 2475 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3375 3780 3375 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 3600 4050 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 3780 4950 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6525 3780 6525 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 3600 6525 3600 6300 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7200 3600 7200 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8100 3780 8100 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8775 3600 8775 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9675 3600 9675 3780
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3345 3600 2445 3825 2670
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 3346 6750 2446 6975 2671
2 1 1 1 1 7 1 0 -1 4.000 0 0 7 0 0 4
	 9585 3510 5400 3510 5310 3420 5310 2790
2 1 2 2 1 -1 1 0 -1 3.000 0 0 7 0 0 9
	 8392 2632 8392 3712 6862 3712 6862 2497 6727 2362 6592 2497
	 6592 3442 5242 3442 5242 2632
4 0 -1 0 0 2 20 0.0000000 4 210 150 5085 3735 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 3510 3690 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 6660 3691 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 8235 3736 0\001
4 2 -1 0 0 2 20 0.0000000 4 210 600 2295 3645 SS:u\001
4 0 -1 0 0 2 20 0.0000000 4 270 585 9810 3690 SS:y\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 3465 2250 R:r_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 4995 2250 C:c_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 6525 2250 R:r_2\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 8100 2295 C:c_2\001

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2n/iRC2n_desc.tex version [9163d2db1b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system iRC2n (iRC2n_desc.tex)
% Generated by MTT on Mon Apr 6 10:46:52 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{iRC2n} is
   displayed in Figure \Ref{iRC2n_abg} and its label
   file is listed in Section \Ref{sec:iRC2n_lbl}.
   The subsystems are listed in Section \Ref{sec:iRC2n_sub}.

This example gives the inverse of a double RC circuit with
\emph{non-collocated} sensor/actuator pairing.

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2n/iRC2n_input.txt version [8fa4a991b7].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (iRC2n_input.txt)
# Generated by MTT at Mon Mar  2 15:42:48 GMT 1998

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

# Set the inputs
u(1) =	 1 ; # iRC2n (u_s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2n/iRC2n_lbl.txt version [3c4a501e9c].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY iRC2n Inverse of double RC circuit with non-collocated io
%DESCRIPTION <Detailed description here>
%% Label file for system iRC2n (iRC2n_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/05/20 16:43:52  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_1		lin	effort,c_1
	c_2		lin	effort,c_2

% Component type R
	r_1		lin	flow,r_1
	r_2		lin	flow,r_2

% Component type SS
	u		SS	external,internal
	y		SS	external,0

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2n/iRC2n_numpar.txt version [3f9b896142].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (iRC2n_numpar.txt)
# Generated by MTT at Mon Mar  2 15:41:26 GMT 1998

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

# Parameters
c_1 = 	1.0; # iRC2n
c_1s = 	0.1; # iRC2n
c_2 = 	1.0; # iRC2n
c_2s = 	0.1; # iRC2n
r_1 = 	1.0; # iRC2n
r_1s = 	1.0; # iRC2n
r_2 = 	1.0; # iRC2n
r_2s = 	1.0; # iRC2n

# Initial states
x(1) = 	0.0; # iRC2n (c_1)
x(2) = 	0.0; # iRC2n (c_1s)
x(3) = 	0.0; # iRC2n (c_2)
x(4) = 	0.0; # iRC2n (c_2s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2n/iRC2n_rep.txt version [683a8983e4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system iRC2n (iRC2n_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt iRC2n abg tex
mtt iRC2n struc tex
mtt iRC2n dae tex
mtt iRC2n dm tex
mtt iRC2n tf tex



Deleted mttroot/mtt/lib/examples/Inverse/iRC2/iRC2n/iRC2n_simp.r version [a8454e246a].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce commands to simplify output for system iRC2n (iRC2n_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MTTu1 := y;

END;

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/saRC2c/saRC2c_abg.fig version [64973640f8].

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
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
123
124
125
126
127
128
129
130
131
132
133
134






































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 3601 4051 3601 3826 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3376 5851 2476 6076 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9001 3377 9001 2477 9226 2702
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3601 5626 3601 5401 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7876 3602 8776 3602 8551 3827
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4726 3601 4726 3421
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7201 3781 7201 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6301 3601 7201 3601 6976 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 3346 4276 2446 4501 2671
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 3347 7426 2447 7651 2672
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5671 3376 5986 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8821 3376 9136 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7291 2476 7606 2476
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7201 3601 7201 3421
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7876 3781 7876 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 3825 2925 4725 3150 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 5175 2925 6075 3150 5850
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 6301 4051 6301 3826 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 6076 5851 5176 6076 5401
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9001 6077 9001 5177 9226 5402
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 6301 5626 6301 5401 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7876 6302 8776 6302 8551 6527
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4726 6301 4726 6121
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7201 6481 7201 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6301 6301 7201 6301 6976 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 6046 4276 5146 4501 5371
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 6047 7426 5147 7651 5372
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3151 6481 3151 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3151 6301 3151 6121
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4141 6076 4456 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4726 6481 4726 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5671 6076 5986 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8821 6076 9136 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7291 5176 7606 5176
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7201 6301 7201 6121
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7876 6481 7876 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1756 6301 2656 6301 2431 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 3780 4050 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 3600 4050 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4141 2475 4456 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 3781 4725 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7875 3645 7875 3465
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7875 6300 7875 6120
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 3375 2700 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1801 3600 2701 3600 2476 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 3825 3150 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3105 5175 2925 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2925 5175 2745 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1755 6480 1755 6300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1755 6300 1755 6120
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 9900 4050 9900 1530 3600 1530 3600 4050 9900 4050
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 9900 7020 9900 4500 3600 4500 3600 7020 9900 7020
4 2 -1 0 0 2 20 0.0000000 4 240 870 1710 3645 SS:u_s\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 7336 3692 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 8911 3737 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 4231 3691 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 5806 3736 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 7336 6392 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 8911 6437 0\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 4141 4951 R:r_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 5671 4951 C:c_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 7201 4951 R:r_2\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 4231 6391 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 5806 6436 0\001
4 2 -1 0 0 2 20 0.0000000 4 210 600 1665 6345 SS:u\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 8775 4950 C:c_2\001
4 2 -1 0 0 2 20 0.0000000 4 210 150 3016 3691 1\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 4141 2251 R:r_1s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 5671 2251 C:c_1s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 7201 2251 R:r_2s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 8775 2250 C:c_2s\001
4 0 -1 0 0 2 20 0.0000000 4 210 390 2835 5040 AF\001
4 2 -1 0 0 2 20 0.0000000 4 210 150 3016 6391 0\001
4 1 1 1 0 0 20 0.0000000 4 210 450 2565 4455 e=0\001
4 1 1 1 0 0 20 0.0000000 4 210 420 2070 6570 f=0\001
4 1 1 1 0 0 20 0.0000000 4 270 2550 6750 1845 Specification system\001
4 1 1 1 0 0 20 0.0000000 4 270 1830 6615 6840 Inverse system\001

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/saRC2c/saRC2c_desc.tex version [b9cbbd7602].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system saRC2c (saRC2c_desc.tex)
% Generated by MTT on Mon Apr 6 10:47:43 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{saRC2c} is
   displayed in Figure \Ref{saRC2c_abg} and its label
   file is listed in Section \Ref{sec:saRC2c_lbl}.
   The subsystems are listed in Section \Ref{sec:saRC2c_sub}.

This example gives the inverse of a double RC circuit with
\begin{itemize}
\item specification system,
\item amplifier connection and
\item collocated sensor/actuator pairing.
\end{itemize}


Deleted mttroot/mtt/lib/examples/Inverse/iRC2/saRC2c/saRC2c_input.txt version [a1e2f1f8fd].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (saRC2c_input.txt)
# Generated by MTT at Mon Mar  2 15:42:48 GMT 1998

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

# Set the inputs
u(1) =	 1 ; # saRC2c (u_s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/saRC2c/saRC2c_lbl.txt version [a4d16b5d03].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY saRC2c
%DESCRIPTION <Detailed description here>
%% Label file for system saRC2c (saRC2c_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_1		lin	effort,c_1
	c_1s		lin	effort,c_1s
	c_2		lin	effort,c_2
	c_2s		lin	effort,c_2s

% Component type R
	r_1		lin	flow,r_1
	r_1s		lin	flow,r_1s
	r_2		lin	flow,r_2
	r_2s		lin	flow,r_2s

% Component type SS
	u		SS	external,0
	u_s		SS	external,external

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/saRC2c/saRC2c_numpar.txt version [9913932e70].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (saRC2c_numpar.txt)
# Generated by MTT at Mon Mar  2 15:41:26 GMT 1998

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

# Parameters
c_1 = 	1.0; # saRC2c
c_1s = 	0.1; # saRC2c
c_2 = 	1.0; # saRC2c
c_2s = 	0.1; # saRC2c
r_1 = 	1.0; # saRC2c
r_1s = 	1.0; # saRC2c
r_2 = 	1.0; # saRC2c
r_2s = 	1.0; # saRC2c

# Initial states
x(1) = 	0.0; # saRC2c (c_1)
x(2) = 	0.0; # saRC2c (c_1s)
x(3) = 	0.0; # saRC2c (c_2)
x(4) = 	0.0; # saRC2c (c_2s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/saRC2c/saRC2c_rep.txt version [96cc75e97e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system saRC2c (saRC2c_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt saRC2c abg tex
mtt saRC2c struc tex
mtt saRC2c dae tex
mtt saRC2c dm tex
mtt saRC2c tf tex

mtt -c saRC2c odeso ps
mtt saRC2c lmfr ps


Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2c/szRC2c_abg.fig version [ac27af0e16].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141













































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 3601 4051 3601 3826 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3376 5851 2476 6076 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9001 3377 9001 2477 9226 2702
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3601 5626 3601 5401 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7876 3602 8776 3602 8551 3827
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4726 3601 4726 3421
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7201 3781 7201 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6301 3601 7201 3601 6976 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 3346 4276 2446 4501 2671
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 3347 7426 2447 7651 2672
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5671 3376 5986 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8821 3376 9136 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7291 2476 7606 2476
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7201 3601 7201 3421
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7876 3781 7876 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 3825 2925 4725 3150 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2925 5175 2925 6075 3150 5850
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3151 6301 4051 6301 3826 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 6076 5851 5176 6076 5401
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9001 6077 9001 5177 9226 5402
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 6301 5626 6301 5401 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7876 6302 8776 6302 8551 6527
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4726 6301 4726 6121
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7201 6481 7201 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6301 6301 7201 6301 6976 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 6046 4276 5146 4501 5371
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 6047 7426 5147 7651 5372
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3151 6481 3151 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3151 6301 3151 6121
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4141 6076 4456 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4726 6481 4726 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5671 6076 5986 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8821 6076 9136 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7291 5176 7606 5176
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7201 6301 7201 6121
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7876 6481 7876 6301
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1756 6301 2656 6301 2431 6526
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1801 4950 2701 4950 2476 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 4950 2700 4770
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 5130 1800 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2655 6480 2655 6300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 3780 4050 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 3600 4050 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4141 2475 4456 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4725 3781 4725 3601
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7875 3645 7875 3465
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7875 6300 7875 6120
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 3375 2700 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1801 3600 2701 3600 2476 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 3825 3150 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2925 6075 2745 6075
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3105 5175 2925 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1755 6300 1755 6120
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 9900 4275 9900 1125 3600 1125 3600 4275 9900 4275
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 9900 7650 9900 4500 3600 4500 3600 7650 9900 7650
4 2 -1 0 0 2 20 0.0000000 4 240 870 1710 3645 SS:u_s\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 7336 3692 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 8911 3737 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 4231 3691 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 5806 3736 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 7336 6392 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 8911 6437 0\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 4141 4951 R:r_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 5671 4951 C:c_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 7201 4951 R:r_2\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 4231 6391 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 5806 6436 0\001
4 2 -1 0 0 2 20 0.0000000 4 210 600 1665 6345 SS:u\001
4 2 -1 0 0 2 20 0.0000000 4 210 990 1620 5040 SS:zero\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 8775 4950 C:c_2\001
4 2 -1 0 0 2 20 0.0000000 4 210 150 3016 3691 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 2835 5040 0\001
4 2 -1 0 0 2 20 0.0000000 4 210 150 3016 6391 1\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 4141 2251 R:r_1s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 5671 2251 C:c_1s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 7201 2251 R:r_2s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 8775 2250 C:c_2s\001
4 1 1 1 0 3 20 0.0000000 4 210 450 2250 4860 e=0\001
4 1 1 1 0 3 20 0.0000000 4 270 420 2250 5220 f=0\001
4 1 1 1 0 3 20 0.0000000 4 270 1845 6525 7110 Inverse system\001
4 1 1 1 0 3 20 0.0000000 4 270 2565 6660 1665 Specification system\001

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2c/szRC2c_desc.tex version [26c739d9e0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system szRC2c (szRC2c_desc.tex)
% Generated by MTT on Mon Apr 6 10:50:51 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{szRC2c} is
   displayed in Figure \Ref{szRC2c_abg} and its label
   file is listed in Section \Ref{sec:szRC2c_lbl}.
   The subsystems are listed in Section \Ref{sec:szRC2c_sub}.


This example gives the inverse of a double RC circuit with
\begin{itemize}
\item specification system,
\item zero-zero \textbf{SS} connection and
\item collocated sensor/actuator pairing.
\end{itemize}

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2c/szRC2c_input.txt version [5d473ec309].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (szRC2c_input.txt)
# Generated by MTT at Mon Mar  2 15:42:48 GMT 1998

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

# Set the inputs
u(1) =	 1 ; # szRC2c (u_s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2c/szRC2c_lbl.txt version [d6596f0777].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY szRC2c Specification inverse of double RC circuit with collocated io
%DESCRIPTION <Detailed description here>
%% Label file for system szRC2c (szRC2c_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/05/20 16:44:55  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_1		lin	effort,c_1
	c_1s		lin	effort,c_1s
	c_2		lin	effort,c_2
	c_2s		lin	effort,c_2s

% Component type R
	r_1		lin	flow,r_1
	r_1s		lin	flow,r_1s
	r_2		lin	flow,r_2
	r_2s		lin	flow,r_2s

% Component type SS
	u_s		SS	external,external
	zero		SS	0,0
	u		SS	external,external

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2c/szRC2c_numpar.txt version [4f0023ce06].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (szRC2c_numpar.txt)
# Generated by MTT at Mon Mar  2 15:41:26 GMT 1998

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

# Parameters
c_1 = 	1.0; # szRC2c
c_1s = 	0.1; # szRC2c
c_2 = 	1.0; # szRC2c
c_2s = 	0.1; # szRC2c
r_1 = 	1.0; # szRC2c
r_1s = 	1.0; # szRC2c
r_2 = 	1.0; # szRC2c
r_2s = 	1.0; # szRC2c

# Initial states
x(1) = 	0.0; # szRC2c (c_1)
x(2) = 	0.0; # szRC2c (c_1s)
x(3) = 	0.0; # szRC2c (c_2)
x(4) = 	0.0; # szRC2c (c_2s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2c/szRC2c_rep.txt version [8ec5d4fc14].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system szRC2c (szRC2c_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt szRC2c abg tex
mtt szRC2c struc tex
mtt szRC2c dae tex
mtt szRC2c dm tex
mtt szRC2c tf tex

mtt -c szRC2c odeso ps
mtt szRC2c lmfr ps


Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2n/szRC2n_abg.fig version [2bd65cadb4].

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
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
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























































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2251 4726 3151 4726 2926 4951
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 4501 4951 3601 5176 3826
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8101 4502 8101 3602 8326 3827
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4726 4726 4726 4501 4951
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6976 4727 7876 4727 7651 4952
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 4727 9451 4727 9226 4952
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3151 4906 3151 4726
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4726 3826 4546
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6301 4906 6301 4726
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5401 4726 6301 4726 6076 4951
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6976 4726 6976 4546
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3825 4905 3825 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4770 4500 5085 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6345 3600 6660 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6975 4905 6975 4725
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7920 4500 8235 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9450 4725 9450 4905
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9450 4680 9450 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10126 6301 9901 6076 11026 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9901 6076 9901 5896
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 11026 6256 11026 6076
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9675 4950 9675 5850 9900 5625
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5402 7427 5402 7247
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2252 7427 3152 7427 2927 7652
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4952 7202 4952 6302 5177 6527
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8102 7203 8102 6303 8327 6528
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3827 7427 4727 7427 4502 7652
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 7428 7877 7428 7652 7653
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8552 7428 9452 7428 9227 7653
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3242 7202 3557 7202
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4817 6302 5132 6302
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6392 7202 6707 7202
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7967 6302 8282 6302
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2252 7427 2252 7247
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3152 7607 3152 7427
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3827 7427 3827 7247
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4727 7607 4727 7427
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6302 7607 6302 7427
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5402 7427 6302 7427 6077 7652
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6977 7427 6977 7247
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7877 7607 7877 7427
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8552 7427 8552 7247
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3377 7172 3377 6272 3602 6497
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6527 7173 6527 6273 6752 6498
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9450 7425 9450 7605
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 4725 3150 4545
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3240 3600 3555 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9901 4725 10801 4725 10576 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 10800 4725 10800 4905
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 10800 4725 10800 4545
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 4516 3375 3616 3600 3841
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 4517 6525 3617 6750 3842
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9495 5850 9810 5850
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9675 6300 9855 6300
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9675 6313 9675 7213 9900 6988
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9675 7245 9495 7245
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 9045 5355 9045 2250 2475 2250 2475 5355 9045 5355
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 9045 8730 9045 5625 2475 5625 2475 8730 9045 8730
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6300 4680 6300 4500
4 0 -1 0 0 2 20 0.0000000 4 210 150 4861 4861 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 3286 4816 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 6436 4817 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 8011 4862 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 9586 4816 0\001
4 2 -1 0 0 2 20 0.0000000 4 240 870 2071 4771 SS:u_s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 3241 3376 R:r_1s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 6301 3376 R:r_2s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 4771 3376 C:c_1s\001
4 0 -1 0 0 2 20 0.0000000 4 240 870 7875 3375 C:c_2s\001
4 0 -1 0 0 2 20 0.0000000 4 210 990 11206 6166 SS:zero\001
4 1 1 1 0 3 20 0.0000000 4 210 450 10441 5986 e=0\001
4 1 1 1 0 3 20 0.0000000 4 270 420 10441 6346 f=0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 9585 6210 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 4862 7562 0\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 3287 7517 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 6437 7518 1\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 8012 7563 0\001
4 2 -1 0 0 2 20 0.0000000 4 210 600 2072 7472 SS:u\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 3242 6077 R:r_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 4772 6077 C:c_1\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 6302 6077 R:r_2\001
4 0 -1 0 0 2 20 0.0000000 4 240 750 7876 6076 C:c_2\001
4 0 -1 0 0 2 20 0.0000000 4 210 150 9630 7515 0\001
4 0 -1 0 0 2 20 0.0000000 4 270 855 10935 4815 SS:y_s\001
4 1 1 1 0 3 20 0.0000000 4 270 420 10260 5085 f=0\001
4 1 1 1 0 3 20 0.0000000 4 270 2565 5625 2745 Specification system\001
4 1 1 1 0 3 20 0.0000000 4 270 1845 5535 8280 Inverse system\001

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2n/szRC2n_desc.tex version [c87760ad0d].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system szRC2n (szRC2n_desc.tex)
% Generated by MTT on Mon Apr 6 10:52:26 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{szRC2n} is
   displayed in Figure \Ref{szRC2n_abg} and its label
   file is listed in Section \Ref{sec:szRC2n_lbl}.
   The subsystems are listed in Section \Ref{sec:szRC2n_sub}.

This example gives the inverse of a double RC circuit with
\begin{itemize}
\item specification system,
\item zero-zero \textbf{SS} connection and
\item non-collocated sensor/actuator pairing.
\end{itemize}



%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2n/szRC2n_input.txt version [24879df543].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (szRC2n_input.txt)
# Generated by MTT at Mon Mar  2 15:42:48 GMT 1998

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

# Set the inputs
u(1) =	 1 ; # szRC2n (u_s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2n/szRC2n_lbl.txt version [c5ad26295d].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY szRC2n Specification inverse of double RC circuit with noncollocated io
%DESCRIPTION <Detailed description here>
%% Label file for system szRC2n (szRC2n_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/05/20 16:45:37  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	c_1		lin	effort,c_1
	c_1s		lin	effort,c_1s
	c_2		lin	effort,c_2
	c_2s		lin	effort,c_2s

% Component type R
	r_1		lin	flow,r_1
	r_1s		lin	flow,r_1s
	r_2		lin	flow,r_2
	r_2s		lin	flow,r_2s

% Component type SS
	u_s		SS	external,internal
	y_s		SS	external,0
	zero		SS	0,0
	u		SS	external,external

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2n/szRC2n_numpar.txt version [bd74abe778].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (szRC2n_numpar.txt)
# Generated by MTT at Mon Mar  2 15:41:26 GMT 1998

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

# Parameters
c_1 = 	1.0; # szRC2n
c_1s = 	0.1; # szRC2n
c_2 = 	1.0; # szRC2n
c_2s = 	0.1; # szRC2n
r_1 = 	1.0; # szRC2n
r_1s = 	1.0; # szRC2n
r_2 = 	1.0; # szRC2n
r_2s = 	1.0; # szRC2n

# Initial states
x(1) = 	0.0; # szRC2n (c_1)
x(2) = 	0.0; # szRC2n (c_1s)
x(3) = 	0.0; # szRC2n (c_2)
x(4) = 	0.0; # szRC2n (c_2s)

Deleted mttroot/mtt/lib/examples/Inverse/iRC2/szRC2n/szRC2n_rep.txt version [b35e15fb83].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system szRC2n (szRC2n_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt szRC2n abg tex
mtt szRC2n struc tex
mtt szRC2n dae tex
mtt szRC2n dm tex
mtt szRC2n tf tex

mtt -c szRC2n odeso ps
mtt szRC2n lmfr ps


Deleted mttroot/mtt/lib/examples/Inverse/iTanks/iTanks_abg.fig version [4413ea1185].

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
68
69
70
71
72
73
74
75
76
77













































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 900 3150 2025 3150 1755 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 3150 3600 3150 3330 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 2925 2250 1800 2520 2070
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7201 3151 8326 3151 8056 3421
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8776 3151 9901 3151 9631 3421
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6976 2926 6976 1801 7246 2071
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 2926 8551 1801 8821 2071
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 3150 5175 3150 4905 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5625 3150 6750 3150 6480 3420
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 2925 3825 1800 4095 2070
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 2925 5400 1800 5670 2070
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 3375 6975 4500 7245 4230
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11295 5625 11295 450 45 450 45 5625 11295 5625
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 3
	 3150 1125 3150 2700 1305 2700
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 4
	 4500 1125 4500 2700 6300 2700 6300 1125
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 3
	 7650 1125 7650 2700 9675 2700
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1350 3600 9720 3600
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 3375 3825 4500 4095 4230
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 900 2925 900 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2025 3150 2025 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3600 3375 3825 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3825 4500 4095 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 2925 9900 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8775 3150 8775 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6705 3375 6930 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6975 4500 7200 4500
4 1 -1 0 0 2 20 0.0000 4 195 135 2250 3240 1\001
4 1 -1 0 0 2 20 0.0000 4 195 210 2250 1665 R\001
4 1 -1 0 0 2 20 0.0000 4 195 135 8551 3241 1\001
4 1 -1 0 0 2 20 0.0000 4 195 135 6976 3241 0\001
4 1 -1 0 0 2 20 0.0000 4 195 210 8551 1666 R\001
4 1 -1 0 0 2 20 0.0000 4 195 210 6976 1666 C\001
4 1 -1 0 0 2 20 0.0000 4 195 135 5400 3240 1\001
4 1 -1 0 0 2 20 0.0000 4 195 135 3825 3240 0\001
4 1 -1 0 0 2 20 0.0000 4 195 210 5400 1665 R\001
4 1 -1 0 0 2 20 0.0000 4 195 210 3825 1665 C\001
4 1 -1 0 0 2 20 0.0000 4 195 705 495 3240 SS:u1\001
4 1 -1 0 0 2 20 0.0000 4 195 705 10440 3240 SS:u2\001
4 1 -1 0 0 2 20 0.0000 4 255 675 3825 4725 SS:y1\001
4 1 -1 0 0 2 20 0.0000 4 255 675 6975 4770 SS:y2\001
4 1 1 1 0 3 20 0.0000 4 270 510 2295 1125 Pipe\001
4 1 1 1 0 3 20 0.0000 4 270 510 5445 1125 Pipe\001
4 1 1 1 0 3 20 0.0000 4 270 510 8595 1125 Pipe\001
4 1 1 1 0 3 20 0.0000 4 210 600 3870 1125 Tank\001
4 1 1 1 0 3 20 0.0000 4 210 600 6975 1125 Tank\001
4 1 1 1 0 3 20 0.0000 4 270 1665 5265 5445 System inverse\001

Deleted mttroot/mtt/lib/examples/Inverse/iTanks/iTanks_desc.tex version [d912f0defd].

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

































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system iTanks (iTanks_desc.tex)
% Generated by MTT on Wed Nov 18 11:04:33 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Figure \Ref{iTanks_abg} shows the bond graph of a two-tank system
superimposed on a schematic diagram. 
The two \textbf{C} components corresponds to the fluid storage and how
it relates to the pressure at the base of the tanks. In this case, for
simplicity, each tank ($i=1$ or $i=2$) is assumed to have a unity constitutive relationship:
\begin{equation}
  \text{pressure} = p_i = v_i = \text{volume}
\end{equation}
The volumetric flow rate into the first, and out of the second, tank
is represented by the two unlabelled \textbf{R} components. Again,
each is assumed to have a unit constitutive relationship:
\begin{equation}
  \text{flow} = f_i = \Delta_i = \text{pressure drop}
\end{equation}
The volumetric flow rate between the first and the second  tanks
is represented  \textbf{R} component labelled $k$. The constitutive relationship is assumed
linear of the form:
\begin{equation}
  \text{flow} = f = k \Delta  = \text{pressure drop}
\end{equation}

The system has two inputs:
\begin{equation}
  \begin{aligned}
    u_1 &= \text{input pressure at left-hand pipe} \\
    u_2 &= \text{input pressure at right-hand pipe} 
  \end{aligned}
\end{equation}
and two outputs:
\begin{equation}
  \begin{aligned}
    y_1 &= p_1 = \text{pressure at left-hand tank} \\
    y_2 &= p_2 = \text{pressure at right-hand tank} 
  \end{aligned}
\end{equation}
The system transfer-function matrix is given by:
\begin{equation}
  \begin{aligned}
G_{11} = G_{22} &= \frac{(s + k + 1)}{(s^2 + 2 s {(k + 1)} + 2 k + 1)}\\
G_{12} = G_{21} &= \frac{k}{(s^2 + 2 s {(k + 1)} + 2 k + 1)}
\end{aligned}
\end{equation}

However, Figure \Ref{iTanks_abg} shows the causality of the
\textbf{SS} components to \emph{invert} the system with respect to its
inputs and outputs. Figure \Ref{fig:iTanks_cbg.ps} shows the causally
complete bond graph; this system has no dynamic components in integral
causality -- the inverse has no poles and therefore the system has no
zeros.

Some further representations of the inverse appear in the following
sections.


Deleted mttroot/mtt/lib/examples/Inverse/iTanks/iTanks_lbl.txt version [51b222a0af].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY iTanks: Inversion of a two-tanks system
%DESCRIPTION This inverse system has no poles thus
%DESCRIPTION the system itself has no (multivariable) zeros
%% Label file for system iTanks (iTanks_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type SS
	u1		SS	external,internal
	u2		SS	external,internal
	y1		SS	external,0
	y2		SS	external,0

Deleted mttroot/mtt/lib/examples/Inverse/iTanks/iTanks_rep.txt version [a71249d1e5].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system iTanks (iTanks_rep.txt)
# Generated by MTT on" Wed Nov 18 10:44:55 GMT 1998.

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

mtt iTanks abg tex			# The system description
mtt iTanks cbg ps 		        # The causal bond graph
# Uncomment the following lines or add others
 mtt iTanks struc tex	        # The system structure
# mtt iTanks dae tex	        # The system dae
# mtt iTanks ode tex	        # The system ode 
# mtt iTanks sspar tex		# Steady-state parameters
# mtt iTanks ss tex 		# Steady state
mtt iTanks dm tex			# Descriptor matrices (of linearised system)
mtt iTanks tf tex
mtt iTanks lmfr ps		# log modulus of frequency response (of linearised system)
mtt iTanks lpfr ps		# log modulus of frequency response (of linearised system)
# mtt iTanks simpar tex		# Simulation parameters
# mtt iTanks numpar tex		# Numerical simulation parameters
# mtt iTanks input tex		# Simulation input
# mtt iTanks odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/ROD_abg.fig version [81af279f2a].

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
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
123



























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 4950 2700 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5850 4950 5850 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 4950 8550 5400
4 1 -1 0 0 0 20 0.0000000 4 210 150 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 315 6933 5268 I:J\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000000 4 270 735 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000000 4 240 735 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000000 4 210 1170 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1170 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000000 4 210 1155 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1155 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000000 4 210 150 3603 5313 0\001
4 1 26 0 0 0 16 0.0000000 4 195 330 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 330 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 570 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000000 4 210 990 4681 5266 INTF:th\001
4 1 1 1 0 0 20 0.0000000 4 210 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000000 4 135 195 5580 9990 a\001
4 1 1 1 0 0 20 0.0000000 4 210 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000000 4 195 570 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000000 4 195 570 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000000 4 195 570 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000000 4 195 330 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000000 4 195 330 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000000 4 240 1065 2971 1216 SS:[x_a]\001
4 1 4 0 0 0 20 0.0000000 4 240 1080 2971 9361 SS:[x_b]\001
4 1 4 0 0 0 20 0.0000000 4 270 1065 8372 1217 SS:[y_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 1080 8417 9362 SS:[y_b]\001
4 1 4 0 0 0 20 0.0000000 4 270 1575 5671 1216 SS:[alpha_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 1590 5671 9361 SS:[alpha_b]\001
4 1 1 1 0 0 20 0.0000000 4 270 630 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000000 4 240 1470 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000000 4 270 645 1350 9855 Tip b\001

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/ROD_desc.tex version [740b974979].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system ROD (ROD_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ROD} is
   displayed in Figure \Ref{ROD_abg} and its label
   file is listed in Section \Ref{sec:ROD_lbl}.
   The subsystems are listed in Section \Ref{sec:ROD_sub}.

{\bf ROD} is essentially as described in Figure 10.2 of
``Metamodelling''.

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/ROD_lbl.txt version [1f86f162c8].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	ROD: rigid rod in two dimensions
%DESCRIPTION	Port [alpha_a]:	Angular torque/velocity - end a
%DESCRIPTION	Port [alpha_b]:	Angular torque/velocity - end b
%DESCRIPTION	Port [x_a]:	x force/velocity - end a
%DESCRIPTION	Port [x_b]:	x force/velocity - end b
%DESCRIPTION	Port [y_a]:	y force/velocity - end a
%DESCRIPTION	Port [y_b]:	y force/velocity - end b
%DESCRIPTION
%DESCRIPTION	Parameter 1:	length from end 1 to mass centre
%DESCRIPTION	Parameter 2:	length from end 2 to mass centre
%DESCRIPTION	Parameter 3:	inertia about mass centre
%DESCRIPTION	Parameter 4:	mass
%DESCRIPTION	See Section 10.2 of "Metamodelling"


%% Label file for system ROD (ROD_lbl.txt)



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,$3
m_x	lin	flow,$4
m_y	lin	flow,$4

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,$1
s2	lsin	flow,$2
c1	lcos	flow,$1
c2	lcos	flow,$2


	

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_abg.fig version [b300b8132c].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 2476 4951 2701 5176
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4051 3376 4051 4726 4276 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3781 4726 4276 4726
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2476 4726 2476 5221
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 4951 5626 4951 5401 5176
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6526 4681 6526 5176
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 2250 2475 2250 2700 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 675 4050 2025 4275 1800
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3780 2025 4275 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2475 2025 2475 2520
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4275 2250 5625 2250 5400 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6525 1980 6525 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 2250 7875 2250 7650 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 4950 7875 4950 7650 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8371 3376 7876 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8101 3376 8101 4726 8326 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8326 4726 8326 5221
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8370 675 7875 675
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8100 675 8100 2025 8325 1800
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8325 2025 8325 2520
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 5175 6075 675 6075 675 225 5175 225 5175 6075
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 675 5625 5175 5625
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 11475 6075 6975 6075 6975 225 11475 225 11475 6075
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 6975 5625 11475 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8325 2250 9450 3375 9225 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8325 4950 9450 3825 9225 3825
4 1 -1 0 0 0 20 0.0000000 4 210 150 4051 5041 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 4050 2340 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 780 4050 585 SS:t1s\001
4 1 -1 0 0 0 20 0.0000000 4 210 750 6120 2340 AF:a1\001
4 1 -1 0 0 0 20 0.0000000 4 270 1290 1845 2340 msd:spec1\001
4 1 -1 0 0 0 20 0.0000000 4 270 1290 1846 5041 msd:spec2\001
4 1 -1 0 0 0 20 0.0000000 4 210 780 4051 3286 SS:t2s\001
4 1 -1 0 0 0 20 0.0000000 4 210 750 6121 5041 AF:a2\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8101 5041 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8100 2340 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 660 8100 585 SS:t1\001
4 1 1 1 0 0 20 0.0000000 4 270 1620 2880 5940 Specification\001
4 1 1 1 0 0 20 0.0000000 4 270 900 9270 5940 System\001
4 1 -1 0 0 0 20 0.0000000 4 210 660 8101 3286 SS:t2\001
4 1 -1 0 0 0 20 0.0000000 4 270 1500 9900 3690 twolink:syst\001
4 0 4 0 0 0 20 0.0000000 4 270 1080 9585 3330 [joint_1]\001
4 0 4 0 0 0 20 0.0000000 4 270 1080 9540 4140 [joint_2]\001

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_desc.tex version [81019ef0b9].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system iTwoLink (iTwoLink_desc.tex)
% Generated by MTT on Mon Nov 17 10:42:48 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/01/19 10:08:21  peterg
% %% Added comment about linearisation point
% %%
% %% Revision 1.2  1998/01/19 09:57:26  peterg
% %% Added a discussion of the relevance of G(s).
% %%
% Revision 1.1  1997/12/09  16:53:27  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{iTwoLink} is
   displayed in Figure \Ref{iTwoLink_abg} and its label
   file is listed in Section \Ref{sec:iTwoLink_lbl}.
   The subsystems are listed in Section \Ref{sec:iTwoLink_sub}.

This example illustrates the inversion of  two link manipulator
dynamics using two identical  simple mass-spring-damper systems as
specification systems.

The velocities $\omega_1=\omega_2$ specified by the specification
systems are given in Figure \Ref{fig:iTwoLink_odeso.ps-iTwoLink-t1s}
together with the input defined in Section \Ref{sec:iTwoLink_input.txt}.
The torques $\tau_1$ and $\tau_2$ required to give the these
velocities specified by the specification system are given in Figures
\Ref{fig:iTwoLink_odeso.ps-iTwoLink-t1} and
\Ref{fig:iTwoLink_odeso.ps-iTwoLink-t2} respectively.

The corresponding velocity/torque diagrams for joints 1 and 2 appear in
Figures \Ref{fig:iTwoLink_odeso.ps-iTwoLink-t1s:iTwoLink-t1}
\Ref{fig:iTwoLink_odeso.ps-iTwoLink-t2s:iTwoLink-t2} respectively.
Such diagrams can be used for actuator sizing in terms of torque,
velocity and power.

 
This non-linear system can be linearised (about the various
configurations) and small-signal frequency response methods applied.
For example, the four transfer functions $G_11$ to $G_22$ in Section
\Ref{sec:iTwoLink_tf} (representing the system linearised about zero
angles and velocities), give the small-signal relations between the
two spec. torques and the required system torques. Used together with
$G_31$ and $G_42$ (relating the spec. torques and the joint
velocities) gives, in principle, a method for evaluating actuator
requirements (for small signals) as a function of frequency.

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_input.txt version [7a5043f130].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (iTwoLink_input.txt)
# Generated by MTT at Mon Nov 17 10:40:37 GMT 1997

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

# Set the inputs
u(1) =	1.0 - 2.0*(t>5.0) + 2.0*(t>15.0);; # t1s input torque
u(2) =	1.0 - 2.0*(t>5.0) + (t>15.0); # t2s input torque

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_lbl.txt version [d83014c071].

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








































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY iTwoLink: Inverse of two-link manipulator
%DESCRIPTION Uses the specification system idea to get an ordinary
%DESCRIPTION differential equation inverse.
%% Label file for system iTwoLink (iTwoLink_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/11/17 15:50:45  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%ALIAS INTF	General/INTF

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type AF
	a1		lin	flow,1
	a2		lin	flow,1

% Component type SS
	t1		SS	external,0
	t2		SS	external,0
	t1s		SS	external,external
	t2s		SS	external,external

% Component type msd
	spec1
	spec2

% Component type onelink
	syst

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_numpar.txt version [8f4f09e883].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (iTwoLink_numpar.txt)
# Generated by MTT at Mon Nov 17 10:40:34 GMT 1997

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

# Parameters
d_s = 	1.0; # Parameter d_s for msd
k_s = 	1.0; # Parameter k_s for msd
m_s = 	1.0; # Parameter m_s for msd
j_s = 	1.0; # Parameter j_s for twolink
l = 	1.0; # Parameter l for twolink
m_s = 	1.0; # Parameter m_s for twolink

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_rep.txt version [457e46d061].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system iTwoLink (iTwoLink_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/12/09 16:53:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -c iTwoLink abg tex
mtt -c iTwoLink struc tex
mtt -c iTwoLink simp r
mtt -c iTwoLink dae tex
mtt -c iTwoLink ode tex
mtt -c iTwoLink sspar r
mtt -c iTwoLink sm tex
mtt -c iTwoLink tf tex

mtt -c iTwoLink numpar txt
mtt -c iTwoLink input txt
mtt -c iTwoLink odeso ps  'iTwoLink_t1'
mtt -c iTwoLink odeso ps  'iTwoLink_t2'
mtt -c iTwoLink odeso ps  'iTwoLink_t1s'
mtt -c iTwoLink odeso ps  'iTwoLink_t1s:iTwoLink_t1'
mtt -c iTwoLink odeso ps  'iTwoLink_t2s:iTwoLink_t2'






Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_simp.r version [654a42ab54].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system twolink (twolink_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

END;

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_sspar.r version [d89c4eea57].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for ionelink (ionelink_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mttx1 := 0;
mttx2 := 0;
mttx3 := 0;
mttx4 := 0;
mttx5 := 0;
mttx6 := 0;

END;

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/iTwoLink_state.txt version [49ed77b390].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# State file (iTwoLink_state.txt)
# Generated by MTT at Mon Nov 17 10:40:34 GMT 1997

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

# Initial states
x(1) = 	0.0; # Initial state for iTwoLink_spec1 (spring)
x(2) = 	0.0; # Initial state for iTwoLink_spec1 (inertia)
x(3) = 	0.0; # Initial state for iTwoLink_spec2 (spring)
x(4) = 	0.0; # Initial state for iTwoLink_spec2 (inertia)
x(5) = 	0.0; # Initial state for iTwoLink_syst_rod1_th (3)
x(6) = 	0.0; # Initial state for iTwoLink_syst_rod2_th (3)

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/itwolink_desc.tex version [1a4b6d91b5].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system itwolink (itwolink_desc.tex)
% Generated by MTT on Mon Nov 17 10:42:48 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/01/19 09:57:26  peterg
% %% Added a discussion of the relevance of G(s).
% %%
% Revision 1.1  1997/12/09  16:53:27  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{itwolink} is
   displayed in Figure \Ref{itwolink_abg} and its label
   file is listed in Section \Ref{sec:itwolink_lbl}.
   The subsystems are listed in Section \Ref{sec:itwolink_sub}.

This example illustrates the inversion of  two link manipulator
dynamics using two identical  simple mass-spring-damper systems as
specification systems.

The velocities $\omega_1=\omega_2$ specified by the specification
systems are given in Figure \Ref{fig:itwolink_odeso.ps-itwolink-t1s}
together with the input defined in Section \Ref{sec:itwolink_input.txt}.
The torques $\tau_1$ and $\tau_2$ required to give the these
velocities specified by the specification system are given in Figures
\Ref{fig:itwolink_odeso.ps-itwolink-t1} and
\Ref{fig:itwolink_odeso.ps-itwolink-t2} respectively.

The corresponding velocity/torque diagrams for joints 1 and 2 appear in
Figures \Ref{fig:itwolink_odeso.ps-itwolink-t1s:itwolink-t1}
\Ref{fig:itwolink_odeso.ps-itwolink-t2s:itwolink-t2} respectively.
Such diagrams can be used for actuator sizing in terms of torque,
velocity and power.

 
This non-linear system can be linearised (about the various
configurations) and small-signal frequency response methods applied.
For example, the four transfer functions $G_11$ to $G_22$ in Section
\Ref{sec:itwolink_tf} (representing the system linearised about zero
angles and velocities), give the small-signal relations between the
two spec. torques and the required system torques. Used together with
$G_31$ and $G_42$ (relating the spec. torques and the joint
velocities) gives, in principle, a method for evaluating actuator
requirements (for small signals) as a function of frequency.

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/itwolink_rep.txt version [e6822537da].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system itwolink (itwolink_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -c itwolink abg tex
mtt -c itwolink struc tex
mtt -c itwolink simp r
mtt -c itwolink dae tex
mtt -c itwolink cse tex
mtt -c itwolink ode tex
mtt -c itwolink sspar r
mtt -c itwolink dm tex
mtt -c itwolink sm tex
mtt -c itwolink tf tex
mtt -c itwolink lmfr ps

mtt -c itwolink odes h
mtt -c itwolink numpar txt
mtt -c itwolink input txt
mtt -c itwolink odeso ps  'itwolink_t1'
mtt -c itwolink odeso ps  'itwolink_t2'
mtt -c itwolink odeso ps  'itwolink_t1s'
mtt -c itwolink odeso ps  'itwolink_t1s:itwolink_t1'
mtt -c itwolink odeso ps  'itwolink_t1s:itwolink_t2'
mtt -c itwolink rep txt





Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/msd_abg.fig version [97c8be2457].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 4050 4950 4050 4725 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3825 3600 2700 3825 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 4275 3600 5400 3825 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2250 4050 3375 4050 3150 4275
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6750 6975 6750 1125 900 1125 900 6975 6750 6975
4 1 -1 0 0 0 20 0.0000000 4 210 150 3600 4185 1\001
4 0 -1 0 0 0 20 0.0000000 4 270 1200 5085 4140 R:damper\001
4 1 1 1 0 0 20 0.0000000 4 270 3585 3555 6300 Mass-spring-damper system\001
4 2 4 0 0 0 20 0.0000000 4 240 870 2160 4140 SS:[in]\001
4 1 -1 0 0 0 20 0.0000000 4 210 990 3600 5715 I:inertia\001
4 1 -1 0 0 0 20 0.0000000 4 270 1050 3555 2610 C:spring\001

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/msd_desc.tex version [47aeb1c32d].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system msd (msd_desc.tex)
% Generated by MTT on Thu Nov 13 09:38:17 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{msd} is
   displayed in Figure \Ref{msd_abg} and its label
   file is listed in Section \Ref{sec:msd_lbl}.
   The subsystems are listed in Section \Ref{sec:msd_sub}.


 \textbf{msd} is a simple Mass-Spring-Damper system with collocated
 force and velocity. It is set up to provide a specification system
 for each link of the two-link maipulator. This is appropriate because
 \begin{itemize}
 \item  it has compatible physical behaviour with the system itself,
 \item it specifies two decoupled systems,
 \item it has linear behaviour and
 \item it has a simple performance interpretation in terms of system
   rise-time and overshoot.
 \end{itemize}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/msd_lbl.txt version [4ba1d7187e].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY msd: Simple mass-spring damper
%DESCRIPTION <Detailed description here>
%% Label file for system msd (msd_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type C
	spring		lin	state,k_s

% Component type I
	inertia		lin	flow,m_s

% Component type R
	damper		lin	flow,d_s

% Component type SS
	[in]		SS	external,external

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/oldROD_abg.fig version [81af279f2a].

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
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
123



























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 4278 5403 4953 5178 4953
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5854 5404 6529 6079 6304 6079
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 6078 5403 5403 5403 5628
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 4953 6528 4278 6528 4503
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1
	 4277 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 2702 4277 3827 4052 3827
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 6527 8102 7652 7877 7652
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 7652 4277 6527 4277 6752
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3827 8102 2702 8102 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5852 5177 6527 5177 6392 5312
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 2927 2927 4952 3152 4727
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5402 2927 7427 3152 7202
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2701 5176 2026 5176 2161 5311
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 1351 2926 2476 3196 2206
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 7876 2926 9001 3196 8731
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 2928 8328 4953 8553 4728
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8328 5403 8328 7428 8553 7203
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 1352 8327 2477 8597 2207
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8327 7877 8327 9002 8597 8732
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 1351 5626 4951 5851 4726
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5626 5401 5626 9001 5851 8776
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8551 5176 9226 5176 9091 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 4951 6526 4051 6436 4231
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3826 4996 3826 5356
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 5176 3826 5176 3961 5311
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3826 5401 6301 6301 6121 6301
2 1 0 1 5 -1 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 5401 4051 6301 3826 6301
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 4951 4051 4051 4051 4276
2 1 0 1 5 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5536 5176 5086 5176 5221 5311
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6300 9675 6300 675 4950 675 4950 9675 6300 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 9000 9675 9000 675 7650 675 7650 9675 9000 9675
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11025 10305 11025 225 225 225 225 10305 11025 10305
2 4 0 1 1 7 0 0 -1 0.000 0 0 7 0 0 5
	 3600 9675 2250 9675 2250 675 3600 675 3600 9675
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 2250 990 2250 990 900 10125 900 10125 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 5850 990 5850 990 4500 10125 4500 10125 5850
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 10125 9450 990 9450 990 8100 10125 8100 10125 9450
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2700 4950 2700 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5850 4950 5850 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8550 4950 8550 5400
4 1 -1 0 0 0 20 0.0000000 4 210 150 5628 5268 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 315 6933 5268 I:J\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2927 5312 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2972 2792 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2927 7742 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8328 5313 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8373 2793 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8328 7743 0\001
4 1 -1 0 0 0 20 0.0000000 4 270 735 9676 5266 I:m_y\001
4 1 -1 0 0 0 20 0.0000000 4 240 735 1531 5221 I:m_x\001
4 1 -1 0 0 0 20 0.0000000 4 210 1170 4636 4141 EMTF:c1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1170 4681 6391 EMTF:c2\001
4 1 -1 0 0 0 20 0.0000000 4 210 1155 7156 4141 EMTF:s1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1155 7156 6391 EMTF:s2\001
4 1 5 0 0 0 20 0.0000000 4 210 150 3603 5313 0\001
4 1 26 0 0 0 16 0.0000000 4 195 330 6751 4456 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 6751 3781 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 330 6751 6076 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 6751 6706 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 570 6211 6526 [mod]\001
4 1 5 0 0 0 20 0.0000000 4 210 990 4681 5266 INTF:th\001
4 1 1 1 0 0 20 0.0000000 4 210 210 2925 10035 X\001
4 1 1 1 0 32 20 0.0000000 4 135 195 5580 9990 a\001
4 1 1 1 0 0 20 0.0000000 4 210 210 8280 9990 Y\001
4 2 26 0 0 0 16 0.0000000 4 195 570 3960 4140 [mod]\001
4 2 26 0 0 0 16 0.0000000 4 195 570 6345 4095 [mod]\001
4 2 26 0 0 0 16 0.0000000 4 195 570 3960 6210 [mod]\001
4 1 26 0 0 0 16 0.0000000 4 195 330 4590 4455 [in]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 4545 3780 [out]\001
4 1 26 0 0 0 16 0.0000000 4 195 450 4590 6660 [out]\001
4 0 26 0 0 0 16 0.0000000 4 195 330 4365 6030 [in]\001
4 1 4 0 0 0 20 0.0000000 4 240 1065 2971 1216 SS:[x_a]\001
4 1 4 0 0 0 20 0.0000000 4 240 1080 2971 9361 SS:[x_b]\001
4 1 4 0 0 0 20 0.0000000 4 270 1065 8372 1217 SS:[y_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 1080 8417 9362 SS:[y_b]\001
4 1 4 0 0 0 20 0.0000000 4 270 1575 5671 1216 SS:[alpha_a]\001
4 1 4 0 0 0 20 0.0000000 4 270 1590 5671 9361 SS:[alpha_b]\001
4 1 1 1 0 0 20 0.0000000 4 270 630 1350 2700 Tip a\001
4 1 1 1 0 0 20 0.0000000 4 240 1470 1260 6300 Mass centre\001
4 1 1 1 0 0 20 0.0000000 4 270 645 1350 9855 Tip b\001

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/oldROD_desc.tex version [995adfaa28].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system oldROD (oldROD_desc.tex)
% Generated by MTT on Fri Aug 15 09:53:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/08/15  09:41:19  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{oldROD} is
   displayed in Figure \Ref{oldROD_abg} and its label
   file is listed in Section \Ref{sec:oldROD_lbl}.
   The subsystems are listed in Section \Ref{sec:oldROD_sub}.

{\bf oldROD} is essentially as described in Figure 10.2 of
``Metamodelling''.

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/oldROD_lbl.txt version [0ac94f22b1].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY	oldROD: rigid rod in two dimensions
%DESCRIPTION	Port [alpha_a]:	Angular torque/velocity - end a
%DESCRIPTION	Port [alpha_b]:	Angular torque/velocity - end b
%DESCRIPTION	Port [x_a]:	x force/velocity - end a
%DESCRIPTION	Port [x_b]:	x force/velocity - end b
%DESCRIPTION	Port [y_a]:	y force/velocity - end a
%DESCRIPTION	Port [y_b]:	y force/velocity - end b
%DESCRIPTION
%DESCRIPTION	Parameter 1:	length from end 1 to mass centre
%DESCRIPTION	Parameter 2:	length from end 2 to mass centre
%DESCRIPTION	Parameter 3:	inertia about mass centre
%DESCRIPTION	Parameter 4:	mass
%DESCRIPTION	See Section 10.2 of "Metamodelling"


%% Label file for system oldROD (oldROD_lbl.txt)



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1997/08/15  09:43:06  peterg
% %% Now has lablelled (as opposed to numbered) ports.
% %%
% Revision 1.1  1996/11/07  10:57:17  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Inertias
J	lin	flow,$3
m_x	lin	flow,$4
m_y	lin	flow,$4

%Integrate angular velocity to get angle
th

%Modulated transformers
s1	lsin	flow,$1
s2	lsin	flow,$2
c1	lcos	flow,$1
c2	lcos	flow,$2


	

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/twolink_abg.fig version [4bb685d60b].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 1125 485 485 8550 1125 8730 1575
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 5625 485 485 8550 5625 9035 6110
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3468 1128 3738 1128
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 5625 4502 5627 4277 5852
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 7426 4951 7201
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3472 8647 3742 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4597 8647 4867 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5724 8649 5994 8649
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4730 8645 4730 10220 4955 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5855 8645 5855 10220 6080 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3826 3601 7426 3826 7201
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3826 5851 7426 6076 7201
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 8775 6525 7200 2925 7200 2925 8775 6525 8775
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 6435 6525 4860 2925 4860 2925 6435 6525 6435
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 11250 6525 9675 2925 9675 2925 11250 6525 11250
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 11475 9450 225 180 225 180 11475 9450 11475
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 8622 3600 10197 3825 9972
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 9675 8775 6075 8325 6075 8325 9675 8775 9675
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 2025 2250 4725 2250 4725 2700 4950 2475
4 1 -1 0 0 0 20 0.0000 4 255 810 3603 948 SS:v_x\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4683 5718 0\001
4 1 -1 0 0 0 20 0.0000 4 255 840 3608 10673 SS:F_x\001
4 1 -1 0 0 0 20 0.0000 4 255 840 4733 10673 SS:F_a\001
4 1 -1 0 0 0 20 0.0000 4 255 840 5903 10673 SS:F_y\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 4729 3379 ROD:rod1\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 4731 8196 ROD:rod2\001
4 0 1 1 0 3 20 0.0000 4 210 720 6795 3375 Link 1\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 5760 Joint 2\001
4 0 1 1 0 3 20 0.0000 4 210 720 6750 8190 Link 2\001
4 0 1 1 0 3 20 0.0000 4 270 375 6750 10485 Tip\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 1260 Joint 1\001
4 1 4 0 0 0 16 0.0000 4 210 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5850 2970 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3605 7835 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4730 7835 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5855 7835 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3607 8512 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4733 8513 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5859 8514 [y_b]\001
4 2 4 0 0 0 20 0.0000 4 255 1380 1936 2341 SS:[joint_1]\001
4 2 4 0 0 0 20 0.0000 4 255 1380 1936 5716 SS:[joint_2]\001
4 1 -1 0 0 0 20 0.0000 4 255 810 5808 948 SS:v_y\001

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/twolink_desc.tex version [40badf236c].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system twolink (twolink_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{twolink} is
   displayed in Figure \Ref{twolink_abg} and its label
   file is listed in Section \Ref{sec:twolink_lbl}.
   The subsystems are listed in Section \Ref{sec:twolink_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses two compound components: {\bf ROD} and {\bf
GRAV}.  {\bf ROD} is essentially as described in Figure 10.2 {\bf
GRAV} represents gravity by a vertical accelleration as in Section
10.9 of "Metamodelling"

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Inverse/iTwoLink/twolink_lbl.txt version [d7401fba34].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY twolink: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (twolink_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/12/05  12:39:49  peterg
% %% Documentation
% %%
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - identical rods
rod1	none	l;l;j_s;m_s
rod2	none	l;l;j_s;m_s

%Zero velocity sources
v_x	 SS     internal,0
v_y	 SS	internal,0


%Zero force/torque sources
F_x	SS	   0,internal
F_a	SS	   0,internal
F_y	SS	   0,internal


%Torque at joints
%f_a1	SS external,external
%f_a2	SS external,external

%Gravity
%g

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/CantileverBeam_abg.fig version [fc9a7335dd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1125 2700 2250 2700 2025 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2745 2700 3870 2700 3645 2925
4 1 0 100 0 18 20 1.5708 4 225 675 1035 2700 Free\001
4 1 0 100 0 18 20 1.5708 4 300 3405 2610 2700 BernoulliEuler:Lump*20\001
4 1 0 100 0 18 20 1.5708 4 225 795 4230 2700 Fixed\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/CantileverBeam_desc.tex version [b37e0425c2].

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



























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system CantileverBeam (CantileverBeam_desc.tex)
% Generated by MTT on Mon Apr 19 07:04:54 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/05/18 04:01:50  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The acausal bond graph of system \textbf{CantileverBeam} is displayed in
Figure \Ref{fig:CantileverBeam_abg.ps} and its label file is listed in
Section \Ref{sec:CantileverBeam_lbl}.  The subsystems are listed in Section
\Ref{sec:CantileverBeam_sub}.
   
This example represents the dynamics of a uniform beam with one fixed
and one free end.  The beam is approximated by 20 equal lumps using
the Bernoulli-Euler approximation with damping. 
The input is the angular velocity of the fixed end, the output is the
linear velocity of the free end.

The system parameters are given in Section
\Ref{sec:CantileverBeam_numpar.tex}. Note that the numer of ban
segments has been set to 21. 

 The system has 20 states (10
modes of vibration), 1 inputs and 1 outputs.

The first 5 vibration frequencies are given in Table \ref{tab:freq}
togtherr with the theoretical (based on the Bernoulli-Euler beam with
the same values of $EI$ and $\rho A$. 
\begin{table}[htbp]
  \begin{center}
    \begin{tabular}{||l|l|l||}
      \hline
      \hline
      Mode & Frequency & Theoretical frequency\\
      \hline
      1 &  76.14 &  76.14\\
      2 & 477.11 & 484.50\\
      3 &1330.62 &1334.55\\
      4 &2586.77 &2617.19\\
      5 &4225.14 &4323.77\\
       \hline
      \hline
    \end{tabular}
    \caption{Mode frequencies (rad $s^{-1}$)}
    \label{tab:freq}
  \end{center}
\end{table}





Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/CantileverBeam_input.txt version [8977885a4e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (CantileverBeam_input.txt)
# Generated by MTT at Thu Apr 22 00:12:54 BST 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the inputs
mttu(1) = exp(-t/0.1); 	# tau (CantileverBeam)

# Set the switches

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/CantileverBeam_lbl.txt version [948cc2e88c].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system CantileverBeam (CantileverBeam_lbl.txt)
%SUMMARY CantileverBeam
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%VAR n
%VAR BeamLength
%VAR BeamWidth
%VAR BeamThickness
%VAR Youngs
%VAR Density
%VAR Area
%VAR AreaMoment
%VAR EI
%VAR rhoA
%VAR k

% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type BernoulliEuler
	Lump

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/CantileverBeam_numpar.txt version [1d4fbd0634].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (CantileverBeam_numpar.txt)
# Generated by MTT at Mon Apr 19 06:24:08 BST 1999

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

# Parameters
N = 21;
BeamLength = 0.58;
BeamWidth = 0.05;
BeamThickness = 0.005;
Youngs = 68.94e9;
Density =  2712.8;
Area = BeamWidth*BeamThickness;
AreaMoment = (BeamWidth*BeamThickness^3)/12;

EI = Youngs*AreaMoment;
rhoA = Density*Area;

dz = BeamLength/N;		# Incremental length
dm = rhoA*dz;			# Incremental mass
dk = EI/dz;			# Incremental stiffness
dr = 0;				# Damping

K = sqrt(EI/rhoA)/BeamLength^2;	# Normalising factor


# EI= 58.6957			# from Reza
# rhoA= 0.7989			# from Reza
 







Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/CantileverBeam_rep.txt version [f61fd41422].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system CantileverBeam (CantileverBeam_rep.txt)
## Generated by MTT on" Mon Apr 19 06:43:08 BST 1999.

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

mtt CantileverBeam abg tex			# The system description
## mtt CantileverBeam cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt CantileverBeam struc tex	        # The system structure
## mtt CantileverBeam dae tex	        # The system dae
## mtt CantileverBeam ode tex	        # The system ode 
## mtt CantileverBeam sspar tex		# Steady-state parameters
## mtt CantileverBeam ss tex 		# Steady state
## mtt CantileverBeam dm tex		# Descriptor matrices (of linearised system)
## mtt CantileverBeam sm tex		# State matrices (of linearised system)
## mtt CantileverBeam tf tex		# Transfer function (of linearised system)
mtt CantileverBeam simpar tex		# Simulation parameters
mtt CantileverBeam numpar tex		# Numerical simulation parameters
## mtt CantileverBeam input tex		# Simulation input
## mtt CantileverBeam odeso ps		# Simulation output
mtt CantileverBeam lmfr ps		# log modulus of frequency response (of linearised system)

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/CantileverBeam_simpar.txt version [bbb93af30e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system CantileverBeam (CantileverBeam_simpar.txt)
# Generated by MTT on Mon Apr 19 06:32:42 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 1.0;       # Last time in simulation
DT          = 0.001;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = 1;         # Minimum frequency = 10^WMIN
WMAX        = 4;          # Maximum frequency = 10^WMAX
WSTEPS      = 200;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/Fixed_abg.fig version [e0ba4ffe54].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 1800 5400 1800 5175 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4230 2700 5355 2700 5130 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 1575 5400 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 2475 5400 2925
4 0 0 100 0 18 20 0.0000 4 225 1065 5625 1890 Sf:zero\001
4 0 0 100 0 18 20 0.0000 4 225 585 5625 2790 Sf:u\001
4 2 4 100 0 18 20 0.0000 4 300 1230 4140 1890 SS:[y_in]\001
4 2 4 100 0 18 20 0.0000 4 300 1785 4140 2790 SS:[theta_in]\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/Fixed_lbl.txt version [8de3fd38c9].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Fixed (Fixed_lbl.txt)
%SUMMARY Fixed
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	y_in,theta_in

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[theta_in]	SS		external,external
	[y_in]		SS		external,external

% Component type Sf
	u		SS		external
	zero		SS		0

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/Free_abg.fig version [6e75a503c3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 1800 5400 1800 5175 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4230 2700 5355 2700 5130 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 1575 5400 2025
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5400 2475 5400 2925
4 2 0 100 0 18 20 0.0000 4 300 585 4140 1890 Df:y\001
4 2 0 100 0 18 20 0.0000 4 225 1125 4140 2790 Se:zero\001
4 0 4 100 0 18 20 0.0000 4 300 1440 5490 1890 SS:[y_out]\001
4 0 4 100 0 18 20 0.0000 4 300 1995 5445 2790 SS:[theta_out]\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/Free_lbl.txt version [623dab72b6].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Free (Free_lbl.txt)
%SUMMARY Free
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	out	y_out,theta_out

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type Df
	y	SS	external

% Component type SS
	[theta_out]	SS		external,external
	[y_out]		SS		external,external

% Component type Se
	zero		SS		0


Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/CantileverBeam/frequencies.m version [2bba72298d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [w_r,w_a,n_null] = frequencies (A,B,C,D)

  ## usage:  [w_r,w_a] = frequencies (A,B,C,D)
  ##
  ## Resonant and antiresonant frequencies for undampled beam

  poles = eig(A);
  Np = length(poles);
  zeros = tzero(A,B,C,D);
  Nz = length(zeros);
  w_r = sort(imag(poles)); w_r = w_r(Np/2+1:Np);
  w_a = sort(imag(zeros)); w_a = nozeros(w_a(Nz/2+1:Nz))';
  n_null = (Nz/2-length(w_a))*2;
endfunction

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/Fixed_lbl.txt version [8de3fd38c9].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Fixed (Fixed_lbl.txt)
%SUMMARY Fixed
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	y_in,theta_in

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[theta_in]	SS		external,external
	[y_in]		SS		external,external

% Component type Sf
	u		SS		external
	zero		SS		0

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/Free_lbl.txt version [623dab72b6].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Free (Free_lbl.txt)
%SUMMARY Free
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	out	y_out,theta_out

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type Df
	y	SS	external

% Component type SS
	[theta_out]	SS		external,external
	[y_out]		SS		external,external

% Component type Se
	zero		SS		0


Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/MakeFreqTable.m version [71cecf4031].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# ## Makes the table of resonant frequencies

# ## Actual resonant freqs
# fr_measured = [
# 	2.0683e+01
# 	7.5310e+01
# 	1.7080e+02
# 	3.0532e+02
# 	4.7414e+02];

# fa_measured = [
# 	 2.0896e+01
# 	 7.6867e+01
# 	 1.7794e+02
# 	 3.1890e+02
# 	 4.8768e+02];

## Parameters - ideal pinned beam
PinnedBeam_numpar;

## Ideal pinned beam - theory
[fr_theory] = beam_frequencies("pinned",ei,rhoa,beamlength)/(2*pi);
[fa_theory] = beam_frequencies("clamped-pinned",ei,rhoa,beamlength)/(2*pi);

## SM form to get poles and zeros of the model
# ## Ideal pinned
# [A,B,C,D] = PinnedBeam_sm;
# fr_model_ideal  = frequencies(A,B,C,D)/(2*pi);

# ## Actual with non-ideal pins 
# PinnedBeam_numpar;

[A,B,C,D] = PinnedBeam_sm;

[w_r, w_a]  = frequencies(A,B,C,D);
fr_model = w_r/(2*pi);
fa_model = w_a/(2*pi);


printf("\nIndex \t& Theory   \t& Model \t& Theory  \t& Model \\\\ \n");
printf("\\hline\n");
for i = 1:5
  printf("%i \t& %3.2f \t& %3.2f \t& %3.2f  \t& %3.2f\\\\ \n", i, \
	 fr_theory(i), fr_model(i), fa_theory(i), fa_model(i));
endfor

# printf("\nMode \t& Theory   \t& Model(ideal) \t& Model  \t& Actual \\\\ \n");
# printf("\\hline\n");
# for i = 1:5
#   printf("%i \t& %3.2f \t& %3.2f \t& %3.2f  \t& %3.2f\\\\ \n", i, fr_theory(i), \
# 	 fr_model_ideal(i), fr_model(i), fr_measured(i));
# endfor
	 
# printf("\nMode  \t& Theory  \t& Model  \t& Actual \\\\ \n");
# printf("\\hline\n");
# for i = 1:5
#   printf("%i \t& %3.2f \t& %3.2f \t& %3.2f \\\\ \n", i, fa_theory(i), fa_model(i), fa_measured(i));
# endfor
	





Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/PinnedBeam_abg.fig version [624a6ece3a].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2925 1980 3015 2520
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2970 2025 2970 2475
-6
6 4005 2880 4095 3420
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 4050 2925 4050 3375
-6
6 8955 1980 9045 2520
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 9000 2025 9000 2475
-6
6 7830 2880 7920 3420
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 7875 2925 7875 3375
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4770 2700 5895 2700 5670 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6300 2700 7425 2700 7200 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2970 2250 4095 2250 3870 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2925 3150 4050 3150 3825 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7875 2250 9000 2250 8775 2475
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 7875 3150 9000 3150 8775 3375
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 1125 225 1125 5400 10800 5400 10800 225 1125 225
4 1 0 100 0 18 20 1.5708 4 360 3855 4635 2700 BernoulliEuler:LumpL\001
4 1 0 100 0 18 20 1.5708 4 360 4170 6165 2700 BernoulliEuler:Lump*18\001
4 1 0 100 0 18 20 1.5708 4 360 3885 7740 2700 BernoulliEuler:LumpR\001
4 2 4 100 0 18 14 0.0000 4 210 585 3915 2070 [y_in]\001
4 2 4 100 0 18 14 0.0000 4 210 990 3915 2970 [theta_in]\001
4 0 4 100 0 18 14 0.0000 4 210 735 7965 1980 [y_out]\001
4 0 4 100 0 18 14 0.0000 4 210 1140 7965 2970 [theta_out]\001
4 2 0 100 0 18 20 0.0000 4 285 1230 2835 3285 SS:ssL\001
4 0 0 100 0 18 20 0.0000 4 285 1515 9135 2385 Sf:zeroR\001
4 0 0 100 0 18 20 0.0000 4 285 1260 9135 3285 SS:ssR\001
4 2 0 100 0 18 20 0.0000 4 285 1485 2835 2385 Sf:zeroL\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/PinnedBeam_desc.tex version [81085b5b72].

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
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





































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system PinnedBeam (PinnedBeam_desc.tex)
% Generated by MTT on Mon Apr 19 07:04:54 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1999/11/24 22:17:26  peterg
% %% Updated to correspond to Reza's beam
% %%
% %% Revision 1.1  1999/10/11 05:08:14  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1999/05/18 04:01:50  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The acausal bond graph of system \textbf{PinnedBeam} is displayed in
Figure \Ref{fig:PinnedBeam_abg.ps} and its label file is listed in
Section \Ref{sec:PinnedBeam_lbl}.  The subsystems are listed in Section
\Ref{sec:PinnedBeam_sub}.
   
This example represents the dynamics of a uniform beam with two pinned
ends. The left-hand end is driven by a torque input and the
corresponding collocated angular velocity is measured.  The beam is
approximated by 20 equal lumps using the Bernoulli-Euler.  Because the
two end lumps have different causality to the rest of the beam lumps,
they are represented seperately.  The system has 40 states (20 modes
of vibration), 1 input and 1 output.

\begin{table}[htbp]
  \begin{center}
    \begin{tabular}{|l|l|}
      \hline
      Name & Value\\
      \hline
      Beam Length, $L$       & 0.60 m\\
      Beam Width $w$             & 0.05 m\\
      Beam Thickness $t_b$   & 0.003\\
      Young's Modulus  $E$       & $68.94 \times 10^9$ \\
      Density          $\rho$    & 2712.8\\
      \hline
      Derived quantities & \\
      \hline
      $EI$                     & 7.76\\
      $\rho A$   & 0.40692 \\
      \hline
    \end{tabular}
    \caption{Beam parameters}
    \label{tab:beam}
  \end{center}
\end{table}


The beam was made of aluminium with physical dimensions and constants
given in Table \ref{tab:beam}. The derived beam constants are given by the
formulae:
\begin{equation}
  \label{eq:formulae}
  \begin{align}
    EI &= E \times w \frac{1}{12} t_b^3\\
    \rho A &= \rho \times w t_b
  \end{align}
\end{equation}

The system parameters are also given in Section
\Ref{sec:PinnedBeam_numpar.tex}.


\begin{table}[htbp]
  \begin{center}
    \begin{tabular}{||l|l|l|l|l||}
      \hline
      \hline
Index   & $f_r$ (theory) & $f_r$ (model)& $f_a$ (theory) & $f_a$ (model) \\ 
\hline
1       & 19.05         & 19.01         & 29.72         & 31.28\\ 
2       & 76.24         & 75.57         & 96.50         & 100.80\\ 
3       & 171.58        & 168.29        & 200.73        & 208.20\\ 
4       & 304.76        & 294.89        & 344.13        & 350.88\\ 
5       & 476.34        & 452.25        & 524.98        & 525.23\\ 
      \hline
      \hline
    \end{tabular}
    \caption{Resonant and anti-resonant frequencies (Hz)}
    \label{tab:freq}
  \end{center}
\end{table}

Standard modal analysis give the theoretical system resonant
frequencies $f_r$ (based on the Bernoulli-Euler beam with the same values of
$EI$ and $\rho A$). The system anti-resonances $f_a$ correspond to those of
the \emph{inverse} system with reversed causality, that the driven
pinned end is replaced by a clamped end; again modal analysis of the
inverse system gives the system anti resonances. The model and
theoretical values are compared in Table \ref{tab:freq} for the first
5 modes. (This table was generated using the script MakeFreqTable.m)

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/PinnedBeam_input.txt version [35ed139acb].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (PinnedBeam_input.txt)
# Generated by MTT at Thu Apr 22 00:12:54 BST 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the inputs
mttu(1) = exp(-t/0.1); 	# tau (PinnedBeam)

# Set the switches

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/PinnedBeam_lbl.txt version [4d75aaf12d].

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




















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system PinnedBeam (PinnedBeam_lbl.txt)
%SUMMARY PinnedBeam
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/10/11 05:08:22  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%VAR n
%VAR BeamLength
%VAR BeamWidth
%VAR BeamThickness
%VAR Youngs
%VAR Density
%VAR Area
%VAR AreaMoment
%VAR EI
%VAR rhoA
%VAR k

% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type BernoulliEuler
	Lump
	LumpL
	LumpR

% Component type SS
	ssL	SS		external,external
	ssR	SS		0,internal

% Component type Sf
	zeroL	 none		0
	zeroR	 none		0


Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/PinnedBeam_numpar.txt version [a5c9be85bc].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (pPinnedBeam_numpar.txt)
# Generated by MTT at Mon Apr 19 06:24:08 BST 1999

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

## Number of lumps
Lumps = 20;			# Number of lumps

## Beam physical parameters
BeamLength = 0.60;
BeamWidth  = 0.05;
BeamThickness = 0.003;
Youngs = 68.94e9;
Density =  2712.8;
Area = BeamWidth*BeamThickness;
AreaMoment = (BeamWidth*BeamThickness^3)/12;
EI = Youngs*AreaMoment;
rhoA = Density*Area;

## Segments
dz = BeamLength/Lumps;	        # Incremental length
dm = rhoA*dz;			# Incremental mass
dk = EI/dz;			# Incremental stiffness
dr = 0;				# Damping

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/PinnedBeam_rep.txt version [b3b35e35ca].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system PinnedBeam (PinnedBeam_rep.txt)
## Generated by MTT on" Mon Apr 19 06:43:08 BST 1999.

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

mtt PinnedBeam abg tex			# The system description
## mtt PinnedBeam cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt PinnedBeam struc tex	        # The system structure
## mtt PinnedBeam dae tex	        # The system dae
## mtt PinnedBeam ode tex	        # The system ode 
## mtt PinnedBeam sspar tex		# Steady-state parameters
## mtt PinnedBeam ss tex 		# Steady state
## mtt PinnedBeam dm tex		# Descriptor matrices (of linearised system)
## mtt PinnedBeam sm tex		# State matrices (of linearised system)
## mtt PinnedBeam tf tex		# Transfer function (of linearised system)
mtt PinnedBeam simpar tex		# Simulation parameters
mtt PinnedBeam numpar tex		# Numerical simulation parameters
## mtt PinnedBeam input tex		# Simulation input
## mtt PinnedBeam odeso ps		# Simulation output
mtt PinnedBeam lmfr ps		# log modulus of frequency response (of linearised system)

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/Beams/PinnedBeam/PinnedBeam_simpar.txt version [3f7404ca28].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system PinnedBeam (PinnedBeam_simpar.txt)
# Generated by MTT on Mon Apr 19 06:32:42 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 1.0;       # Last time in simulation
DT          = 0.01;        # Print interval
STEPFACTOR  = 10;          # Integration steps per print interval
WMIN        = 1;         # Minimum frequency = 10^WMIN
WMAX        = 4;          # Maximum frequency = 10^WMAX
WSTEPS      = 200;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/MacroMicro/MacroMicro_abg.fig version [7358b66296].

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
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
123
124
125
126
127
128
129
130
131
132




































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Inches
1200 2
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2706 4806 3606 4806 3456 4956
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2406 5106 2406 6006 2556 5856
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3906 5106 3906 6006 4056 5856
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7208 4808 8108 4808 7958 4958
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8708 4808 9608 4808 9458 4958
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8408 5108 8408 6008 8558 5858
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7208 4508 8108 3608 8108 3833
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8708 3608 9608 4508 9383 4508
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9909 5109 9909 6009 10059 5859
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6908 5108 6908 6008 7058 5858
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 8405 2405 8405 3305 8555 3155
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11407 5107 11407 6007 11557 5857
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11406 3306 11406 2406 11556 2556
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4206 4806 5106 4806 4956 4956
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5406 5106 5406 6006 5556 5856
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4206 4506 5106 3606 5106 3831
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5405 3305 5405 2405 5555 2555
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2405 3305 2405 2405 2555 2555
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11707 4807 12607 4807 12457 4957
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11707 3607 12607 4507 12382 4507
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2105 1805 2105 905 2255 1055
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2705 1805 2705 905 2855 1055
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5706 4806 6606 4806 6456 4956
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5706 3606 6606 4506 6381 4506
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2704 3604 3604 4504 3379 4504
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1208 4808 2108 4808 1958 4958
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1208 4508 2108 3608 2108 3833
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 681 3606 1131 3606
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 906 4506 906 3606 1056 3756
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12905 4505 12905 3605 13055 3755
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10207 4807 11107 4807 10957 4957
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10207 4507 11107 3607 11107 3832
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8400 3300 8625 3300
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 12900 3600 13125 3600
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 12675 3600 12900 3600
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8175 3300 8400 3300
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 1501 5401 301 5401 301 3001 1501 3001 1501 5401
2 2 1 2 1 7 1 0 -1 6.000 1 0 0 0 0 5
	 1502 452 3302 452 3302 3377 1502 3377 1502 452
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 4501 6601 3301 6601 3301 3901 4501 3901 4501 6601
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 6000 6600 4800 6600 4800 1800 6000 1800 6000 6600
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 7501 6601 6301 6601 6301 3901 7501 3901 7501 6601
2 4 1 2 1 7 2 0 -1 6.000 0 0 7 0 0 5
	 9000 6600 7800 6600 7800 1800 9000 1800 9000 6600
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 10501 6601 9301 6601 9301 3901 10501 3901 10501 6601
2 4 1 2 1 -1 1 0 -1 6.000 0 0 7 0 0 5
	 12000 6600 10800 6600 10800 1800 12000 1800 12000 6600
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 13501 5401 12301 5401 12301 3001 13501 3001 13501 5401
4 1 -1 0 0 0 20 0.0000000 4 210 150 2406 4881 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 585 3906 6381 I:m1\001
4 1 -1 0 0 0 20 0.0000000 4 210 585 2405 6380 R:b1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2405 3680 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 3906 4881 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8408 4883 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 8408 3683 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 585 8483 6383 R:b3\001
4 1 -1 0 0 0 20 0.0000000 4 210 675 8407 2182 SS:f2\001
4 1 -1 0 0 0 20 0.0000000 4 210 585 9906 6381 I:m3\001
4 1 -1 0 0 0 20 0.0000000 4 210 585 6905 6380 I:m2\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 11407 4882 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 11407 3682 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 525 11406 2181 C:kt\001
4 1 -1 0 0 0 20 0.0000000 4 210 525 11482 6382 R:bt\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 5406 4881 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 5406 3681 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 585 5481 6381 R:b2\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 12909 4884 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 6908 4883 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 2404 2179 1\001
4 1 -1 0 0 0 20 0.0000000 4 270 585 2779 754 C:p1\001
4 1 -1 0 0 0 20 0.0000000 4 210 585 2104 754 R:d1\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 910 4885 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 675 902 3377 SS:fb\001
4 1 -1 0 0 0 20 0.0000000 4 210 615 12905 3380 SS:ft\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 9909 4884 1\001
4 1 -1 0 0 0 20 0.0000000 4 210 585 5405 2180 C:k2\001
4 1 1 1 0 3 20 0.0000000 4 240 1530 3901 6901 Macro mass\001
4 1 1 1 0 3 20 0.0000000 4 240 1800 2401 376 Macro control\001
4 1 1 1 0 3 20 0.0000000 4 240 1455 900 5700 Macro base\001
4 1 1 1 0 3 20 0.0000000 4 270 1890 5400 1650 Compliant link\001
4 1 1 1 0 3 20 0.0000000 4 240 1470 6901 6901 Micro mass\001
4 1 1 1 0 3 20 0.0000000 4 240 1890 8475 1650 Micro actuator\001
4 1 1 1 0 3 20 0.0000000 4 270 1125 9901 6901 Tip mass\001
4 1 1 1 0 3 20 0.0000000 4 270 2985 11400 1650 Compliant environment\001
4 1 1 1 0 3 20 0.0000000 4 270 1305 12901 5701 Tip sensor\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/MacroMicro/MacroMicro_desc.tex version [3e936ec3d0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system MacroMicro (MacroMicro_desc.tex)
% Generated by MTT on Tue Dec 9 17:55:41 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{MacroMicro} is
   displayed in Figure \Ref{MacroMicro_abg} and its label
   file is listed in Section \Ref{sec:MacroMicro_lbl}.
   The subsystems are listed in Section \Ref{sec:MacroMicro_sub}.

This is a Bond Graph model of the macro-micro manipulation system
discussed by Sharon in his thesis and BY Sharon, Hogan and Hardt in
various papers.

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/MacroMicro/MacroMicro_lbl.txt version [eda41e1822].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file (macmic_lbl.txt)
%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Masses
m1	lin	flow,m_1
m2	lin	flow,m_2
m3	lin	flow,m_3

%Springs
k2	lin	state,k_2
kt	lin	state,k_t

%Dampers
b1	lin	flow,b_1
b2	lin	flow,b_2
b3	lin	flow,b_3
bt	lin	flow,b_t

%Source/sensors
f2	SS	external,internal
ft	SS	external,0
fb	SS	internal,0

%Control
p1	lin	flow,p_1
d1	lin	flow,d_1



Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/MacroMicro/MacroMicro_numpar.txt version [d5d101b825].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-

m_1 = 0.0169;		# m_1;
m_2 = 0.0169;		# m_2;
b_1 = 0.13;		# b_1;
b_2 = 0.013;		# b_2;
k_2 = 24;	        # k_2;
k_t = 150;		# k_t;
b_t = 0.16;		# b_t;
b_3 = 0.13;		# b_3;
m_3 = 0.005;		# m_3;
p_1 = 10;		# p_1;
d_1 = 0.9;		# d_1;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/MacroMicro/MacroMicro_rep.txt version [420def6255].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system MacroMicro (MacroMicro_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt MacroMicro abg tex
mtt MacroMicro cbg ps
mtt MacroMicro struc tex
mtt MacroMicro dae tex
mtt MacroMicro dm tex
mtt MacroMicro tf tex
mtt MacroMicro numpar txt
mtt MacroMicro lmfr ps 
mtt MacroMicro sro ps 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/MacroMicro/MacroMicro_simpar.txt version [479d1e287e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system MacroMicro (MacroMicro_simpar.txt)
# Generated by MTT on Thu Nov 9 15:19:17 GMT 2000.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


FIRST        = 0.0;       # First time in simulation output
DT          = 0.01;        # Print interval
LAST        = 1.0;       # Last time in simulation
STEPFACTOR  = 10;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/MacroMicro/MacroMicro_state.txt version [7abde731cb].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System MacroMicro, representation state, language txt; 
## File MacroMicro_state.txt; 
## Generated by MTT on Thu Nov  9 15:19:28 GMT 2000; 


MacroMicro_k2	= 0.0; # Default
MacroMicro_kt	= 0.0; # Default
MacroMicro_m1	= 0.0; # Default
MacroMicro_m2	= 0.0; # Default
MacroMicro_m3	= 0.0; # Default
MacroMicro_p1	= 0.0; # Default

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_abg.fig version [6195b18731].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
0 32 #969296
0 33 #e7e7cf
0 34 #9e9a9e
0 35 #cf9200
0 36 #f761ae
0 37 #7171ff
0 38 #595d59
1 3 0 3 1 7 55 0 -1 0.000 1 0.0000 1845 2430 186 186 1845 2430 2031 2430
2 2 0 1 1 7 55 0 47 0.000 0 0 -1 0 0 5
	 1800 2475 4500 2475 4500 2925 1800 2925 1800 2475
2 1 0 3 1 7 55 0 -1 0.000 0 0 -1 0 0 2
	 1830 2467 3180 129
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 5625 4725 5625 4500 5850
2 1 0 3 1 7 55 0 -1 0.000 0 0 -1 0 0 12
	 4453 2442 4177 1964 3884 2024 4282 1579 3700 1707 4103 1268
	 3521 1396 3914 946 3337 1077 3749 632 3445 696 3158 215
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2925 5625 1575 5625 1800 5850
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 5400 3150 4050 3375 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 7200 3150 5850 3375 6075
4 1 1 55 0 32 30 0.0000 4 315 240 2385 2295 q\001
4 0 1 55 0 3 30 0.0000 4 300 270 2025 1260 L\001
4 0 1 55 0 3 30 0.0000 4 300 270 3105 3510 L\001
4 1 1 55 0 32 30 0.0000 4 225 195 1530 2250 t\001
4 1 0 100 0 18 18 0.0000 4 195 150 3150 5715 1\001
4 1 0 100 0 18 18 0.0000 4 210 390 3195 3915 R:r\001
4 1 4 100 0 18 18 0.0000 4 270 930 3060 7515 SS:[yu]\001
4 1 0 100 0 18 18 0.0000 4 270 240 1305 5715 I:j\001
4 0 0 100 0 18 18 0.0000 4 270 8610 4860 5715 C:k:mtt_e=k*(l^2)*cos(mtt_f/2)*2*(sin(mtt_f/2)-sin(alpha/2))+0*eta\001
4 0 1 101 0 3 20 0.0000 4 270 3255 4950 675 Rod (length L) hinged at left\001
4 0 1 101 0 3 20 0.0000 4 270 4275 4950 1125 Spring (stiffness k) unstretched when \001
4 0 1 101 0 32 20 0.0000 4 210 510 9225 1125 q=a\001
4 0 1 101 0 3 20 0.0000 4 270 3120 4950 1575 eta is the equilibrium angle\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_desc.tex version [84c725288d].

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
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
123
124
125
126
127































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system NonlinearMSD (NonlinearMSD_desc.tex)
% Generated by MTT on Thu Mar 7 14:48:47 GMT 2002.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 09:13:38  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This example illustrates the use of \textbf{MTT} to \emph{linaerise} a
nonlinear system -- a non-linear mass-spring-damper system called
\textbf{NonlinearMSD}. The model is considered in Section
\ref{sec:model} and linearisation in Section \Ref{sec:linearisation}.

Further work is suggested in Section \Ref{sec:further}.

\subsection{Bond Graph model}\label{sec:model}

The schematic diagram  of the system
\textbf{NonlinearMSD} is displayed in Figure
\ref{fig:NonlinearMSD_abg.ps}. The system comprises
\begin{itemize}
\item a rigid foundation,
\item a rod of length $L$ hinged at the left-hand end and
\item a linear spring of stiffness $k$ attached to the rigid
  foundation a distance $L$ from the hinge and to the free end of the rod.
\end{itemize}
The spring is unstretched when the rod makes an angle $\theta = \alpa
= \frac{pi}{3}$ with the foundation.

Using elementary geometry, the effectice angular spring generates a
torque $\tau$ given by (\ref{eq:spring})
\begin{equation}\label{eq:spring}
  \tau = -2kl^2 \cos{\frac{\theta}{2}} (\sin{\frac{\theta}{2}}-\sin{\frac{\alpha}{2}})
\end{equation}

The acausal bond graph of system \textbf{NonlinearMSD} is also
displayed in Figure \Ref{fig:NonlinearMSD_abg.ps}. This shows the
three bond graph components representing the friction \textbf{R}, the
inertia \textbf{I} and the spring \textbf{C} components. The
non-linear spring characteristic is given explicitly\footnote{The
  additional 0*eta term has no effect - it merely introduced the
  variable $\eta$ -- the equilibrium angle -- into the model}.

The (nonlinear) system ordinary differential equation is given by
\textbf{MTT} in Section \Ref{sec:NonlinearMSD_ode.tex}. This is a
special case of the general non-linear ordinary differential equation:
\begin{equation}
  \label{eq:non-state}
  \begin{cases}
    \dot{x} = f(x,u)\\
    y = g(x,u)
  \end{cases}
\end{equation}

\subsection{Linearisation}
\label{sec:linearisation}

The first step in linearisation is to determine a set of (constant)
states $x_e$ and (constant) inputs $u_e$ so that the system is in
equilibrium - that is
\begin{equation}
  \label{eq:eqilibrium}
 \dot{x} = f(x_e,u_e) = 0
\end{equation}

In this case, choosing an angle $\theta=\eta$ and an input:
\begin{equation}\label{eq:u_e}
  u_e = -\tau = 2kl^2 \cos{\frac{\eta}{2}} (\sin{\frac{\eta}{2}}-\sin{\frac{\alpha}{2}})
\end{equation}
together with zero velocity gives an equilibrium.

With this choice
The linearised system is given in terms of the $A$, $B$, $C$ and $D$
matrices appearing in the state equation:
\begin{equation}
  \label{eq:state}
  \begin{cases}
    \dot{x} = Ax + Bu\\
    y = Cx + Du
  \end{cases}
\end{equation}

\textbf{MTT} automatically generates these matrices -- see Section
\Ref{sec:NonlinearMSD_sm.tex}.

\subsection{Further work}
\label{sec:further}
\begin{enumerate}
\item Derive the system ordinary differential equation appearing in
  Section \Ref{sec:NonlinearMSD_ode.tex}.
\item Explain how the input of (\ref{eq:u_e}) gives equilibrium for
  all $\eta$.
\item Explain how the elements of the $A$, $B$, $C$ and $D$ appearing
  Section \Ref{sec:NonlinearMSD_sm.tex} arise from the ordinary
  differential equation of Section \Ref{sec:NonlinearMSD_ode.tex}
  together with the input of (\ref{eq:u_e}).
\item Setting up parameters, inputs and initial state as in Sections
  \Ref{sec:NonlinearMSD_numpar.tex}, \Ref{sec:NonlinearMSD_input.tex}
  and \Ref{sec:NonlinearMSD_state.tex}, perform simulations as in
  Section \Ref{sec:NonlinearMSD_state.tex} - the figure shows the
  angular \emph{velocity} $\dot{\theta}$.
\item Repeat the simulation with different perturbations by modifying
  the file ``NonlinearMSD\_input.tex'' (see Section
  \Ref{sec:NonlinearMSD_input.tex})
  \begin{enumerate}
  \item note that for smaller perturbations, the graphs are of similar
    shape (scaled by the perturbation input)
  \item note that for larger perturbations the graphs are quite
    different - this is a non-linear system.
  \end{enumerate}
\item \label{item:1} Repeat the simulation with different equilibrium angles $\eta$ by modifying
  the file ``NonlinearMSD\_numpar.tex'' (see Section
  \Ref{sec:NonlinearMSD_numpar.tex}) appropriately. Note that when
  $\eta=\pi$, the linearised system is \emph{unstable}.
\item The (2,1) element of the $A$ matrix in Section
  \Ref{sec:NonlinearMSD_sm.tex} is the \emph{linearised} stiffness
  $k_l$. Plot this against $\eta$ and explain the observation in item
  \ref{item:1}.
\end{enumerate}


Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_input.txt version [96b10a19b1].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System NonlinearMSD, representation input, language txt; 
## File NonlinearMSD_input.txt; 
## Generated by MTT on Thu Mar  7 10:50:46 GMT 2002; 

## First term is the equilibrium input; last term is the perturbation input.
NonlinearMSD_yu	= k*(l^2)*cos(eta/2)*2*(sin(eta/2)-sin(alpha/2)) + 1e-2;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_numpar.txt version [da778d0db5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System NonlinearMSD, representation numpar, language txt; 
## File NonlinearMSD_numpar.txt; 
## Generated by MTT on Thu Mar  7 14:03:19 GMT 2002; 



alpha	= pi/3; # Angle for unstretched string
eta	= pi/3; #  Equilibrium angle
j	= 1.0; # Inertia
k	= 1.0; # Spring constant
l	= 1.0; # Rod length
r	= 1.0; # Rotational resistance

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_rep.txt version [b54172b254].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system NonlinearMSD (NonlinearMSD_rep.txt)
## Generated by MTT on" Thu Mar  7 14:44:37 GMT 2002.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2000/12/28 11:58:07  peterg
## Put under RCS
##
###############################################################

mtt NonlinearMSD abg tex			# The system description
mtt NonlinearMSD sympar tex	        # The system parameters
## Uncomment the following lines or add others
## mtt NonlinearMSD dae tex	        # The system dae
mtt NonlinearMSD ode tex	        # The system ode 
mtt NonlinearMSD sspar tex		# Steady-state parameters
mtt NonlinearMSD ss tex 		# Steady state
## mtt NonlinearMSD dm tex		# Descriptor matrices (of linearised system)
mtt NonlinearMSD sm tex		# State matrices (of linearised system)
## mtt NonlinearMSD tf tex		# Transfer function (of linearised system)
## mtt NonlinearMSD lmfr ps		# log modulus of frequency response (of linearised system)
## mtt NonlinearMSD simpar tex		# Simulation parameters
mtt NonlinearMSD numpar tex		# Numerical simulation parameters
mtt NonlinearMSD state tex		# Simulation initial state
mtt NonlinearMSD input tex		# Simulation input
## mtt NonlinearMSD logic tex		# Logic control
mtt NonlinearMSD odeso ps		# Simulation output

## mtt NonlinearMSD rep txt		# This file

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_sspar.r version [7911451fd5].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (NonlinearMSD_sspar.r)
% Generated by MTT at Thu Mar  7 10:39:15 GMT 2002

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.1  2000/12/28 09:32:04  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%% This one corresponds to the unstretched spring at theta = pi/3 
%% Note that U is calculated to give equilibrium for all angles

alpha := pi/3;

% Steady-state states
MTTX1 := 	eta;     %Initial angle (corresponds to u=0)
MTTX2 := 	0;        %Initial anglular velocity
% Steady-state inputs
MTTU1 := 	k*(l^2)*cos(MTTX1/2)*2*(sin(MTTX1/2)-sin(alpha/2));
;;END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/NonlinearMSD_state.txt version [d8c602cd8d].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System NonlinearMSD, representation state, language txt; 
## File NonlinearMSD_state.txt; 
## Generated by MTT on Thu Mar  7 10:50:45 GMT 2002; 



NonlinearMSD_j	= 0.0;  % Initial angular momentum
NonlinearMSD_k	= eta; % Initial angle

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-1D/NonlinearMSD/plot_k.m version [7f6ea9ee11].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Plots the effective spring constant.

p = NonlinearMSD_numpar;	# Numerical parameters
s = NonlinearMSD_sympar		# Symbolic parameters

Eta = eta=[0:0.01:1]*pi; K = [];
for eta=Eta
  p(s.eta) = eta;		# Change the eta parameter
  A = NonlinearMSD_sm(p);	# SS A matrix
  k = -A(2,1);
  K = [K k];
endfor

grid;
ylabel("k");
xlabel("eta");
plot(Eta,K);
figfig("k","eps");

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/Cart_abg.fig version [451fec60c3].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4050 2925 4050 1575 4275 1800
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 3150 5625 3150 5400 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4950 5625 4950 5400 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2475 3825 2475 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 3150 3825 3150 3600 3375
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 4950 2475 4950 2700 5175
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 2925 2870 1970 2870 2289
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4288 2957 5243 2002 5243 2320
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6525 3150 7875 3150 7650 3375
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9900 5850 225 5850 225 900 9900 900 9900 5850
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 4050 3825 4050 3600 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4050 5625 4050 5400 4275
4 1 1 101 0 3 20 0.0000 4 270 1155 4140 3600 x-velocity\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 3240 1\001
4 1 4 100 0 18 20 0.0000 4 270 1320 1710 3240 SS:[drive]\001
4 1 1 101 0 3 20 0.0000 4 270 1125 4185 4500 y-velocity\001
4 1 1 101 0 3 20 0.0000 4 270 1905 4050 5490 angular-velocity\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 5040 1\001
4 1 4 100 0 18 20 0.0000 4 270 825 6165 5040 SS:[a]\001
4 2 0 100 0 18 20 0.0000 4 270 735 2430 5040 R:r_p\001
4 1 0 100 0 18 20 0.0000 4 270 720 2835 1845 R:r_c\001
4 1 4 100 0 18 20 0.0000 4 270 825 4050 1440 SS:[x]\001
4 1 0 100 0 18 20 0.0000 4 270 735 5355 1845 I:m_c\001
4 1 0 100 0 18 20 0.0000 4 210 630 6075 3240 INTF\001
4 0 0 100 0 18 20 0.0000 4 210 1590 8010 3240 De:Position\001
4 1 0 100 0 18 20 0.0000 4 195 150 4050 4140 1\001
4 1 4 100 0 18 20 0.0000 4 270 825 6165 4140 SS:[y]\001
4 2 0 100 0 18 20 0.0000 4 270 2190 2430 4140 Sf:zero_velocity\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/Cart_lbl.txt version [947eebb4f2].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Cart (Cart_lbl.txt)
%SUMMARY Cart
%DESCRIPTION Simple cart model

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	drive
%ALIAS	pendulum|out	x,y,a
%UNITS  drive     translational N m/s
b%UNITS  x         translational N m/s
%UNITS  y         translational N m/s
%UNITS  a         rotational N*m radian/s


% Argument aliases
%ALIAS	$1	m_c

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type I
	m_c		lin	flow,m_c

% Component type R
	r_c		lin	flow,r_c
	r_p		lin	flow,r_p

% Component type SS
	[a]	SS		external,external
	[drive]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type De
	Position			SS	external

% Component type Sf
	zero_velocity		SS	0



Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulumOnCart_abg.fig version [95293b57ef].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3780 4005 3870 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 3825 4050 3825 4500
-6
1 4 0 2 1 7 51 0 -1 0.000 1 0.0000 3700 4909 203 203 3497 4909 3903 4909
1 4 0 2 1 7 51 0 -1 0.000 1 0.0000 4817 4902 203 203 4614 4902 5020 4902
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 2475 4275 3825 4275 3600 4500
2 4 0 2 1 7 101 0 -1 0.000 0 0 7 0 0 5
	 5175 4725 3375 4725 3375 3825 5175 3825 5175 4725
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4275 4050 5230 3095 5230 3414
2 1 0 2 1 7 101 0 -1 0.000 0 0 -1 0 0 5
	 4477 3712 5872 2317 6052 2497 4702 3847 4522 3667
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 6750 5400 1125 5400 1125 2025 6750 2025 6750 5400
4 1 0 100 0 18 20 0.0000 4 210 570 4275 4365 Cart\001
4 1 0 100 0 18 20 0.0000 4 270 840 2070 4365 SS:[F]\001
4 1 0 100 0 18 20 0.0000 4 210 2445 5355 3060 InvertedPendulum\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulumOnCart_desc.tex version [1fb76406fa].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system InvertedPendulumOnCart (InvertedPendulumOnCart_desc.tex)
% Generated by MTT on Thu Aug 5 10:38:16 BST 1999.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{InvertedPendulumOnCart} is
   displayed in Figure \Ref{fig:InvertedPendulumOnCart_abg.ps} and its label
   file is listed in Section \Ref{sec:InvertedPendulumOnCart_lbl}.
   The subsystems are listed in Section \Ref{sec:InvertedPendulumOnCart_sub}.

This is a one input, two output nonlinear system comprising an
inverted pendulum attached by a hinge to a cart constrained to move in
the horizontal direction. The input is the horizontal force acting on
the cart, and the two outputs are the horizontal position and the
pendulum angle respectively.

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulumOnCart_input.txt version [eed0316c02].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System InvertedPendulumOnCart, representation input, language txt; 
## File idInvertedPendulumOnCart_input.txt; 
## Generated by MTT on Thu Apr  5 15:27:30 BST 2001; 



InvertedPendulumOnCart_f	= 1.0*(t<1); # Force for 1 sec

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulumOnCart_lbl.txt version [f7c8e12ace].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system InvertedPendulumOnCart (InvertedPendulumOnCart_lbl.txt)
%SUMMARY InvertedPendulumOnCart
%DESCRIPTION An Inverted Pendulum on a Cart

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS in   F
%UNITS F    translational  N m/s

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type SS
	[F]   SS	 external,internal




Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulumOnCart_numpar.txt version [553e3e5c8b].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (InvertedPendulumOnCart_numpar.txt)
# Generated by MTT at Thu Aug  5 10:07:08 BST 1999

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

# Parameters
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: e_s = 	1.0;			# Se
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: f_s = 	1.0;			# Sf
g = 	1.0;			# Pendulum,gRODa
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: j_m = 	1.0;			# gRODa
j_r = 	1.0;			# Pendulum
l = 	1.0;			# Pendulum
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: l_a = 	1.0;			# gRODa
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: ## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: l_b = 	1.0;			# gRODa
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: m = 	1.0;			# gRODa
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: m_c = 	1.0;			# Cart
## Removed by MTT on Thu Nov  9 17:21:31 GMT 2000: m_r = 	1.0;			# Pendulum
r_c = 	0.1;			# Cart
r_p = 	0.1;			# Cart
m_c	= 1.0; # Added by MTT on Thu Nov 09 17:22:55 GMT 2000
m_r	= 1.0; # Added by MTT on Thu Nov 09 17:22:55 GMT 2000

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulumOnCart_rep.txt version [9fc8c17df2].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system InvertedPendulumOnCart (InvertedPendulumOnCart_rep.txt)
## Generated by MTT on" Fri Oct 22 09:03:14 EST 1999.

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

mtt InvertedPendulumOnCart abg tex			# The system description
mtt InvertedPendulumOnCart cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt InvertedPendulumOnCart struc tex	        # The system structure
mtt InvertedPendulumOnCart dae tex	        # The system dae
## mtt InvertedPendulumOnCart ode tex	        # The system ode 
## mtt InvertedPendulumOnCart sspar tex		# Steady-state parameters
## mtt InvertedPendulumOnCart ss tex 		# Steady state
## mtt InvertedPendulumOnCart dm tex		# Descriptor matrices (of linearised system)
mtt InvertedPendulumOnCart sm tex		# State matrices (of linearised system)
## mtt InvertedPendulumOnCart tf tex		# Transfer function (of linearised system)
## mtt InvertedPendulumOnCart lmfr ps		# log modulus of frequency response (of linearised system)
mtt InvertedPendulumOnCart simpar tex		# Simulation parameters
mtt InvertedPendulumOnCart numpar tex		# Numerical simulation parameters
mtt InvertedPendulumOnCart input tex		# Simulation input
mtt -c InvertedPendulumOnCart odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulumOnCart_simpar.txt version [fa514a3154].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system InvertedPendulumOnCart (InvertedPendulumOnCart_simpar.txt)
# Generated by MTT on Thu Aug 5 09:17:05 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 100.0;      # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulumOnCart_subs.r version [752962d684].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Default SUBS file
% File InvertedPendulumOnCart_subs.r
% Generated by MTT on Thu Nov  9 18:55:44 GMT 2000.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  2001/04/02 10:57:57  gawthrop
% %% Added missing ;
% %%
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Put algebraic substitution commands here

for all x let cos(x)^2+sin(x)^2 = 1;

FOR ALL x,y LET x^y = pow(x,y); % Use the pow function

ON ROUNDED; % No integer output

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulum_abg.fig version [fd34fadce3].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 3555 5085 6345 5310
4 1 4 100 0 18 14 0.0000 4 210 510 3825 5265 [x_b]\001
4 1 4 100 0 18 14 0.0000 4 210 525 4950 5265 [y_b]\001
4 1 4 100 0 18 14 0.0000 4 210 525 6075 5265 [a_b]\001
-6
6 3780 3105 6345 4545
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 3150 4950 4500 5175 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 3150 6075 4500 6300 4275
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 3150 3825 4500 4050 4275
-6
6 3780 5355 6345 6795
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 4950 5400 4950 6750 5175 6525
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6075 5400 6075 6750 6300 6525
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3825 5400 3825 6750 4050 6525
-6
6 3555 4545 6345 4770
4 1 4 100 0 18 14 0.0000 4 210 495 3825 4725 [x_a]\001
4 1 4 100 0 18 14 0.0000 4 210 510 4950 4725 [y_a]\001
4 1 4 100 0 18 14 0.0000 4 210 510 6075 4725 [a_a]\001
-6
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 6840 4950 8190 4950 7965 5175
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 9675 7425 3150 7425 3150 2475 9675 2475 9675 7425
4 1 4 100 0 18 20 0.0000 4 270 825 3825 7065 SS:[x]\001
4 1 4 100 0 18 20 0.0000 4 270 825 4950 7065 SS:[y]\001
4 1 4 100 0 18 20 0.0000 4 270 825 6075 7065 SS:[a]\001
4 1 0 100 0 18 20 0.0000 4 270 1545 4964 5040 gRODa:rod\001
4 1 0 100 0 18 20 0.0000 4 270 915 3825 3015 Se:x_0\001
4 1 0 100 0 18 20 0.0000 4 270 915 4950 3015 Se:y_0\001
4 1 0 100 0 18 20 0.0000 4 270 915 6030 3015 Se:a_0\001
4 1 4 100 0 18 14 0.0000 4 210 270 6660 4995 [a]\001
4 1 0 100 0 18 20 0.0000 4 210 1140 8865 5040 De:theta\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/InvertedPendulumOnCart/InvertedPendulum_lbl.txt version [4d5db894bb].

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

















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system InvertedPendulum (InvertedPendulum_lbl.txt)
%SUMMARY InvertedPendulum
%DESCRIPTION <Detailed description here>

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/12/28 18:00:45  peterg
% %% To RCS
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%UNITS  x         translational N m/s
%UNITS  y         translational N m/s
%UNITS  a         rotational N*m radian/s


%ALIAS	in|cart	x,y,a


% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type De
	theta			SS	external

% Component type SS
	[a]	SS		external,external
	[x]	SS		external,external
	[y]	SS		external,external

% Component type Se
	a_0	 SS	0
	x_0      SS     0
	y_0      SS     0

% Component type gRod
	rod	 none		l;l;j_r;m_r;g
 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_abg.fig version [795633633a].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3017 1577 3287 1577
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5269 1579 5539 1579
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 1577 3152 3152 3377 2927
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4142 3152 4412 3152
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4277 1577 4277 3152 4502 2927
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5402 1577 5402 3152 5627 2927
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3019 4279 3289 4279
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4144 4279 4414 4279
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5271 4281 5541 4281
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4277 4277 4277 5852 4502 5627
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5402 4277 5402 5852 5627 5627
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 7200 2250 7200 675 1575 675 1575 2250 7200 2250
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 7200 4500 7200 2925 1575 2925 1575 4500 7200 4500
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 7200 6750 7200 5175 1575 5175 1575 6750 7200 6750
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 4299 3150 5874 3375 5649
4 1 -1 0 0 0 20 0.0000000 4 240 870 3152 1397 SS:v_x\001
4 1 -1 0 0 0 20 0.0000000 4 240 810 4277 1397 SS:f_a\001
4 1 -1 0 0 0 20 0.0000000 4 210 1110 4278 3828 ROD:rod\001
4 1 -1 0 0 0 20 0.0000000 4 240 885 3155 6305 SS:F_x\001
4 1 -1 0 0 0 20 0.0000000 4 240 870 4280 6305 SS:F_a\001
4 1 -1 0 0 0 20 0.0000000 4 270 885 5450 6305 SS:F_y\001
4 1 -1 0 0 0 20 0.0000000 4 270 1920 5986 1396 ACCEL:gravity\001
4 1 1 1 0 3 20 0.0000000 4 240 1245 7965 1440 Fixed end\001
4 1 1 1 0 3 20 0.0000000 4 240 1110 7920 6075 Free end\001
4 1 1 1 0 3 20 0.0000000 4 270 1755 8280 3735 Rod dynamics\001
4 1 4 0 0 0 16 0.0000000 4 195 495 3152 3467 [x_a]\001
4 1 4 0 0 0 16 0.0000000 4 210 885 4277 3467 [alpha_a]\001
4 1 4 0 0 0 16 0.0000000 4 210 495 5402 3467 [y_a]\001
4 1 4 0 0 0 16 0.0000000 4 195 510 3154 4144 [x_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 900 4280 4145 [alpha_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 510 5406 4146 [y_b]\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_desc.tex version [8fffb820c7].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Pendulum (Pendulum_desc.tex)
% Generated by MTT on Fri Aug 15 09:52:55 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Pendulum} is
   displayed in Figure \Ref{Pendulum_abg} and its label
   file is listed in Section \Ref{sec:Pendulum_lbl}.
   The subsystems are listed in Section \Ref{sec:Pendulum_sub}.

This is a heirachical version of the example from Section 10.3 of
``Metamodelling''.  It uses two compound components: {\bf ROD} and {\bf
GRAV}. {\bf ROD} is
essentially as described in Figure 10.2 {\bf GRAV} represents gravity by a
vertical accelleration as in Section 10.9 of "Metamodelling".

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_input.txt version [951212a41d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode' 
# Numerical parameter file (Pendulum_input.txt)
# Generated by MTT at Fri Aug 15 09:02:02 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# Revision 1.1  1997/08/15  08:04:01  peterg
# Initial revision
#
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Set the inputs
u(1) =	0.0;			# no torque at joint
u(2) =	9.81;			# g

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_lbl.txt version [a4f4c9c248].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Pendulum: Pendulum example from Section 10.3 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.3 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling".

%ALIAS ACCEL	Mechanical-2D/ACCEL # Constant acceleration
%% Label file for system pend (pend_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1997/08/15  09:46:22  peterg
% %% New labeled ports version
% %%
% Revision 1.1  1996/11/09  18:44:58  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters
rod	none	l;l;j;m

%Zero velocity sources
v_x	SS     internal,0

%Zero force/torque sources
F_x	SS	   0,internal
F_y	SS	   0,internal
F_a	SS	   0,internal

%Torque at end
f_a	SS external,external

%Gravity
gravity





Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_numpar.txt version [1aa95a298a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (Pendulum_numpar.txt)
# Generated by MTT at Mon Jul 27 12:38:25 BST 1998

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

# Parameters
l = 	1.0;			# Pendulum
m = 	1.0;			# Pendulum
j = 	m*l*l/12.0;		# Pendulum

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_rep.txt version [c1e66794e6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Pendulum (Pendulum_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/22 09:17:59  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt Pendulum abg tex
mtt Pendulum struc tex
mtt Pendulum dae tex
mtt Pendulum cse tex
mtt Pendulum rfe tex
mtt Pendulum ode tex
mtt Pendulum input txt
mtt Pendulum numpar txt
mtt -c Pendulum odeso ps

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_simpar.txt version [18a566dbec].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system Pendulum (Pendulum_simpar.txt)
# Generated by MTT on Mon Jul 27 12:27:43 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1999/12/23 20:16:47  peterg
## Removed MTHOD
##
## Revision 1.2  1999/02/22 10:08:05  peterg
## 
##
## Revision 1.1  1998/07/27 11:29:13  peterg
## Initial revision
##
###############################################################


LAST=10.0;			# Last time in simulation
DT=0.1;				# Print interval
STEPFACTOR=10;			# Integration steps per print interval

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_state.txt version [4f4e2a98f4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Initial state  file (Pendulum_state.txt)
# Generated by MTT at Mon Jul 27 12:34:12 BST 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the states
mttx(1) 	= 0.0; 	# J (Pendulum_rod)
mttx(2) 	= pi/4;	# 3 (Pendulum_rod_th)
mttx(3) 	= 0.0; 	# 2 (Pendulum_gravity)

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/Pendulum/Pendulum_subs.r version [7a6dcb4fcb].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to sunstitute in system Pendulum (Pendulum_subs.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_abg.fig version [e0aed8f131].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.0000000 1 0.000 8550 1125 485 485 8550 1125 8730 1575
1 3 0 2 1 7 1 0 -1 0.0000000 1 0.000 8550 5625 485 485 8550 5625 9035 6110
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3468 1128 3738 1128
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4593 2703 4863 2703
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 1128 4728 2703 4953 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4502 5492 4502 5762
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5627 4502 5627 4277 5852
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 7426 4951 7201
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3472 8647 3742 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4597 8647 4867 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5724 8649 5994 8649
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4730 8645 4730 10220 4955 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5855 8645 5855 10220 6080 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3826 3601 7426 3826 7201
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3826 5851 7426 6076 7201
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 8775 6525 7200 2925 7200 2925 8775 6525 8775
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 6435 6525 4860 2925 4860 2925 6435 6525 6435
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 11250 6525 9675 2925 9675 2925 11250 6525 11250
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 11475 9450 225 180 225 180 11475 9450 11475
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 8622 3600 10197 3825 9972
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 9675 8775 6075 8325 6075 8325 9675 8775 9675
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 7650 450 9405 450 9405 675 7650 675 7650 450
4 1 -1 0 0 0 20 0.0000000 4 240 870 3603 948 SS:v_x\001
4 0 -1 0 0 0 20 0.0000000 4 210 150 4683 5718 0\001
4 1 -1 0 0 0 20 0.0000000 4 240 960 2432 5717 SS:f_a2\001
4 1 -1 0 0 0 20 0.0000000 4 240 885 3608 10673 SS:F_x\001
4 1 -1 0 0 0 20 0.0000000 4 240 870 4733 10673 SS:F_a\001
4 1 -1 0 0 0 20 0.0000000 4 270 885 5903 10673 SS:F_y\001
4 1 -1 0 0 0 20 0.0000000 4 210 1260 4729 3379 ROD:rod1\001
4 1 -1 0 0 0 20 0.0000000 4 210 1260 4731 8196 ROD:rod2\001
4 1 -1 0 0 0 20 0.0000000 4 240 960 4771 946 SS:f_a1\001
4 0 1 1 0 3 20 0.0000000 4 240 810 6795 3375 Link 1\001
4 0 1 1 0 3 20 0.0000000 4 240 870 6750 5760 Joint 2\001
4 0 1 1 0 3 20 0.0000000 4 240 810 6750 8190 Link 2\001
4 0 1 1 0 3 20 0.0000000 4 270 420 6750 10485 Tip\001
4 0 1 1 0 3 20 0.0000000 4 240 870 6750 1260 Joint 1\001
4 1 4 0 0 0 16 0.0000000 4 195 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000000 4 210 885 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000000 4 195 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 900 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 495 5850 2970 [y_a]\001
4 1 4 0 0 0 16 0.0000000 4 195 495 3605 7835 [x_a]\001
4 1 4 0 0 0 16 0.0000000 4 210 885 4730 7835 [alpha_a]\001
4 1 4 0 0 0 16 0.0000000 4 210 495 5855 7835 [y_a]\001
4 1 4 0 0 0 16 0.0000000 4 195 510 3607 8512 [x_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 900 4733 8513 [alpha_b]\001
4 1 4 0 0 0 16 0.0000000 4 210 510 5859 8514 [y_b]\001
4 1 -1 0 0 0 20 0.0000000 4 270 870 5850 945 SS:v_y\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_desc.tex version [1b0381b9ba].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TwoLink (TwoLink_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/19 14:20:07  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLink} is
   displayed in Figure \Ref{TwoLink_abg} and its label
   file is listed in Section \Ref{sec:TwoLink_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLink_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses the compound components: {\bf ROD}.  {\bf
ROD} is essentially as described in Figure 10.2.
There is no gravity included in this model.

This system has a number of dynamic elements (those corresponding to
translation motion) in derivative causality, thus the system is
represnted as a Differential-Algebraic Equation (Section
\Ref{sec:TwoLink_dae.tex}). Hovever, this is of contrained-state form
and therfore can be written as a set of constrained-state equations
(Section \Ref{sec:TwoLink_cse.tex}). The corresponding ordinary
differential equation is complicated due to the trig functions
involved in inverting the E matrix.

As well as the standard representation the ``robot-form'' equations
appear in Section  \Ref{sec:TwoLink_rfe}. 

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_input.txt version [1fea5dda9b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLink_input.txt)
# Generated by MTT at Fri Jun 13 16:56:09 BST 1997

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

# Set the inputs
u(1) =	(t<1.0);		# Torque on Joint 1
u(2) =	-(t>10.0)&&(t<11.0);	# Torque on Joint 2
u(3) =	0.0;			# Gravity

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_lbl.txt version [9f787960d1].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLink: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (TwoLink_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/27 10:45:22  peterg
% %% Initial revision
% %%
% %% Revision 1.2  1996/12/05  12:39:49  peterg
% %% Documentation
% %%
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - uniform rods
rod1	none	l_1;l_1;j_1;m_1
rod2	none	l_2;l_2;j_2;m_2

%Zero velocity sources
v_x	SS     internal,0
v_y	SS     internal,0


%Zero force/torque sources
F_x	SS	   0,internal
F_a	SS	   0,internal
F_y	SS	   0,internal


%Torque/velocity at joints
f_a1	SS	 external,external
f_a2	SS	 external,external


Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_numpar.txt version [0fbe82c500].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLink_numpar.txt)
# Generated by MTT at Mon Jan 19 13:53:15 GMT 1998

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

# Parameters
j_1 = 	1.0; # Parameter j_1 for TwoLink
j_2 = 	1.0; # Parameter j_2 for TwoLink
l_1 = 	1.0; # Parameter l_1 for TwoLink
l_2 = 	1.0; # Parameter l_2 for TwoLink
m_1 = 	1.0; # Parameter m_1 for TwoLink
m_2 = 	1.0; # Parameter m_2 for TwoLink

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_rep.txt version [7b8e923eb7].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TwoLink (TwoLink_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1999/02/22 09:18:33  peterg
% %% Removed -c
% %%
% %% Revision 1.2  1998/01/19 14:21:21  peterg
% %% Removed ordinary differential equation representation - its to
% %% verbose.
% %%
% %% Revision 1.1  1998/01/19 14:15:52  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt TwoLink abg tex
mtt TwoLink struc tex
mtt TwoLink sympar tex
mtt TwoLink dae tex
mtt TwoLink cse tex
mtt TwoLink rfe tex

mtt TwoLink input txt
mtt TwoLink numpar txt
mtt -c TwoLink odeso ps

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_simp.r version [78d66bdfd1].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system TwoLink (TwoLink_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_simpar.txt version [ee10733737].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Simulation parameters for system TwoLink (TwoLink_simpar.txt)
# Generated by MTT on Mon Jul 27 08:16:50 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1999/02/22 10:07:24  peterg
## Step facttor 10
##
## Revision 1.2  1999/02/22 10:06:13  peterg
## Method Euler
##
## Revision 1.1  1998/07/27 10:46:30  peterg
## Initial revision
##
###############################################################


LAST=50.0;
DT=0.1;
STEPFACTOR=10;


Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/TwoLink_subs.r version [cceaeb9eae].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce  substitution statements for system TwoLink (TwoLink_subs.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/03/22 20:12:51  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/twolink_desc.tex version [bb657d852c].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system twolink (twolink_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{twolink} is
   displayed in Figure \Ref{twolink_abg} and its label
   file is listed in Section \Ref{sec:twolink_lbl}.
   The subsystems are listed in Section \Ref{sec:twolink_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses two compound components: {\bf ROD} and {\bf
GRAV}.  {\bf ROD} is essentially as described in Figure 10.2 {\bf
GRAV} represents gravity by a vertical accelleration as in Section
10.9 of "Metamodelling"

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/twolink_lbl.txt version [e8bd693d1c].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY twolink: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (twolink_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - identical rods
rod1	none	l;l;j;m
rod2	none	l;l;j;m

%Zero velocity sources
v_x	internal	0


%Zero force/torque sources
F_x	0	internal
F_a	0	internal
F_y	0	internal


%Torque at joints
f_a1	external external
f_a2	external external


%Gravity
g

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/twolink_params.r version [eb6c0cbeba].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Parameter file for system twolink (twolink_params.r)
%% This file provides symbolic parameters for simplification

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Useful trig simplifications


        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

% Some simplifications -- see book
j := m*l*l/3;

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/twolink_rep.txt version [26658efeb2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Outline report file for system twolink (twolink_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

abg tex
struc tex
dae tex
csm tex
sro ps
lmfr ps
odeso ps
input txt
numpar txt

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLink/twolink_simp.r version [322b9f1b83].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system twolink (twolink_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%simplify the output equations
% Joint  angles
mttx2 := theta_1;
mttx4 := theta_1 + theta_2;
END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_abg.fig version [b1caa985f3].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 1125 485 485 8550 1125 8730 1575
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 5625 485 485 8550 5625 9035 6110
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3468 1128 3738 1128
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4593 2703 4863 2703
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 1128 4728 2703 4953 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4502 5492 4502 5762
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5627 4502 5627 4277 5852
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 7426 4951 7201
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3472 8647 3742 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4597 8647 4867 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5724 8649 5994 8649
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4730 8645 4730 10220 4955 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5855 8645 5855 10220 6080 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3826 3601 7426 3826 7201
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3826 5851 7426 6076 7201
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 8775 6525 7200 2925 7200 2925 8775 6525 8775
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 6435 6525 4860 2925 4860 2925 6435 6525 6435
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 11250 6525 9675 2925 9675 2925 11250 6525 11250
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 11475 9450 225 180 225 180 11475 9450 11475
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 8622 3600 10197 3825 9972
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 9675 8775 6075 8325 6075 8325 9675 8775 9675
4 1 -1 0 0 0 20 0.0000 4 255 810 3603 948 SS:v_x\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4683 5718 0\001
4 1 -1 0 0 0 20 0.0000 4 255 900 2432 5717 SS:f_a2\001
4 1 -1 0 0 0 20 0.0000 4 255 840 3608 10673 SS:F_x\001
4 1 -1 0 0 0 20 0.0000 4 255 840 4733 10673 SS:F_a\001
4 1 -1 0 0 0 20 0.0000 4 255 840 5903 10673 SS:F_y\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 4729 3379 ROD:rod1\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 4731 8196 ROD:rod2\001
4 1 -1 0 0 0 20 0.0000 4 255 900 4771 946 SS:f_a1\001
4 0 1 1 0 3 20 0.0000 4 210 720 6795 3375 Link 1\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 5760 Joint 2\001
4 0 1 1 0 3 20 0.0000 4 210 720 6750 8190 Link 2\001
4 0 1 1 0 3 20 0.0000 4 270 375 6750 10485 Tip\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 1260 Joint 1\001
4 1 -1 0 0 0 20 0.0000 4 255 1170 5850 945 ACCEL:g\001
4 1 4 0 0 0 16 0.0000 4 210 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5850 2970 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3605 7835 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4730 7835 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5855 7835 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3607 8512 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4733 8513 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5859 8514 [y_b]\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_desc.tex version [6281d6e316].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TwoLinkxyc (TwoLinkxyc_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkxyc} is
   displayed in Figure \Ref{TwoLinkxyc_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkxyc_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkxyc_sub}.

This system is identical to  \textbf{twolink} except that the two
colocated {\bf SS} components act at the tip in the $x$ and $y$
directions instead of at the two joints.

It uses two compound components: {\bf ROD} and {\bf GRAV}.  {\bf ROD}
is essentially as described in Figure 10.2 of "Metamodelling" and {\bf
GRAV} represents gravity by a vertical acceleration as in Section
10.9 of "Metamodelling"

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_input.txt version [b1362e33a2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkxyc_input.txt)
# Generated by MTT at Fri Jun 13 16:56:09 BST 1997

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

# Set the inputs
u(1) =	(t<1.0);
u(2) =	0.0; # 
u(3) =	0.0; # gravity

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_lbl.txt version [3994ea9709].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLinkxyc: two-link manipulator with collocated tip source-sensors.
%DESCRIPTION This is related to a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"
%DESCRIPTION except that the  collocated  source-sensors act at the
%DESCRIPTION tip rather than at the joints.

%% Label (TwoLinkxyc_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/06  15:56:31  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - identical rods
rod1	none	l;l;j;m;mg
rod2	none	l;l;j;m;mg

%Zero velocity sources
v_x	SS     internal,0


%Zero force/torque sources
F_a	SS	   0,internal


%Torque at joints
f_a1	SS	0,internal
f_a2	SS	0,internal

%Forces at tip
F_x	SS	external,external
F_y	SS	external,external


%Gravity
g

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_numpar.txt version [2962a2d1ec].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkxyc_numpar.txt)
# Generated by MTT at Fri Jun 13 16:39:41 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  2000/05/20 15:43:27  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Parameters
l = 	1.0; # Default value
m = 	1.0; # Default value
j = 	m*l*l/12.0; # Uniform rod

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_rep.txt version [678c8a9117].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TwoLinkxyc (TwoLinkxyc_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt TwoLinkxyc abg tex
mtt TwoLinkxyc struc tex
mtt TwoLinkxyc dae tex
mtt TwoLinkxyc cse tex
mtt TwoLinkxyc rfe tex
mtt TwoLinkxyc ode tex
mtt TwoLinkxyc input txt
mtt TwoLinkxyc numpar txt
mtt -c TwoLinkxyc odeso ps

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_simp.r version [e44c55285d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system TwoLinkxyc (TwoLinkxyc_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_simpar.txt version [2d422722b4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system TwoLinkxyc (TwoLinkxyc_simpar.txt)
# Generated by MTT on Mon Feb 22 09:44:37 GMT 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1999/02/22 10:09:34  peterg
## Initial revision
##
###############################################################


LAST        = 10.0;       # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 10;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_sspar.r version [77f6d0b61a].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for TwoLinkxyc (TwoLinkxyc_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyc/TwoLinkxyc_state.txt version [0955ea7eb1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# State initialisation file  file (TwoLinkxyc_numpar.txt)
# Generated by MTT at Fri Jun 13 16:39:41 BST 1997

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

# Initial states
x(1) = 	0.0; # Initial state for TwoLinkxyc_rod1 (J)
x(2) = 	0.0; # Initial state for TwoLinkxyc_rod1_th (3)
x(3) = 	0.0; # Initial state for TwoLinkxyc_rod2 (J)
x(4) = 	3.142/4; # Initial state for TwoLinkxyc_rod2_th (3) - 45 deg.
x(5) = 	0.0; # Initial state for TwoLinkxyc_g (2)

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_abg.fig version [b1caa985f3].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 1125 485 485 8550 1125 8730 1575
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 5625 485 485 8550 5625 9035 6110
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3468 1128 3738 1128
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4593 2703 4863 2703
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 1128 4728 2703 4953 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4502 5492 4502 5762
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5627 4502 5627 4277 5852
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 7426 4951 7201
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3472 8647 3742 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4597 8647 4867 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5724 8649 5994 8649
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4730 8645 4730 10220 4955 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5855 8645 5855 10220 6080 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3826 3601 7426 3826 7201
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3826 5851 7426 6076 7201
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 8775 6525 7200 2925 7200 2925 8775 6525 8775
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 6435 6525 4860 2925 4860 2925 6435 6525 6435
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 11250 6525 9675 2925 9675 2925 11250 6525 11250
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 11475 9450 225 180 225 180 11475 9450 11475
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 8622 3600 10197 3825 9972
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 9675 8775 6075 8325 6075 8325 9675 8775 9675
4 1 -1 0 0 0 20 0.0000 4 255 810 3603 948 SS:v_x\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4683 5718 0\001
4 1 -1 0 0 0 20 0.0000 4 255 900 2432 5717 SS:f_a2\001
4 1 -1 0 0 0 20 0.0000 4 255 840 3608 10673 SS:F_x\001
4 1 -1 0 0 0 20 0.0000 4 255 840 4733 10673 SS:F_a\001
4 1 -1 0 0 0 20 0.0000 4 255 840 5903 10673 SS:F_y\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 4729 3379 ROD:rod1\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 4731 8196 ROD:rod2\001
4 1 -1 0 0 0 20 0.0000 4 255 900 4771 946 SS:f_a1\001
4 0 1 1 0 3 20 0.0000 4 210 720 6795 3375 Link 1\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 5760 Joint 2\001
4 0 1 1 0 3 20 0.0000 4 210 720 6750 8190 Link 2\001
4 0 1 1 0 3 20 0.0000 4 270 375 6750 10485 Tip\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 1260 Joint 1\001
4 1 -1 0 0 0 20 0.0000 4 255 1170 5850 945 ACCEL:g\001
4 1 4 0 0 0 16 0.0000 4 210 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5850 2970 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3605 7835 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4730 7835 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5855 7835 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3607 8512 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4733 8513 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5859 8514 [y_b]\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_desc.tex version [4b8a2c615b].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TwoLinkxyn (TwoLinkxyn_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1998/01/06  17:36:33  peterg
% Initial revision
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TwoLinkxyn} is
   displayed in Figure \Ref{TwoLinkxyn_abg} and its label
   file is listed in Section \Ref{sec:TwoLinkxyn_lbl}.
   The subsystems are listed in Section \Ref{sec:TwoLinkxyn_sub}.

This system is identical to  \textbf{twolink} except that there are
now two non-collocated input-output pairs: The torque input to joint 1
-- x velocity of the tip and the torque input to joint 2
-- y velocity of the tip. 

It uses two compound components: {\bf ROD} and {\bf GRAV}.  {\bf ROD}
is essentially as described in Figure 10.2 of "Metamodelling" and {\bf
GRAV} represents gravity by a vertical acceleration as in Section
10.9 of "Metamodelling"

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_input.txt version [3b69b5adbd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkxyn_input.txt)
# Generated by MTT at Fri Jun 13 16:56:09 BST 1997

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

# Set the inputs
u(1) =	(t<1.0);
u(2) =	0.0; # 
u(3) =	0.0; # gravity

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_lbl.txt version [2f9773334c].

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



















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TwoLinkxyn: two-link manipulator with collocated tip source-sensors.
%DESCRIPTION This is related to a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"
%DESCRIPTION except that the source sensors are not collocated:
%DESCRIPTION sources at the joints, sensors at the xy motion of the tip.

%% Label (TwoLinkxyn_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/06  17:37:55  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - identical rods
rod1	none	l;l;j;m;mg
rod2	none	l;l;j;m;mg

%Zero velocity sources
v_x	SS     internal,0


%Zero force/torque sources
F_a	SS	   0,internal


%Torque at joints
f_a1	SS	external,internal
f_a2	SS	external,internal

%Forces at tip
F_x	SS	0,external
F_y	SS	0,external


%Gravity
g

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_numpar.txt version [e5f0a726f4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (TwoLinkxyn_numpar.txt)
# Generated by MTT at Fri Jun 13 16:39:41 BST 1997

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

# Parameters
l = 	1.0; # Default value
m = 	1.0; # Default value
j = 	m*l*l/12.0; # Uniform rod

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_rep.txt version [9ddfbc6dc4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TwoLinkxyn (TwoLinkxyn_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/22 10:01:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt TwoLinkxyn abg tex
mtt TwoLinkxyn struc tex
mtt TwoLinkxyn dae tex
mtt TwoLinkxyn cse tex
mtt TwoLinkxyn rfe tex
mtt TwoLinkxyn ode tex
mtt TwoLinkxyn input txt
mtt TwoLinkxyn numpar txt
mtt -c TwoLinkxyn odeso ps

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_simp.r version [f03e08b08b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system TwoLinkxyn (TwoLinkxyn_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_simpar.txt version [5eae2d65c3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system TwoLinkxyn (TwoLinkxyn_simpar.txt)
# Generated by MTT on Mon Feb 22 09:53:04 GMT 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 10.0;       # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 10;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_sspar.r version [f8140e05f7].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce steady-state parameter file for TwoLinkxyn (TwoLinkxyn_sspar.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/TwoLinkxyn/TwoLinkxyn_state.txt version [317d8f7fea].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# State file (TwoLinkxyn_state.txt)
# Generated by MTT at Fri Jun 13 16:39:41 BST 1997

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

# Initial states
x(1) = 	0.0; # Initial state for TwoLinkxyn_rod1 (J)
x(2) = 	0.0; # Initial state for TwoLinkxyn_rod1_th (3)
x(3) = 	0.0; # Initial state for TwoLinkxyn_rod2 (J)
x(4) = 	3.142/4; # Initial state for TwoLinkxyn_rod2_th (3) - 45 deg.
x(5) = 	0.0; # Initial state for TwoLinkxyn_g (2)

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_abg.fig version [b1caa985f3].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86






















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 1125 485 485 8550 1125 8730 1575
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 8550 5625 485 485 8550 5625 9035 6110
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3468 1128 3738 1128
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5720 1130 5990 1130
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4593 2703 4863 2703
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4728 1128 4728 2703 4953 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4502 5492 4502 5762
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2927 5627 4502 5627 4277 5852
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 5851 4726 7426 4951 7201
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3472 8647 3742 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4597 8647 4867 8647
2 1 0 1 25 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5724 8649 5994 8649
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4730 8645 4730 10220 4955 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5855 8645 5855 10220 6080 9995
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3601 3826 3601 7426 3826 7201
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5851 3826 5851 7426 6076 7201
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 8775 6525 7200 2925 7200 2925 8775 6525 8775
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 2025 6525 450 2925 450 2925 2025 6525 2025
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 6435 6525 4860 2925 4860 2925 6435 6525 6435
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 11250 6525 9675 2925 9675 2925 11250 6525 11250
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 11475 9450 225 180 225 180 11475 9450 11475
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3603 1128 3603 2703 3828 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5853 1128 5853 2703 6078 2478
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4726 3826 4726 5401 4951 5176
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 6525 4050 2925 4050 2925 2475 6525 2475 6525 4050
2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 8622 3600 10197 3825 9972
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 5175 8775 1575 8325 1575 8325 5175 8775 5175
2 4 0 2 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 8775 9675 8775 6075 8325 6075 8325 9675 8775 9675
4 1 -1 0 0 0 20 0.0000 4 255 810 3603 948 SS:v_x\001
4 0 -1 0 0 0 20 0.0000 4 195 135 4683 5718 0\001
4 1 -1 0 0 0 20 0.0000 4 255 900 2432 5717 SS:f_a2\001
4 1 -1 0 0 0 20 0.0000 4 255 840 3608 10673 SS:F_x\001
4 1 -1 0 0 0 20 0.0000 4 255 840 4733 10673 SS:F_a\001
4 1 -1 0 0 0 20 0.0000 4 255 840 5903 10673 SS:F_y\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 4729 3379 ROD:rod1\001
4 1 -1 0 0 0 20 0.0000 4 195 1200 4731 8196 ROD:rod2\001
4 1 -1 0 0 0 20 0.0000 4 255 900 4771 946 SS:f_a1\001
4 0 1 1 0 3 20 0.0000 4 210 720 6795 3375 Link 1\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 5760 Joint 2\001
4 0 1 1 0 3 20 0.0000 4 210 720 6750 8190 Link 2\001
4 0 1 1 0 3 20 0.0000 4 270 375 6750 10485 Tip\001
4 0 1 1 0 3 20 0.0000 4 225 795 6750 1260 Joint 1\001
4 1 -1 0 0 0 20 0.0000 4 255 1170 5850 945 ACCEL:g\001
4 1 4 0 0 0 16 0.0000 4 210 495 3600 2970 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4725 2970 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3600 3780 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4725 3780 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5850 3780 [y_b]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5850 2970 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 495 3605 7835 [x_a]\001
4 1 4 0 0 0 16 0.0000 4 225 900 4730 7835 [alpha_a]\001
4 1 4 0 0 0 16 0.0000 4 225 495 5855 7835 [y_a]\001
4 1 4 0 0 0 16 0.0000 4 210 510 3607 8512 [x_b]\001
4 1 4 0 0 0 16 0.0000 4 225 915 4733 8513 [alpha_b]\001
4 1 4 0 0 0 16 0.0000 4 225 510 5859 8514 [y_b]\001

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_desc.tex version [c73da6dfdc].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system gTwoLink (gTwoLink_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/01/19 14:20:07  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/08/15  13:31:00  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{gTwoLink} is
   displayed in Figure \Ref{gTwoLink_abg} and its label
   file is listed in Section \Ref{sec:gTwoLink_lbl}.
   The subsystems are listed in Section \Ref{sec:gTwoLink_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses the compound components: {\bf ROD}.  {\bf
ROD} is essentially as described in Figure 10.2.
Gravity is included as discussed in "Metamodelling" by accelerating
the manipulator vertically using the {\bf ACCEL} component.

This system has a number of dynamic elements (those corresponding to
translation motion) in derivative causality, thus the system is
represnted as a Differential-Algebraic Equation (Section
\Ref{sec:gTwoLink_dae.tex}). Hovever, this
is of contrained-state form and therfore can be written as a set of
constrained-state equations (Section \Ref{sec:gTwoLink_cse.tex}). The
corresponding ordinary differential equation is complicated due to the
trig functions involved in inverting the E matrix.

As well as the standard representation the ``robot-form'' equations
appear in Section  \Ref{sec:gTwoLink_rfe.tex}. 

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_input.txt version [e7d4199cf4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (gTwoLink_input.txt)
# Generated by MTT at Fri Jun 13 16:56:09 BST 1997

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

# Set the inputs
u(1) =	(t<1.0);
u(2) =	0.0; # 
u(3) =	0.0; # gravity

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_lbl.txt version [ef35e2beef].

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





















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY gTwoLink: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (gTwoLink_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1996/12/05  12:39:49  peterg
% %% Documentation
% %%
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - identical rods
rod1	none	l;l;j;m;mg
rod2	none	l;l;j;m;mg

%Zero velocity sources
v_x	SS     internal,0


%Zero force/torque sources
F_x	SS	   0,internal
F_a	SS	   0,internal
F_y	SS	   0,internal


%Torque at joints
f_a1	SS	external,external
f_a2	SS	external,external

%Gravity
g

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_numpar.txt version [061c655bc3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (gTwoLink_numpar.txt)
# Generated by MTT at Fri Jun 13 16:39:41 BST 1997

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

# Parameters
l = 	1.0; # Default value
m = 	1.0; # Default value
j = 	m*l*l/12.0; # Uniform rod

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_rep.txt version [a078fdf3d5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system gTwoLink (gTwoLink_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/22 09:18:53  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt gTwoLink abg tex
mtt gTwoLink struc tex
mtt gTwoLink sympar tex
mtt gTwoLink dae tex
mtt gTwoLink cse tex
mtt gTwoLink rfe tex
mtt gTwoLink ode tex
mtt gTwoLink input txt
mtt gTwoLink numpar txt
mtt -c gTwoLink odeso ps

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_simp.r version [db95ebfddb].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system gTwoLink (gTwoLink_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_simpar.txt version [3d75c9838a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Simulation parameters for system gTwoLink (gTwoLink_simpar.txt)
# Generated by MTT on Mon Jul 27 08:11:02 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1999/02/22 10:06:54  peterg
## Initial revision
##
###############################################################


LAST=50.0;
DT=0.1;
STEPFACTOR=10;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/gTwoLink_state.txt version [a0531a0161].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Initial state  file (gTwoLink_state.txt)
# Generated by MTT at Mon Jul 27 07:54:23 BST 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the states
mttx(1) 	= 0.0; 	# J (gTwoLink_rod1)
mttx(2) 	= 0.0; 	# 3 (gTwoLink_rod1_th)
mttx(3) 	= 0.0; 	# J (gTwoLink_rod2)
mttx(4) 	= pi/4;	# 3 (gTwoLink_rod2_th)
mttx(5) 	= 0.0; 	# 2 (gTwoLink_g)

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/twolink_desc.tex version [bb657d852c].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system twolink (twolink_desc.tex)
% Generated by MTT on Fri Jun 13 16:30:23 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{twolink} is
   displayed in Figure \Ref{twolink_abg} and its label
   file is listed in Section \Ref{sec:twolink_lbl}.
   The subsystems are listed in Section \Ref{sec:twolink_sub}.

This is a heirachical version of the example from Section 10.5 of
"Metamodelling".  It uses two compound components: {\bf ROD} and {\bf
GRAV}.  {\bf ROD} is essentially as described in Figure 10.2 {\bf
GRAV} represents gravity by a vertical accelleration as in Section
10.9 of "Metamodelling"

%%% Local Variables: 
%%% mode: plain-tex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/twolink_lbl.txt version [e8bd693d1c].

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


















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY twolink: two-link manipulator from Section 10.5 of "Metamodelling"
%DESCRIPTION This is a heirachical version of the 
%DESCRIPTION example from Section 10.5 of "Metamodelling".
%DESCRIPTION It uses two compound components: ROD and GRA
%DESCRIPTION ROD is essentially as described in Figure 10.2
%DESCRIPTION GRAV represents gravity by a vertical accelleration
%DESCRIPTION as in Section 10.9 of "Metamodelling"


%% Label (twolink_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1996/12/05 12:17:15  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1996/11/14  10:48:42  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%Rod parameters - identical rods
rod1	none	l;l;j;m
rod2	none	l;l;j;m

%Zero velocity sources
v_x	internal	0


%Zero force/torque sources
F_x	0	internal
F_a	0	internal
F_y	0	internal


%Torque at joints
f_a1	external external
f_a2	external external


%Gravity
g

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/twolink_params.r version [eb6c0cbeba].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Parameter file for system twolink (twolink_params.r)
%% This file provides symbolic parameters for simplification

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Useful trig simplifications


        trig1 := {cos(~x)*cos(~y) => (cos(x+y)+cos(x-y))/2,
                  cos(~x)*sin(~y) => (sin(x+y)-sin(x-y))/2,
                  sin(~x)*sin(~y) => (cos(x-y)-cos(x+y))/2,
                  cos(~x)^2       => (1+cos(2*x))/2,
                  sin(~x)^2       => (1-cos(2*x))/2};
       LET trig1;

% Some simplifications -- see book
j := m*l*l/3;

END;

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/twolink_rep.txt version [26658efeb2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Outline report file for system twolink (twolink_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

abg tex
struc tex
dae tex
csm tex
sro ps
lmfr ps
odeso ps
input txt
numpar txt

Deleted mttroot/mtt/lib/examples/Mechanical/Mechanical-2D/gTwoLink/twolink_simp.r version [322b9f1b83].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system twolink (twolink_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%simplify the output equations
% Joint  angles
mttx2 := theta_1;
mttx4 := theta_1 + theta_2;
END;

Deleted mttroot/mtt/lib/examples/Sensitivity/sRCc/sRCc_abg.fig version [ccb1b9cb1f].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 1800 1125 162 162 1800 1125 1890 1260
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1802 4277 2702 4277 2477 4502
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 4277 4052 4277 3827 4502
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4502 4277 5402 4277 5177 4502
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 4051 2926 3151 3151 3376
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 4051 4276 3151 4501 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 4276 2701 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5401 4051 5401 4276
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5401 4276 5401 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 4051 2701 4276
2 2 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 2475 585 3375 585 3375 765 2475 765 2475 585
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4050 1215 4500 1215
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4050 1080 4500 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 675 2475 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3375 675 5400 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4275 675 4275 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4275 1215 4275 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 1575 5400 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 945 1800 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 1575 1800 1260
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 5400 1530 5400 765
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6750 5625 6750 225 675 225 675 5625 6750 5625
4 1 -1 0 0 0 20 0.0000 4 255 180 2927 4367 1\001
4 1 -1 0 0 0 20 0.0000 4 255 180 4277 4367 0\001
4 1 -1 0 0 0 20 0.0000 4 255 600 2926 2926 sR:r\001
4 1 -1 0 0 0 20 0.0000 4 255 645 4276 2926 sC:c\001
4 1 -1 0 0 0 20 0.0000 4 255 945 1395 4365 sSe:e1\001
4 0 1 1 0 0 20 0.0000 4 180 120 2880 450 r\001
4 0 1 1 0 0 20 0.0000 4 180 165 4680 1215 c\001
4 0 1 1 0 0 20 0.0000 4 180 165 5625 1170 e\001
4 0 1 1 0 0 20 0.0000 4 255 180 5715 1305 2\001
4 0 1 1 0 0 20 0.0000 4 180 165 1260 1170 e\001
4 0 1 1 0 0 20 0.0000 4 255 180 1350 1305 1\001
4 1 1 1 0 0 20 0.0000 4 330 1725 3600 4995 Bond graph\001
4 1 1 1 0 0 20 0.0000 4 255 1545 3600 2025 Schematic\001
4 1 -1 0 0 0 20 0.0000 4 255 1005 5987 4367 sDe:e2\001
4 1 4 100 0 18 4 0.0000 4 120 270 4500 4005 [1,2]\001
4 1 4 100 0 18 4 0.0000 4 120 270 3105 4005 [1,2]\001

Deleted mttroot/mtt/lib/examples/Sensitivity/sRCc/sRCc_desc.tex version [765c3fe2e6].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system sRCc (sRCc_desc.tex)
% Generated by MTT on Sun Aug 24 11:03:55 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 05:17:04  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1997/08/24 10:27:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{sRCc} is
   displayed in Figure \Ref{sRCc_abg} and its label
   file is listed in Section \Ref{sec:sRCc_lbl}.
   The subsystems are listed in Section \Ref{sec:sRCc_sub}.

The system \textbf{sRCc} is the the sensitivity version of the simple
electrical sRCc circuit shown in Figure \Ref{sRCc_abg}. The circuit itself can be
regarded as a single-input single-output system with input $e_1$ and
output $e_2$; the sensitivity system has {\em two\/} outputs: $e_2$
and $\frac{\partial e_2}{\partial r}$.

All bonds are two-bond vector bonds, and the {\bf sR} and {\bf sC}
components are two-port versions of the usual {\bf R} and {\bf C}
components respectively. One port conveys the usual effort/flow pair;
the other port conveys the sensitivity of the effort and flow with
respect to the $c$ parameter.

Deleted mttroot/mtt/lib/examples/Sensitivity/sRCc/sRCc_lbl.txt version [f4efc4e1d5].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sRCc (sRCc_lbl.txt)
%SUMMARY sRCc Sensitivity of output of RC circuit wrt value of r
%DESCRIPTION Uses the sR and sC components and vector bonds

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 05:18:59  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type sSe
	e1       lin		external;0	

% Component type sDe
	e2

% Component type sC
	c	 lin;lin	effort,c;1

% Component type sR
	r	 lin;lin	flow,r;0

Deleted mttroot/mtt/lib/examples/Sensitivity/sRCc/sRCc_rep.txt version [17b4c98377].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system sRCc (sRCc_rep.txt)
## Generated by MTT on" Thu Jul 29 06:02:47 BST 1999.

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

mtt sRCc abg tex			# The system description
## mtt sRCc cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt sRCc struc tex	        # The system structure
## mtt sRCc dae tex	        # The system dae
mtt sRCc ode tex	        # The system ode 
## mtt sRCc sspar tex		# Steady-state parameters
## mtt sRCc ss tex 		# Steady state
## mtt sRCc dm tex		# Descriptor matrices (of linearised system)
mtt sRCc sm tex		# State matrices (of linearised system)
mtt sRCc tf tex		# Transfer function (of linearised system)
mtt sRCc lmfr ps		# log modulus of frequency response (of linearised system)
## mtt sRCc simpar tex		# Simulation parameters
## mtt sRCc numpar tex		# Numerical simulation parameters
## mtt sRCc input tex		# Simulation input
 mtt sRCc odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Sensitivity/sRCr/sRCr_abg.fig version [d99238c53e].

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
68
69





































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
1 3 0 2 1 7 1 0 -1 0.000 1 0.0000 1800 1125 162 162 1800 1125 1890 1260
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1802 4277 2702 4277 2477 4502
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3152 4277 4052 4277 3827 4502
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4502 4277 5402 4277 5177 4502
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2926 4051 2926 3151 3151 3376
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4276 4051 4276 3151 4501 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 4276 2701 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5401 4051 5401 4276
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5401 4276 5401 4501
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2701 4051 2701 4276
2 2 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 5
	 2475 585 3375 585 3375 765 2475 765 2475 585
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4050 1215 4500 1215
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4050 1080 4500 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 675 2475 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 3375 675 5400 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4275 675 4275 1080
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 4275 1215 4275 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 1575 5400 1575
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 945 1800 675
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 0 0 2
	 1800 1575 1800 1260
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 1 2.00 120.00 240.00
	 5400 1530 5400 765
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6750 5625 6750 225 675 225 675 5625 6750 5625
4 1 -1 0 0 0 20 0.0000 4 255 180 2927 4367 1\001
4 1 -1 0 0 0 20 0.0000 4 255 180 4277 4367 0\001
4 1 -1 0 0 0 20 0.0000 4 255 600 2926 2926 sR:r\001
4 1 -1 0 0 0 20 0.0000 4 255 645 4276 2926 sC:c\001
4 1 -1 0 0 0 20 0.0000 4 255 945 1395 4365 sSe:e1\001
4 0 1 1 0 0 20 0.0000 4 180 120 2880 450 r\001
4 0 1 1 0 0 20 0.0000 4 180 165 4680 1215 c\001
4 0 1 1 0 0 20 0.0000 4 180 165 5625 1170 e\001
4 0 1 1 0 0 20 0.0000 4 255 180 5715 1305 2\001
4 0 1 1 0 0 20 0.0000 4 180 165 1260 1170 e\001
4 0 1 1 0 0 20 0.0000 4 255 180 1350 1305 1\001
4 1 1 1 0 0 20 0.0000 4 330 1725 3600 4995 Bond graph\001
4 1 1 1 0 0 20 0.0000 4 255 1545 3600 2025 Schematic\001
4 1 -1 0 0 0 20 0.0000 4 255 1005 5987 4367 sDe:e2\001
4 1 4 100 0 18 10 0.0000 4 150 345 4545 4005 [1,2]\001
4 1 4 100 0 18 10 0.0000 4 150 345 3195 4005 [1,2]\001

Deleted mttroot/mtt/lib/examples/Sensitivity/sRCr/sRCr_desc.tex version [78a9a2ed8d].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system sRCr (sRCr_desc.tex)
% Generated by MTT on Sun Aug 24 11:03:55 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 05:17:04  peterg
% %% Initial revision
% %%
% %% Revision 1.1  1997/08/24 10:27:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{sRCr} is
   displayed in Figure \Ref{sRCr_abg} and its label
   file is listed in Section \Ref{sec:sRCr_lbl}.
   The subsystems are listed in Section \Ref{sec:sRCr_sub}.

The system \textbf{sRCr} is the the sensitivity version  of the simple
electrical sRCr circuit shown in Figure \Ref{sRCr_abg}. The circuit itself can be
regarded as a single-input single-output system with input $e_1$ and
output $e_2$; the sensitivity system has {\em two\/} outputs: $e_2$
and $\frac{\partial e_2}{\partial r}$.

All bonds are two-bond vector bonds, and the {\bf sR} and {\bf sC}
components are two-port versions of the usual {\bf R} and {\bf C}
components respectively. One port conveys the usual effort/flow pair;
the other port conveys the sensitivity of the effort and flow with
respect to the $r$ parameter.

Deleted mttroot/mtt/lib/examples/Sensitivity/sRCr/sRCr_lbl.txt version [5d8d850afc].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system sRCr (sRCr_lbl.txt)
%SUMMARY sRCr Sensitivity of output of RC circuit wrt value of r
%DESCRIPTION Uses the sR and sC components and vector bonds

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/07/29 05:18:59  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases

% Argument aliases

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type sSe
	e1       lin		external;0	

% Component type sDe
	e2

% Component type sC
	c	 lin;lin	effort,c;0

% Component type sR
	r	 lin;lin	flow,r;1

Deleted mttroot/mtt/lib/examples/Sensitivity/sRCr/sRCr_rep.txt version [e24284fd27].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode
## Outline report file for system sRCr (sRCr_rep.txt)
## Generated by MTT on" Thu Jul 29 06:02:47 BST 1999.

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

mtt sRCr abg tex			# The system description
## mtt sRCr cbg ps 		        # The causal bond graph
## Uncomment the following lines or add others
mtt sRCr struc tex	        # The system structure
## mtt sRCr dae tex	        # The system dae
mtt sRCr ode tex	        # The system ode 
## mtt sRCr sspar tex		# Steady-state parameters
## mtt sRCr ss tex 		# Steady state
## mtt sRCr dm tex		# Descriptor matrices (of linearised system)
mtt sRCr sm tex		# State matrices (of linearised system)
mtt sRCr tf tex		# Transfer function (of linearised system)
mtt sRCr lmfr ps		# log modulus of frequency response (of linearised system)
## mtt sRCr simpar tex		# Simulation parameters
## mtt sRCr numpar tex		# Numerical simulation parameters
## mtt sRCr input tex		# Simulation input
 mtt sRCr odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/BigHeatedRod_abg.fig version [f4fec756c1].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 3150 5850 3150 5625 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 4275 5850 4275 5625 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1800 3150 3150 3150 2925 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 2925 3150 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 4050 1800 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1777 4275 3127 4275 2902 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4500 4095 4500 4545
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 3150 8325 3150 8100 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6975 2925 6975 3375
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 2925 2025 4725 2025 4725 5400 2925 5400 2925 2025
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 5850 9450 1575 450 1575 450 5850 9450 5850
4 0 -1 0 0 0 20 0.0000000 4 240 870 6030 3240 RT:r_2\001
4 2 4 0 0 0 20 0.0000000 4 240 690 2835 3060 [t_in]\001
4 0 4 0 0 0 20 0.0000000 4 240 840 4770 3015 [t_out]\001
4 2 4 0 0 0 20 0.0000000 4 240 735 2880 4185 [e_in]\001
4 0 4 0 0 0 20 0.0000000 4 240 885 4770 4185 [e_out]\001
4 2 -1 0 0 0 20 0.0000000 4 240 900 1620 3240 SS:T_1\001
4 0 -1 0 0 0 20 0.0000000 4 240 900 8460 3240 SS:T_2\001
4 2 -1 0 0 0 20 0.0000000 4 240 780 1665 4365 SS:I_r\001
4 0 -1 0 0 0 20 0.0000000 4 240 930 5985 4365 SS:V_0\001
4 1 -1 0 0 0 20 0.0000000 4 270 1575 3780 3825 Segment:s*100\001

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/BigHeatedRod_input.txt version [2c95f7dc86].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (BigHeatedRod_input.txt)
# Generated by MTT at Thu Sep  4 16:11:06 BST 1997

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

# Set the inputs
u(1) =	10.0*(t<5.0); # I_r 

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/BigHeatedRod_lbl.txt version [2301cb55bc].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY BigHeatedRod: Thermal/Electrical model of Electric rod
%DESCRIPTION Introduces the idea of the ES component which
%DESCRIPTION transforms a relative-temperature/enthalpy pseudo bond 
%DESCRIPTION (at the [e]port) into an absolute-temperature/enntropy 
%DESCRIPTION energy bond (at the [s] port) and vice versa.

%VAR rod_length
%VAR rod_radius
%VAR electrical_resistivity
%VAR thermal_resistivity
%VAR thermal_capacity
%VAR segments
%VAR area
%VAR delta_x
%VAR volume
%VAR density
%VAR mass

%% Label file for system BigHeatedRod (BigHeatedRod_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/11 16:16:29  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type RT
	r_2		lin	flow,r_2

% Component type SS
	I_r	SS	internal,external
	T_1	SS	t_0,internal
	T_2	SS	t_0,internal
	V_0	SS	internal,internal

% Component type Segment
	s

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/BigHeatedRod_numpar.txt version [f90b3de7c8].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (BigHeatedRod_numpar.txt)
# Generated by MTT at Thu Sep  4 16:11:04 BST 1997

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


# Constants for copper
density = 8.96;
rod_length = 1.0;
rod_radius = 1e-3;
electrical_resistivity = 16.8*0.000000001;
thermal_resistivity = 1/390.0;
thermal_capacity = 380.0;


segments = 100;
area = pi*rod_radius*rod_radius;
delta_x = rod_length/segments;
volume = area*delta_x;
mass = volume*density;

# Parameters
c_t = 	thermal_capacity*mass;
r = 	electrical_resistivity*delta_x/area;
r_t = 	thermal_resistivity*delta_x/area;
r_2 = 	r_t;
t_0 = 	300; # Ambient




Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/BigHeatedRod_rep.txt version [8e0c0d3076].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system BigHeatedRod (BigHeatedRod_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -o -c BigHeatedRod abg tex

mtt -o -c BigHeatedRod numpar txt
mtt -o -c BigHeatedRod input txt
mtt -o -c BigHeatedRod odeso ps

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/BigHeatedRod_simpar.txt version [4609d162a5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system BigHeatedRod (BigHeatedRod_simpar.txt)
# Generated by MTT on Tue Aug 24 01:20:41 BST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 10.0;       # Last time in simulation
DT          = 0.1;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

DT          = 1.0;        # Print interval

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/BigHeatedRod_state.txt version [75960b2537].

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
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















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Initial state  file (BigHeatedRod_state.txt)
# Generated by MTT at Friday August 14 18:38:47 BST 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the states
mttx(1) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(2) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(3) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(4) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(5) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(6) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(7) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(8) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(9) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(10) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(11) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(12) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(13) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(14) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(15) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(16) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(17) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(18) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(19) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(20) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(21) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(22) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(23) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(24) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(25) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(26) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(27) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(28) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(29) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(30) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(31) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(32) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(33) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(34) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(35) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(36) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(37) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(38) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(39) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(40) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(41) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(42) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(43) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(44) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(45) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(46) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(47) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(48) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(49) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(50) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(51) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(52) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(53) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(54) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(55) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(56) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(57) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(58) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(59) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(60) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(61) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(62) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(63) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(64) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(65) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(66) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(67) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(68) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(69) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(70) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(71) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(72) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(73) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(74) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(75) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(76) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(77) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(78) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(79) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(80) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(81) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(82) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(83) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(84) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(85) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(86) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(87) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(88) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(89) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(90) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(91) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(92) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(93) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(94) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(95) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(96) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(97) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(98) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(99) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)
mttx(100) 	= c_t*t_0; 	# c (BigHeatedRod_s_c_t)

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/HR_input.txt version [e8bdef2d26].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (HR_input.txt)
# Generated by MTT at Thu Sep  4 16:11:06 BST 1997

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

# Set the inputs
u(1) =	10.0*(t<5.0); # I_r 

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/HR_numpar.txt version [c4b7dfe06b].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (HR_numpar.txt)
# Generated by MTT at Thu Sep  4 16:11:04 BST 1997

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


# Constants for copper
density = 8.96;
rod_length = 1.0;
rod_radius = 1e-3;
electrical_resistivity = 16.8*0.000000001;
thermal_resistivity = 1/390.0;
thermal_capacity = 380.0;


segments = 2;
area = pi*rod_radius*rod_radius;
delta_x = rod_length/segments;
volume = area*delta_x;
mass = volume*density;

# Parameters
c_t = 	thermal_capacity*mass;
r = 	electrical_resistivity*delta_x/area;
r_t = 	thermal_resistivity*delta_x/area;
r_2 = 	r_t/100;
t_0 = 	300; # Ambient




Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/HR_simpar.txt version [8e33457c64].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system HR (HR_simpar.txt)
# Generated by MTT on Wednesday July 29 13:59:50 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 10;       # Last time in simulation
WMIN        = 1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps

STEPFACTOR = 1; # Added automatically
METHOD = IMPLICIT;         # Added automatically
DT = 0.25;                 # Added automatically

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/HeatedRod_desc.tex version [ca122af254].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system HeatedRod (HeatedRod_desc.tex)
% Generated by MTT on Thu Sep 4 18:05:09 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





   The acausal bond graph of system \textbf{HeatedRod} is
   displayed in Figure \Ref{HeatedRod_abg} and its label
   file is listed in Section \Ref{sec:HeatedRod_lbl}.
The subsystems are listed in Section \Ref{sec:HeatedRod_sub}.

 System \textbf{HeatedRod} is a model of a rod of copper with an
 electric current passing through it which warms it up. The two ends of
 the rod are fixed at ambient temperature; this is where all the heat
 loss occurs. 

 This system introduces the idea of the {\bf ES} component which
 transforms a relative-temperature/enthalpy pseudo bond (at the [e]
 port) into an absolute-temperature/enntropy energy bond (at the [s]
 port) and vice versa.

 The model is similar to that described in chapter 8 of
 Cellier's book. However, instead of representing the thermal
 resistance by {\bf RS} components and reinserting the entropy flow,
 the {\bf RT} component uses two {\bf ES} components to convert from
 true to pseudo bonds and back again. Similary, the thermal capacity is
 modelled by the {\bf CT} component.


 The rod parameters are given in the numpar file and the input current
 in the input file.

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/HeatedRod_lbl.txt version [bce0ff1c0a].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY HeatedRod: Thermal/Electrical model of Electric rod
%DESCRIPTION Introduces the idea of the ES component which
%DESCRIPTION transforms a relative-temperature/enthalpy pseudo bond 
%DESCRIPTION (at the [e]port) into an absolute-temperature/enntropy 
%DESCRIPTION energy bond (at the [s] port) and vice versa.

%% Label file for system HeatedRod (HeatedRod_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type RT
	r_2		lin	flow,r_2

% Component type SS
	I_r		internal	external
	T_1		t_0		internal
	T_2		t_0		internal
	V_0		0		internal

% Component type Segment
	s

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run version [e9ed9bb08f].

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
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
123
124
125
126






























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh
# Shell script for running the large HeatedRod systems to compare
# four integration methods.
# Usage example: Run 100 0.25 runf the 100 segment example at interval 0.25

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/08/15 14:07:11  peterg
## Don't do ImplicitL
##
## Revision 1.1  1998/08/15 13:58:27  peterg
## Initial revision
##
###############################################################


n=$1
DT=$2

if [ -z "$n" ]; then
    echo "First argument is N: number of segments (eg 100)"
    exit
fi
if [ -z "$DT" ]; then
    echo "Second argument is DT: the sample interval (eg 0.25)"
    exit
fi
if [ -z "$3" ]; then
    METHODS='ImplicitS Euler Implicit'
else
    METHODS=$3
fi

echo "Running system HR$1 with DT = $DT"
echo "using methods $METHODS"

#Create the system
mtt -q rename HR HR$n >/dev/null
rm -f MTT_work/HR$1_state.* #Why ??

# Is it already correct?
count=`grep -c "*$n" HR$1_abg.fig`

# if not, then set the correct number of segments
if [ "$count" = "0" ]; then
    echo Setting number of segments to $n
    mv HR$1_abg.fig  HR$1_abg.old
    sed "s/\*[0-9]*/*$1/"<HR$1_abg.old>HR$1_abg.fig

    mv HR$1_numpar.txt  HR$1_numpar.old
    sed "s/segments = [0-9]*/segments = $1/"<HR$1_numpar.old >HR$1_numpar.txt

   echo "Making the default HR$1_state.txt"
   rm -f HR$1_state.txt MTT_work/HR$1_state.txt
   mtt -q  HR$1 state txt
   echo "Setting $n states to c_t*t_0"
   mv HR$1_state.txt  HR$1_state.old
   sed "s/0.0/c_t*t_0/"<HR$1_state.old >HR$1_state.txt
fi






rm -f HR$1_table.txt

#Do the methods of interest

for METHOD in $METHODS; do

case $METHOD in
    Euler)
    # What is the minimum step size for Euler?
    mtt -q HR$n numpar m
    mtt -q HR$n sm m
octave -q <<EOF >HR$1.tmp1
    HR$1_numpar;
    A=HR$1_sm;
    Max_Eig=max(eig(-A))
    STEPFACTOR=ceil( Max_Eig*$DT/2 )
EOF
    MinSTEPFACTOR=`awk '{if ($1=="STEPFACTOR") print $3}' HR$1.tmp1`
    STEPFACTOR=$MinSTEPFACTOR
	;;
    ImplicitS)
    # What is the empirical step size for sparse method?
    octave -q <<EOF >HR$1.tmp1
    if $n>100 
      SparseSTEPFACTOR=10*$n
    else
      SparseSTEPFACTOR=5*$n
    endif
EOF
     SparseSTEPFACTOR=`awk '{if ($1=="SparseSTEPFACTOR") print $3}' HR$1.tmp1`

		STEPFACTOR=$SparseSTEPFACTOR
	;;
    *)
		STEPFACTOR=1
	;;
esac


  echo "Doing HR$1 with DT=$DT using $METHOD (STEPFACTOR = $STEPFACTOR)"

  # Modify the simpar.txt files
  grep -v 'STEPFACTOR' HR_simpar.txt | grep -v 'METHOD' | grep -v 'DT' > HR$1_simpar.txt
  echo "STEPFACTOR = $STEPFACTOR; # Added automatically" >>HR$1_simpar.txt
  echo "METHOD = $METHOD;         # Added automatically" >>HR$1_simpar.txt
  echo "DT = $DT;                 # Added automatically" >>HR$1_simpar.txt
  mtt -q -c -o HR$1 odeso ps > junk 2>>junk #HR$1_$METHOD.tmp
  grep user junk |\
     awk '{print System " &\t" METHOD " &\t"  DT " &\t"  STEPFACTOR " &\t" $2 "\\\\"}'\
      METHOD=$METHOD STEPFACTOR=$STEPFACTOR System=HR$1 DT=$DT >> HR$1_table.txt

  cp HR$1_odeso.ps  HR$1.$METHOD.$DT.ps
done

cat HR$1_table.txt



Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run_All version [2d96bc44fd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh
# Generates the tables of timings
# PJG 17/8/98

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


Run 2	0.25	'ImplicitS Implicit Euler'
Run 10	0.25	'ImplicitS Implicit Euler'
Run 20	0.25	'ImplicitS Implicit Euler'
Run 50	0.25	'ImplicitS Implicit Euler'
Run 100	0.25	'ImplicitS Implicit Euler'
Run 200 0.25	'ImplicitS Implicit'

cat Run*_table.txt | sort

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Segment_abg.fig version [1d5850b4e4].

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
































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2835 2205 2925 2745
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 2880 2250 2880 2700
-6
6 8505 2250 8595 2790
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 8550 2295 8550 2745
-6
6 5310 6255 5400 6795
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5355 6300 5355 6750
-6
6 5805 6255 5895 6795
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 5850 6300 5850 6750
-6
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1306 2476 2881 2476 2656 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3781 2476 5356 2476 5131 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5761 2476 8550 2475 8325 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5581 4276 5581 2701 5806 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5581 6301 5581 4726 5806 4951
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 6525 5356 6526 5131 6751
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5806 6526 8550 6525 8325 6750
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5806 2701 6920 3815 6601 3815
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5581 2251 5581 676 5806 901
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5356 676 5806 676
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9900 7425 9900 90 45 90 45 7425 9900 7425
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 7650 4455 7650 1800 1575 1800 1575 4455 7650 4455
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 7650 6975 7650 4545 1575 4545 1575 6975 7650 6975
4 1 -1 0 0 0 20 0.0000 4 240 810 3331 2566 RT:r_t\001
4 1 -1 0 0 0 20 0.0000 4 195 150 5581 2566 0\001
4 1 -1 0 0 0 20 0.0000 4 210 555 5581 4591 RS:r\001
4 1 -1 0 0 0 20 0.0000 4 195 150 5581 6616 1\001
4 1 -1 0 0 0 20 0.0000 4 240 840 7021 4141 CT:c_t\001
4 1 -1 0 0 0 20 0.0000 4 255 870 5581 586 SS:T_s\001
4 2 4 0 0 0 20 0.0000 4 255 1110 1261 2566 SS:[t_in]\001
4 0 4 0 0 0 20 0.0000 4 255 1260 8685 2565 SS:[t_out]\001
4 2 4 0 0 0 20 0.0000 4 255 1155 1260 6615 SS:[e_in]\001
4 0 4 0 0 0 20 0.0000 4 255 1305 8685 6615 SS:[e_out]\001
4 0 1 1 0 0 20 0.0000 4 210 1875 1845 4050 Thermal model\001
4 0 1 1 0 0 20 0.0000 4 210 2025 1800 5175 Electrical model\001
4 0 1 1 0 0 20 0.0000 4 255 2415 6075 585 Temperature sensor\001

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Segment_lbl.txt version [ffb638c19b].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Segment: Segment of HeatedRod
%DESCRIPTION Part of the HeatedRod example.
%% Label file for system Segment (Segment_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/08/10 12:29:48  peterg
% %% Added missing ports.
% %%
% %% Revision 1.1  1997/09/11 16:17:14  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

% Component type CT
	c_t		lin	effort,c_t

% Component type RS
	r		lin	flow,r

% Component type RT
	r_t		lin	flow,r_t

% Component type SS
	T_s		SS		external,0
	[t_in]		SS		external,internal
	[t_out]		SS		internal,external
	[e_in]		SS		external,internal
	[e_out]		SS		external,internal

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/examples.m version [ccb8cc8f8c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

mttdt = 1;
mttx=(zeros(200,1));
mttu=(zeros(200,1));
BigHeatedRod_numpar;
alpha = BigHeatedRod_smx(mttx,mttu,mttdt);
show_matrix (alpha);
psfig("sparsity.ps");


[N,junk] = size(alpha);
A =  eye(N) - alpha;
plot(log10(abs(eig(A))))
grid;
xlabel("i");
ylabel("e_i");
psfig("eig.ps");

Deleted mttroot/mtt/lib/examples/Simulation/BigHeatedRod/time_svdlu.m version [d2d86013f2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function [N,Ts,Tl]=time_svdlu;

  N=[100:100:700];

  Ts=[]; Tl=[];
  for n=N
    n
    M=rand(n,n);
    ts=time; svd(M); ts=time-ts
    tl=time; lu(M); tl=time-tl
    Ts=[Ts,ts];
    Tl=[Tl,tl];
  endfor;

endfunction;
  

Deleted mttroot/mtt/lib/examples/Simulation/ImplicitRC/ImplicitRC_abg.fig version [ed25703b7d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 900 3150 2250 3150 2025 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 3150 4950 3150 4725 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 3150 7425 3150 7200 3375
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8550 5175 8550 900 45 900 45 5175 8550 5175
4 1 -1 0 0 10 20 0.0000 4 210 570 495 3240 Se:u\001
4 1 -1 0 0 10 20 0.0000 4 210 1095 2925 3240 RC:slow\001
4 1 -1 0 0 10 20 0.0000 4 210 1005 5535 3240 RC:fast\001
4 1 -1 0 0 10 20 0.0000 4 270 600 7830 3240 De:y\001

Deleted mttroot/mtt/lib/examples/Simulation/ImplicitRC/ImplicitRC_desc.tex version [fb1ca09eb2].

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
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
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





































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- Put EMACS into LaTeX-mode
% Verbal description for system ImplicitRC (ImplicitRC_desc.tex)
% Generated by MTT on Wednesday June 24 09:50:17 BST 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This report describes the \emph{implicit} integration methods
available in MTT. They are introduced to provide  simulation
of systems within the following context:
\begin{enumerate}
\item The system may be stiff with a mixture of slow and fast
  (possibly due to approximating algebraic loops) subsystems.
\item The fast parts of the response are of no interest
\item A fixed sample interval is required -- possibly for real-time
  simulation or control
\item The system is nonlinear.
\item The solution of nonlinear algebraic equations is to be avaided.
\end{enumerate}

The following sections consider the linear and nonlinear versions
respectively. The ideas are based on a standard textbook
\footnote{Press et al: \emph{Numerical Recipes in C}, 2nd edition,
  1992. Cambridge, Section 16.6}.
 

\subsection{Implicit integration - the linear case}
\label{sec:linear}

Consider the \emph{linear} system:
\begin{equation}
  \label{eq:sys}
    \dot x = A x + B u
\end{equation}

For the purposes of simulation, it can be discretised (with sample
interval $\Delta t$) in at least two
ways:
\begin{enumerate}
\item $ \dot x \approx \frac{x_{i+1} - x_{i}}{\Delta t}$
\item $ \dot x \approx \frac{x_{i} - x_{i-1}}{\Delta t}$
\end{enumerate}
The former is gives rise to the \emph{forward} Euler or \emph{explicit}
integration scheme:
\begin{equation}
   x_{i+1} =  x_{i} + \Delta t \left [ A x_{i} + B_{i} u \right ]
\end{equation}
and the latter gives rise to the \emph{backward} Euler or \emph{implicit}
integration scheme:
\begin{equation}
   x_{i} =  x_{i-1} + \Delta t \left [ A x_{i} + B_{i} u \right ]
\end{equation}
which must be rewritten as:
\begin{equation}
   x_{i} =   \left [ I -  \Delta t A \right ]^{-1} x_{i-1} + \Delta t  B_{i} u
\end{equation}
for the purposes of implementation.

The explicit method gives simple implementation whereas the implicit
method requires matrix inversion. However, the explicit method is only
stable if:
\begin{equation}
  \Delta t < \frac{2}{| \lambda |}
\end{equation}
where $\lambda$ is the \emph{largest} eigenvalue of $A$. If this
largest eigenvalue is real so $\lambda = \frac{1}{\tau}$ where $\tau$
is the \emph{smallest} system time constant:
\begin{equation}
  \Delta t < 2 \tau
\end{equation}

If the system is stiff, that is it contains at least one small time
constant relative to the dominant time constants, Euler integration is
not feasible due to the very small sample interval $\Delta t$
required.

In contrast, the implicit method is stable.


\subsubsection{Example}
   The acausal bond graph of system \textbf{ImplicitRC} is
   displayed in Figure \Ref{ImplicitRC_abg} and its label
   file is listed in Section \Ref{sec:ImplicitRC_lbl}.
   The subsystems are listed in Section \Ref{sec:ImplicitRC_sub}.

The system represents two simple RC circuits in series with
differential equations as given in Section \Ref{sec:ImplicitRC_ode.tex} and
transfer function  as given in Section \Ref{sec:ImplicitRC_tf.tex}.

For the purposes of this example the two time constants are $1$ and
$\epsilon=10^{-3}$ -- this is a stiff system. All of the simulations
use a sample interval of $\Delta t = 0.1$ ang the input is a unit
step.  Section \Ref{sec:ImplicitRC_sro} shows the exact (computed from
the matrix exponential) solution, and  Section \Ref{sec:ImplicitRC_odeso}
shows the solution by implicit integration.

The explicit solution is not shown, but was found to be unstable for
$\Delta t > 0.002$ as predicted.

\subsection{Implicit integration - the nonlinear case}}
\label{sec:nonlinear}

Consider the \emph{nonlinear} system:
\begin{equation}
  \label{eq:sys}
    \dot x = f(x,u)
\end{equation}
and suppose it can be linearised about any state and input to give:
\begin{equation}
  A(x,u) = \frac{\partial f(x,u)}{\partial x}
\end{equation}

The corresponding \emph{implicit} scheme is:
\begin{equation}
   x_{i} =  x_{i-1} + \Delta t f(x_{i},u_{i})
\end{equation}
This is not easy to solve in general due to the set of non-linear
equations that need to be solved. To avoid this, consider a further
approximation:
\begin{equation}
  f(x_{i},u_{i}) \approx f(x_{i-1},u_{i}) + A(x_{i-1},u_i) ( x_{i} -  x_{i-1} )
\end{equation}
This then gives the \emph{semi-implicit} scheme
\begin{equation}
  x_{i} =  x_{i-1} + \Delta t \left [  f(x_{i-1},u_{i}) + A(x_{i-1},u_i) (
    x_{i} -  x_{i-1} ) \right ]
\end{equation}
which can be rewritten as:
\begin{equation}\label{eq:implicit}
   x_{i} =  \left [ I -  \Delta t A(x_{i-1},u_i) \right ]^{-1} 
    \Delta t \left [  f(x_{i-1},u_{i}) - A(x_{i-1},u_i) x_{i-1}  \right ]
\end{equation}


Because of the approximations invoved, Equation \ref{eq:implicit} is
not guarenteed to be stable. Nevertheless, it should do a much better
job than the corresponding \emph{explicit} method for reasonably
smooth systems.
This method is chosen by setting 
\begin{verbatim}
METHOD='Implicit'
\end{verbatim}
in the MTT simpar.txt file.

A further approximation arises by setting  $A(x_{i-1},u_i) =
A(x_{0},u_0)$ ie computing it one only at the beginning of the
simulation.
This method is chosen by setting 
\begin{verbatim}
METHOD='ImplicitL'
\end{verbatim}
in the MTT simpar.txt file.

Both methods make use of the \textbf{smx} ``state-matrix with state $x$''
representation of MTT which is generated symbolically from the system
bond graph.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Simulation/ImplicitRC/ImplicitRC_lbl.txt version [e8ed754f2f].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY ImplicitRC
%DESCRIPTION <Detailed description here>
%% Label file for system ImplicitRC (ImplicitRC_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type RC
	fast		lin	epsilon;1
	slow		lin	1;1

% Component type SS
	u		SS	external
	y		SS	external





Deleted mttroot/mtt/lib/examples/Simulation/ImplicitRC/ImplicitRC_numpar.txt version [308e6c5a7a].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (ImplicitRC_numpar.txt)
# Generated by MTT at Wednesday June 24 09:21:23 BST 1998

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

# Parameters
epsilon = 	1e-3; # ImplicitRC
c =		1.0;
r =		1.0;

Deleted mttroot/mtt/lib/examples/Simulation/ImplicitRC/ImplicitRC_rep.txt version [3341c40ade].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system ImplicitRC (ImplicitRC_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt ImplicitRC abg tex
mtt ImplicitRC struc tex
mtt ImplicitRC ode tex
mtt ImplicitRC sm tex
mtt ImplicitRC sm m
mtt ImplicitRC tf tex

mtt ImplicitRC sro ps

mtt ImplicitRC numpar tex

mtt ImplicitRC simpar tex
mtt -c ImplicitRC odeso ps

Deleted mttroot/mtt/lib/examples/Simulation/ImplicitRC/ImplicitRC_simpar.txt version [8d36b2a6d0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system ImplicitRC (ImplicitRC_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/08/12 13:29:02  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=10.0
DT=0.1
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Simulation/ImplicitRC/examples.sh version [4fe342f5cf].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

mv ImplicitRC_simpar.txt SAVE
Delta="0.01 0.2 1.0"
for delta in $Delta; do
    echo Doing with sample interval = $delta

    cp SAVE ImplicitRC_simpar.txt 
cat <<EOF >>ImplicitRC_simpar.txt 
DT=$delta
EOF
    mtt -q ImplicitRC odeso dat
    cp ImplicitRC_odeso.dat ImplicitRC_odeso.$delta
done

gnuplot <<EOF 
set term postscript
set output "ImplicitRC.ps"
set grid
plot "ImplicitRC_odeso.0.01" with lines, \
     "ImplicitRC_odeso.0.2" with linespoints, \
     "ImplicitRC_odeso.1.0" with linespoints
EOF
mv SAVE ImplicitRC_simpar.txt 

ghostview ImplicitRC.ps

mv ImplicitRC.ps ../../Figs

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Fuel_abg.fig version [91a602d65e].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6303 2703 6303 3844 6528 3619
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6301 1128 6301 2269 6526 2044
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 2475 7425 2475 7200 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6075 2250 6525 2250
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6525 2250 6525 2700
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 12377 4725 12377 225 450 225 450 4725 12377 4725
4 1 -1 0 0 22 20 0.0000 4 210 765 6300 990 Se:T3\001
4 0 -1 0 0 22 20 0.0000 4 210 1035 7605 2565 Df:Heat\001
4 1 -1 0 0 22 20 0.0000 4 210 390 6255 2565 PS\001
4 0 4 0 0 2 12 0.0000 4 180 630 6660 2385 [power]\001
4 1 4 100 0 18 18 0.0000 4 270 1065 6390 4185 SS:[out]\001

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Fuel_lbl.txt version [ea89d593a7].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Fuel (Fuel_lbl.txt)
%SUMMARY Fuel
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	out	out

% Argument aliases
%ALIAS	$1	Heat
%ALIAS	$2	T3

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type Df
 	Heat	SS		external

% Component type SS
	[out]	SS		external,external

% Component type Se
	T3	SS		external

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/In_abg.fig version [7eb82b8438].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2253 2253 3198 2253 3018 2433
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2252 4952 3197 4952 3017 5132
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3196 2026 3196 2476
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 5400 5625 5400 1530 675 1530 675 5625 5400 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3195 4725 3195 5175
4 0 4 0 0 0 20 0.0000 4 255 1440 3332 5042 SS:[Hy_out]\001
4 0 4 0 0 0 20 0.0000 4 255 1425 3377 2342 SS:[Th_out]\001
4 2 -1 0 0 0 20 0.0000 4 255 1095 2026 2341 SS:Th_in\001
4 2 -1 0 0 0 20 0.0000 4 255 1110 2071 5041 SS:Hy_in\001

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/In_desc.tex version [0c97485c1c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system In (In_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:36 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{In} is
   displayed in Figure \Ref{In_abg} and its label
   file is listed in Section \Ref{sec:In_lbl}.
   The subsystems are listed in Section \Ref{sec:In_sub}.

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/In_lbl.txt version [b98a7bad58].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY In: Inflow conditions
%DESCRIPTION <Detailed description here>
%ALIAS	in|out Th_out,Hy_out
%% Label file for system In (In_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/04 09:41:53  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type SS
	[Hy_out]	SS	external,external
	[Th_out]	SS	external,external
	Hy_in		SS	p_1,internal
	Th_in		SS	t_1,internal

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Load_abg.fig version [f6adaf70fd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2700 900 2700 2250 2925 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2700 2700 2700 4050 2925 3825
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4050 2475 5400 2475 5175 2700
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6795 5175 6795 225 1350 225 1350 5175 6795 5175
4 1 4 0 0 22 20 0.0000 4 270 900 2745 720 SS:[in]\001
4 1 -1 0 0 22 20 0.0000 4 210 2325 2880 2565 PS:PowerSensor\001
4 1 4 0 0 22 20 0.0000 4 270 420 2385 2250 [in]\001
4 1 4 0 0 22 20 0.0000 4 270 615 2385 2835 [out]\001
4 1 4 0 0 22 20 0.0000 4 270 1035 3735 2250 [power]\001
4 1 -1 0 0 22 20 0.0000 4 210 1095 6030 2565 Df:Work\001
4 1 -1 0 0 22 20 0.0000 4 270 630 2655 4410 R:r_l\001

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Load_lbl.txt version [cd55430fc2].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Load (Load_lbl.txt)
%SUMMARY Load
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in

% Argument aliases
%ALIAS	$1	r_l

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----


	PowerSensor			

% Component type Df
	Work	SS		external

% Component type R
	r_l	lin		flow,r_l

% Component type SS
	[in]	SS		external,external

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Out_abg.fig version [34cc41cc19].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2252 4952 3197 4952 3017 5132
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 5400 5625 5400 1530 675 1530 675 5625 5400 5625
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2205 2250 3150 2250 2970 2430
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2250 4725 2250 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2250 2250 2250 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2250 1980 2250 2250
4 0 -1 0 0 0 20 0.0000000 4 240 1290 3465 2340 SS:Th_out\001
4 0 -1 0 0 0 20 0.0000000 4 270 1320 3375 5040 SS:Hy_out\001
4 2 4 0 0 0 20 0.0000000 4 270 1380 2160 5040 SS:[Hy_in]\001
4 2 4 0 0 0 20 0.0000000 4 240 1350 2115 2340 SS:[Th_in]\001

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Out_desc.tex version [3dd57dc573].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Out (Out_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:44 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Out} is
   displayed in Figure \Ref{Out_abg} and its label
   file is listed in Section \Ref{sec:Out_lbl}.
   The subsystems are listed in Section \Ref{sec:Out_sub}.

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Out_lbl.txt version [19b6550ba8].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Out: Outflow conditions
%DESCRIPTION <Detailed description here>
%ALIAS	in  Th_in,Hy_in
%% Label file for system Out (Out_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type SS
	[Hy_in]		SS	external,external
	[Th_in]		SS	external,external
	Hy_out		SS	p_1,internal
	Th_out		SS	t_1,internal

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Shaft_abg.fig version [598a000ebe].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 1620 2700 2970 2700 2745 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 2700 4725 2700 4500 2925
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 2925 3150 4275 3375 4050
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3150 2475 3150 1125 3375 1350
2 4 0 2 31 7 50 0 -1 0.000 0 0 7 0 0 5
	 6075 4950 6075 450 450 450 450 4950 6075 4950
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 3375 2475 4330 1520 4330 1839
4 1 0 100 0 18 18 0.0000 4 195 150 3150 2790 1\001
4 1 0 100 0 18 18 0.0000 4 270 540 3150 990 I:j_s\001
4 1 4 100 0 18 18 0.0000 4 270 870 1170 2790 SS:[in]\001
4 1 4 100 0 18 18 0.0000 4 270 1065 5310 2790 SS:[out]\001
4 1 4 100 0 18 18 0.0000 4 270 1215 3195 4680 SS:[load]\001
4 1 0 100 0 18 18 0.0000 4 270 1245 4455 1395 Df:speed\001

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/Shaft_lbl.txt version [93c7018fae].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system Shaft (Shaft_lbl.txt)
%SUMMARY Shaft
%DESCRIPTION 

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in	in
%ALIAS	load	load
%ALIAS	out	out

% Argument aliases
%ALIAS	$1	j_s

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----
	speed	SS		external

% Component type I
	j_s	lin		flow,j_s

% Component type SS
	[in]	SS		external,external
	[load]	SS		external,external
	[out]	SS		external,external

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_abg.fig version [9abd037150].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6078 1803 6078 2944 6303 2719
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4230 3375 5584 3375 5359 3600
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6750 3375 8104 3375 7879 3600
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1575 3375 2704 3375 2479 3600
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9450 3375 10579 3375 10354 3600
2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 4
	 8550 3870 8550 5850 6975 5850 7200 6075
2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 0 0 4
	 5175 5850 3375 5850 3375 3825 3600 4050
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6075 6284 6075 7425 6300 7200
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 12152 8550 12152 675 225 675 225 8550 12152 8550
4 1 4 0 0 2 12 0.0000 4 180 540 8510 3740 [Shaft]\001
4 1 4 0 0 2 12 0.0000 4 180 540 3379 3739 [Shaft]\001
4 1 1 1 0 2 30 0.0000 4 300 210 2162 3017 1\001
4 1 1 1 0 2 30 0.0000 4 300 210 4817 3017 2\001
4 1 1 1 0 2 30 0.0000 4 300 210 7292 3017 3\001
4 1 1 1 0 2 30 0.0000 4 300 210 9947 3017 4\001
4 1 4 0 0 2 12 0.0000 4 180 540 6078 3198 [Heat]\001
4 1 -1 0 0 22 20 0.0000 4 210 570 1217 3467 In:in\001
4 1 -1 0 0 2 20 0.0000 4 195 1050 6167 3467 Comb:c1\001
4 0 -1 0 0 22 20 0.0000 4 210 1005 10758 3468 Out:out\001
4 1 -1 0 0 2 20 0.0000 4 255 1455 3469 3469 Pump:comp\001
4 1 -1 0 0 2 20 0.0000 4 255 1335 8780 3470 Pump:turb\001
4 1 4 0 0 2 12 0.0000 4 180 465 6075 6165 [load]\001
4 1 -1 0 0 22 20 0.0000 4 210 1500 6078 5943 Shaft:shaft\001
4 1 -1 0 0 22 20 0.0000 4 210 1380 6075 7740 Load:load\001
4 1 1 1 0 3 25 0.0000 4 270 1425 6030 8145 Work out\001
4 1 -1 0 0 22 20 0.0000 4 210 1185 6030 1665 Fuel:fuel\001
4 1 1 1 0 3 25 0.0000 4 270 1140 5985 1215 Heat in\001

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_desc.tex version [3351a658e2].

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
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
123



























































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- used to set EMACS into LaTeX-mode
% Verbal description for system SimpleGasTurbine (SimpleGasTurbine_desc.tex)
% Generated by MTT on Tue Jan 13 18:01:55 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/05/18 15:45:50  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{SimpleGasTurbine} is
   displayed in Figure \Ref{SimpleGasTurbine_abg} and its label
   file is listed in Section \Ref{sec:SimpleGasTurbine_lbl}.
   The subsystems are listed in Section \Ref{sec:SimpleGasTurbine_sub}.
   
   \textbf{SimpleGasTurbine} can be regarded as an single-spool gas
   turbine (producing shaft power) with an ideal-gas working fluid. It
   corresponds to the simple Joule Cycle as described in Chapter 12 of
   Rogers and Mayhew and in Chapter 2 of Cohen, Rogers and
   Saravanamutto. However, unlike those examples, the system is
   written with dynamics in mind.
   
   The system is described using an energy Bond Graph- this ensures
   that the first law is observed. In particular transformers are used
   to explicitly convert between energy covariables. Although this is
   a simple model, I believe that it provides the basis for building
   complex thermodynamic systems involving gas power cycles.


There are five main components:
\begin{enumerate}
\item p1 -- a \textbf{Pump} component representing the compressor
  stage. This converts shaft work to energy flow in the working fluid.
\item c1 -- a \textbf{Comb} component representing the combustion
  chamber. This converts the heat obtained by burning fuel to energy
  flow in the working fluid.
\item t1 -- a \textbf{Turb} component representing the turbine
  component. This converts the energy flow in the working fluid to
  shaft work
\item j\_s -- an \textbf{I} component representing the combined inertia
  of the shaft and compressor and turbine rotors.
\item a \textbf{Load} component to absorb the shaft power.
\end{enumerate}
The components \textbf{In} and \textbf{Out} provide the inlet and
outlet conditions.

Both \textbf{Pump} and \textbf{Turb} are implemented with the
\emph{polytropic} constitutive relationship with index $n$. When
$n=\gamma=\frac{c_p}{c_v}$ this corresponds to isentropic compression
and expansion and thus the \textbf{SimpleGasTurbine} achieves its
cycle efficiency. However, other values of $n$ can be used to account
for isentropic efficiency of less than unity.

To obtain a very simple dynamic model (and to avoid the need for an
accurate combustion chamber model) there are no dynamics associated
with the combustion chamber, but rahter it is assumed that the
corresponding temperature is imposed on the component (that is $T_3$
is the system input) the corresponding heat flow is then an output.

Both heat input and work output are measured using the \textbf{PS}
(power sensor) component, that for work output is embedded in the
\textbf{Load} component. These can be monitored to give the efficiency
of the \textbf{SimpleGasTurbine}.

A symbolic steady-state for the model was computed -- see Section
\ref{sec:SimpleGasTurbine_ss.tex}. In particular, the load
resistance was chosen to absorb all the generated work at the steady
state and the shaft inertia was chosen to give a unit time constant
for the linearised system. The mass flow and shaft speeds were taken
as unity.

For the purposed of simulation, the numerical values given in Examples
12.1 of Chapter 12 of Rogers and Mayhew, except that the isentropic
efficiencies are 100\% ($n=\gamma$) -- see Section
\ref{sec:SimpleGasTurbine_numpar.tex}.

Simulations were performed starting at the steady state and increasing
the combustion chamber temperature by 10\% at $t=1$ and reducing by
10\% at $t=5$. Graphs of the various outputs are plotted:
\begin{itemize}
\item Figure
  \Ref{fig:SimpleGasTurbine_odeso-SimpleGasTurbine-comp-1-T,SimpleGasTurbine-c1-1-T,SimpleGasTurbine-turb-1-T.ps}
  -- the temperatures at the output of the
  \begin{itemize}
  \item compressor,
  \item combustion chamber and
  \item turbine
  \end{itemize}
\item Figure
  \Ref{fig:SimpleGasTurbine_odeso-SimpleGasTurbine-fuel-1-Heat-1-y,SimpleGasTurbine-load-1-Work-1-y.ps}
  -- the heat input and work output
\item Figure
  \Ref{fig:SimpleGasTurbine_odeso-SimpleGasTurbine-shaft-1-speed-1-y.ps} -- the shaft speed and
\item Figure
  \Ref{fig:SimpleGasTurbine_odeso-SimpleGasTurbine-c1-1-P.ps}
  -- the pressure at the output of the
  \begin{itemize}
  \item compressor,
  \item combustion chamber and
  \item turbine
  \end{itemize}
\end{itemize}

This model can be modified extended in various ways to yield related
dynamic systems. For example:
\begin{itemize}
\item an air cooler is obtained by changing the direction of heat and
  work flows
\item additional \textbf{Turb} and \textbf{Comb} components add reheat
  to the cycle
\item an isentropic nozzle can be added and the work output removed
  to give a jet engine.
\end{itemize}


%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_input.txt version [93a80833a9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (SimpleGasTurbine_input.txt)
# Generated by MTT at Tue Mar 31 12:38:39 BST 1998

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

t_3 = 1000;

# Set the inputs
## Removed by MTT on Mon Nov 27 15:18:54 GMT 2000: u(1) =	 t_3 + 0.1*t_3*(t>1) -  0.2*t_3*(t>5); # SimpleGasTurbine (T3)
simplegasturbine_fuel_1_t3_1_u	= t_3 + 0.1*t_3*(t>1) -  0.2*t_3*(t>5); 

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_lbl.txt version [84a69ceae1].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87























































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY SimpleGasTurbine: single-spool gas turbine producing shaft power
#DESCRIPTION SimpleGasTurbine can be regarded as an single-spool gas
#DESCRIPTION turbine (producing shaft power) with an ideal-gas working fluid. It
#DESCRIPTION corresponds to the simple Joule Cycle as described in Chapter 12 of
#DESCRIPTION Rogers and Mayhew and in Chapter 2 of Cohen, Rogers and
#DESCRIPTION Saravanamutto. However, unlike those examples, the system is
#DESCRIPTION written with dynamics in mind.

#ALIAS	Comb	CompressibleFlow/Comb
#ALIAS	Pump	CompressibleFlow/Pump

#PAR t_2
#PAR t_3
#PAR t_4
#PAR p_2
#PAR p_3
#PAR p_4
#PAR mdot
#PAR gamma_0
#PAR q_0
#PAR w_0
#PAR omega_0
#PAR r_p
#PAR c_p
#PAR mom_0

#NOTPAR 	density
#NOTPAR	ideal_gas
#NOTPAR	q_0

## Label file for system SimpleGasTurbine (SimpleGasTurbine_lbl.txt)

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.4  1998/07/30 15:27:42  peterg
# ## Use #VAR inplace of dummy component.
# ##
# ## Revision 1.3  1998/07/03 14:54:45  peterg
# ## k_p --> k
# ## k_t --> k
# ##
# ## Revision 1.2  1998/07/03 14:53:38  peterg
# ## Renames tank to comb to be consistent.
# ##
# ## Revision 1.1  1998/05/18 15:46:02  peterg
# ## Initial revision
# ##
# ###############################################################

## Each line should be of one of the following forms:
#	a comment (ie starting with #)
#	Component-name	CR_name	arg1,arg2,..argn
#	blank

# Component type Fuel
	fuel

# Component type In
	in

# Component type Pump
	comp		none		c_v;density,ideal_gas,r;alpha;effort,k

# Component type Comb
	c1		none		m_c;v_c;r

# Component type Pump
	turb		none		c_v;density,ideal_gas,r;alpha;effort,k

# Component type Out
	out

# Component type Shaft
        shaft		none		j_s

# Component type Load
	load		none		r_l







Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_numpar.txt version [29d5371a75].

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
























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (SimpleGasTurbine_numpar.txt)
# Generated by MTT at Tue Mar 31 12:15:00 BST 1998

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

# Parameters
c_p = 	1005.0;
c_v = 	718.0; 
gamma_0 =  c_p/c_v;
alpha = (gamma_0-1)/gamma_0;
k = 	1.0;
p_1 = 	1e5; # 1 bar
p_4 = 	p_1; 
r = 	c_p-c_v;
t_1 = 	288.0; # In
v_c = 	1.0;

%Set the CC pressure and temperature
t_3 = 1000.0;
r_p = 6.0;
p_3 = r_p*p_1;

%Find stored mass to give combustion chamber pressure p_3 (at
% temperature t_3
m_c = (p_3*v_c)/(t_3*r);

%Equate pressures
p_4 = p_1;
p_2 = p_3;

%Compute ss temperatures (isentropic)
t_2 = t_1*(p_2/p_1)^alpha;
t_4 = t_3*(p_4/p_3)^alpha;

%Find the steady-state work output
w_0 = c_p*(t_3-t_4) - c_p*(t_2-t_1);

%Unit mass flow
mdot = 1;

%Corresponding shaft speed
omega_0 = mdot/k;

%Compute the corresponding load resistance (to absorb that work)
r_l = w_0/(omega_0)^2;

%Compute shaft inertia to give unit time constant (j_s*r_l)
j_s = r_l;

%Find angular momentum to give shaft speed omega_0
mom_0 =  omega_0*j_s;

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_rep.txt version [23bb4693b4].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system SimpleGasTurbine (SimpleGasTurbine_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  2000/11/27 18:16:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -o -ss SimpleGasTurbine abg tex
mtt -o -ss SimpleGasTurbine struc tex
mtt -o -ss SimpleGasTurbine sympar tex
mtt -o -ss SimpleGasTurbine ode tex

mtt -o -ss SimpleGasTurbine sspar r
mtt -o -ss SimpleGasTurbine ss tex
mtt -o -ss SimpleGasTurbine sm tex

mtt -o -ss SimpleGasTurbine numpar tex
mtt -o -ss SimpleGasTurbine input tex
mtt -o -ss SimpleGasTurbine state tex
mtt -o -ss SimpleGasTurbine simpar tex
mtt -o -ss -c SimpleGasTurbine odeso ps 'SimpleGasTurbine_comp_1_T,SimpleGasTurbine_c1_1_T,SimpleGasTurbine_turb_1_T'

mtt -o -ss -c SimpleGasTurbine odeso ps 'SimpleGasTurbine_fuel_1_Heat_1_y,SimpleGasTurbine_load_1_Work_1_y'

mtt -o -ss -c SimpleGasTurbine odeso ps 'SimpleGasTurbine_shaft_1_speed_1_y'

mtt -o -ss -c SimpleGasTurbine odeso ps 'SimpleGasTurbine_c1_1_P'





Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_simp.r version [81a3a4cecb].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
%% Reduce commands to simplify output for system SimpleGasTurbine (SimpleGasTurbine_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LET c_v = c_p - r;
END;

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_sspar.r version [9448edc654].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (SimpleGasTurbine_sspar.r)
% Generated by MTT at Thu Mar 26 16:28:59 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Find stored mass to give combustion chamber pressure p_3 (at
% temperature t_3
m_c := (p_3*v_c)/(t_3*r);

%Equate pressures
p_4 := p_1;
p_2 := p_3;

%Compute ss temperatures (isentropic)
t_2 := t_1*(p_2/p_1)^alpha;
t_4 := t_3*(p_4/p_3)^alpha;

%Find the steady-state work output
w_0 := c_p*(t_3-t_4) - c_p*(t_2-t_1);

%Compute the corresponding load resistance (to absorb that work)
r_l := w_0/(omega_0)^2;

%Unit mass flow
mdot := 1;

%Corresponding shaft speed
omega_0 := mdot/k;

%Compute shaft inertia to give unit time constant (j_s*r_l)
j_s := r_l;

%Find angular momentum to give shaft speed omega_0
mom_0 :=  omega_0*j_s;

% Steady-state states
MTTX1 := 	mom_0;

% Steady-state inputs - combustion temperature
MTTU1 := 	t_3; % SimpleGasTurbine (T3)

;;END;

Deleted mttroot/mtt/lib/examples/Thermal/GasTurbines/SimpleGasTurbine/SimpleGasTurbine_state.txt version [6b258d7849].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# State initialisation file (SimpleGasTurbine_state.txt)
# Generated by MTT at Tue Mar 31 12:37:17 BST 1998

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


# Set the states
## Removed by MTT on Mon Nov 27 15:20:21 GMT 2000: x(1) =	 j_s/k ; # SimpleGasTurbine (j_s)

simplegasturbine_shaft_1_j_s	= j_s/k ;

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestPipe/TestPipe_abg.fig version [546701647b].

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
































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 1351 4051 1351 3826 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4051 1126 4051 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2027 2702 4052 2702 3827 2927
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 2702 6976 2702 6751 2927
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 1351 6976 1351 6751 1576
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8550 3375 8550 405 450 405 450 3375 8550 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 2475 4050 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 2475 4950 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 1125 4950 1575
4 2 4 0 0 0 20 0.0000000 4 240 930 4096 991 [Th_in]\001
4 2 -1 0 0 22 20 0.0000000 4 285 1065 1936 1441 SS:Th_in\001
4 2 -1 0 0 22 20 0.0000000 4 285 1080 1937 2792 SS:Hy_in\001
4 2 4 0 0 0 20 0.0000000 4 270 960 4097 2342 [Hy_in]\001
4 0 -1 0 0 22 20 0.0000000 4 285 1215 7111 1441 SS:Th_out\001
4 0 4 0 0 0 20 0.0000000 4 240 1080 4951 991 [Th_out]\001
4 0 4 0 0 0 20 0.0000000 4 270 1110 4951 2342 [Hy_out]\001
4 0 -1 0 0 22 20 0.0000000 4 285 1230 7111 2792 SS:Hy_out\001
4 1 -1 0 0 22 20 0.0000000 4 285 1110 4545 1980 Pipe:pipe\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestPipe/TestPipe_lbl.txt version [151ff03f63].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TestPipe
%DESCRIPTION <Detailed description here>
%% Label file for system TestPipe (TestPipe_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/11/20 08:02:53  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%ALIAS Pipe IncompressibleFlow/Pipe

% Component type Pipe
	pipe		lin		rho;c_p;lin,r

% Component type SS
	Hy_in		SS	external,external
	Hy_out		SS	external,external
	Th_in		SS	external,external
	Th_out		SS	external,external

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestPipe/TestPipe_rep.txt version [864bebdd7e].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TestPipe (TestPipe_rep.txt)
# Generated by MTT on" Fri Nov 20 08:16:40 GMT 1998.

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

mtt TestPipe abg tex			# The system description
mtt TestPipe cbg ps 		        # The causal bond graph
# Uncomment the following lines or add others
mtt TestPipe struc tex	        # The system structure
mtt TestPipe dae tex	        # The system dae
# mtt TestPipe ode tex	        # The system ode 
# mtt TestPipe sspar tex		# Steady-state parameters
# mtt TestPipe ss tex 		# Steady state
# mtt TestPipe dm tex			# Descriptor matrices (of linearised system)
# mtt TestPipe sm tex			# State matrices (of linearised system)
# mtt TestPipe tf tex			# Transfer function (of linearised system)
# mtt TestPipe lmfr ps		# log modulus of frequency response (of linearised system)
# mtt TestPipe simpar tex		# Simulation parameters
# mtt TestPipe numpar tex		# Numerical simulation parameters
# mtt TestPipe input tex		# Simulation input
# mtt TestPipe odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestPump/TestPump_abg.fig version [1e77e038d9].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 1351 4051 1351 3826 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2027 2702 4052 2702 3827 2927
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 2702 6976 2702 6751 2927
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 1351 6976 1351 6751 1576
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8550 3375 8550 405 450 405 450 3375 8550 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 4500 4500 2475 4725 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4275 4500 4725 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 2475 4050 2925
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 2476 4950 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 1125 4950 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 1125 4050 1575
4 2 4 0 0 0 20 0.0000 4 255 870 4096 991 [Th_in]\001
4 2 -1 0 0 22 20 0.0000 4 270 1200 1936 1441 SS:Th_in\001
4 2 -1 0 0 22 20 0.0000 4 270 1245 1937 2792 SS:Hy_in\001
4 0 -1 0 0 22 20 0.0000 4 270 1395 7111 1441 SS:Th_out\001
4 0 4 0 0 0 20 0.0000 4 255 1020 4951 991 [Th_out]\001
4 0 -1 0 0 22 20 0.0000 4 270 1440 7111 2792 SS:Hy_out\001
4 2 4 0 0 0 20 0.0000 4 255 885 3735 2565 [Hy_in]\001
4 0 4 0 0 0 20 0.0000 4 255 1035 5355 2565 [Hy_out]\001
4 1 4 0 0 0 20 0.0000 4 240 810 4545 2340 [Shaft]\001
4 1 -1 0 0 22 20 0.0000 4 210 1200 4500 4815 SS:Shaft\001
4 1 -1 0 0 22 20 0.0000 4 270 1740 4545 1980 lPump:pump\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestPump/TestPump_lbl.txt version [0beeb5c1ed].

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











































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TestPump: test of incompressible-flow pump component
%DESCRIPTION
%% Label file for system TestPump (TestPump_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.5  1998/11/20 13:00:27  peterg
% %% Replaces Pump by lPump in ALIAS
% %%
% %% Revision 1.4  1998/11/20 08:31:24  peterg
% %% Fixed alias error
% %%
% %% Revision 1.3  1998/11/20 08:28:41  peterg
% %% Tidied
% %%
% %% Revision 1.2  1998/11/20 08:09:57  peterg
% %% Added alias for Pump
% %%
% %% Revision 1.1  1998/11/20 08:06:28  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%ALIAS lPump IncompressibleFlow/lPump


% Component type lPump
	pump		lin;lin		rho;c_p;flow,r_p;k_p;flow,r_l

% Component type SS
	Hy_in		SS	external,external
	Hy_out		SS	external,external
	Shaft		SS	external,external
	Th_in		SS	external,external
	Th_out		SS	external,external

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestPump/TestPump_rep.txt version [a84c161cd8].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TestPump (TestPump_rep.txt)
# Generated by MTT on" Fri Nov 20 08:19:56 GMT 1998.

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

mtt TestPump abg tex			# The system description
mtt TestPump cbg ps 		        # The causal bond graph
# Uncomment the following lines or add others
mtt TestPump struc tex	        # The system structure
#mtt TestPump dae tex	        # The system dae
mtt TestPump ode tex	        # The system ode 
# mtt TestPump sspar tex		# Steady-state parameters
# mtt TestPump ss tex 		# Steady state
# mtt TestPump dm tex			# Descriptor matrices (of linearised system)
# mtt TestPump sm tex			# State matrices (of linearised system)
# mtt TestPump tf tex			# Transfer function (of linearised system)
# mtt TestPump lmfr ps		# log modulus of frequency response (of linearised system)
# mtt TestPump simpar tex		# Simulation parameters
# mtt TestPump numpar tex		# Numerical simulation parameters
# mtt TestPump input tex		# Simulation input
# mtt TestPump odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestTank/TestTank_abg.fig version [39fee160b3].

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




































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 1351 4051 1351 3826 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2027 2702 4052 2702 3827 2927
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 2702 6976 2702 6751 2927
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4951 1351 6976 1351 6751 1576
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8550 3375 8550 405 450 405 450 3375 8550 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2025 1125 2025 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6975 1126 6975 1576
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6975 2476 6975 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2025 2476 2025 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4502 4500 4502 2475 4727 2700
4 2 4 0 0 0 20 0.0000000 4 240 930 4096 991 [Th_in]\001
4 2 -1 0 0 22 20 0.0000000 4 285 1065 1936 1441 SS:Th_in\001
4 2 -1 0 0 22 20 0.0000000 4 285 1080 1937 2792 SS:Hy_in\001
4 0 -1 0 0 22 20 0.0000000 4 285 1215 7111 1441 SS:Th_out\001
4 0 4 0 0 0 20 0.0000000 4 240 1080 4951 991 [Th_out]\001
4 0 -1 0 0 22 20 0.0000000 4 285 1230 7111 2792 SS:Hy_out\001
4 1 -1 0 0 22 20 0.0000000 4 225 1140 4545 1980 Tank:tank\001
4 1 4 0 0 0 20 0.0000000 4 240 1170 4590 2295 [Heat_in]\001
4 2 4 0 0 0 20 0.0000000 4 270 960 3915 2565 [Hy_in]\001
4 0 4 0 0 0 20 0.0000000 4 270 1110 5130 2565 [Hy_out]\001
4 1 -1 0 0 0 20 0.0000000 4 240 1590 4500 4860 SS:[Heat_in]\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestTank/TestTank_lbl.txt version [f62d6e747b].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TestTank: Equations for incompressible-flow Tank component
%DESCRIPTION
%% Label file for system TestTank (TestTank_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/11/20 08:36:30  peterg
% %% Corrected alias
% %%
% %% Revision 1.2  1998/11/20 08:09:20  peterg
% %% Added alias for Tank
% %%
% %% Revision 1.1  1998/11/20 08:07:20  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%ALIAS Tank IncompressibleFlow/Tank

% Component type SS
	Heat_in		SS	external,external
	Hy_in		SS	external,external
	Hy_out		SS	external,external
	Th_in		SS	external,external
	Th_out		SS	external,external

% Component type Tank
	tank		none		rho;c_p;c

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Components/TestTank/TestTank_rep.txt version [92aadf89bd].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system TestTank (TestTank_rep.txt)
# Generated by MTT on" Fri Nov 20 08:11:01 GMT 1998.

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

mtt TestTank abg tex			# The system description
mtt TestTank cbg ps 		        # The causal bond graph
# Uncomment the following lines or add others
mtt TestTank struc tex	        # The system structure
# mtt TestTank dae tex	        # The system dae
mtt TestTank ode tex	        # The system ode 
# mtt TestTank sspar tex		# Steady-state parameters
# mtt TestTank ss tex 		# Steady state
# mtt TestTank dm tex			# Descriptor matrices (of linearised system)
# mtt TestTank sm tex			# State matrices (of linearised system)
# mtt TestTank tf tex			# Transfer function (of linearised system)
# mtt TestTank lmfr ps		# log modulus of frequency response (of linearised system)
# mtt TestTank simpar tex		# Simulation parameters
# mtt TestTank numpar tex		# Numerical simulation parameters
# mtt TestTank input tex		# Simulation input
# mtt TestTank odeso ps		# Simulation output

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/In_abg.fig version [991e0796f9].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2253 2253 3198 2253 3018 2433
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2252 4952 3197 4952 3017 5132
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3196 2026 3196 2476
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3195 4725 3195 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3602 4950 4547 4950 4367 5130
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3602 2250 4547 2250 4367 2430
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 7200 5670 7200 1530 675 1530 675 5670 7200 5670
4 2 -1 0 0 0 20 0.0000 4 255 1095 2026 2341 SS:Th_in\001
4 2 -1 0 0 0 20 0.0000 4 255 1110 2071 5041 SS:Hy_in\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3376 5041 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3376 2341 0\001
4 0 4 0 0 0 20 0.0000 4 255 2235 4727 5042 SS:[Hydraulic_out]\001
4 0 4 0 0 0 20 0.0000 4 255 2085 4772 2342 SS:[Thermal_out]\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/In_desc.tex version [0c97485c1c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system In (In_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:36 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{In} is
   displayed in Figure \Ref{In_abg} and its label
   file is listed in Section \Ref{sec:In_lbl}.
   The subsystems are listed in Section \Ref{sec:In_sub}.

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/In_lbl.txt version [3db8aa0e33].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY In: Inflow conditions
%DESCRIPTION <Detailed description here>
%% Label file for system In (In_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%ALIAS	out Thermal_out,Hydraulic_out
%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out



% Component type SS
	Hy_in			SS	p_0,external
	Th_in			SS	t_0,external
	[Hydraulic_out]		SS	external,external
	[Thermal_out]		SS	external,external

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/LiquidTurbine_abg.fig version [1fdbc1249e].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6302 1127 6302 2252 6527 2027
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6077 1127 6527 1127
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9495 2700 10534 2703 10309 2928
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 6075 5175 3600 5175 3600 3150 3849 3399
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6076 5401 6526 5401
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 4950 6300 4050 6525 4275
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 4
	 8775 3150 8775 5175 6525 5175 6750 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6301 6299 6301 5399 6526 5624
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 2700 3060 2700 2835 2925
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4497 2698 5715 2700 5490 2925
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6930 2700 8145 2700 7920 2925
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11925 7200 11925 225 900 225 900 7200 11925 7200
4 1 4 0 0 2 16 0.0000 4 210 750 3602 3062 [Shaft]\001
4 1 4 0 0 2 16 0.0000 4 225 1005 6302 2477 [Heat_in]\001
4 1 4 0 0 2 16 0.0000 4 210 750 8733 3063 [Shaft]\001
4 1 -1 0 0 2 20 0.0000 4 255 1185 3737 2792 lPump:p1\001
4 1 -1 0 0 22 20 0.0000 4 210 1110 6257 1037 SS:Heat\001
4 1 -1 0 0 22 20 0.0000 4 195 150 6301 5266 1\001
4 1 -1 0 0 22 20 0.0000 4 210 1170 6391 6751 SS:Work\001
4 1 -1 0 0 22 20 0.0000 4 270 555 6300 3915 I:j_s\001
4 1 -1 0 0 2 20 0.0000 4 195 1065 6302 2792 Tank:C1\001
4 1 -1 0 0 2 20 0.0000 4 255 1140 8868 2793 lPump:t1\001
4 1 -1 0 0 22 20 0.0000 4 210 570 1620 2790 In:in\001
4 1 -1 0 0 22 20 0.0000 4 210 1005 11116 2791 Out:out\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/LiquidTurbine_desc.tex version [4d57456af9].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- used to set EMACS into LaTeX-mode
% Verbal description for system LiquidTurbine (LiquidTurbine_desc.tex)
% Generated by MTT on Tue Jan 13 18:01:55 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{LiquidTurbine} is
   displayed in Figure \Ref{LiquidTurbine_abg} and its label
   file is listed in Section \Ref{sec:LiquidTurbine_lbl}.
   The subsystems are listed in Section \Ref{sec:LiquidTurbine_sub}.

\textbf{LiquidTurbine} can be regarded as a single-spool gas turbine
with an incompressible working fluid. Of course, such a device cannot
convert heat to work; however, it provides a useful first step towards
modelling a gas turbine.

There are three main components:
\begin{enumerate}
\item p1 -- a leaky pump \textbf{lPump} component. This is analogous
  to the gas turbine compressor.
\item c1 -- a tank \textbf{Tank} component. This is analogous
  to the gas turbine combustion chamber.
\item t1 -- a leaky turbine \textbf{lTurb} component. This is analogous
  to the gas turbine turbine.
\end{enumerate}
The components \textbf{In} and \textbf{Out} provide the inlet and
outlet conditions.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/LiquidTurbine_lbl.txt version [e86e85fc85].

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














































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY LiquidTurbine
%DESCRIPTION <Detailed description here>
%% Label file for system LiquidTurbine (LiquidTurbine_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%ALIAS	lPump	IncompressibleFlow/lPump
%ALIAS	Tank	IncompressibleFlow/Tank

%VAR p_0
%VAR q_0
%VAR t_0


%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

% Component type I
	j_s		lin		flow,j_s

% Component type Pump
	p1		lin;lin		rho;c_p;flow,r_p;k_p;flow,r_pl

% Component type SS
	Heat		SS	external,external
	Work		SS	external,external

% Component type Turb
	t1		lin;lin		rho;c_p;flow,r_t;k_t;flow,r_tl

% Component type Tank
	C1		none		rho;c_p;c_t

% Component type In
	in

% Component type Out
	out

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/LiquidTurbine_numpar.txt version [5ce4952130].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (LiquidTurbine_numpar.txt)
# Generated by MTT at Mon Mar  9 09:16:28 GMT 1998

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

# Parameters
c   =   1.0;
c_p = 	1.0; # LiquidTurbine
c_t = 	1.0; # LiquidTurbine
j_s = 	1.0; # LiquidTurbine
k_p = 	1.0; # LiquidTurbine
k_t = 	1.0; # LiquidTurbine
p_0 = 	1e5; # In,Out
q_0 = 	1e5; # Heat in 
r_p = 	1.0; # LiquidTurbine
r_pl = 	100.0; # LiquidTurbine
r_t = 	1.0; # LiquidTurbine
r_tl = 	100.0; # LiquidTurbine
rho = 	1.0; # LiquidTurbine
t_0 = 	300.0; # In,Out

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/LiquidTurbine_rep.txt version [91b76102c7].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system LiquidTurbine (LiquidTurbine_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:13:25  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -o -ss LiquidTurbine abg tex
mtt -o -ss LiquidTurbine struc tex
mtt -o -ss LiquidTurbine sympar tex
mtt -o -ss LiquidTurbine ss tex
mtt -o -ss LiquidTurbine ode tex


mtt -o -ss LiquidTurbine numpar txt
mtt -o -ss LiquidTurbine input txt

mtt -o -ss -c LiquidTurbine odeso ps 'LiquidTurbine_Heat'
mtt -o -ss -c LiquidTurbine odeso ps 'LiquidTurbine_Work'
mtt -o -ss -c LiquidTurbine odeso ps 'LiquidTurbine_in_Hy_in'
mtt -o -ss -c LiquidTurbine odeso ps 'LiquidTurbine_out_Hy_out'
mtt -o -ss -c LiquidTurbine odeso ps 'LiquidTurbine_out_Th_out'

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/LiquidTurbine_sspar.r version [9128209004].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (LiquidTurbine_sspar.r)
% Generated by MTT at Fri Nov 20 11:42:16 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Steady-state states
MTTX1 := 	1; % LiquidTurbine (j_s)
MTTX2 := 	p_0*c/rho; % LiquidTurbine_C1 (tank) - pressure = p0
MTTX3 := 	t_0*p_0*c*c_p; % LiquidTurbine_C1 (tank) - temp = t0
% Steady-state inputs
MTTU1 := 	q_0; % LiquidTurbine (Heat)
MTTU2 := 	0; % LiquidTurbine (Work)
;;END;

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/Out_abg.fig version [50c38b16c3].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2252 4952 3197 4952 3017 5132
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2205 2250 3150 2250 2970 2430
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2250 4725 2250 5175
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2205 2025 2205 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 4950 4545 4950 4365 5130
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3555 2250 4500 2250 4320 2430
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6075 5850 6075 1530 45 1530 45 5850 6075 5850
4 2 4 0 0 0 20 0.0000 4 255 2085 2160 5040 SS:[Hydraulic_in]\001
4 2 4 0 0 0 20 0.0000 4 255 1935 2115 2340 SS:[Thermal_in]\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3375 5040 0\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3375 2340 0\001
4 0 -1 0 0 0 20 0.0000 4 255 1245 4590 2340 SS:Th_out\001
4 0 -1 0 0 0 20 0.0000 4 255 1260 4635 5040 SS:Hy_out\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/Out_desc.tex version [3dd57dc573].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Out (Out_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:44 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Out} is
   displayed in Figure \Ref{Out_abg} and its label
   file is listed in Section \Ref{sec:Out_lbl}.
   The subsystems are listed in Section \Ref{sec:Out_sub}.

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/LiquidTurbine/Out_lbl.txt version [36c671bdc9].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Out: Outflow conditions
%DESCRIPTION <Detailed description here>
%% Label file for system Out (Out_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in


% Component type SS
	Hy_out		SS	p_0,external
	Th_out		SS	t_0,external
	[Hydraulic_in]	SS	external,external
	[Thermal_in]	SS	external,external

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/In_abg.fig version [695cb8cbc2].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2253 2253 3198 2253 3018 2433
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2252 4952 3197 4952 3017 5132
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3196 2026 3196 2476
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3602 4950 4547 4950 4367 5130
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3602 2250 4547 2250 4367 2430
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 7200 5670 7200 1530 675 1530 675 5670 7200 5670
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2250 4725 2250 5175
4 2 -1 0 0 0 20 0.0000 4 285 1140 2026 2341 SS:Th_in\001
4 2 -1 0 0 0 20 0.0000 4 285 1125 2071 5041 SS:Hy_in\001
4 1 -1 0 0 0 20 0.0000 4 210 150 3376 5041 0\001
4 1 -1 0 0 0 20 0.0000 4 210 150 3376 2341 0\001
4 0 4 0 0 0 20 0.0000 4 285 2295 4727 5042 SS:[Hydraulic_out]\001
4 0 4 0 0 0 20 0.0000 4 285 2175 4772 2342 SS:[Thermal_out]\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/In_desc.tex version [0c97485c1c].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system In (In_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:36 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{In} is
   displayed in Figure \Ref{In_abg} and its label
   file is listed in Section \Ref{sec:In_lbl}.
   The subsystems are listed in Section \Ref{sec:In_sub}.

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/In_lbl.txt version [7b70ce34dc].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY In: Inflow conditions
%DESCRIPTION <Detailed description here>
%% Label file for system In (In_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%ALIAS	out Thermal_out,Hydraulic_out
%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out



% Component type SS
	Hy_in			SS	internal,external
	Th_in			SS	external,internal
	[Hydraulic_out]		SS	external,external
	[Thermal_out]		SS	external,external

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/Out_abg.fig version [168ef8465c].

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





























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2252 4952 3197 4952 3017 5132
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2205 2250 3150 2250 2970 2430
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2250 4725 2250 5175
2 1 0 3 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2205 2025 2205 2475
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 4950 4545 4950 4365 5130
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3555 2250 4500 2250 4320 2430
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 6075 5850 6075 1530 45 1530 45 5850 6075 5850
4 2 4 0 0 0 20 0.0000 4 285 2145 2160 5040 SS:[Hydraulic_in]\001
4 2 4 0 0 0 20 0.0000 4 285 2025 2115 2340 SS:[Thermal_in]\001
4 1 -1 0 0 0 20 0.0000 4 210 150 3375 5040 0\001
4 1 -1 0 0 0 20 0.0000 4 210 150 3375 2340 0\001
4 0 -1 0 0 0 20 0.0000 4 285 1290 4590 2340 SS:Th_out\001
4 0 -1 0 0 0 20 0.0000 4 285 1275 4635 5040 SS:Hy_out\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/Out_desc.tex version [3dd57dc573].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Out (Out_desc.tex)
% Generated by MTT on Tue Jan 13 18:02:44 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Out} is
   displayed in Figure \Ref{Out_abg} and its label
   file is listed in Section \Ref{sec:Out_lbl}.
   The subsystems are listed in Section \Ref{sec:Out_sub}.

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/Out_lbl.txt version [6454b3a5a6].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Out: Outflow conditions
%DESCRIPTION <Detailed description here>
%% Label file for system Out (Out_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank

%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in


% Component type SS
	Hy_out		SS        p_0,internal
	Th_out		SS        t_0,internal
	[Hydraulic_in]	SS	external,external
	[Thermal_in]	SS	external,external

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_abg.fig version [5d0413d6f9].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 6210 4140 6390 4365
4 1 0 100 0 18 18 0.0000 4 195 150 6300 4365 0\001
-6
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9495 2700 10534 2703 10309 2928
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2025 2700 3060 2700 2835 2925
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4497 2698 5715 2700 5490 2925
2 1 0 4 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6930 2700 8145 2700 7920 2925
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 11925 7200 11925 225 900 225 900 7200 11925 7200
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6300 4050 6300 2925 6525 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6525 4275 7650 4275 7425 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4950 4275 6075 4275 5850 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2475 4275 3600 4275 3375 4500
4 1 4 0 0 2 16 0.0000 4 240 1020 6302 2477 [Heat_in]\001
4 1 -1 0 0 2 20 0.0000 4 210 1245 6302 2792 TankC:t1\001
4 1 -1 0 0 2 20 0.0000 4 285 945 8868 2793 Pipe:p2\001
4 1 -1 0 0 22 20 0.0000 4 225 600 1620 2790 In:in\001
4 1 -1 0 0 22 20 0.0000 4 225 1080 11116 2791 Out:out\001
4 1 -1 0 0 2 20 0.0000 4 285 945 3737 2792 Pipe:p1\001
4 1 0 100 0 18 18 0.0000 4 210 1305 4275 4365 RS:heater\001
4 1 0 100 0 18 18 0.0000 4 270 1020 1935 4365 Se:V_in\001
4 1 0 100 0 18 18 0.0000 4 270 1215 8280 4365 De:T_out\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_desc.tex version [51759f48f8].

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























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% -*-latex-*- used to set EMACS into LaTeX-mode
% Verbal description for system ShowerHeater (ShowerHeater_desc.tex)
% Generated by MTT on Tue Jan 13 18:01:55 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{ShowerHeater} is
   displayed in Figure \Ref{ShowerHeater_abg} and its label
   file is listed in Section \Ref{sec:ShowerHeater_lbl}.
   The subsystems are listed in Section \Ref{sec:ShowerHeater_sub}.

\textbf{ShowerHeater} is a very elementary model of an electric heater suitable for
a shower. It illustates the use of bond graph components which are
internally pseudo, but externally true bond graphs
(temperature/entropy flow).

There are three main components:
\begin{enumerate}
\item p1 and p2 -- a \textbf{Pipe} component (see Section
  \Ref{sec:Pipe}). It is assumed that the pipes have zero flow
  resistance and thus do not generate heat via flow resistance.
\item t1 -- a tank \textbf{Tank} component. 
\item Heater -- a resistive heater modelled by the thermodynamic
  \textbf{R} component \textbf{RS}.
\end{enumerate}
Other components could be added to represent thermal conduction and
thermal capacities.

The components \textbf{In} and \textbf{Out} provide the inlet and
outlet conditions.

The three inputs are
\begin{description}
\item[$u_1$] The flow rate
\item[$u_2$] The inlet temperature
\item[$u_3$] The voltage across the heating element.
\end{description}
The single output is
\begin{description}
\item[$y_1$] The outflow temperature
\end{description}
and the state is 
\begin{description}
\item[$x_1$] The heat contained in the tank.
\end{description}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_input.txt version [41b9db6185].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Input specification (ShowerHeater_input.txt)
# Generated by MTT at Tue Dec 14 10:03:59 EST 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the inputs
mttu(1) = 1e-4*(t>30);		# Inflow
mttu(2) = 280;			# In temperature
mttu(3) = 240*((t<60)&&(t>1));	# Input voltage

# Set the switches

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_lbl.txt version [4a31eec2e1].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY ShowerHeater
%DESCRIPTION <Detailed description here>
%% Label file for system ShowerHeater (ShowerHeater_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%ALIAS	Pipe	IncompressibleFlow/Pipe

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank


% Component type Pipe
	p1		lin	        rho;c_p;flow,0
	p2		lin	        rho;c_p;flow,0


% Component type TankC
	t1		TankC		rho;c_p;v

% Component type In
	in

% Component type Out
	out

% Component type RS
        heater	        lin		flow,r_h

% Component type Se
        V_in             SS              external

% Component type De
        T_out            SS              external

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_numpar.txt version [dbff65808f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (ShowerHeater_numpar.txt)
# Generated by MTT at Tue Dec 14 09:52:42 EST 1999

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

# Parameters
c_p = 	4.184*1e3;		# Specific heat
p_0 = 	0.0;			# Ambient pressure
r   =   1.0;                    # Pipe flow resistance (no idea what
				# this should be)
r_h = 	10.0;			# Heater resistance
rho = 	1e3;			# Density
v = 	1e-3;			# Volume (1 lit)

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_rep.txt version [6ab3f0a293].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system ShowerHeater (ShowerHeater_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:13:25  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt  ShowerHeater abg tex
mtt  ShowerHeater struc tex
mtt  ShowerHeater sympar tex
mtt  ShowerHeater ode tex


mtt  ShowerHeater numpar txt
mtt  ShowerHeater input txt

mtt -c  ShowerHeater odeso ps 

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_simpar.txt version [3b623625a5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system ShowerHeater (ShowerHeater_simpar.txt)
# Generated by MTT on Tue Dec 14 10:05:57 EST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 100.0;		# Last time in simulation
DT          = 0.5;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_simpar.txt_old version [3b623625a5].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system ShowerHeater (ShowerHeater_simpar.txt)
# Generated by MTT on Tue Dec 14 10:05:57 EST 1999.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


LAST        = 100.0;		# Last time in simulation
DT          = 0.5;        # Print interval
STEPFACTOR  = 1;          # Integration steps per print interval
WMIN        = -1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps
INPUT       = 1;          # Index of the input

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_sspar.r version [c5e3a0b620].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (ShowerHeater_sspar.r)
% Generated by MTT at Fri Nov 20 11:42:16 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Steady-state states
MTTX1 := 	1; % ShowerHeater (j_s)
MTTX2 := 	p_0*c/rho; % ShowerHeater_C1 (tank) - pressure = p0
MTTX3 := 	t_0*p_0*c*c_p; % ShowerHeater_C1 (tank) - temp = t0
% Steady-state inputs
MTTU1 := 	q_0; % ShowerHeater (Heat)
MTTU2 := 	0; % ShowerHeater (Work)
;;END;

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/ShowerHeater_state.txt version [e0b794af70].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Initial state  file (ShowerHeater_state.txt)
# Generated by MTT at Tue Dec 14 10:06:08 EST 1999
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the states
mttx(1) 	= 280*rho*v*c_p; # Initial heat in tank



Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/TankC_TankC_abg.fig version [61a9baa3f5].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81

















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2430 2070 3600 3105
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2445 2477 3570 2477 3345 2702
4 1 1 1 0 3 20 0.0000 4 210 180 2850 2297 T\001
4 1 1 1 0 3 20 0.0000 4 210 150 2985 2387 1\001
4 1 1 1 0 3 20 0.0000 4 210 150 2985 3062 1\001
4 1 1 1 0 3 20 0.0000 4 210 180 2850 2927 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 2850 2657 .\001
-6
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5865 2477 6990 2477 6765 2702
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4065 5627 6990 5627 6765 5852
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7440 2478 8565 2478 8340 2703
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9241 2479 10366 2479 10141 2704
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7440 5626 10365 5626 10140 5851
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 8609 6571 5864 6571 5864 1801 8609 1801 8609 6571
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6989 2701 7439 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7214 2702 7214 3827 7439 3602
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 5850 4050 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 1127 3825 2252 4050 2027
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4065 2475 5190 2475 4965 2700
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 12825 7155 12825 225 225 225 225 7155 12825 7155
4 0 4 0 0 0 20 0.0000 4 285 2295 10546 5719 SS:[Hydraulic_out]\001
4 0 4 0 0 0 20 0.0000 4 285 2175 10501 2569 SS:[Thermal_out]\001
4 2 4 0 0 0 20 0.0000 4 285 2145 4019 5716 SS:[Hydraulic_in]\001
4 1 -1 0 0 22 20 0.0000 4 225 390 5550 2567 ES\001
4 1 1 1 0 3 20 0.0000 4 210 150 4606 5538 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 4471 5808 .\001
4 1 1 1 0 3 20 0.0000 4 210 180 4471 5448 P\001
4 1 1 1 0 3 20 0.0000 4 210 210 4471 6078 V\001
4 1 4 0 0 0 20 0.0000 4 270 300 5280 2252 [s]\001
4 1 4 0 0 0 20 0.0000 4 270 315 5820 2252 [e]\001
4 1 1 1 0 3 20 0.0000 4 210 150 6406 2388 1\001
4 1 1 1 0 3 20 0.0000 4 210 660 6584 2206 T - T\001
4 1 1 1 0 3 20 0.0000 4 210 150 6899 2386 0\001
4 1 1 1 0 3 30 0.0000 4 60 120 6497 2659 .\001
4 1 1 1 0 3 20 0.0000 4 210 195 6497 2929 E\001
4 1 -1 0 0 22 20 0.0000 4 225 915 7214 4186 C:tank\001
4 1 -1 0 0 22 20 0.0000 4 210 165 7215 5762 0\001
4 1 -1 0 0 22 20 0.0000 4 225 390 8925 2568 ES\001
4 1 1 1 0 3 30 0.0000 4 60 120 9648 5811 .\001
4 1 1 1 0 3 20 0.0000 4 210 180 9648 5451 P\001
4 1 1 1 0 3 20 0.0000 4 210 210 9648 6081 V\001
4 1 1 1 0 3 20 0.0000 4 210 150 9783 5541 2\001
4 1 1 1 0 3 20 0.0000 4 210 195 7846 2930 E\001
4 1 4 0 0 0 20 0.0000 4 270 315 8655 2208 [e]\001
4 1 4 0 0 0 20 0.0000 4 270 300 9150 2208 [s]\001
4 1 1 1 0 3 20 0.0000 4 210 180 9648 2301 T\001
4 1 1 1 0 3 20 0.0000 4 210 150 9783 2391 2\001
4 1 1 1 0 3 20 0.0000 4 210 180 9648 2931 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 9648 2661 .\001
4 1 1 1 0 3 20 0.0000 4 210 150 9783 3066 2\001
4 1 1 1 0 3 30 0.0000 4 60 120 7846 2660 .\001
4 1 1 1 0 3 20 0.0000 4 210 660 7936 2209 T - T\001
4 1 1 1 0 3 20 0.0000 4 210 150 8251 2389 0\001
4 1 1 1 0 3 20 0.0000 4 210 150 7758 2391 2\001
4 1 1 1 0 3 20 0.0000 4 285 2550 7259 6346 Pseudo Bond Graph\001
4 1 4 0 0 0 20 0.0000 4 285 1530 3870 945 SS:[Heat_in]\001
4 1 -1 0 0 22 20 0.0000 4 210 165 7245 2565 0\001
4 1 -1 0 0 22 20 0.0000 4 210 165 3825 2565 0\001
4 2 4 0 0 0 20 0.0000 4 285 2025 2385 2565 SS:[Thermal_in]\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/TankC_abg.fig version [61a9baa3f5].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81

















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
6 2430 2070 3600 3105
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2445 2477 3570 2477 3345 2702
4 1 1 1 0 3 20 0.0000 4 210 180 2850 2297 T\001
4 1 1 1 0 3 20 0.0000 4 210 150 2985 2387 1\001
4 1 1 1 0 3 20 0.0000 4 210 150 2985 3062 1\001
4 1 1 1 0 3 20 0.0000 4 210 180 2850 2927 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 2850 2657 .\001
-6
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5865 2477 6990 2477 6765 2702
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4065 5627 6990 5627 6765 5852
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7440 2478 8565 2478 8340 2703
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 9241 2479 10366 2479 10141 2704
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7440 5626 10365 5626 10140 5851
2 4 1 2 1 7 1 0 -1 6.000 0 0 7 0 0 5
	 8609 6571 5864 6571 5864 1801 8609 1801 8609 6571
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6989 2701 7439 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7214 2702 7214 3827 7439 3602
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4050 5850 4050 5400
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3825 1127 3825 2252 4050 2027
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4065 2475 5190 2475 4965 2700
2 4 0 2 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 12825 7155 12825 225 225 225 225 7155 12825 7155
4 0 4 0 0 0 20 0.0000 4 285 2295 10546 5719 SS:[Hydraulic_out]\001
4 0 4 0 0 0 20 0.0000 4 285 2175 10501 2569 SS:[Thermal_out]\001
4 2 4 0 0 0 20 0.0000 4 285 2145 4019 5716 SS:[Hydraulic_in]\001
4 1 -1 0 0 22 20 0.0000 4 225 390 5550 2567 ES\001
4 1 1 1 0 3 20 0.0000 4 210 150 4606 5538 1\001
4 1 1 1 0 3 30 0.0000 4 60 120 4471 5808 .\001
4 1 1 1 0 3 20 0.0000 4 210 180 4471 5448 P\001
4 1 1 1 0 3 20 0.0000 4 210 210 4471 6078 V\001
4 1 4 0 0 0 20 0.0000 4 270 300 5280 2252 [s]\001
4 1 4 0 0 0 20 0.0000 4 270 315 5820 2252 [e]\001
4 1 1 1 0 3 20 0.0000 4 210 150 6406 2388 1\001
4 1 1 1 0 3 20 0.0000 4 210 660 6584 2206 T - T\001
4 1 1 1 0 3 20 0.0000 4 210 150 6899 2386 0\001
4 1 1 1 0 3 30 0.0000 4 60 120 6497 2659 .\001
4 1 1 1 0 3 20 0.0000 4 210 195 6497 2929 E\001
4 1 -1 0 0 22 20 0.0000 4 225 915 7214 4186 C:tank\001
4 1 -1 0 0 22 20 0.0000 4 210 165 7215 5762 0\001
4 1 -1 0 0 22 20 0.0000 4 225 390 8925 2568 ES\001
4 1 1 1 0 3 30 0.0000 4 60 120 9648 5811 .\001
4 1 1 1 0 3 20 0.0000 4 210 180 9648 5451 P\001
4 1 1 1 0 3 20 0.0000 4 210 210 9648 6081 V\001
4 1 1 1 0 3 20 0.0000 4 210 150 9783 5541 2\001
4 1 1 1 0 3 20 0.0000 4 210 195 7846 2930 E\001
4 1 4 0 0 0 20 0.0000 4 270 315 8655 2208 [e]\001
4 1 4 0 0 0 20 0.0000 4 270 300 9150 2208 [s]\001
4 1 1 1 0 3 20 0.0000 4 210 180 9648 2301 T\001
4 1 1 1 0 3 20 0.0000 4 210 150 9783 2391 2\001
4 1 1 1 0 3 20 0.0000 4 210 180 9648 2931 S\001
4 1 1 1 0 3 30 0.0000 4 60 120 9648 2661 .\001
4 1 1 1 0 3 20 0.0000 4 210 150 9783 3066 2\001
4 1 1 1 0 3 30 0.0000 4 60 120 7846 2660 .\001
4 1 1 1 0 3 20 0.0000 4 210 660 7936 2209 T - T\001
4 1 1 1 0 3 20 0.0000 4 210 150 8251 2389 0\001
4 1 1 1 0 3 20 0.0000 4 210 150 7758 2391 2\001
4 1 1 1 0 3 20 0.0000 4 285 2550 7259 6346 Pseudo Bond Graph\001
4 1 4 0 0 0 20 0.0000 4 285 1530 3870 945 SS:[Heat_in]\001
4 1 -1 0 0 22 20 0.0000 4 210 165 7245 2565 0\001
4 1 -1 0 0 22 20 0.0000 4 210 165 3825 2565 0\001
4 2 4 0 0 0 20 0.0000 4 285 2025 2385 2565 SS:[Thermal_in]\001

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/TankC_cr.r version [b7730f4aa2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Constitutive relation file for TankC (TankC_cr.r)
% Generated by MTT at Thu Mar  5 10:30:23 GMT 1998

OPERATOR TankC;

%Pressure
% -- not relevant here

%Temperature
FOR ALL rho,c_p,volume,Energy
LET TankC(rho,c_p,volume,effort,1,
	Energy,state,1
	) = Energy/(volume*rho*c_p);

END;

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/TankC_desc.tex version [944934a0ef].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system TankC (TankC_desc.tex)
% Generated by MTT on Tue Jan 13 18:03:04 GMT 1998.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{TankC} is
   displayed in Figure \Ref{TankC_abg} and its label
   file is listed in Section \Ref{sec:TankC_lbl}.
   The subsystems are listed in Section \Ref{sec:TankC_sub}.

Deleted mttroot/mtt/lib/examples/Thermal/Incompressible/Incompressible-Systems/ShowerHeater/TankC_lbl.txt version [649a90bba0].

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


























































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Label file for system TankC (TankC_lbl.txt)
%SUMMARY TankC: TankC of hot incompressible liquid - fixed volume
%DESCRIPTION rho - density; c_p - specific heat; v - volume
%DESCRIPTION Typical lable: tank  TankC  rho;c_p;v

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/11/20 13:20:27  peterg
% %% Aliased ports
% %%
% %% Revision 1.2  1998/11/20 09:46:34  peterg
% %% Modernised lbl syntax
% %%
% %% Revision 1.1  1998/11/20 08:57:19  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Port aliases
%ALIAS	in  Thermal_in,Hydraulic_in
%ALIAS	out Thermal_out,Hydraulic_out

%ALIAS	Th_in  Thermal_in
%ALIAS	Hy_in  Hydraulic_in

%ALIAS	Th_out  Thermal_out
%ALIAS	Hy_out  Hydraulic_out

%ALIAS	Heat	Heat_in

% Argument aliases
%ALIAS	$1	rho
%ALIAS	$2	c_p
%ALIAS	$3	v

%% Each line should be of one of the following forms:
%	     a comment (ie starting with %)
%	     component-name	cr_name	arg1,arg2,..argn
%	     blank

% ---- Component labels ----

% Component type C
	tank		TankC	       rho,c_p,v

% Component type SS
	[Heat_in]	SS	external,external
	[Hydraulic_in]	SS	external,external
	[Hydraulic_out]	SS	external,external
	[Thermal_in]	SS	external,external
	[Thermal_out]	SS	external,external



Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_abg.fig version [ebaa782f1c].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 3150 5850 3150 5625 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 4500 4275 5850 4275 5625 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1800 3150 3150 3150 2925 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 2925 3150 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1800 4050 1800 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1777 4275 3127 4275 2902 4500
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4500 4095 4500 4545
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6975 3150 8325 3150 8100 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6975 2925 6975 3375
2 2 0 2 1 7 1 0 -1 0.000 0 0 0 0 0 5
	 2925 2025 4725 2025 4725 5400 2925 5400 2925 2025
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9450 5850 9450 1575 450 1575 450 5850 9450 5850
4 0 -1 0 0 0 20 0.0000000 4 240 870 6030 3240 RT:r_2\001
4 2 4 0 0 0 20 0.0000000 4 240 690 2835 3060 [t_in]\001
4 0 4 0 0 0 20 0.0000000 4 240 840 4770 3015 [t_out]\001
4 2 4 0 0 0 20 0.0000000 4 240 735 2880 4185 [e_in]\001
4 0 4 0 0 0 20 0.0000000 4 240 885 4770 4185 [e_out]\001
4 2 -1 0 0 0 20 0.0000000 4 240 900 1620 3240 SS:T_1\001
4 0 -1 0 0 0 20 0.0000000 4 240 900 8460 3240 SS:T_2\001
4 2 -1 0 0 0 20 0.0000000 4 240 780 1665 4365 SS:I_r\001
4 0 -1 0 0 0 20 0.0000000 4 240 930 5985 4365 SS:V_0\001
4 1 -1 0 0 0 20 0.0000000 4 270 1575 3780 3825 Segment:s*20\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_desc.tex version [4a2a8618be].

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



































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system HeatedRod (HeatedRod_desc.tex)
% Generated by MTT on Thu Sep 4 18:05:09 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/11 16:16:50  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{table}[htbp]
  \begin{center}
    \leavevmode
    \begin{tabular}{l l l}
      \hline
      Parameter & Symbol & Value  \\
      \hline
      Length & $L_r$ & 1m \\
      Diameter & $D_r$ & 1mm \\
      Resistivity & $\rho$ & $1.68\times10^{-9} \Omega$m \\
      Thermal conductivity & $\sigma$ & 390 W$\text{m}^{-1}$\\
      Thermal capacity & $\kappa$ & 380 J$\text{m}^{-3}$\\
      \hline
    \end{tabular}
    \caption{Heated rod parameters}
    \label{tab:rod}
  \end{center}
\end{table}

 System \textbf{HeatedRod} is a model of a well-insulated rod of copper with an
 electric current passing through it which warms it up. The two ends of
 the rod are fixed at ambient temperature; this is where all the heat
 loss occurs. 
 
 This example introduces the idea of the {\bf FP}, \textbf{RT} and
 \textbf{CT} components in the context of thermal conduction.
 
 The model is similar to that described in chapter 8 of \citeN{Cel91}.
 However, instead of representing the thermal resistance by {\bf RS}
 components and reinserting the entropy flow, the {\bf RT} component
 uses two {\bf FP} components to convert from true to pseudo bonds and
 back again. Similary, the thermal capacity is modelled by the {\bf
   CT} component.
 
 This distributed system (which strictly speaking has a partial
 differential equation model) is approximated by an ordinary
 diffferential equation model by modelling the system by a number of
 discrete segments of length $\Delta x$. Each segment model consists
 of two conceptual parts.
 \begin{itemize}
 \item An ideal lump of copper with no thermal resistance but with the
   normal attributes of electrical resistance (modelled by the
   \textbf{RS} component and thermal capacity (modelled by the
   \textbf{CF} component).
 \item A thin lump wtih thermal resistance but no thermal capacity or
   electrical resistance (modeled by the \textbf{RT} component).
 \end{itemize}
At this level of the hierarchy, all bonds are true energy bonds and
thus energy conservation is assured. Note that the \textbf{RS}
component correctely transforms electrical to thermal energy.

The system was simulated with a total of nine lumps whilst passing a
current of 1A though the rod for a total of 10s. The initial
temperature and the end temperatures were all set at 300K.

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_input.txt version [514b68757e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (HeatedRod_input.txt)
# Generated by MTT at Thu Sep  4 16:11:06 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/08/15 13:40:20  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Set the inputs
u(1) =	10.0*(t<5.0); # I_r 

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_lbl.txt version [d5b6ca5013].

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
















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY HeatedRod: Thermal/Electrical model of Electric rod
%DESCRIPTION Introduces the idea of the ES component which
%DESCRIPTION transforms a relative-temperature/enthalpy pseudo bond 
%DESCRIPTION (at the [e]port) into an absolute-temperature/enntropy 
%DESCRIPTION energy bond (at the [s] port) and vice versa.

%VAR rod_length
%VAR rod_radius
%VAR electrical_resistivity
%VAR thermal_resistivity
%VAR thermal_capacity
%VAR segments
%VAR area
%VAR delta_x
%VAR volume
%VAR density
%VAR mass

%% Label file for system HeatedRod (HeatedRod_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/11 16:16:29  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type RT
	r_2		lin	flow,r_2

% Component type SS
	I_r	SS	internal,external
	T_1	SS	t_0,internal
	T_2	SS	t_0,internal
	V_0	SS	internal,internal

% Component type Segment
	s

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_numpar.txt version [a9f0752d97].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (HeatedRod_numpar.txt)
# Generated by MTT at Thu Sep  4 16:11:04 BST 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/08/15 13:40:33  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


# Constants for copper
density = 8.96;
rod_length = 1.0;
rod_radius = 1e-3;
electrical_resistivity = 16.8*0.000000001;
thermal_resistivity = 1/390.0;
thermal_capacity = 380.0;


segments = 20;
area = pi*rod_radius*rod_radius;
delta_x = rod_length/segments;
volume = area*delta_x;
mass = volume*density;

# Parameters
c_t = 	thermal_capacity*mass;
r = 	electrical_resistivity*delta_x/area;
r_t = 	thermal_resistivity*delta_x/area;
r_2 = 	r_t;
t_0 = 	300; # Ambient




Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_rep.txt version [f2cbf52729].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system HeatedRod (HeatedRod_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:14:29  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -o -ss HeatedRod abg tex
mtt -o -ss HeatedRod struc tex
mtt -o -ss HeatedRod ode tex
mtt -o -ss HeatedRod ss tex
mtt -o -ss HeatedRod sm tex
mtt -o -ss HeatedRod lmfr ps

mtt -o -ss HeatedRod numpar txt
mtt -o -ss HeatedRod input txt
mtt -o -ss -c HeatedRod odeso ps

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_simpar.txt version [b039d6f9cd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Simulation parameters for system HR (HR_simpar.txt)
# Generated by MTT on Wednesday July 29 13:59:50 BST 1998.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/08/15 13:40:47  peterg
## Initial revision
##
###############################################################


LAST        = 10;       # Last time in simulation
WMIN        = 1;         # Minimum frequency = 10^WMIN
WMAX        = 2;          # Maximum frequency = 10^WMAX
WSTEPS      = 100;        # Number of frequency steps

STEPFACTOR = 1; # Added automatically
DT = 0.1;                 # Added automatically

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_sspar.r version [a711759aa0].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (HeatedRod_sspar.r)
% Generated by MTT at Thu Jun 25 09:32:38 BST 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Steady-state states
MTTX1 := 	t_0*c_t; % HeatedRod_s_c_t (c)
MTTX2 := 	t_0*c_t; % HeatedRod_s_c_t (c)
MTTX3 := 	t_0*c_t; % HeatedRod_s_c_t (c)
MTTX4 := 	t_0*c_t; % HeatedRod_s_c_t (c)
MTTX5 := 	t_0*c_t; % HeatedRod_s_c_t (c)
MTTX6 := 	t_0*c_t; % HeatedRod_s_c_t (c)
MTTX7 := 	t_0*c_t; % HeatedRod_s_c_t (c)
MTTX8 := 	t_0*c_t; % HeatedRod_s_c_t (c)
MTTX9 := 	t_0*c_t; % HeatedRod_s_c_t (c)

% Steady-state inputs
MTTU1 := 	1.0; % HeatedRod (I_r)

;;END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/HeatedRod_state.txt version [c02c4e3e15].

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































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-octave-*- Put Emacs into octave-mode
# Initial state  file (HeatedRod_state.txt)
# Generated by MTT at Sat Aug 15 15:34:41 BST 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

# Set the states
mttx(1) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(2) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(3) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(4) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(5) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(6) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(7) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(8) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(9) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(10) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(11) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(12) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(13) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(14) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(15) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(16) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(17) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(18) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(19) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)
mttx(20) 	= c_t*t_0; 	# c (HeatedRod_s_c_t)

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/Segment_abg.fig version [b5d0a0a3ff].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1306 2476 2881 2476 2656 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3781 2476 5356 2476 5131 2701
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5761 2476 8550 2475 8325 2700
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5581 4276 5581 2701 5806 2926
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5581 6301 5581 4726 5806 4951
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1350 6525 5356 6526 5131 6751
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5806 6526 8550 6525 8325 6750
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5806 2701 6920 3815 6601 3815
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5581 2251 5581 676 5806 901
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5356 676 5806 676
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9900 7425 9900 90 45 90 45 7425 9900 7425
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 7650 4455 7650 1800 1575 1800 1575 4455 7650 4455
2 4 0 1 1 7 1 0 -1 0.000 0 0 7 0 0 5
	 7650 6975 7650 4545 1575 4545 1575 6975 7650 6975
4 1 -1 0 0 0 20 0.0000000 4 240 810 3331 2566 RT:r_t\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 5581 2566 0\001
4 1 -1 0 0 0 20 0.0000000 4 210 555 5581 4591 RS:r\001
4 1 -1 0 0 0 20 0.0000000 4 210 150 5581 6616 1\001
4 1 -1 0 0 0 20 0.0000000 4 240 840 7021 4141 CT:c_t\001
4 1 -1 0 0 0 20 0.0000000 4 240 870 5581 586 SS:T_s\001
4 2 4 0 0 0 20 0.0000000 4 240 1020 1261 2566 SS:[t_in]\001
4 0 4 0 0 0 20 0.0000000 4 240 1020 8685 2565 SS:[t_out]\001
4 2 4 0 0 0 20 0.0000000 4 240 1065 1260 6615 SS:[e_in]\001
4 0 4 0 0 0 20 0.0000000 4 240 1065 8685 6615 SS:[e_out]\001
4 0 1 1 0 0 20 0.0000000 4 240 1875 1845 4050 Thermal model\001
4 0 1 1 0 0 20 0.0000000 4 240 2025 1800 5175 Electrical model\001
4 0 1 1 0 0 20 0.0000000 4 270 2415 6075 585 Temperature sensor\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/Segment_desc.tex version [6387facfb7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Segment (Segment_desc.tex)
% Generated by MTT on Thu Sep 4 18:05:43 BST 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



   The acausal bond graph of system \textbf{Segment} is
   displayed in Figure \ref{Segment_abg} and its label
   file is listed in Section \ref{sec:Segment_lbl}.
   The subsystems are listed in Section \ref{sec:Segment_sub}.



Deleted mttroot/mtt/lib/examples/Thermal/ThermalConduction/HeatedRod/Segment_lbl.txt version [1cb8b4681d].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Segment: Segment of HeatedRod
%DESCRIPTION Part of the HeatedRod example.
%% Label file for system Segment (Segment_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/08/10 12:29:48  peterg
% %% Added missing ports.
% %%
% %% Revision 1.1  1997/09/11 16:17:14  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type CT
	c_t		lin	effort,c_t

% Component type RS
	r		lin	flow,r

% Component type RT
	r_t		lin	flow,r_t

% Component type SS
	T_s		SS		external,0
	[t_in]		SS		external,external
	[t_out]		SS		external,external
	[e_in]		SS		external,external
	[e_out]		SS		external,external

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_abg.fig version [7b663bd4fd].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3827 3152 5402 3152 5177 3377
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 6977 3152 8552 3152 8327 3377
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 8552 2927 8552 3377
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1352 3150 2927 3150 2702 3375
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 9900 5850 9900 450 0 450 0 5850 9900 5850
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2925 2925 2925 3375
4 1 -1 0 0 0 20 0.0000000 4 270 1440 6212 3242 Cycle:cycle\001
4 0 -1 0 0 0 20 0.0000000 4 210 1110 8687 3242 SS:Work\001
4 1 1 1 0 3 20 0.0000000 4 210 735 4456 3466 dS/dT\001
4 1 1 1 0 3 20 0.0000000 4 210 180 4501 2926 T\001
4 1 1 1 0 3 20 0.0000000 4 210 180 7921 2926 P\001
4 1 1 1 0 3 20 0.0000000 4 210 765 7786 3466 dV/dT\001
4 2 -1 0 0 0 20 0.0000000 4 210 990 1170 3285 SS:Heat\001
4 1 1 1 0 3 30 0.0000000 4 390 2310 5085 4635 Carnot cycle\001
4 1 -1 0 0 0 20 0.0000000 4 210 570 3375 3240 RT:r\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_desc.tex version [2f3b6bc5ff].

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
68
69
70
71
72








































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system CarnotCycle (CarnotCycle_desc.tex)
% Generated by MTT on Tue Dec 9 12:13:57 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{CarnotCycle} is
   displayed in Figure \Ref{CarnotCycle_abg} and its label
   file is listed in Section \Ref{sec:CarnotCycle_lbl}.
   The subsystems are listed in Section \Ref{sec:CarnotCycle_sub}.

The Carnot cycle is a simple closed thermodynamic cycle with four parts:
\begin{enumerate}
\item Isentropic compression
\item Heat injection at constant temperature
\item Isentropic expansion
\item Heat extraction at constant temperature
\end{enumerate}

The subsystem \textbf{Cycle} (Section \Ref{sec:Cycle}) is a two-port
component describing an ideal gas. It has two energy ports which, with
integral causality correspond to
\begin{enumerate}
\item Entropy flow in; temperature out
\item Volume rate of change in; pressure out
\end{enumerate}

In contast to the Otto cycle (see Table
\Ref{tab:cycles} where each table entry gives the causality on the
heat and work ports respectively). The ideal Carnot cycle has
derivative causality on the {\bf [Heat]} port for two parts of the
cycle.

To avoid this causlity change, the Carnot cycle is approximated by
applying the heat from a temperature source via a thermal resistance
{\bf RT} component. During the {\em heat injection\/} and {\em heat
extraction\/} parts of the cycle, the resistance parameter $r\approx
0$, but during the {\em isentropic compression\/} and {\em isentropic
expansion\/} parts of the cycle, the resistance parameter $r\approx
\inf$.

The simulation parameters appear in Section
\Ref{sec:CarnotCycle_numpar.txt}. The results are plotted against time
as follows:
\begin{itemize}
\item Volume (Figure \Ref{fig:CarnotCycle_odeso.ps-CarnotCycle-cycle-V})
\item Pressure (Figure
\Ref{fig:CarnotCycle_odeso.ps-CarnotCycle-cycle-P})
\item Entropy (Figure \Ref{fig:CarnotCycle_odeso.ps-CarnotCycle-cycle-S})
\item Temperature (Figure
\Ref{fig:CarnotCycle_odeso.ps-CarnotCycle-cycle-T})
\end{itemize}

These values are replotted as the standard PV and TS diagrams in
Figures
\Ref{fig:CarnotCycle_odeso.ps-CarnotCycle-cycle-V:CarnotCycle-cycle-P}
and
\Ref{fig:CarnotCycle_odeso.ps-CarnotCycle-cycle-S:CarnotCycle-cycle-T}
respectively.

The PV diagram shows the long and thin form typical of the Carnot
cycle -- this implies a poor work ratio. The TS diagram is not
informative; it is not the expected rectangle because both T and S
change in a stepwise manner.




Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_input.txt version [1e7784419c].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (CarnotCycle_input.txt)
# Generated by MTT at Mon Dec  8 20:05:30 GMT 1997

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


alpha = 0.553;

# Set the inputs
if ((t>=0.0)&&(t<1.0))		#Cooling
  u(1) = 300.0;			# Source temperature
  r    = 1e-5;			# Small r - isothermal
  u(2) = -alpha;		# Volume rate-of-change
endif;

if ((t>=1.0)&&(t<2.0))		#Compression
  u(1) = 300.0;			# Source temperature 
  r    = 1e5;			# Large resistance -- isentropic
  u(2) = -(0.8-alpha);		# Volume rate-of-change
  TopTemp = x(1)/(m_g*c_v);
endif;

if ((t>=2.0)&&(t<3.0))		#Heating
  u(1) = TopTemp;		# Source temperature
  r    = 1e-5;			# Small r - isothermal
  u(2) = (0.8-alpha);		# Volume rate-of-change
endif;

if (t>=3.0)			#Cooling
%  Temp = x(1)/(m_g*c_v);	# 
  u(1) = 300.0;			# Source temperature
  r    = 1e5;			# Large resistance -- no entropy flow
  u(2) = alpha;			# Volume rate-of-change
endif;



Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_lbl.txt version [2be2889121].

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










































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY CarnotCycle: a simple closed thermodynamic cycle
%DESCRIPTION The Carnot cycle is a simple closed thermodynamic cycle
%DESCRIPTION with four parts:
%DESCRIPTION o Isentropic compression
%DESCRIPTION o Heat injection at constant temperature
%DESCRIPTION o Isentropic expansion
%DESCRIPTION o Heat extraction at constant temperature

%VAR P_0
%VAR T_0
%VAR V_0
%VAR TopTemp
%VAR alpha

%% Label file for system CarnotCycle (CarnotCycle_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/21 15:18:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Cycle
	cycle	none	ideal_gas;c_v;gamma_g;m_g

% Component type RT
	r		lin	flow,r

% Component type SS
	Heat	SS	external,internal
	Work	SS	internal,external

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_numpar.txt version [001ae1d227].

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



























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (CarnotCycle_numpar.txt)
# Generated by MTT at Mon Dec  8 20:02:31 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/03/04 11:49:01  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Initial states -- needed to choose an approppriate mass
P_0 = 1e5;
V_0 = 1;
T_0 = 300;

# Parameters
c_v = 	718.0; # Parameter c_v for CU
gamma_g = 1.4; # Parameter gamma for CU
m_g = 	P_0*V_0/(T_0*(gamma_g-1)*c_v); # Parameter m for CU


r = 	1.0; # Parameter r for CarnotCycle


Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_params.r version [20ff45d443].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
%% Parameter file for system CarnotCycle (CarnotCycle_params.r)
%% This file provides symbolic parameters for simplification

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_rep.txt version [972b985cb2].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system CarnotCycle (CarnotCycle_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:15:05  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -ss -o CarnotCycle abg tex
mtt -ss -o CarnotCycle struc tex
mtt -ss -o CarnotCycle ode tex
mtt -ss -o CarnotCycle ss tex

mtt -ss -o CarnotCycle numpar txt
mtt -ss -o CarnotCycle input txt

mtt -ss -c -o CarnotCycle odeso ps 'CarnotCycle_cycle_V'
mtt -ss -c -o CarnotCycle odeso ps 'CarnotCycle_cycle_P'
mtt -ss -c -o CarnotCycle odeso ps 'CarnotCycle_cycle_S'
mtt -ss -c -o CarnotCycle odeso ps 'CarnotCycle_cycle_T'
mtt -ss -c -o CarnotCycle odeso ps 'CarnotCycle_cycle_V:CarnotCycle_cycle_P'
mtt -ss -c -o CarnotCycle odeso ps 'CarnotCycle_cycle_S:CarnotCycle_cycle_T'

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_simp.r version [8c64ed9a32].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce comands to simplify output for system CarnotCycle (CarnotCycle_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_simpar.txt version [4178b56134].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system OttoCycle (OttoCycle_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=4.0
DT=0.01
STEPFACTOR=10

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/CarnotCycle/CarnotCycle_sspar.r version [7171022687].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (CarnotCycle_sspar.r)
% Generated by MTT at Wed Mar  4 11:02:40 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.1  1998/03/04 11:49:14  peterg
% % Initial revision
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% Set a pressure of 1 bar
P_0 := 10^5;

% Unit initial volume
V_0 := 1;

% Internal energy
U_0 := P_0*V_0/(gamma_g-1);

% Set initial temperature of 300k
T_0 := 300;

% Deduce the mass of gas
m :=  U_0/(T_0*c_v);

% Entropy
S_0 := U_0/T_0;

% Steady-state states
MTTX1 := 	U_0;         % CarnotCycle_cycle_gas (c)
MTTX2 := 	V_0;         % CarnotCycle_cycle_gas (c)
MTTX3 := 	S_0;         % CarnotCycle_cycle_entropy (3)
MTTX4 := 	V_0;         % CarnotCycle_cycle_volume (3)

% Steady-state inputs
MTTU1 := 	0; % CarnotCycle (Heat)
MTTU2 := 	0; % CarnotCycle (Work)
;;END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/CT2_desc.tex version [2ac31e428a].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system CT2 (CT2_desc.tex)
% Generated by MTT on Thu Dec 4 16:00:14 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/12/07 20:29:56  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{CT2} is
   displayed in Figure \Ref{CT2_abg} and its label
   file is listed in Section \Ref{sec:CT2_lbl}.
   The subsystems are listed in Section \Ref{sec:CT2_sub}.

\textbf{CT2} is a two port thermal capacitor representing an ideal
heat engine converting heat to work without energy loss. There are two
ports {\bf [in]} (with covariables Temperature (absolute) and
entropy flow) and {\bf [out]} with covariables Pressure and rate of
change of volume. 

Rather than using the corresponding (nonlinear) Constitutive
Relationship (with entropy and volume as states) directly, the
component is built up from a {\em linear\/} two-port capacitor with
internal energy and volume as states. The {\bf ES} component provides
the conversion from the pseudo Bond Graph with temperature (relative)
and enthalpy flow as covariables to the true Bond Graph with with
covariables Temperature (absolute) and entropy flow.

The power-sensor {\bf PS} component is used to subtract the work enrgy
from the internal energy.







Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/DieselCycle_abg.fig version [88eaa76f60].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 3151 3601 3151 3376 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5176 3151 6751 3151 6526 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6751 2926 6751 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2026 2926 2026 3376
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 10350 5850 10350 450 675 450 675 5850 10350 5850
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7425 2925 7425 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7426 3150 9001 3150 8776 3375
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7065 2924 7065 1349 7290 1574
4 1 4 0 0 0 20 0.0000 4 240 735 3601 2926 [Heat]\001
4 1 -1 0 0 0 20 0.0000 4 255 1290 4411 3241 Cycle:cycle\001
4 1 4 0 0 0 20 0.0000 4 240 825 5176 2926 [Work]\001
4 2 -1 0 0 0 20 0.0000 4 195 960 1936 3241 SS:Heat\001
4 1 1 1 0 3 20 0.0000 4 210 690 2655 3465 dS/dT\001
4 1 1 1 0 3 20 0.0000 4 195 165 2700 2925 T\001
4 1 1 1 0 3 20 0.0000 4 195 165 6120 2925 P\001
4 1 1 1 0 3 20 0.0000 4 210 720 5985 3465 dV/dT\001
4 0 -1 0 0 0 20 0.0000 4 195 1050 9091 3241 SS:Work\001
4 1 1 1 0 3 30 0.0000 4 405 2085 5535 4500 Diesel cycle\001
4 1 -1 0 0 0 20 0.0000 4 195 135 7066 3241 1\001
4 1 -1 0 0 0 20 0.0000 4 195 375 7021 1261 R:r\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/DieselCycle_desc.tex version [ea96ae646d].

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
68
69
70
71
72
73









































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system DieselCycle (DieselCycle_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/12/09  12:30:26  peterg
% Initial revision
%
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{DieselCycle} is
   displayed in Figure \Ref{DieselCycle_abg} and its label
   file is listed in Section \Ref{sec:DieselCycle_lbl}.
   The subsystems are listed in Section \Ref{sec:DieselCycle_sub}.


The Diesel cycle is a simple closed thermodynamic cycle with four parts:
\begin{enumerate}
\item Isentropic compression
\item Heating at constant pressure
\item Isentropic expansion
\item Cooling at constant volume
\end{enumerate}

The subsystem \textbf{Cycle} (Section \Ref{sec:Cycle}) is a two-port
component describing an ideal gas. It has two energy ports which, with
integral causality correspond to
\begin{enumerate}
\item Entropy flow in; temperature out
\item Volume rate of change in; pressure out
\end{enumerate}

In contast to the Otto cycle (see Table
\Ref{tab:cycles} where each table entry gives the causality on the
heat and work ports respectively). The ideal Diesel cycle has
derivative causality on the {\bf [Work]} port for one part of the
cycle.

To avoid this causality change, the Diesel cycle is approximated by
applying the volume change from a pressure source via a resistance
{\bf R} component. During the {\em heat injection\/} part of the
cycle, the resistance parameter $r\approx 0$, but during the other parts of
the cycle, the resistance parameter $r\approx \inf$.

The simulation parameters appear in Section
\Ref{sec:DieselCycle_numpar.txt}. The results are plotted against time
as follows:
\begin{itemize}
\item Volume (Figure \Ref{fig:DieselCycle_odeso.ps-DieselCycle-cycle-V})
\item Pressure (Figure
\Ref{fig:DieselCycle_odeso.ps-DieselCycle-cycle-P})
\item Entropy (Figure \Ref{fig:DieselCycle_odeso.ps-DieselCycle-cycle-S})
\item Temperature (Figure
\Ref{fig:DieselCycle_odeso.ps-DieselCycle-cycle-T})
\end{itemize}

These values are replotted as the standard PV and TS diagrams in
Figures
\Ref{fig:DieselCycle_odeso.ps-DieselCycle-cycle-V:DieselCycle-cycle-P}
and
\Ref{fig:DieselCycle_odeso.ps-DieselCycle-cycle-S:DieselCycle-cycle-T}
respectively.





Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/DieselCycle_input.txt version [6836ac416b].

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












































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (DieselCycle_input.txt)
# Generated by MTT at Thu Dec  4 11:17:09 GMT 1997

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


# Set the inputs

if ((t>=0.0)&&(t<1.0))		#Compression
  u(1) = 0.0;			# Entropy flow
  r = 1e10;			# Big R to make a flow source 
  u(2) = 0.8*r;			#- Volume rate-of-change
  TopPressure = (gamma_g-1)*(x(1)/x(2))
endif;

if ((t>=1.0)&&(t<2.0))		#Heating
  u(1) = 1000;			# Entropy flow
  r    = 1e4;			# small r constant pressure
  u(2) = TopPressure;		# Pressure source
  Volume = x(4);
endif;

if ((t>=2.0)&&(t<3.0))		#Expansion
  u(1) = 0.0;			# Entropy flow
  r = 1e10;			# Big R to make a flow source 
  u(2) = -(1-Volume)*r;		# Volume rate-of-change
endif;

if (t>=3.0)			#Cooling
  Pressure = (gamma_g-1)*x(1)/x(2);
  u(1) = -1000*(Pressure>1e5);	# Entropy flow
  r = 1e10;			# Big R to make a flow source 
  u(2) = 0.0*r;			# Volume rate-of-change
endif;





Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/DieselCycle_lbl.txt version [8af9af50cf].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY DieselCycle:a simple closed thermodynamic cycle
%DESCRIPTION The Diese cycle is a simple closed thermodynamic cycle
%DESCRIPTION with four parts:
%DESCRIPTION o Isentropic compression
%DESCRIPTION o Heating at constant pressure
%DESCRIPTION o Isentropic expansion
%DESCRIPTION o Cooling at constant volume
  
%VAR P_0
%VAR T_0
%VAR V_0
%VAR S_0
%VAR U_0
%VAR TopPressure
%VAR Volume
%VAR Pressure

%% Label file for system DieselCycle (DieselCycle_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/21 15:25:50  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Cycle
	cycle	none	ideal_gas;c_v;gamma_g;m_g	

% Component type R
	r		lin	flow,r

% Component type SS
	Heat	SS	internal,external
	Work	SS	external,internal

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/DieselCycle_numpar.txt version [ca28228f51].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (DieselCycle_numpar.txt)
# Generated by MTT at Thu Dec  4 11:44:46 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/03/04 11:45:49  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Initial states -- needed to choose an approppriate mass
P_0 = 1e5;
V_0 = 1;
T_0 = 300;

# Parameters
c_v = 	718.0;			# Parameter c_v for CU
gamma_g = 1.4;			# Parameter gamma_g for CU
m_g = 	P_0*V_0/(T_0*(gamma_g-1)*c_v);# Parameter m for CU

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/DieselCycle_rep.txt version [ccbd6c7b43].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system DieselCycle (DieselCycle_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:15:29  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -o -ss DieselCycle abg tex
mtt -o -ss DieselCycle struc tex
mtt -o -ss DieselCycle ode tex
mtt -o -ss DieselCycle ss tex

mtt -o -ss DieselCycle numpar txt
mtt -o -ss DieselCycle input txt

mtt -o -ss -c DieselCycle odeso ps 'DieselCycle_cycle_V'
mtt -o -ss -c DieselCycle odeso ps 'DieselCycle_cycle_P'
mtt -o -ss -c DieselCycle odeso ps 'DieselCycle_cycle_S'
mtt -o -ss -c DieselCycle odeso ps 'DieselCycle_cycle_T'
mtt -o -ss -c DieselCycle odeso ps 'DieselCycle_cycle_V:DieselCycle_cycle_P'
mtt -o -ss -c DieselCycle odeso ps 'DieselCycle_cycle_S:DieselCycle_cycle_T'




Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/DieselCycle_simpar.txt version [e9cd3abd99].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system DieselCycle (DieselCycle_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=4.0
DT=0.01
STEPFACTOR=10

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/DieselCycle_sspar.r version [2c036456eb].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (DieselCycle_sspar.r)
% Generated by MTT at Wed Mar  4 11:02:40 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Set a pressure of 1 bar
P_0 := 10^5;

% Unit initial volume
V_0 := 1;

% Internal energy
U_0 := P_0*V_0/(gamma_g-1);

% Set initial temperature of 300k
T_0 := 300;

% Deduce the mass of gas
m :=  U_0/(T_0*c_v);

% Entropy
S_0 := U_0/T_0;

% Steady-state states
MTTX1 := 	U_0;         % DieselCycle_cycle_gas (c)
MTTX2 := 	V_0;         % DieselCycle_cycle_gas (c)
MTTX3 := 	S_0;         % DieselCycle_cycle_entropy (3)
MTTX4 := 	V_0;         % DieselCycle_cycle_volume (3)

% Steady-state inputs
MTTU1 := 	0; % DieselCycle (Heat)
MTTU2 := 	0; % DieselCycle (Work)
;;END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/TestCU_abg.fig version [398c1900da].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1125 2925 2475 2925 2250 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3150 2925 4500 2925 4275 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 1125 2700 1125 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4500 2700 4500 3150
4 1 -1 0 0 0 20 0.0000 4 195 600 2790 3015 CU:c\001
4 2 -1 0 0 0 20 0.0000 4 195 960 1035 3015 SS:Heat\001
4 0 -1 0 0 0 20 0.0000 4 195 1050 4635 3015 SS:Work\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/TestCU_cr.r version [5ae303ac70].

1
2
3
4
5
6






-
-
-
-
-
-
% Constitutive relation file for TestCU (TestCU_cr.r)
% Generated by MTT at Sat Jun 27 12:13:42 BST 1998

in "CU_cr.r";
in "lin.cr";
END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/TestCU_lbl.txt version [392aab3c76].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY TestCU
%DESCRIPTION <Detailed description here>
%% Label file for system TestCU (TestCU_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type CU
	c		CU		ideal_gas,c_v,gamma,m

% Component type SS
	Heat		external	external
	Work		external	external

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/DieselCycle/TestCU_simp.r version [b8a043bcf9].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Reduce commands to simplify output for system TestCU (TestCU_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

On Factor;
Off Div;
END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/CT2_desc.tex version [2ac31e428a].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system CT2 (CT2_desc.tex)
% Generated by MTT on Thu Dec 4 16:00:14 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/12/07 20:29:56  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{CT2} is
   displayed in Figure \Ref{CT2_abg} and its label
   file is listed in Section \Ref{sec:CT2_lbl}.
   The subsystems are listed in Section \Ref{sec:CT2_sub}.

\textbf{CT2} is a two port thermal capacitor representing an ideal
heat engine converting heat to work without energy loss. There are two
ports {\bf [in]} (with covariables Temperature (absolute) and
entropy flow) and {\bf [out]} with covariables Pressure and rate of
change of volume. 

Rather than using the corresponding (nonlinear) Constitutive
Relationship (with entropy and volume as states) directly, the
component is built up from a {\em linear\/} two-port capacitor with
internal energy and volume as states. The {\bf ES} component provides
the conversion from the pseudo Bond Graph with temperature (relative)
and enthalpy flow as covariables to the true Bond Graph with with
covariables Temperature (absolute) and entropy flow.

The power-sensor {\bf PS} component is used to subtract the work enrgy
from the internal energy.







Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_abg.fig version [060f831f14].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 3151 3601 3151 3376 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5176 3151 6751 3151 6526 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6751 2926 6751 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2026 2926 2026 3376
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 5850 8325 450 675 450 675 5850 8325 5850
4 1 -1 0 0 0 20 0.0000000 4 270 1440 4411 3241 Cycle:cycle\001
4 0 -1 0 0 0 20 0.0000000 4 210 1110 6886 3241 SS:Work\001
4 2 -1 0 0 0 20 0.0000000 4 210 990 1936 3241 SS:Heat\001
4 1 1 1 0 3 20 0.0000000 4 210 735 2655 3465 dS/dT\001
4 1 1 1 0 3 20 0.0000000 4 210 180 2700 2925 T\001
4 1 1 1 0 3 20 0.0000000 4 210 180 6120 2925 P\001
4 1 1 1 0 3 20 0.0000000 4 210 765 5985 3465 dV/dT\001
4 1 1 1 0 3 30 0.0000000 4 390 1800 4365 4770 Otto cycle\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_desc.tex version [0e04e9a7ae].

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

































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system OttoCycle (OttoCycle_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{OttoCycle} is
   displayed in Figure \Ref{OttoCycle_abg} and its label
   file is listed in Section \Ref{sec:OttoCycle_lbl}.
   The subsystems are listed in Section \Ref{sec:OttoCycle_sub}.


The Otto cycle is a simple closed thermodynamic cycle with four parts:
\begin{enumerate}
\item Isentropic compression
\item Heating at constant volume
\item Isentropic expansion
\item Cooling at constant volume
\end{enumerate}

The subsystem \textbf{Cycle} (Section \Ref{sec:Cycle}) is a two-port
component describing an ideal gas. It has two energy ports which, with
integral causality correspond to
\begin{enumerate}
\item Entropy flow in; temperature out
\item Volume rate of change in; pressure out
\end{enumerate}

In Bond Graph terms, each of the four parts of the Otto cycle
correspond to integral causality as in each case a \emph{flow} is
constrained. This is in contrast to other cycles listed in Table
\Ref{tab:cycles} where each table entry gives the causality on the
heat and work ports respectively. This is possibly why the Otto cycle
is conceptually and practically simple.

The simulation parameters appear in Section
\Ref{sec:OttoCycle_numpar.txt}. The results are plotted against time
as follows:
\begin{itemize}
\item Volume (Figure \Ref{fig:OttoCycle_odeso.ps-OttoCycle-cycle-V})
\item Pressure (Figure
\Ref{fig:OttoCycle_odeso.ps-OttoCycle-cycle-P})
\item Entropy (Figure \Ref{fig:OttoCycle_odeso.ps-OttoCycle-cycle-S})
\item Temperature (Figure
\Ref{fig:OttoCycle_odeso.ps-OttoCycle-cycle-T})
\end{itemize}

These values are replotted as the standard PV and TS diagrams in
Figures
\Ref{fig:OttoCycle_odeso.ps-OttoCycle-cycle-V:OttoCycle-cycle-P}
and
\Ref{fig:OttoCycle_odeso.ps-OttoCycle-cycle-S:OttoCycle-cycle-T}
respectively.





Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_input.txt version [e370e89133].

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









































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (OttoCycle_input.txt)
# Generated by MTT at Thu Dec  4 11:17:09 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.2  2000/12/28 18:15:52  peterg
# %% To RCS
# %%
# %% Revision 1.1  1998/08/10 14:42:13  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Set the inputs

if ((t>=0.0)&&(t<1.0))		#Compression
  OttoCycle_Heat = 0.0;		# Entropy flow
  OttoCycle_Work = -0.8;	# Volume rate-of-change
endif;

if ((t>=1.0)&&(t<2.0))		#Heating
  OttoCycle_Heat = 1000;	# Entropy flow
  OttoCycle_Work = 0.0;		# Volume rate-of-change
endif;

if ((t>=2.0)&&(t<3.0))		#Expansion
  OttoCycle_Heat = 0.0;		# Entropy flow
  OttoCycle_Work = 0.8;		# Volume rate-of-change
endif;

if (t>=3.0)			#Cooling
  OttoCycle_Heat = -1000;	# Entropy flow
  OttoCycle_Work = 0.0;		# Volume rate-of-change
endif;




Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_lbl.txt version [141af0a637].

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













































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY OttoCycle: a simple closed thermodynamic cycle
%DESCRIPTION The Otto cycle is a simple closed thermodynamic cycle
%DESCRIPTION with four parts:
%DESCRIPTION o Isentropic compression
%DESCRIPTION o Heating at constant volume
%DESCRIPTION o Isentropic expansion
%DESCRIPTION o Cooling at constant volume
  
%PAR P_0
%PAR T_0
%PAR V_0
%NOTPAR ideal_gas


%% Label file for system OttoCycle (OttoCycle_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1998/08/10 16:05:52  peterg
% %% Added VARs and parameters
% %%
% %% Revision 1.2  1998/07/21 15:15:27  peterg
% %% Documentation + new format
% %%
% %% Revision 1.1  1998/07/21 15:12:21  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Cycle
	cycle	none	ideal_gas;c_v;gamma_g;m_g	

% Component type SS
	Heat	SS	internal,external
	Work	SS	internal,external

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_numpar.txt version [b464fa9930].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (OttoCycle_numpar.txt)
# Generated by MTT at Thu Dec  4 11:44:46 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/03/04 11:45:49  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Initial states -- needed to choose an appropriate mass
P_0 = 1e5;
V_0 = 1;
T_0 = 300;			

# Parameters
c_v = 	718.0;			# Parameter c_v for CU
gamma_g = 1.4;			# Parameter gamma for CU
m_g = 	P_0*V_0/(T_0*(gamma_g-1)*c_v);# Parameter m for CU

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_rep.txt version [e5ad3c322a].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system OttoCycle (OttoCycle_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:16:17  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -o -ss OttoCycle abg tex
mtt -o -ss OttoCycle struc tex
mtt -o -ss OttoCycle ode tex
mtt -o -ss OttoCycle ss tex

mtt -o -ss OttoCycle numpar txt
mtt -o -ss OttoCycle input txt

mtt -o -ss -c OttoCycle odeso ps 'OttoCycle_cycle_V'
mtt -o -ss -c OttoCycle odeso ps 'OttoCycle_cycle_P'
mtt -o -ss -c OttoCycle odeso ps 'OttoCycle_cycle_S'
mtt -o -ss -c OttoCycle odeso ps 'OttoCycle_cycle_T'
mtt -o -ss -c OttoCycle odeso ps 'OttoCycle_cycle_V:OttoCycle_cycle_P'
mtt -o -ss -c OttoCycle odeso ps 'OttoCycle_cycle_S:OttoCycle_cycle_T'




Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_simpar.txt version [5caab9af7f].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system OttoCycle (OttoCycle_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=4.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_sspar.r version [1c0494b9f2].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (OttoCycle_sspar.r)
% Generated by MTT at Wed Mar  4 11:02:40 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Set a pressure of 1 bar
P_0 := 10^5;

% Unit initial volume
V_0 := 1;

% Internal energy
U_0 := P_0*V_0/(gamma_g-1);

% Set initial temperature of 300k
T_0 := 300;

% Deduce the mass of gas
m :=  U_0/(T_0*c_v);

% Entropy
S_0 := U_0/T_0;

% Steady-state states
MTTX1 := 	U_0;         % OttoCycle_cycle_gas (c)
MTTX2 := 	V_0;         % OttoCycle_cycle_gas (c)
MTTX3 := 	S_0;         % OttoCycle_cycle_entropy (3)
MTTX4 := 	V_0;         % OttoCycle_cycle_volume (3)

% Steady-state inputs
MTTU1 := 	0; % OttoCycle (Heat)
MTTU2 := 	0; % OttoCycle (Work)
;;END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicCycles/OttoCycle/OttoCycle_state.txt version [db69719b4e].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
## -*-octave-*- Put Emacs into octave-mode ##
 
## 
## System OttoCycle, representation state, language txt; 
## File OttoCycle_state.txt; 
## Generated by MTT on Thu Dec 28 18:37:57 GMT 2000; 



OttoCycle_cycle_1_entropy_1_mtt3	= 0.0; # Default
OttoCycle_cycle_1_gas_1_c	= 0.0; # Default
OttoCycle_cycle_1_gas_1_c	= 0.0; # Default
OttoCycle_cycle_1_volume_1_mtt3	= 0.0; # Default

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_abg.fig version [5d72c6d9ef].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 3151 3601 3151 3376 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5176 3151 6751 3151 6526 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6751 2926 6751 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2026 2926 2026 3376
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 5850 8325 450 675 450 675 5850 8325 5850
4 1 -1 0 0 0 20 0.0000000 4 270 1440 4411 3241 Cycle:cycle\001
4 0 -1 0 0 0 20 0.0000000 4 210 1110 6886 3241 SS:Work\001
4 2 -1 0 0 0 20 0.0000000 4 210 990 1936 3241 SS:Heat\001
4 1 1 1 0 3 20 0.0000000 4 210 180 2700 2925 T\001
4 1 1 1 0 3 20 0.0000000 4 210 180 6120 2925 P\001
4 1 1 1 0 3 30 0.0000000 4 390 3360 4365 4770 Isentropic process\001
4 1 1 1 0 3 20 0.0000000 4 210 480 2700 3555 S=0\001
4 1 1 1 0 3 30 0.0000000 4 60 105 2565 3330 .\001
4 1 1 1 0 3 20 0.0000000 4 210 195 6120 3555 V\001
4 1 1 1 0 3 30 0.0000000 4 60 105 6165 3285 .\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_desc.tex version [ff2532462b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Isentropic (Isentropic_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/12/09  12:30:26  peterg
% Initial revision
%
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_input.txt version [4ba9e8c0c3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Isentropic_input.txt)
# Generated by MTT at Thu Dec  4 11:17:09 GMT 1997

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

# Set the inputs
  u(1) = -0.8;     # Volume rate-of-change



Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_lbl.txt version [6423440a0f].

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


































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Isentropic: Isentropic thermodynamic process - ideal gas
%DESCRIPTION A dynamic simulation of an isentropic process using
%DESCRIPTION the Cycle component and the two-prt CU component.

%VAR P_0
%VAR T_0
%VAR V_0


%% Label file for system Isentropic (Isentropic_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/21 14:27:44  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Cycle
	cycle	none	ideal_gas;c_v;gamma_g;m_g	

% Component type SS
	Heat	SS	internal,0
	Work	SS	internal,external

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_numpar.txt version [561c815b07].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Isentropic_numpar.txt)
# Generated by MTT at Thu Dec  4 11:44:46 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/03/04 11:45:49  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Initial states -- needed to choose an approppriate mass
P_0 = 1e5;
V_0 = 1;
T_0 = 300;

# Parameters
c_v = 	718.0; # Parameter c_v for CU
gamma_g = 1.4; # Parameter gamma for CU
m_g = 	P_0*V_0/(T_0*(gamma_g-1)*c_v); # Parameter m for CU

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_rep.txt version [32e4eabd87].

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


























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Isentropic (Isentropic_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:18:41  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -o -ss Isentropic abg tex
mtt -o -ss Isentropic struc tex
mtt -o -ss Isentropic ode tex
mtt -o -ss Isentropic ss tex

mtt -o -ss Isentropic numpar txt
mtt -o -ss Isentropic input txt

mtt -o -ss -c Isentropic odeso ps 'Isentropic_cycle_V'
mtt -o -ss -c Isentropic odeso ps 'Isentropic_cycle_P'
mtt -o -ss -c Isentropic odeso ps 'Isentropic_cycle_S'
mtt -o -ss -c Isentropic odeso ps 'Isentropic_cycle_T'
mtt -o -ss -c Isentropic odeso ps 'Isentropic_cycle_V:Isentropic_cycle_P'
mtt -o -ss -c Isentropic odeso ps 'Isentropic_cycle_S:Isentropic_cycle_T'

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_simpar.txt version [ac622df4b8].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system Isentropic (Isentropic_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=1.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_simpar.txt_old version [ac622df4b8].

1
2
3
4
5
6
7
8
9
10
11
12
13













-
-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system Isentropic (Isentropic_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=1.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isentropic/Isentropic_sspar.r version [b36b93a55f].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (Isentropic_sspar.r)
% Generated by MTT at Wed Mar  4 11:02:40 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Set a pressure of 1 bar
P_0 := 10^5;

% Unit initial volume
V_0 := 1;

% Internal energy
U_0 := P_0*V_0/(gamma_g-1);

% Set initial temperature of 300k
T_0 := 300;

% Deduce the mass of gas
m :=  U_0/(T_0*c_v);

% Entropy
S_0 := U_0/T_0;

% Steady-state states
MTTX1 := 	U_0;         % Isentropic_cycle_gas (c)
MTTX2 := 	V_0;         % Isentropic_cycle_gas (c)
MTTX3 := 	S_0;         % Isentropic_cycle_entropy (3)
MTTX4 := 	V_0;         % Isentropic_cycle_volume (3)

% Steady-state inputs
MTTU1 := 	0; % Isentropic (Heat)
MTTU2 := 	0; % Isentropic (Work)
;;END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Cycle_abg.fig version [93ba4d6458].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81

















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 1800 6750 1800 6525 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 2025 5175 3375 5400 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3825 5175 5175 5400 4950
2 2 0 3 1 7 1 0 -1 0.000 1 0 -1 0 0 5
	 6075 900 9000 900 9000 2700 6075 2700 6075 900
2 2 0 2 1 3 1 0 20 0.000 0 0 -1 0 0 5
	 8325 900 8550 900 8550 2700 8325 2700 8325 900
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10125 3825 10125 5175 10350 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 1800 9900 1800 9675 2025
2 2 0 2 1 3 1 0 20 0.000 0 0 -1 0 0 5
	 8550 1665 9585 1665 9585 1935 8550 1935 8550 1665
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 4725 1440 5805 1440
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 9675 1440 10755 1440
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 7785 3465 8415 2835
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 1800 4950 1800 4725 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1755 1800 3105 1800 2880 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 2025 3375 5175 3600 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 5175 3600 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10350 1800 11700 1800 11475 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12150 1800 13500 1800 13275 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 11700 5175 12150 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11925 2025 11925 5175 12150 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10125 2025 10125 3375 10350 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 2025 5400 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 2025 10350 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 5175 10350 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 5175 5400 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5400 1575 5400 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 7875 1575 7875 2025
4 1 -1 0 0 0 20 0.0000 4 255 855 7290 1890 CU:gas\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 1890 1\001
4 1 -1 0 0 0 20 0.0000 4 255 1590 5175 3690 INTF:entropy\001
4 1 -1 0 0 0 20 0.0000 4 195 135 10125 1890 1\001
4 1 1 1 0 3 20 0.0000 4 270 1035 7200 1440 Ideal gas\001
4 1 1 1 0 3 20 0.0000 4 210 885 4635 1305 Heat in\001
4 1 1 1 0 3 20 0.0000 4 210 1080 10170 1305 Work out\001
4 1 1 1 0 3 20 0.0000 4 270 1800 5130 5895 Entropy change\001
4 1 1 1 0 3 20 0.0000 4 270 1365 7110 3690 Ideal piston\001
4 1 -1 0 0 0 20 0.0000 4 195 1560 10125 3690 INTF:volume\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3375 1890 0\001
4 2 4 0 0 0 20 0.0000 4 240 1140 1575 1890 SS:[Heat]\001
4 1 -1 0 0 0 20 0.0000 4 195 585 3375 5490 SS:T\001
4 1 1 1 0 3 20 0.0000 4 255 1485 3240 5895 Temperature\001
4 1 -1 0 0 0 20 0.0000 4 195 570 5130 5490 SS:S\001
4 1 -1 0 0 0 20 0.0000 4 195 615 10125 5490 SS:V\001
4 1 -1 0 0 0 20 0.0000 4 195 570 11880 5490 SS:P\001
4 0 4 0 0 0 20 0.0000 4 240 1230 13680 1890 SS:[Work]\001
4 1 1 1 0 3 20 0.0000 4 270 1815 10080 5850 Volume change\001
4 1 1 1 0 3 20 0.0000 4 195 975 11925 5850 Pressure\001
4 1 -1 0 0 0 20 0.0000 4 195 135 11925 1890 0\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Cycle_desc.tex version [9decb9a7b6].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Cycle (Cycle_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/06/30 12:46:49  peterg
% %% Changed CT2 to CU
% %%
% %% Revision 1.1  1998/06/30 12:46:24  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Cycle} is
   displayed in Figure \Ref{Cycle_abg} and its label
   file is listed in Section \Ref{sec:Cycle_lbl}.
   The subsystems are listed in Section \Ref{sec:Cycle_sub}.

The system has two heat engine ports: 
\begin{enumerate}
\item \textbf{[Heat]} and
\item \textbf{[Work]}
\end{enumerate}
By convention, energy flows in to the \textbf{[Heat]} port and out of
the \textbf{[Work]} port. Both ports are true energy ports.


The subsystem \textbf{CU} (Section \Ref{sec:CU}) is a two-port
component describing an ideal gas. It has two energy ports which, with
integral causality correspond to
\begin{enumerate}
\item Entropy flow in; temperature out
\item Volume rate of change in; pressure out
\end{enumerate}

Four \textbf{SS} components are set up as sensors to measure the
important quantities pertaining to the cycle:
\begin{enumerate}
\item \textbf{S} to measure the integrated entropy flow
\item \textbf{T} to measure the (absolute) temperature
\item \textbf{V} to measure the integrated volume change
\item \textbf{P} to measure the pressure
\end{enumerate}

   \begin{table}[htbp]
     \begin{center}
       \leavevmode
       \begin{tabular}{|l|l|l|l|l|}
         \hline
         Cycle & Compression & Heating & Expansion & Cooling \\
         \hline
         Otto & II & II & II & II \\
         Carnot & II & DI & II & DI \\
         Diesel & II & ID & II & II \\
         Joule & II & ID & II & ID \\
         \hline
       \end{tabular}
       \caption{Cycles and their causality}
       \label{tab:cycles}
     \end{center}
   \end{table}
   
   A number of cycles can be built depending on the causality of the
   two ports \textbf{[Heat]} and \textbf{[Work]} of \textbf{Cycle}
   Some possible cycles listed in Tables \Ref{tab:cycles} where each
   table entry gives the causality on the heat and work ports
   respectively.

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Cycle_lbl.txt version [d82e73d04d].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY Cycle: Closed cycle with ideal gas
#DESCRIPTION Uses the CU two-port thermal capacitor.

#ALIAS in	Heat
#ALIAS out	Work

#ALIAS $1	ideal_gas
#ALIAS $2	c_v
#ALIAS $3	gamma_g
#ALIAS $4	m_g

## Label file for system Cycle (Cycle_lbl.txt)

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.2  1998/07/21 14:21:04  peterg
# ## New style file
# ##
# ## Revision 1.1  1997/12/08 20:24:43  peterg
# ## Initial revision
# ##
# ## Revision 1.1  1997/12/07 20:38:05  peterg
# ## Initial revision
# ##
# ###############################################################

## Each line should be of one of the following forms:
#	a comment (ie starting with #)
#	Component-name	CR_name	arg1,arg2,..argn
#	blank




# Component type CU
	gas	CU	ideal_gas,c_v,gamma_g,m_g

# Component type INTF
	entropy
	volume

# Component type SS
	S	SS	external,0
	T	SS	external,0
	V	SS	external,0
	P	SS	external,0
	[Heat]	SS	external,external
	[Work]	SS	external,external



Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Cycle_simp.r version [b8f003f5e9].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce commands to simplify output for system Cycle (Cycle_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_abg.fig version [476d13332f].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 3151 3601 3151 3376 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5176 3151 6751 3151 6526 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2026 2926 2026 3376
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 5850 8325 450 675 450 675 5850 8325 5850
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 5175 2925 5175 3375
4 1 -1 0 0 0 20 0.0000000 4 270 1440 4411 3241 Cycle:cycle\001
4 0 -1 0 0 0 20 0.0000000 4 210 1110 6886 3241 SS:Work\001
4 2 -1 0 0 0 20 0.0000000 4 210 990 1936 3241 SS:Heat\001
4 1 1 1 0 3 20 0.0000000 4 210 180 2700 2925 T\001
4 1 1 1 0 3 20 0.0000000 4 210 180 6120 2925 P\001
4 1 1 1 0 3 30 0.0000000 4 390 3015 4365 4770 Isobaric process\001
4 1 1 1 0 3 20 0.0000000 4 210 480 2700 3555 S=0\001
4 1 1 1 0 3 30 0.0000000 4 60 105 2565 3330 .\001
4 1 1 1 0 3 20 0.0000000 4 210 195 6120 3555 V\001
4 1 1 1 0 3 30 0.0000000 4 60 105 6165 3285 .\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_desc.tex version [b3e2d1ccc2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Isobaric (Isobaric_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/12/09  12:30:26  peterg
% Initial revision
%
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_input.txt version [2035ce9de6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Isobaric_input.txt)
# Generated by MTT at Thu Dec  4 11:17:09 GMT 1997

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

# Set the inputs
  u(1) = 1000;     #Entropy flow 



Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_lbl.txt version [bdf17571a6].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Isobaric: Isobaric thermodynamic process - ideal gas 
%DESCRIPTION A dynamic simulation of an isobaric (constant pressure)
%DESCRIPTION  process using the Cycle component and the two-port CU component.

%VAR P_0
%VAR T_0
%VAR V_0

%% Label file for system Isobaric (Isobaric_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/21 14:32:49  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Cycle
	cycle	none	ideal_gas;c_v;gamma_g;m_g	

% Component type SS
	Heat	SS	internal,external
	Work	SS	P_0,internal

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_numpar.txt version [fbce8cfc6e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Isobaric_numpar.txt)
# Generated by MTT at Thu Dec  4 11:44:46 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/03/04 11:45:49  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Initial states -- needed to choose an approppriate mass
P_0 = 1e5;
V_0 = 1;
T_0 = 300;

# Parameters
c_v = 	718.0; # Parameter c_v for CU
gamma_g = 1.4; # Parameter gamma_g for CU
m_g = 	P_0*V_0/(T_0*(gamma_g-1)*c_v); # Parameter m for CU

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_rep.txt version [c73088f2ef].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Isobaric (Isobaric_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:19:31  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt  -ss Isobaric abg tex
mtt  -ss Isobaric struc tex
mtt  -ss Isobaric ode tex
mtt  -ss Isobaric ss tex

mtt  -ss Isobaric numpar txt
mtt  -ss Isobaric input txt

mtt  -ss -c Isobaric odeso ps 'Isobaric_cycle_V'
mtt  -ss -c Isobaric odeso ps 'Isobaric_cycle_P'
mtt  -ss -c Isobaric odeso ps 'Isobaric_cycle_S'
mtt  -ss -c Isobaric odeso ps 'Isobaric_cycle_T'
mtt  -ss -c Isobaric odeso ps 'Isobaric_cycle_V:Isobaric_cycle_P'
mtt  -ss -c Isobaric odeso ps 'Isobaric_cycle_S:Isobaric_cycle_T'




Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_simpar.txt version [545a74e285].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system Isobaric (Isobaric_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=1.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_simpar.txt_old version [545a74e285].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system Isobaric (Isobaric_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=1.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isobaric/Isobaric_sspar.r version [c0e371332c].

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






































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (Isobaric_sspar.r)
% Generated by MTT at Wed Mar  4 11:02:40 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Set a pressure of 1 bar
P_0 := 10^5;

% Unit initial volume
V_0 := 1;

% Internal energy
U_0 := P_0*V_0/(gamma_g-1);

% Set initial temperature of 300k
T_0 := 300;

% Deduce the mass of gas
m :=  U_0/(T_0*c_v);

% Entropy
S_0 := U_0/T_0;

% Steady-state states
MTTX1 := 	U_0;         % Isobaric_cycle_gas (c)
%MTTX2 := 	V_0;         % Isobaric_cycle_gas (c)
MTTX2 := 	S_0;         % Isobaric_cycle_entropy (3)
MTTX3 := 	V_0;         % Isobaric_cycle_volume (3)

% Steady-state inputs
MTTU1 := 	0; % Isobaric (Heat)
;;END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Cycle_abg.fig version [8fdef28898].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81

















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5400 1800 6750 1800 6525 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 2025 5175 3375 5400 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5175 3825 5175 5175 5400 4950
2 2 0 3 1 7 1 0 -1 0.000 1 0 -1 0 0 5
	 6075 900 9000 900 9000 2700 6075 2700 6075 900
2 2 0 2 1 3 1 0 20 0.000 0 0 -1 0 0 5
	 8325 900 8550 900 8550 2700 8325 2700 8325 900
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10125 3825 10125 5175 10350 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 7875 1800 9900 1800 9675 2025
2 2 0 2 1 3 1 0 20 0.000 0 0 -1 0 0 5
	 8550 1665 9585 1665 9585 1935 8550 1935 8550 1665
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 4725 1440 5805 1440
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 9675 1440 10755 1440
2 1 0 2 1 7 1 0 -1 0.000 0 0 -1 1 0 2
	1 0 2.00 120.00 240.00
	 7785 3465 8415 2835
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3600 1800 4950 1800 4725 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 1755 1800 3105 1800 2880 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 3375 2025 3375 5175 3600 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3150 5175 3600 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10350 1800 11700 1800 11475 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 12150 1800 13500 1800 13275 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 11700 5175 12150 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 11925 2025 11925 5175 12150 4950
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 10125 2025 10125 3375 10350 3150
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 2025 5400 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 2025 10350 2025
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 5175 10350 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 4950 5175 5400 5175
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6750 2025 6750 1575
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 9900 2025 9900 1575
4 1 -1 0 0 0 20 0.0000 4 255 855 7290 1890 CU:gas\001
4 1 -1 0 0 0 20 0.0000 4 195 135 5175 1890 1\001
4 1 -1 0 0 0 20 0.0000 4 255 1590 5175 3690 INTF:entropy\001
4 1 -1 0 0 0 20 0.0000 4 195 135 10125 1890 1\001
4 1 1 1 0 3 20 0.0000 4 270 1035 7200 1440 Ideal gas\001
4 1 1 1 0 3 20 0.0000 4 210 885 4635 1305 Heat in\001
4 1 1 1 0 3 20 0.0000 4 210 1080 10170 1305 Work out\001
4 1 1 1 0 3 20 0.0000 4 270 1800 5130 5895 Entropy change\001
4 1 1 1 0 3 20 0.0000 4 270 1365 7110 3690 Ideal piston\001
4 1 -1 0 0 0 20 0.0000 4 195 1560 10125 3690 INTF:volume\001
4 1 -1 0 0 0 20 0.0000 4 195 135 3375 1890 0\001
4 2 4 0 0 0 20 0.0000 4 240 1140 1575 1890 SS:[Heat]\001
4 1 -1 0 0 0 20 0.0000 4 195 585 3375 5490 SS:T\001
4 1 1 1 0 3 20 0.0000 4 255 1485 3240 5895 Temperature\001
4 1 -1 0 0 0 20 0.0000 4 195 570 5130 5490 SS:S\001
4 1 -1 0 0 0 20 0.0000 4 195 615 10125 5490 SS:V\001
4 1 -1 0 0 0 20 0.0000 4 195 570 11880 5490 SS:P\001
4 0 4 0 0 0 20 0.0000 4 240 1230 13680 1890 SS:[Work]\001
4 1 1 1 0 3 20 0.0000 4 270 1815 10080 5850 Volume change\001
4 1 1 1 0 3 20 0.0000 4 195 975 11925 5850 Pressure\001
4 1 -1 0 0 0 20 0.0000 4 195 135 11925 1890 0\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Cycle_desc.tex version [9decb9a7b6].

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
68
69
70
71
72
73
74










































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Cycle (Cycle_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.2  1998/06/30 12:46:49  peterg
% %% Changed CT2 to CU
% %%
% %% Revision 1.1  1998/06/30 12:46:24  peterg
% %% Initial revision
% %%
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   The acausal bond graph of system \textbf{Cycle} is
   displayed in Figure \Ref{Cycle_abg} and its label
   file is listed in Section \Ref{sec:Cycle_lbl}.
   The subsystems are listed in Section \Ref{sec:Cycle_sub}.

The system has two heat engine ports: 
\begin{enumerate}
\item \textbf{[Heat]} and
\item \textbf{[Work]}
\end{enumerate}
By convention, energy flows in to the \textbf{[Heat]} port and out of
the \textbf{[Work]} port. Both ports are true energy ports.


The subsystem \textbf{CU} (Section \Ref{sec:CU}) is a two-port
component describing an ideal gas. It has two energy ports which, with
integral causality correspond to
\begin{enumerate}
\item Entropy flow in; temperature out
\item Volume rate of change in; pressure out
\end{enumerate}

Four \textbf{SS} components are set up as sensors to measure the
important quantities pertaining to the cycle:
\begin{enumerate}
\item \textbf{S} to measure the integrated entropy flow
\item \textbf{T} to measure the (absolute) temperature
\item \textbf{V} to measure the integrated volume change
\item \textbf{P} to measure the pressure
\end{enumerate}

   \begin{table}[htbp]
     \begin{center}
       \leavevmode
       \begin{tabular}{|l|l|l|l|l|}
         \hline
         Cycle & Compression & Heating & Expansion & Cooling \\
         \hline
         Otto & II & II & II & II \\
         Carnot & II & DI & II & DI \\
         Diesel & II & ID & II & II \\
         Joule & II & ID & II & ID \\
         \hline
       \end{tabular}
       \caption{Cycles and their causality}
       \label{tab:cycles}
     \end{center}
   \end{table}
   
   A number of cycles can be built depending on the causality of the
   two ports \textbf{[Heat]} and \textbf{[Work]} of \textbf{Cycle}
   Some possible cycles listed in Tables \Ref{tab:cycles} where each
   table entry gives the causality on the heat and work ports
   respectively.

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Cycle_lbl.txt version [d82e73d04d].

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






















































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#SUMMARY Cycle: Closed cycle with ideal gas
#DESCRIPTION Uses the CU two-port thermal capacitor.

#ALIAS in	Heat
#ALIAS out	Work

#ALIAS $1	ideal_gas
#ALIAS $2	c_v
#ALIAS $3	gamma_g
#ALIAS $4	m_g

## Label file for system Cycle (Cycle_lbl.txt)

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.2  1998/07/21 14:21:04  peterg
# ## New style file
# ##
# ## Revision 1.1  1997/12/08 20:24:43  peterg
# ## Initial revision
# ##
# ## Revision 1.1  1997/12/07 20:38:05  peterg
# ## Initial revision
# ##
# ###############################################################

## Each line should be of one of the following forms:
#	a comment (ie starting with #)
#	Component-name	CR_name	arg1,arg2,..argn
#	blank




# Component type CU
	gas	CU	ideal_gas,c_v,gamma_g,m_g

# Component type INTF
	entropy
	volume

# Component type SS
	S	SS	external,0
	T	SS	external,0
	V	SS	external,0
	P	SS	external,0
	[Heat]	SS	external,external
	[Work]	SS	external,external



Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Cycle_simp.r version [b8f003f5e9].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
%% Reduce commands to simplify output for system Cycle (Cycle_simp.r)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_abg.fig version [a9b0aef23c].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 3151 3601 3151 3376 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5176 3151 6751 3151 6526 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6751 2926 6751 3376
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 5850 8325 450 675 450 675 5850 8325 5850
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 3600 2925 3600 3375
4 1 -1 0 0 0 20 0.0000000 4 270 1440 4411 3241 Cycle:cycle\001
4 0 -1 0 0 0 20 0.0000000 4 210 1110 6886 3241 SS:Work\001
4 2 -1 0 0 0 20 0.0000000 4 210 990 1936 3241 SS:Heat\001
4 1 1 1 0 3 20 0.0000000 4 210 180 6120 2925 P\001
4 1 1 1 0 3 30 0.0000000 4 390 3510 4365 4770 Isothermal process\001
4 1 1 1 0 3 20 0.0000000 4 210 195 6120 3555 V\001
4 1 1 1 0 3 30 0.0000000 4 60 105 6165 3285 .\001
4 1 1 1 0 3 20 0.0000000 4 210 165 2700 3555 S\001
4 1 1 1 0 3 30 0.0000000 4 60 105 2700 3285 .\001
4 1 1 1 0 3 20 0.0000000 4 210 1005 2700 2925 T=const\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_desc.tex version [ccb4c49b18].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Isothermal (Isothermal_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/12/09  12:30:26  peterg
% Initial revision
%
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_input.txt version [9bf6eb21e4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Isothermal_input.txt)
# Generated by MTT at Thu Dec  4 11:17:09 GMT 1997

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

# Set the inputs
  u(1) = -0.8;     # Volume rate-of-change



Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_lbl.txt version [f260e8f499].

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

































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Isothermal: Isothermal thermodynamic process - ideal gas
%DESCRIPTION A dynamic simulation of an isothermal process using
%DESCRIPTION the Cycle component and the two-port CU component.

%VAR P_0
%VAR T_0
%VAR V_0

%% Label file for system Isothermal (Isothermal_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/21 14:30:29  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Cycle
	cycle	none	ideal_gas;c_v;gamma_g;m_g	

% Component type SS
	Heat		SS	t_0,internal
	Work		SS	internal,external

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_numpar.txt version [7bdc15640d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Isothermal_numpar.txt)
# Generated by MTT at Thu Dec  4 11:44:46 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/03/04 11:45:49  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Initial states -- needed to choose an approppriate mass
P_0 = 1e5;
V_0 = 1;
T_0 = 300;

# Parameters
c_v = 	718.0; # Parameter c_v for CU
gamma_g = 1.4; # Parameter gamma_g for CU
m_g = 	P_0*V_0/(T_0*(gamma_g-1)*c_v); # Parameter m for CU

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_rep.txt version [d94809da93].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Isothermal (Isothermal_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:20:18  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -ss Isothermal abg tex
mtt -ss Isothermal struc tex
mtt -ss Isothermal ode tex
mtt -ss Isothermal ss tex

mtt -ss Isothermal numpar txt
mtt -ss Isothermal input txt

mtt -ss -c Isothermal odeso ps 'Isothermal_cycle_V'
mtt -ss -c Isothermal odeso ps 'Isothermal_cycle_P'
mtt -ss -c Isothermal odeso ps 'Isothermal_cycle_S'
mtt -ss -c Isothermal odeso ps 'Isothermal_cycle_T'
mtt -ss -c Isothermal odeso ps 'Isothermal_cycle_V:Isothermal_cycle_P'
mtt -ss -c Isothermal odeso ps 'Isothermal_cycle_S:Isothermal_cycle_T'




Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_simpar.txt version [ba2a940038].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system Isothermal (Isothermal_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=1.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_simpar.txt_old version [ba2a940038].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system Isothermal (Isothermal_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=1.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isothermal/Isothermal_sspar.r version [14b711f7a3].

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





































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (Isothermal_sspar.r)
% Generated by MTT at Wed Mar  4 11:02:40 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Set a pressure of 1 bar
P_0 := 10^5;

% Unit initial volume
V_0 := 1;

% Internal energy
U_0 := P_0*V_0/(gamma_g-1);

% Set initial temperature of 300k
T_0 := 300;

% Deduce the mass of gas
m :=  U_0/(T_0*c_v);

% Entropy
S_0 := U_0/T_0;

% Steady-state states
MTTX1 := 	V_0;         % Isothermal_cycle_gas (c)
MTTX2 := 	S_0;         % Isothermal_cycle_entropy (3)
MTTX3 := 	V_0;         % Isothermal_cycle_volume (3)

% Steady-state inputs
MTTU1 := 	0; % Isothermal (Work)
;;END;

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_abg.fig version [4deb859011].

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

























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#FIG 3.1
Portrait
Center
Metric
1200 2
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 2026 3151 3601 3151 3376 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 3
	 5176 3151 6751 3151 6526 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 6751 2926 6751 3376
2 1 0 2 -1 7 0 0 -1 0.000 0 0 -1 0 0 2
	 2026 2926 2026 3376
2 4 0 1 31 7 1 0 -1 0.000 0 0 7 0 0 5
	 8325 5850 8325 450 675 450 675 5850 8325 5850
4 1 -1 0 0 0 20 0.0000000 4 270 1440 4411 3241 Cycle:cycle\001
4 0 -1 0 0 0 20 0.0000000 4 210 1110 6886 3241 SS:Work\001
4 2 -1 0 0 0 20 0.0000000 4 210 990 1936 3241 SS:Heat\001
4 1 1 1 0 3 20 0.0000000 4 210 180 2700 2925 T\001
4 1 1 1 0 3 20 0.0000000 4 210 180 6120 2925 P\001
4 1 1 1 0 3 30 0.0000000 4 390 4020 4365 4770 Isovolumetric process\001
4 1 1 1 0 3 20 0.0000000 4 210 510 6120 3555 V=0\001
4 1 1 1 0 3 30 0.0000000 4 60 105 5940 3285 .\001
4 1 1 1 0 3 20 0.0000000 4 210 165 2700 3555 S\001
4 1 1 1 0 3 30 0.0000000 4 60 105 2700 3285 .\001

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_desc.tex version [6670b4774d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Verbal description for system Isovolumetric (Isovolumetric_desc.tex)
% Generated by MTT on Thu Dec 4 15:59:55 GMT 1997.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% Revision 1.1  1997/12/09  12:30:26  peterg
% Initial revision
%
% Revision 1.1  1997/12/08  09:37:04  peterg
% Initial revision
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_input.txt version [f0aabff4d1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Isovolumetric_input.txt)
# Generated by MTT at Thu Dec  4 11:17:09 GMT 1997

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

# Set the inputs
  u(1) = 1000;     #Entropy flow 



Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_lbl.txt version [2f48ed2971].

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



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%SUMMARY Isovolumetric: Isovolumetric thermodynamic process - ideal gas 
%DESCRIPTION A dynamic simulation of an Isovolumetric (constant volume)
%DESCRIPTION  process using the Cycle component and the two-port CU component.
%DESCRIPTION 
%DESCRIPTION the Cycle component and the two-port CU component.

%VAR P_0
%VAR T_0
%VAR V_0

%% Label file for system Isovolumetric (Isovolumetric_lbl.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1998/07/21 14:37:03  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Each line should be of one of the following forms:
%	a comment (ie starting with %)
%	Component-name	CR_name	arg1,arg2,..argn
%	blank



% Component type Cycle
	cycle	none	ideal_gas;c_v;gamma_g;m_g	

% Component type SS
	Heat	SS	internal,external
	Work	SS	internal,0

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_numpar.txt version [df377cc85f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Numerical parameter file (Isovolumetric_numpar.txt)
# Generated by MTT at Thu Dec  4 11:44:46 GMT 1997

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1998/03/04 11:45:49  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Initial states -- needed to choose an approppriate mass
P_0 = 1e5;
V_0 = 1;
T_0 = 300;

# Parameters
c_v = 	718.0; # Parameter c_v for CU
gamma_g = 1.4; # Parameter gamma_g for CU
m_g = 	P_0*V_0/(T_0*(gamma_g-1)*c_v); # Parameter m for CU

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_rep.txt version [bdec411e19].

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






























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Outline report file for system Isovolumetric (Isovolumetric_rep.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1999/02/21 02:21:03  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mtt -o -ss Isovolumetric abg tex
mtt -o -ss Isovolumetric struc tex
mtt -o -ss Isovolumetric ode tex
mtt -o -ss Isovolumetric ss tex

mtt -o -ss Isovolumetric numpar txt
mtt -o -ss Isovolumetric input txt

mtt -o -ss -c Isovolumetric odeso ps 'Isovolumetric_cycle_V'
mtt -o -ss -c Isovolumetric odeso ps 'Isovolumetric_cycle_P'
mtt -o -ss -c Isovolumetric odeso ps 'Isovolumetric_cycle_S'
mtt -o -ss -c Isovolumetric odeso ps 'Isovolumetric_cycle_T'
mtt -o -ss -c Isovolumetric odeso ps 'Isovolumetric_cycle_V:Isovolumetric_cycle_P'
mtt -o -ss -c Isovolumetric odeso ps 'Isovolumetric_cycle_S:Isovolumetric_cycle_T'




Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_simpar.txt version [669617cdc7].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system Isovolumetric (Isovolumetric_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=1.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_simpar.txt_old version [669617cdc7].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
%% Simulation parameters for system Isovolumetric (Isovolumetric_simpar.txt)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

LAST=1.0
DT=0.01
STEPFACTOR=1

Deleted mttroot/mtt/lib/examples/Thermal/ThermodynamicProcesses/Isovolumetric/Isovolumetric_sspar.r version [cfb7ef7827].

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







































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
% Steady-state parameter file (Isovolumetric_sspar.r)
% Generated by MTT at Wed Mar  4 11:02:40 GMT 1998

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Set a pressure of 1 bar
P_0 := 10^5;

% Unit initial volume
V_0 := 1;

% Internal energy
U_0 := P_0*V_0/(gamma_g-1);

% Set initial temperature of 300k
T_0 := 300;

% Deduce the mass of gas
m :=  U_0/(T_0*c_v);

% Entropy
S_0 := U_0/T_0;

% Steady-state states
MTTX1 := 	U_0;         % Isovolumetric_cycle_gas (c)
MTTX2 := 	V_0;         % Isovolumetric_cycle_gas (c)
MTTX3 := 	S_0;         % Isovolumetric_cycle_entropy (3)
MTTX4 := 	V_0;         % Isovolumetric_cycle_volume (3)

% Steady-state inputs
MTTU1 := 	0; % Isovolumetric (Heat)
MTTU2 := 	0; % Isovolumetric (Work)
;;END;

Deleted mttroot/mtt/lib/octave/.octaverc version [f137ea17ca].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Startup file for Octave for use with MTT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

implicit_str_to_num_ok = 1;
empty_list_elements_ok = 1;

Deleted mttroot/mtt/lib/octave/README version [b32763b888].

1

-
This contains some octave specific helps to MTT

Deleted mttroot/mtt/lib/octave/mkoctfile version [e7f6db0ac4].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202










































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh
#
# mkoctfile -- create a .oct file suitable for dynamic linking by
# Octave.
echo mkoctfile with optimisation level 0
# Exit immediately on any error.

set -e

# Default values for these variables are filled in when Octave is
# compiled. 

: ${CPPFLAGS=""}
: ${INCFLAGS="-I/usr/include -I/usr/include/octave-2.0.16"}
: ${F77="g77"}
: ${FFLAGS="-O0"}
: ${FPICFLAG="-fPIC"}
: ${CC="gcc"}
: ${CFLAGS="-DHAVE_CONFIG_H -mieee-fp -O0"}
: ${CPICFLAG="-fPIC"}
: ${CXX="c++"}
: ${CXXFLAGS="-O0"}
: ${CXXPICFLAG="-fPIC"}
: ${XTRA_CFLAGS="-mieee-fp -fno-rtti -fno-exceptions -fno-implicit-templates"}
: ${XTRA_CXXFLAGS="-mieee-fp -fno-rtti -fno-exceptions -fno-implicit-templates"}

: ${SH_LD="c++"}
: ${SH_LDFLAGS="-shared"}

: ${ALL_FFLAGS="$FFLAGS"}

: ${ALL_CFLAGS="$INCFLAGS $XTRA_CFLAGS $CFLAGS"}

: ${ALL_CXXFLAGS="$INCFLAGS $XTRA_CXXFLAGS $CXXFLAGS"}

# Local variables.

usage_msg="usage: mkoctfile [options] file ..."

cfiles=
ccfiles=
f77files=
objfiles=
octfiles=
octfile=
incflags=
defs=
ldflags=
dbg=:
strip=false

if [ $# -eq 0 ]; then
  echo $usage_msg
  exit 1;
fi

while [ $# -gt 0 ]; do
  file=
  case "$1" in
    *.c)
      file=$1
      cfiles="$cfiles $file"
    ;;
    *.cc | *.C | *.cpp)
      file=$1
      ccfiles="$ccfiles $file"
    ;;
    *.f | *.F)
      file=$1
      f77files="$f77files $file"
    ;;
    *.o)
      file=$1
      objfiles="$objfiles $file"
    ;;
    -d | --debug | -v | --verbose)
      dbg=echo
    ;;
    -h | -\? | --help)
      echo $usage_msg
      cat << EOF

Options:

  -h, -?, --help          Print this message.
  -IDIR                   Add -IDIR to compile commands.
  -DDEF                   Add -DDEF to compile commands.
  -lLIB                   Add library LIB to link command.
  -LDIR                   Add -LDIR to link command.
  -o FILE, --output FILE  Output file name.  Default extension is .oct.
  -s, --strip             Strip output file.
  -v, --verbose           Echo commands as they are executed.

  FILE                    Compile or link FILE.  Recognized file types are:

			    .c    C source
			    .cc   C++ source
			    .C    C++ source
			    .cpp  C++ source
			    .f    Fortran source
			    .F    Fortran source
			    .o    object file

EOF
      exit 0
    ;;
    -I*)
      incflags="$incflags $1"
    ;;
    -D*)
      defs="$defs $1"
    ;;
    -[lL]*)
      ldflags="$ldflags $1"
    ;;
    -o | --output)
      shift
      if [ $# -gt 0 ]; then
        octfile=`echo $1 | sed 's,\.[^.]*$,,'`.oct
      else
        echo "mkoctfile: output file name missing"
      fi
    ;;
    -s | --strip)
      strip=true
    ;;
    *)
      echo "mkoctfile: unrecognized argument $1"
      exit 1
    ;;
  esac
  if [ -n "$file" ]; then
    if [ -z "$octfile" ]; then
      octfile=`echo $file | sed 's,\.[^.]*$,,'`.oct
    fi
  fi
  shift
done

# Compile Fortran, C, and C++ files.  Add the name of each object file
# that is produced to the overall list of object files.

if [ -n "$f77files" ]; then
  for f in $f77files; do
    case $f in
      *.f)
        b=`echo $f | sed 's,\.f$,,'`
      ;;
      *.F)
        b=`echo $f | sed 's,\.F$,,'`
      ;;
    esac
    o=$b.o
    objfiles="$objfiles $o"
    $dbg $F77 -c $FPICFLAG $ALL_FFLAGS $f -o $o
    eval $F77 -c $FPICFLAG $ALL_FFLAGS $f -o $o
  done
fi

if [ -n "$cfiles" ]; then
  for f in $cfiles; do
    b=`echo $f | sed 's,\.c$,,'`
    o=$b.o
    objfiles="$objfiles $o"
    $dbg $CC -c $CPPFLAGS $CPICFLAG $ALL_CFLAGS $incflags $defs $f -o $o
    eval $CC -c $CPPFLAGS $CPICFLAG $ALL_CFLAGS $incflags $defs $f -o $o
  done
fi

if [ -n "$ccfiles" ]; then
  for f in $ccfiles; do
    case $f in
      *.cc)
        b=`echo $f | sed 's,\.cc$,,'`
      ;;
      *.C)
        b=`echo $f | sed 's,\.C$,,'`
      ;;
      *.cpp)
        b=`echo $f | sed 's,\.cpp$,,'`
      ;;
    esac
    o=$b.o
    objfiles="$objfiles $o"
    $dbg $CXX -c $CPPFLAGS $CXXPICFLAG $ALL_CXXFLAGS $incflags $defs $f -o $o
    eval $CXX -c $CPPFLAGS $CXXPICFLAG $ALL_CXXFLAGS $incflags $defs $f -o $o
  done
fi

# Link all the object files.

$dbg $SH_LD $SH_LDFLAGS -o $octfile $objfiles $ldflags
eval $SH_LD $SH_LDFLAGS -o $octfile $objfiles $ldflags

# Maybe strip it.

if $strip; then
  $dbg strip $octfile
  eval strip $octfile
fi

exit 0

Deleted mttroot/mtt/lib/reduce/fix_c.r version [0428d6f425].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
%% Fixes for c-code generation

ON ROUNDED$ % No integer output

%% Changes x^y to pow(x,y)
 OPERATOR pow$
 FOR ALL x,y LET x^y = pow(x,y)$ % Use the pow function
 
 %% Derivatives
 FOR ALL f,g,x LET df(pow(f,g),x)=
 	   pow(f,g-1) * (df(f,x)*g + df(g,x)*f*log(f))$

 %% Special cases
 FOR ALL x LET pow(x,0) = 1$
 FOR ALL x LET pow(x,1) = x$

OPERATOR fabs$
FOR ALL x let abs(x) = fabs(x)$

END$

Deleted mttroot/mtt/lib/reduce/reserved_words.make version [098f123485].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/sh

reduce_reserved_word_manual_page=${1:-"/usr/local/reduce/doc/manual/appenda.tex"}
output="reserved_words.txt"

cat $reduce_reserved_word_manual_page                   |\
    tr "\n" " "                                         |\
    sed 's/\\\_/_/g'                                    |\
    sed 's/\\tt\ \([A-Za-z0-9_]*\)/\"\1\"/g'            |\
    tr " " "\n"                                         |\
    sed 's/\{//g'                                       |\
    sed 's/\}//g'                                       |\
    awk -F\" '(NF==3) { printf "%s\n",$2 }'             |\
    sort -u						\
> $output

Deleted mttroot/mtt/lib/reduce/reserved_words.txt version [727a3fd398].

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
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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279























































































































































































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
ABS
ACOS
ACOSH
ACOT
ACOTH
ACSC
ACSCH
ADJPREC
ALGEBRAIC
ALGINT
ALLBRANCH
ALLFAC
AND
ANTISYMMETRIC
APPEND
ARGLENGTH
ARRAY
ASEC
ASECH
ASIN
ASINH
ATAN
ATAN2
ATANH
BEGIN
BFSPACE
BYE
CARD_NO
CEILING
CLEAR
CLEARRULES
COEFF
COEFFN
COFACTOR
COMBINEEXPT
COMBINELOGS
COMMENT
COMP
COMPLEX
CONJ
CONS
CONT
COS
COSH
COT
COTH
CRAMER
CREF
CSC
CSCH
DECOMPOSE
DEFINE
DEFN
DEG
DEMO
DEN
DEPEND
DET
DF
DIFFERENCE
DILOG
DISPLAY
DIV
DO
E
ECHO
ED
EDITDEF
EI
END
EPS
EQ
EQUAL
ERF
ERRCONT
EVALLHSEQP
EVAL_MODE
EVEN
EVENP
EXP
EXPANDLOGS
EXPR
EXPT
EZGCD
FACTOR
FACTORIAL
FACTORIZE
FEXPR
FIRST
FIX
FIXP
FLOOR
FOR
FORALL
FOREACH
FORT
FORT_WIDTH
FREEOF
FULLROOTS
G
GCD
GEQ
GO
GOTO
GREATERP
HIGH_POW
HYPOT
I
IF
IFACTOR
IMPART
IN
INDEX
INFINITY
INFIX
INPUT
INT
INTEGER
INTERPOL
INTSTR
K
KORDER
LAMBDA
LCM
LCOF
LENGTH
LEQ
LESSP
LET
LHS
LINEAR
LINELENGTH
LISP
LIST
LISTARGP
LISTARGS
LN
LOAD
LOAD_PACKAGE
LOG
LOG10
LOGB
LOW_POW
LTERM
MACRO
MAINVAR
MASS
MAT
MATCH
MATEIGEN
MATRIX
MAX
MCD
MEMBER
MEMQ
MIN
MINUS
MKID
MODULAR
MSG
MSHELL
MULTIPLICITIES
NAT
NEQ
NERO
NEXTPRIME
NIL
NODEPEND
NONCOM
NONZERO
NOSPLIT
NOSPUR
NULLSPACE
NUM
NUMBERP
ODD
OFF
ON
OPERATOR
OR
ORDER
ORDP
OUT
OUTPUT
PART
PAUSE
PERIOD
PF
PI
PLUS
PRECEDENCE
PRECISE
PRECISION
PRET
PRI
PRIMEP
PRINT_PRECISION
PROCEDURE
PRODUCT
QUIT
QUOTIENT
RANDOM
RANDOM_NEW_SEED
RANK
RAT
RATARG
RATIONAL
RATIONALIZE
RATPRI
REAL
REDERR
REDUCT
REMAINDER
REMFAC
REMIND
REPART
REPEAT
REST
RESULTANT
RETRY
RETURN
REVERSE
REVPRI
RHS
RLISP88
ROOT_MULTIPLICITY
ROUND
ROUNDALL
ROUNDBF
ROUNDED
SAVEAS
SAVESTRUCTR
SCALAR
SEC
SECH
SECOND
SET
SETMOD
SETQ
SHARE
SHOWRULES
SHOWTIME
SHUT
SIGN
SIN
SINH
SMACRO
SOLVE
SOLVESINGULAR
SPUR
SQRT
STRUCTR
SUB
SUM
SYMBOLIC
SYMMETRIC
T
TAN
TANH
THIRD
TIME
TIMES
TP
TRA
TRACE
TRFAC
TRIGFORM
TRINT
UNTIL
VARNAME
VECDIM
VECTOR
WEIGHT
WHEN
WHERE
WHILE
WRITE
WS
WTLEVEL

Deleted mttroot/mtt/lib/rep/gnuplot_rep.make version [95bd623855].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-makefile-*-
# create a gnuplot input file

MTTFLAGS	= $(OPTS)

all: $(SYS)_gnuplot.$(LANG)

$(SYS)_gnuplot.view: $(SYS)_gnuplot.wish $(SYS)_odes.dat2
	sh $(SYS)_gnuplot.wish

$(SYS)_gnuplot.wish: $(SYS)_struc.txt
	$(MTTPATH)/trans/struc2gnuplot_txt2wish $(SYS)

$(SYS)_gnuplot.txt: $(SYS)_struc.txt $(MTTPATH)/trans/struc2gnuplot_txt.exe
	$(MTTPATH)/trans/struc2gnuplot_txt.exe $(SYS) < $(SYS)_struc.txt > $(SYS)_gnuplot.txt

$(SYS)_struc.txt:
	mtt $(MTTFLAGS) $(SYS) struc txt

$(MTTPATH)/trans/struc2gnuplot_txt.exe:
	make -f $(MTT_CC)/Makefile struc2gnuplot_txt.exe

$(SYS)_odes.dat2:
	mtt $(OPTS) $(SYS) odes dat2

Deleted mttroot/mtt/lib/rep/ippp_rep.make version [aaaaecfa67].

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
68
69
70
71







































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-makefile-*-
# Makefile for representation ippp - ppp system identification
# File ippp_rep.make

  ###################################### 
  ##### Model Transformation Tools #####
  ######################################

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.3  2001/04/11 07:52:45  gawthrop
  ## Temporary fix to avoid incorrect _input.cc with stdin
  ##
  ## Revision 1.2  2001/04/05 11:49:07  gawthrop
  ## Fixed a number of bugs to as to work with reports.
  ##
  ## Revision 1.1  2001/04/04 10:05:38  gawthrop
  ## Reresentation for system identification for ppp
  ##
  ###############################################################

#Copyright (C) 2000 by Peter J. Gawthrop

all: $(SYS)_ippp.$(LANG)

$(SYS)_ippp.view:  $(SYS)_ippp.pdf
	acroread *.pdf

$(SYS)_ippp.ps: $(SYS)_parameters.ps $(SYS)_error.ps $(SYS)_outputs.ps $(SYS)_ippp.pdf
	cp $(SYS)_parameters.ps $(SYS)_ippp.ps

$(SYS)_ippp.pdf: $(SYS)_parameters.pdf $(SYS)_error.pdf $(SYS)_outputs.pdf
	cp $(SYS)_parameters.pdf $(SYS)_ippp.pdf

$(SYS)_parameters.ps: s$(SYS)_ode2odes.m s$(SYS)_ssim.m $(SYS)_ippp.m s$(SYS)_sympar.m s$(SYS)_simpar.m
	octave $(SYS)_ippp.m

$(SYS)_error.ps: $(SYS)_parameters.ps
	touch $(SYS)_error.ps

$(SYS)_outputs.ps: $(SYS)_parameters.ps
	touch $(SYS)_outputs.ps

$(SYS)_parameters.pdf: s$(SYS)_ode2odes.m s$(SYS)_ssim.m $(SYS)_ippp.m s$(SYS)_sympar.m s$(SYS)_simpar.m
	octave $(SYS)_ippp.m

$(SYS)_error.pdf: $(SYS)_parameters.pdf
	touch $(SYS)_error.pdf

$(SYS)_outputs.pdf: $(SYS)_parameters.pdf
	touch $(SYS)_outputs.pdf

s$(SYS)_ode2odes.m: 
	echo Starting creation of s$(SYS)_ode2odes.m with options $(OPTS)
	mtt -q $(OPTS) -stdin -s s$(SYS) ode2odes oct

s$(SYS)_ssim.m: s$(SYS)_def.m
	mtt -q $(OPTS) -s s$(SYS) ssim m

s$(SYS)_sympar.m:
	mtt -q $(OPTS) -s s$(SYS) sympar m

s$(SYS)_simpar.m:
	mtt -q $(OPTS) -s s$(SYS) simpar m

s$(SYS)_def.m:
	mtt -q $(OPTS) -s s$(SYS) def m

Deleted mttroot/mtt/lib/rep/nppp_rep.make version [ad1e223858].

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84




















































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-makefile-*-
# Makefile for representation nppp
# File nppp_rep.make

#Copyright (C) 2000,2001,2002 by Peter J. Gawthrop

all: $(SYS)_nppp.$(LANG)

$(SYS)_nppp.view: $(SYS)_nppp.ps
	echo Viewing $(SYS)_nppp.ps; ghostview $(SYS)_nppp.ps&

$(SYS)_nppp.ps: $(SYS)_ode2odes.out s$(SYS)_ode2odes.out \
                $(SYS)_sim.m s$(SYS)_sim.m \
                $(SYS)_state.m $(SYS)_sympar.m $(SYS)_numpar.m  \
                s$(SYS)_state.m s$(SYS)_sympar.m s$(SYS)_numpar.m \
                $(SYS)_sm.m $(SYS)_def.m  s$(SYS)_def.m \
                $(SYS)_simpar.m s$(SYS)_simpar.m
	octave $(SYS)_nppp.m

$(SYS)_ode2odes.out: 
	echo Starting creation of $(SYS)_ode2odes.out '....'
	mtt -q -stdin $(SYS) ode2odes out

s$(SYS)_ode2odes.out:
	echo Starting creation of s$(SYS)_ode2odes.out '....'
	mtt  -q -stdin -s s$(SYS) ode2odes out

$(SYS)_sim.m:
	echo Starting creation of $(SYS)_sim '....'
	mtt -q $(SYS) sim m

s$(SYS)_sim.m:
	echo Starting creation of s$(SYS)_sim. '....'
	mtt -q  -s s$(SYS) sim m

$(SYS)_state.m:
	echo Starting creation of $(SYS)_state. '....'
	mtt -q $(SYS) state m

$(SYS)_sympar.m :
	echo Starting creation of $(SYS)_sympar.m '....'
	mtt -q $(SYS) sympar m 

$(SYS)_numpar.m:
	echo Starting creation of $(SYS)_numpar. '....'
	mtt -q $(SYS) numpar m

$(SYS)_simpar.m:
	echo Starting creation of $(SYS)_simpar. '....'
	mtt -q $(SYS) simpar m

s$(SYS)_state.m:
	echo Starting creation of s$(SYS)_state. '....'
	mtt -q -s s$(SYS) state m

s$(SYS)_sympar.m :
	echo Starting creation of s$(SYS)_sympar.m '....'
	mtt -q -s s$(SYS) sympar m 

s$(SYS)_numpar.m:
	echo Starting creation of s$(SYS)_numpar. '....'
	mtt -q -s s$(SYS) numpar m

s$(SYS)_simpar.m:
	echo Starting creation of s$(SYS)_simpar. '....'
	mtt -q -s s$(SYS) simpar m

$(SYS)_sm.m:
	echo Starting creation of $(SYS)_sm. '....'
	mtt -q $(SYS) sm m

$(SYS)_def.m:
	echo Starting creation of $(SYS)_def. '....'
	mtt -q $(SYS) def m

s$(SYS)_def.m:
	echo Starting creation of s$(SYS)_def. '....'
	mtt -q -s s$(SYS) def m






Deleted mttroot/mtt/lib/rep/sim_rep.make version [e3e8292afa].

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
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



















































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-makefile-*-
# $Id$
# $Log$
# Revision 1.3  2000/08/31 02:56:18  geraint
# Keep mkdir quiet if $(SYS)_Simulation_Dir exists
#
# Revision 1.2  2000/08/30 04:34:55  geraint
# *** empty log message ***
#

BIN=$(MTTPATH)/trans
INC=$(MTTPATH)/lib/cr/hh
SRC=$(MTTPATH)/trans/cc

CC=g++

INCLUDE=-I$(MTTPATH)/lib/cr/hh
OPTIMISE=-O3
WARNINGS=-Wall -ansi -pedantic

DIR=$(SYS)_Simulation_Dir
EXE=$(SYS)_sim.exe
OBJ=$(SYS)_input.o $(SYS)_numpar.o $(SYS)_ode.o $(SYS)_init.o $(SYS)_sim.o $(SYS)_switch.o

MTTFLAGS=-c -i euler -o -q

all: $(EXE)

$(SYS)_sim.exe: $(OBJ)
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) $(OBJ) -o $(SYS)_sim.exe
	mkdir -p ../$(DIR)
	cp *.cc ../$(DIR)
	cp *.hh ../$(DIR)
	cp *.o ../$(DIR)
	cp $(EXE) ../$(DIR)

$(SYS)_sim.o: $(SYS)_sim.cc $(SYS)_struc.hh
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_sim.cc

$(SYS)_sim.cc: sim.txt
	$(BIN)/sim_txt2cc $(SYS) sim < sim.txt > $(SYS)_sim.cc

sim.txt:
	cp $(MTTPATH)/trans/cc/src/sim.txt .

# list of constitutive relationships
$(SYS)_cr.hh: $(SYS)_cr.txt
	$(BIN)/cr_txt2hh $(SYS) < $(SYS)_cr.txt > $(SYS)_cr.hh

$(SYS)_cr.txt:
	mtt $(MTTFLAGS) $(SYS) cr txt

# elementary system equations, Reduce format
$(SYS)_ese.r:
	mtt --version
	mtt $(MTTFLAGS) $(SYS) ese r

# state initialisation (MTT already has state.cc)
$(SYS)_init.o: $(SYS)_init.cc
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_init.cc

$(SYS)_init.cc: $(SYS)_struc.txt
	$(BIN)/struc2state_txt2cc $(SYS) < $(SYS)_struc.txt > $(SYS)_init.cc

# system inputs
$(SYS)_input.o: $(SYS)_input.cc $(SYS)_cr.hh $(SYS)_numpar.hh
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_input.cc

$(SYS)_input.cc: $(SYS)_struc.txt
	$(BIN)/struc2input_txt2cc $(SYS) < $(SYS)_struc.txt > $(SYS)_input.cc

# system numerical parameters
$(SYS)_numpar.o: $(SYS)_numpar.cc
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_numpar.cc

$(SYS)_numpar.cc: $(SYS)_sympar.txt
	$(BIN)/sympar2numpar_txt2cc $(SYS) < $(SYS)_sympar.txt > $(SYS)_numpar.cc

$(SYS)_numpar.hh: $(SYS)_sympar.txt
	$(BIN)/sympar2numpar_txt2hh $(SYS) < $(SYS)_sympar.txt > $(SYS)_numpar.hh

$(SYS)_numpar.txt:
	mtt $(MTTFLAGS) $(SYS) numpar txt

# ordinary differential equations
$(SYS)_ode.o: $(SYS)_ode.cc $(SYS)_cr.hh $(SYS)_numpar.hh
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_ode.cc

$(SYS)_ode.cc: $(SYS)_ode.txt
	$(BIN)/ode_txt2cc $(SYS) < $(SYS)_ode.txt > $(SYS)_ode.cc

$(SYS)_ode.txt: $(SYS)_ese.r
	$(BIN)/stripComments '%' < $(SYS)_ese.r | $(BIN)/resolve $(SYS) > $(SYS)_ode.txt

# system structure, sizes of state-space matrices
$(SYS)_struc.hh: $(SYS)_struc.txt
	$(BIN)/struc_txt2hh $(SYS) < $(SYS)_struc.txt > $(SYS)_struc.hh

$(SYS)_struc.txt:
	mtt $(MTTFLAGS) $(SYS) struc txt

# logic control
$(SYS)_switch.o: $(SYS)_switch.cc $(SYS)_struc.txt $(SYS)_sympars.txt
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_switch.cc

$(SYS)_switch.cc: $(SYS)_struc.txt
	$(BIN)/struc2switch_txt2cc $(SYS) < $(SYS)_struc.txt > $(SYS)_switch.cc

# list of symbolic parameters
$(SYS)_sympar.txt:
	mtt $(MTTFLAGS) $(SYS) sympar txt

# list of symbolic parameters and switch controls
$(SYS)_sympars.txt:
	mtt $(MTTFLAGS) $(SYS) sympars txt

Deleted mttroot/mtt/lib/rep/simu_rep.make version [8d2c1dcf36].

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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141













































































































































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# -*-makefile-*-
# $Id$
# $Log$
# Revision 1.1  2000/08/31 14:31:28  peterg
# Initial revision
#
# Revision 1.3  2000/08/31 02:56:18  geraint
# Keep mkdir quiet if $(SYS)_Simulation_Dir exists
#
# Revision 1.2  2000/08/30 04:34:55  geraint
# *** empty log message ***
#

BIN=$(MTTPATH)/trans
INC=$(MTTPATH)/lib/cr/hh
SRC=$(MTTPATH)/trans/cc

CC=g++

INCLUDE=-I$(MTTPATH)/lib/cr/hh
OPTIMISE=-O3
WARNINGS=-Wall -ansi -pedantic

DIR=$(SYS)_Simulation_Dir
EXE=$(SYS)_sim.exe
OBJ=$(SYS)_input.o $(SYS)_numpar.o $(SYS)_ode.o $(SYS)_init.o $(SYS)_sim.o $(SYS)_switch.o

MTTFLAGS=-c -i euler -o -q

all: $(EXE)

$(SYS)_sim.exe: $(OBJ) 
	echo Creating $(SYS)_sim.exe
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) $(OBJ) -o $(SYS)_sim.exe
	mkdir -p ../$(DIR)
	cp *.cc ../$(DIR)
	cp *.hh ../$(DIR)
	cp *.o ../$(DIR)
	cp $(EXE) ../$(DIR)

$(SYS)_sim.o: $(SYS)_sim.cc $(SYS)_struc.hh
	echo Creating $(SYS)_sim.o
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_sim.cc

$(SYS)_sim.cc: sim.txt
	echo Creating $(SYS)_sim.cc
	$(BIN)/sim_txt2cc $(SYS) sim < sim.txt > $(SYS)_sim.cc

sim.txt:
	echo Creating sim.txt:
	cp $(MTTPATH)/trans/cc/src/sim.txt .

# list of constitutive relationships
$(SYS)_cr.hh: $(SYS)_cr.txt
	echo Creating $(SYS)_cr.hh
	$(BIN)/cr_txt2hh $(SYS) < $(SYS)_cr.txt > $(SYS)_cr.hh

$(SYS)_cr.txt:
	mtt $(MTTFLAGS) $(SYS) cr txt

# elementary system equations, Reduce format
$(SYS)_ese.r:
	echo Creating $(SYS)_ese.r
	mtt --version
	mtt $(MTTFLAGS) $(SYS) ese r

# state initialisation (MTT already has state.cc)
$(SYS)_init.o: $(SYS)_init.cc
	echo Creating $(SYS)_init.o
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_init.cc

$(SYS)_init.cc: $(SYS)_struc.txt
	echo Creating $(SYS)_init.cc
	$(BIN)/struc2state_txt2cc $(SYS) < $(SYS)_struc.txt > $(SYS)_init.cc

# system inputs
$(SYS)_input.o: $(SYS)_input.cc $(SYS)_cr.hh $(SYS)_numpar.hh
	echo Creating $(SYS)_input.o
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_input.cc

$(SYS)_input.cc: $(SYS)_struc.txt
	echo Creating $(SYS)_input.cc
	$(BIN)/struc2input_txt2cc $(SYS) < $(SYS)_struc.txt > $(SYS)_input.cc

# system numerical parameters
$(SYS)_numpar.o: $(SYS)_numpar.cc
	echo Creating $(SYS)_numpar.o
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_numpar.cc

$(SYS)_numpar.cc: $(SYS)_sympar.txt
	echo Creating $(SYS)_numpar.cc
	$(BIN)/sympar2numpar_txt2cc $(SYS) < $(SYS)_sympar.txt > $(SYS)_numpar.cc

$(SYS)_numpar.hh: $(SYS)_sympar.txt
	echo Creating $(SYS)_numpar.hh
	$(BIN)/sympar2numpar_txt2hh $(SYS) < $(SYS)_sympar.txt > $(SYS)_numpar.hh

$(SYS)_numpar.txt:
	echo Creating $(SYS)_numpar.txt
	mtt $(MTTFLAGS) $(SYS) numpar txt

# ordinary differential equations
$(SYS)_ode.o: $(SYS)_ode.cc $(SYS)_cr.hh $(SYS)_numpar.hh
	echo Creating $(SYS)_ode.o
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_ode.cc

$(SYS)_ode.cc: $(SYS)_ode.txt
	echo Creating $(SYS)_ode.cc
	$(BIN)/ode_txt2cc $(SYS) < $(SYS)_ode.txt > $(SYS)_ode.cc

$(SYS)_ode.txt: $(SYS)_ese.r
	echo Creating $(SYS)_ode.txt
	$(BIN)/stripComments '%' < $(SYS)_ese.r | $(BIN)/resolve $(SYS) > $(SYS)_ode.txt

# system structure, sizes of state-space matrices
$(SYS)_struc.hh: $(SYS)_struc.txt
	echo Creating $(SYS)_struc.hh
	$(BIN)/struc_txt2hh $(SYS) < $(SYS)_struc.txt > $(SYS)_struc.hh

$(SYS)_struc.txt:
	echo Creating $(SYS)_struc.txt
	mtt $(MTTFLAGS) $(SYS) struc txt

# logic control
$(SYS)_switch.o: $(SYS)_switch.cc $(SYS)_struc.txt $(SYS)_sympars.txt
	echo Creating $(SYS)_switch.o
	$(CC) $(WARNINGS) $(OPTIMISE) $(INCLUDE) $(CFLAGS) -c $(SYS)_switch.cc

$(SYS)_switch.cc: $(SYS)_struc.txt
	echo Creating $(SYS)_switch.cc
	$(BIN)/struc2switch_txt2cc $(SYS) < $(SYS)_struc.txt > $(SYS)_switch.cc

# list of symbolic parameters
$(SYS)_sympar.txt:
	echo Creating $(SYS)_sympar.txt
	mtt $(MTTFLAGS) $(SYS) sympar txt

# list of symbolic parameters and switch controls
$(SYS)_sympars.txt:
	echo Creating $(SYS)_sympars.txt
	mtt $(MTTFLAGS) $(SYS) sympars txt

Deleted mttroot/mtt/lib/xfig/Basic/0.fig version [fc409194ef].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 0\001

Deleted mttroot/mtt/lib/xfig/Basic/1.fig version [fa271395bb].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 1\001

Deleted mttroot/mtt/lib/xfig/Basic/AE.fig version [63cbbf46d6].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 AE:ae_1\001

Deleted mttroot/mtt/lib/xfig/Basic/AEf.fig version [cd581c11ab].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 AEf:aef_1\001

Deleted mttroot/mtt/lib/xfig/Basic/AF.fig version [d3d62f06c4].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 AF:af_1\001

Deleted mttroot/mtt/lib/xfig/Basic/AFe.fig version [e76fcd7f46].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 AFe:afe_1\001

Deleted mttroot/mtt/lib/xfig/Basic/C.fig version [7ff23716fc].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 C:c_1\001

Deleted mttroot/mtt/lib/xfig/Basic/De.fig version [453a3f3f0b].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 De:de_1\001

Deleted mttroot/mtt/lib/xfig/Basic/DescriptiveText.fig version [174032c291].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 1 101 0 3 20 0.0000 4 255 2025 1395 630 Descriptive text.\001

Deleted mttroot/mtt/lib/xfig/Basic/Df.fig version [371772784b].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 Df:df_1\001

Deleted mttroot/mtt/lib/xfig/Basic/EMTF.fig version [3d87d41331].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 EMTF:emtf_1\001

Deleted mttroot/mtt/lib/xfig/Basic/GY.fig version [a49e410bdc].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 GY:gy_1\001

Deleted mttroot/mtt/lib/xfig/Basic/I.fig version [2989eccd82].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 I:i_1\001

Deleted mttroot/mtt/lib/xfig/Basic/INTF.fig version [ecff474a22].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 INTF:intf_1\001

Deleted mttroot/mtt/lib/xfig/Basic/InPort.fig version [fd70624acc].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 2 4 100 0 18 18 0.0000 4 270 870 1890 855 SS:[in]\001

Deleted mttroot/mtt/lib/xfig/Basic/MAKE_COMPONENT version [e7c52bd3fa].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
## Makes a new component

if [ -z "$2" ]; then
  label=$1
else
  label=$2    
fi

case $1 in
    0)
	echo Making new component $1 with no label
        sed "s/TEXT/$1/" <template.txt >$1.fig
	;;
    1)
	echo Making new component $1 with no label
        sed "s/TEXT/$1/" <template.txt >$1.fig
	;;
    *)
  echo Making new component $1 with label $label
  sed "s/TEXT/$1:$label/" <template.txt >$1.fig
esac

Deleted mttroot/mtt/lib/xfig/Basic/MAKE_COMPONENTS version [e2b32f5799].

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




























-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
## Makes all components

./MAKE_COMPONENT R r_1
./MAKE_COMPONENT C c_1
./MAKE_COMPONENT I i_1

./MAKE_COMPONENT 0
./MAKE_COMPONENT 1

./MAKE_COMPONENT SS ss_1
./MAKE_COMPONENT Se se_1
./MAKE_COMPONENT Sf sf_1
./MAKE_COMPONENT De de_1
./MAKE_COMPONENT Df df_1

./MAKE_COMPONENT TF tf_1
./MAKE_COMPONENT GY gy_1
./MAKE_COMPONENT AE ae_1
./MAKE_COMPONENT AEf aef_1
./MAKE_COMPONENT AF af_1
./MAKE_COMPONENT AFe afe_1


./MAKE_COMPONENT EMTF emtf_1
./MAKE_COMPONENT INTF intf_1

./MAKE_COMPONENT Subsystem sub_1

Deleted mttroot/mtt/lib/xfig/Basic/OutPort.fig version [9c5dd9c690].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 0 4 100 0 18 18 0.0000 4 270 1065 1890 855 SS:[out]\001

Deleted mttroot/mtt/lib/xfig/Basic/Port.fig version [6321cfa21c].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 4 100 0 18 18 0.0000 4 300 1620 1890 855 SS:[port_1]\001

Deleted mttroot/mtt/lib/xfig/Basic/PortLabel.fig version [cb5b36e605].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 4 100 0 18 14 0.0000 4 210 825 855 630 [port_1]\001

Deleted mttroot/mtt/lib/xfig/Basic/PortLabel.txt version [cb5b36e605].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 4 100 0 18 14 0.0000 4 210 825 855 630 [port_1]\001

Deleted mttroot/mtt/lib/xfig/Basic/R.fig version [654cc51222].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 R:r_1\001

Deleted mttroot/mtt/lib/xfig/Basic/SS.fig version [9f614e5774].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 SS:ss_1\001

Deleted mttroot/mtt/lib/xfig/Basic/Se.fig version [6de4ea567d].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 Se:se_1\001

Deleted mttroot/mtt/lib/xfig/Basic/Sf.fig version [6e96816a11].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 Sf:sf_1\001

Deleted mttroot/mtt/lib/xfig/Basic/Subsystem.fig version [37c513eb5f].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 Subsystem:sub_1\001

Deleted mttroot/mtt/lib/xfig/Basic/TF.fig version [86e02d055f].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 TF:tf_1\001

Deleted mttroot/mtt/lib/xfig/Basic/blue-box.fig version [de5f3c52ac].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 4 1 2 1 7 101 0 -1 6.000 0 0 7 0 0 5
	 3825 2700 450 2700 450 450 3825 450 3825 2700

Deleted mttroot/mtt/lib/xfig/Basic/bond.fig version [320851a75c].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 3
	 900 675 2250 675 2025 900

Deleted mttroot/mtt/lib/xfig/Basic/gold-box.fig version [68e5946bc3].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 4 0 2 31 7 101 0 -1 0.000 0 0 7 0 0 5
	 3825 2700 450 2700 450 450 3825 450 3825 2700

Deleted mttroot/mtt/lib/xfig/Basic/halfstroke.fig version [1fdeb37f4d].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 1350 1125 1350 1350

Deleted mttroot/mtt/lib/xfig/Basic/stroke.fig version [4fd3498223].

1
2
3
4
5
6
7
8
9
10
11











-
-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
2 1 0 2 0 7 100 0 -1 0.000 0 0 -1 0 0 2
	 675 675 675 1125

Deleted mttroot/mtt/lib/xfig/Basic/template.txt version [b2d9218f91].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 TEXT\001

Deleted mttroot/mtt/lib/xfig/Thermal/CT.fig version [fc7936d9f9].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 CT:ct_1\001

Deleted mttroot/mtt/lib/xfig/Thermal/MAKE_COMPONENT version [9f63b6b6f6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#!/bin/sh
## Makes a new component

if [ -z "$2" ]; then
  label=$1
else
  label=$2    
fi

if [ "$1" = "0" ]||[ "$1" = "1" ]; then
  echo Making new component $1 with no label
  sed "s/TEXT/$1/" <template.txt >$1.fig
else
  echo Making new component $1 with label $label
  sed "s/TEXT/$1:$label/" <template.txt >$1.fig
fi

Deleted mttroot/mtt/lib/xfig/Thermal/MAKE_COMPONENTS version [ab85a0e8eb].

1
2
3
4
5
6
7







-
-
-
-
-
-
-
#!/bin/sh
## Makes all components

./MAKE_COMPONENT RS rs_1
./MAKE_COMPONENT RT rt_1
./MAKE_COMPONENT CT ct_1

Deleted mttroot/mtt/lib/xfig/Thermal/RS.fig version [d967438bbf].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 RS:rs_1\001

Deleted mttroot/mtt/lib/xfig/Thermal/RT.fig version [434299c19a].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 RT:rt_1\001

Deleted mttroot/mtt/lib/xfig/Thermal/template.txt version [b2d9218f91].

1
2
3
4
5
6
7
8
9
10










-
-
-
-
-
-
-
-
-
-
#FIG 3.2
Portrait
Center
Metric
A4      
100.00
Single
-2
1200 2
4 1 0 100 0 18 18 0.0000 4 285 765 900 765 TEXT\001

Deleted mttroot/mtt/lib/xfig/libs.txt version [021119315b].

1
2
3
4




-
-
-
-
/home/peterg/mtt_new/mtt/lib/xfig/Basic  Basic
/home/peterg/mtt_new/mtt/lib/comp/compound/Electrical Electrical
/home/peterg/mtt_new/mtt/lib/comp/compound/Thermal Thermal


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