Overview
Comment: | Initial revision |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
80e80788f1b70d24188ab3c6d5c8426f |
User & Date: | gawthrop@users.sourceforge.net on 1999-10-27 01:43:33 |
Other Links: | branch diff | manifest | tags |
Context
1999-10-27
| ||
01:47:36 | Removed the mtt_solve include directive check-in: 02a0439217 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
01:43:33 | Initial revision check-in: 80e80788f1 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
1999-10-26
| ||
23:47:58 | Now does cse.m file check-in: ab8ae05167 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Added 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"; |