#! /bin/sh

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

# Bourne shell script: mtt

# Usage: mtt system_name  representation_name
# E.g.: 
# 	mtt dc mtf
# converts dc to matlab transfer function form.
#
# P.J.Gawthrop Oct 1989, Dec 1989, 1990, 1991, Oct 1993, Dec 1993, Jan 1994.
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994.

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

#Inform user
echo Creating $1_cr.r

cat - > $1_cr.r << EOF
%Default CR file
%File $1_cr.r
%Generated by MTT

%Unity CR
OPERATOR Unity;
FOR ALL Causality,Input
LET Unity(Causality,Input) = Input;

%Linear CR: e = Gain*f (if DefaultCausality = flow) 
%           f = Gain*e (if DefaultCausality = effort)
OPERATOR Lin;
FOR ALL DefaultCausality, Gain, Causality, Input
SUCH THAT Causality = DefaultCausality
LET Lin(DefaultCausality, Gain, Causality, Input) = Gain*Input;

%Linear CR: e = (1/Gain)*f (if DefaultCausality = flow) 
%           f = (1/Gain)*e (if DefaultCausality = effort)
FOR ALL DefaultCausality, Gain, Causality, Input
SUCH THAT Causality NEQ DefaultCausality
LET Lin(DefaultCausality, Gain, Causality, Input) = (1/Gain)*Input;

%Default CR
% -- Unity CR
OPERATOR Default;
FOR ALL Causality,Input
LET Default(Causality,Input) = Unity(Causality,Input);

END;

EOF









