-
Notifications
You must be signed in to change notification settings - Fork 0
/
log_compressed_dev.tex
231 lines (227 loc) · 7.99 KB
/
log_compressed_dev.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
\documentclass[12pt]{article}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\M}[1]{\mathbf{#1}}
\newcommand{\myvector}[3]{\left\{\begin{array}{c}#1\\#2\\#3\end{array}\right\}}
\addtolength{\textwidth}{1.25in}
\addtolength{\textheight}{1.0in}
\addtolength{\evensidemargin}{-0.75in}
\addtolength{\oddsidemargin}{-0.75in}
\addtolength{\topmargin}{-0.75in}
%\usepackage{easybmat}
\usepackage{fancyhdr}
\RequirePackage{ifpdf}
%test if using pdflatex or regular latex
%\newif\ifpdf\ifx\pdfoutput\undefined\pdffalse\else\pdfoutput=1\pdftrue\fi
%set up package use based on whether or not we are using pdflatex
\ifpdf
%use these options with pdflatex
\usepackage[pdftex]{graphicx}
\DeclareGraphicsExtensions{.pdf,.jpg,.png}
\usepackage{times}
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\usepackage[pdfstartview=FitH, bookmarks=true,pdfpagemode=None, breaklinks=true, urlbordercolor={0 0 1}]{hyperref}
\else
%use these options with regular latex
\usepackage{graphicx}
\DeclareGraphicsExtensions{.eps}
\usepackage[dvips,pdfstartview=FitH, bookmarks=true,pdfpagemode=None, breaklinks=true, urlbordercolor={0 0 1}]{hyperref}
\fi
%--------------------------------------------------------
%
% hyperref options:
%
% (details can be found in the hyperref manual which may
% have been included in your Tex distribution, otherwise
% try typing ``hyperref manual'' into Google)
%
%the breaklinks options allows links in the table of contents to break accross multiple lines. This is important if you have long figure titles. The link that it makes doesn't appear to work super well, at least with dvi->ps->pdf (the link is a thin line in between the two lines and it is hard to click on the line exactly. The alternative, however is to have a long figure title forced onto one line and possibly going off the page.
%deleting the pdfpagemode option or setting to pdfpagemode=UseOutlines will cause the bookmarks to be displayed when the document is first opened in Acrobat.
%pdfpagemode=None
%pdfpagemode=UseOutlines
%pdfstartviewoptions:
%pdfstartview=FitV fit vertical (whole page is visible)
%pdfstartview=FitH fit horizontal (fit width)
%pdfstartview=FitB ? fit both, fit badly (fairly small on my computer)
%--------------------------------------------------------
%end packages that switch
\ifpdf
%\newcommand{\picA}[1]{\includegraphics[angle=90,width=2.8in]{#1}}
\newcommand{\picR}[2]{\includegraphics[angle=90, width=#2in]{#1}}
\else
\newcommand{\picR}[2]{\includegraphics[width=#2in]{#1}}
\fi
\newcommand{\picNR}[2]{\includegraphics[width=#2in]{#1}}
\usepackage{color}
\definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
\definecolor{darkgreen}{rgb}{0,0.4,0.1}
\definecolor{mygray}{gray}{0.9}
\usepackage{listings}
\lstset{
%%%%Fernando + Ryan
language=Python,
numbers=left,
%%%% basicstyle=\ttfamily,
basicstyle=\small\sffamily,
%%%% basicstyle=\rmfamily,
%%%% basicstyle=\small\ttfamily,
%%$ commentstyle=\ttfamily\color{blue},
stringstyle=\ttfamily\color{orange},
%stringstyle=\ttfamily\color{red},
showstringspaces=false,
breaklines=true,
%%%% postbreak = \space\dots
postbreak = {},%\space,
% %Prabhu
commentstyle=\itshape\color{darkgreen},
%commentstyle=\color{green}\itshape,
%% commentstyle=\textbf,
%%% stringstyle=\color{darkgreen},
showstringspaces=false,
%%% keywordstyle=\color{blue}\bfseries,
keywordstyle=\bfseries\color{blue},
escapeinside={(*}{*)},
%%% emph={unknownparams},
emphstyle=\bfseries\color{blue},
emph={figure, clf, plot},
backgroundcolor=\color{mygray}
}
\usepackage{amsmath}
\usepackage{mathrsfs}
\newcommand{\e}[1]{\bar{e}_{#1}}
\renewcommand{\r}[1]{\bar{r}_{#1}}
\renewcommand{\deg}{^\circ}
\lstdefinestyle{numbers}
{numbers=left, stepnumber=1, numberstyle=\tiny, numbersep=10pt}
\lstdefinestyle{nonumbers}
{numbers=none}
\usepackage[all]{hypcap}
\newcommand{\inlinegraphic}[2]{\begin{center}\includegraphics[width=#1]{#2}\end{center}}
\renewcommand{\vector}[1]{\M{#1}}
\renewcommand{\i}{\vector{i}}
\renewcommand{\j}{\vector{j}}
\renewcommand{\r}{\vector{r}}
\renewcommand{\v}{\vector{v}}
\renewcommand{\a}{\vector{a}}
\lstset{style=nonumbers}
\begin{document}
\begin{maxima}
\parseopts{lhs='\M{U}_{act}'}
Uact:matrix([1.0, 0.0, 0.0, 0.0, 0.0],[0.0, 1.0, 0.0, 0.0, Kact*tauact/(s*(s+tauact))],[0.0, 0.0, 1.0, 0.0, 0.0],[0.0, 0.0, 0.0, 1.0, 0.0],[0.0, 0.0, 0.0, 0.0, 1.0])
\end{maxima}
\begin{maxima}
\parseopts{lhs='\M{U}_{sp}'}
Usp:matrix([1.0, 0.0, 0.0, 0.0, 0.0],[0.0, 1.0, 1/(ksp+csp*s), 0.0, 0.0],[0.0, 0.0, 1.0, 0.0, 0.0],[0.0, 0.0, 0.0, 1.0, 0.0],[0.0, 0.0, 0.0, 0.0, 1.0])
\end{maxima}
\begin{maxima}
\parseopts{lhs='\M{U}_{beam}'}
Ubeam:matrix([c1beam, 0.5*Lbeam*c4beam/betabeam, (((-0.5)*abeam)*c3beam)/(betabeam*betabeam), ((((-0.5)*Lbeam)*abeam)*c2beam)/(betabeam**3), 0.0],[0.5*betabeam*c2beam/Lbeam, c1beam, 0.5*abeam*c4beam/betabeam/Lbeam, 0.5*abeam*c3beam/(betabeam*betabeam), 0.0],[(((-0.5)*betabeam*betabeam)*c3beam)/abeam, 0.5*betabeam*Lbeam*c2beam/abeam, c1beam, (((-0.5)*Lbeam)*c4beam)/betabeam, 0.0],[((((-0.5)*betabeam**3)*c4beam)/Lbeam)/abeam, 0.5*betabeam*betabeam*c3beam/abeam, (((-0.5)*betabeam)*c2beam)/Lbeam, c1beam, 0.0],[0.0, 0.0, 0.0, 0.0, 1.0])
\end{maxima}
\begin{maxima}
\parseopts{lhs='\M{U}_{accel}'}
Uaccel:matrix([1.0, Laccel, 0, 0, 0.0],[0, 1.0, 0, 0, 0.0],[((-maccel)*s**2)*(Laccel-raccel), s**2*Iaccel-(maccel*s**2*raccel*(Laccel-raccel)), 1.0, -Laccel, 0.0],[maccel*s**2, maccel*s**2*raccel, 0, 1.0, 0.0],[0.0, 0.0, 0.0, 0.0, 1.0])
\end{maxima}
The system transfer matrix will be
\begin{equation}
Usys=Uaccel Ubeam Usp Uact
\end{equation}
\begin{maxima-noout}
Usys:Uaccel.Ubeam.Usp.Uact
\end{maxima-noout}
Based on the system boundary conditions, the submatrix whose determinant is the characteristic equation is
\begin{maxima-noout}
submat:submatrix(1,2,5,Usys,1,2,5)
\end{maxima-noout}
\begin{equation}
submat=submatrix(1,2,5,Usys,1,2,5)
\end{equation}
and the sub-column that will be used to calculated the Bode response is
\begin{maxima}
\parseopts{lhs='\M{subcol}',wrap=0}
subcol:submatrix(1,2,5,Usys,1,2,3,4)
\end{maxima}
The non-zero portion of the base vector will be found using
\begin{equation}
\M{nzbv}=\M{submat}^{-1}\left(-\M{subcol}\right)
\end{equation}
\begin{maxima-noout}
nzbv:invert(submat).(-1*subcol)
\end{maxima-noout}
\begin{maxima-noout}
bv:zeromatrix(5,1)
bv[5,1]:1
bv[3,1]:nzbv[1,1]
bv[4,1]:nzbv[2,1]
\end{maxima-noout}
The transfer matrix from the base vector to model position 3 is
\begin{equation}
U3=Uaccel Ubeam Usp Uact
\end{equation}
\begin{maxima-noout}
U3:Uaccel.Ubeam.Usp.Uact
\end{maxima-noout}
The state vector at this location is given by
\begin{equation}
\M{z}_{3}=U3 \M{bv}
\end{equation}
\begin{maxima-noout}
temprow:row(U3,1)
rb0:temprow.bv
\end{maxima-noout}
The transfer matrix from the base vector to model position 1 is
\begin{equation}
U1=Usp Uact
\end{equation}
\begin{maxima-noout}
U1:Usp.Uact
\end{maxima-noout}
The state vector at this location is given by
\begin{equation}
\M{z}_{1}=U1 \M{bv}
\end{equation}
\begin{maxima-noout}
temprow:row(U1,2)
rb1:temprow.bv
\end{maxima-noout}
Bode output 0 will be given by
\begin{equation}
bode0=rb0 s^2
\end{equation}
\begin{maxima-noout}
bode0:rb0*s^2
\end{maxima-noout}
A gain is introduced to scale the bode output to engineering units
\begin{equation}
bode0=bode0*gainbode0
\end{equation}
\begin{maxima-noout}
bode0:bode0*gainbode0
\end{maxima-noout}
\begin{maxima-noout}
bode0:subst([sin=zsin,cos=zcos,sinh=zsinh, cosh=zcosh],bode0)
\end{maxima-noout}
\begin{maxima-noout}
with_stdout ("log_compressed_bode0.f", fortran_optimize (bode0))
\end{maxima-noout}
Bode output 1 will be given by
\begin{equation}
bode1=rb1
\end{equation}
\begin{maxima-noout}
bode1:rb1
\end{maxima-noout}
A gain is introduced to scale the bode output to engineering units
\begin{equation}
bode1=bode1*gainbode1
\end{equation}
\begin{maxima-noout}
bode1:bode1*gainbode1
\end{maxima-noout}
\begin{maxima-noout}
bode1:subst([sin=zsin,cos=zcos,sinh=zsinh, cosh=zcosh],bode1)
\end{maxima-noout}
\begin{maxima-noout}
with_stdout ("log_compressed_bode1.f", fortran_optimize (bode1))
\end{maxima-noout}
\end{document}