-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·232 lines (203 loc) · 6.64 KB
/
Copy pathconfigure
File metadata and controls
executable file
·232 lines (203 loc) · 6.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
#!/bin/sh
#############################################################################
# This is a Matlab simulation configuration script file.
# The purpose is to control the toplevel simulation so that simulation
# and the result analysis can be controlled
# in parametrized manner from this single file
# Created by Marko Kosunen on 24.03.2015
# Last modification by Marko Kosunen, marko.kosunen@aalto.fi, 11.07.2017 14:26
#############################################################################
##Function to display help with -h argument and to control
##The configuration from the commnad line
help_f()
{
echo -e "CONFIGURE Release 1.0 (04.04.2016)"
echo -e "configure-configuration script for a digital flow"
echo -e "Written by Marko "Pikkis" Kosunen"
echo -e -n "\n"
echo -e "SYNOPSIS"
echo -e " configure [OPTIONS] "
echo -e "DESCRIPTION"
echo -e " Producess all configuration and Makefile for the digital flow"
echo -e -n "\n"
echo -e "OPTIONS"
echo -e " -M"
echo -e " Do not reconfigure matlab control file."
echo -e " -S"
echo -e " Do not reconfigure slides."
echo -e " -h"
echo -e " Show this help."
}
# Configuration control, '1'=configure
MATLABCONF="1"
SLIDES="1"
while getopts MSh opt
do
case "$opt" in
M) MATLABCONF="0";;
S) SLIDES="0";;
h) help_f; exit 0;;
\?) help_f;;
esac
done
# SET ALL VARIABLES AND PATHS RELATIVE TO THE CURRENT DESIGN
# Design paths
ROOTPATH=`pwd`
TEMPLATEDIR="/tools/designs/mkosunen/mkosunen/FADER_MATLAB/OO_MIMO/simulations/Slidetemplate"
MATLABPATH="${ROOTPATH}/Matlab"
SLIDEPATH="${ROOTPATH}/Slides/"
PICPATH="${ROOTPATH}/Pics"
#Check, create if missing
for dir in ${ROOTPATH} ${MATLABPATH} ${MATLABPATH}/Matfiles \
${PICPATH}; do
if [ ! -d "$dir" ]; then
echo "Creating directory $dir"
mkdir -p $dir
fi
done
if [ ! -d "$SLIDEPATH" ]; then
echo "Creating directory $dir"
${TEMPLATEDIR}/initslides ${SLIDEPATH}
fi
#Top entity name and savestring (i.e. for filenames)
#Defaults the directory name
TOP_ENTITY=`basename $ROOTPATH`
if [ ${MATLABCONF} == "1" ]; then
#############################################################################
# Matlab command file generation
#############################################################################
CURRENTFILE="${MATLABPATH}/${TOP_ENTITY}.m"
echo "Creating ${CURRENTFILE}"
cat <<EOF > ${CURRENTFILE}
%You may write any matlab code here to control your sim
clear all;
cla;
rootpath='$ROOTPATH'
picpath=[rootpath '/Pics'];
x=1:100;
figure(1)
h=plot(x,x);
axis([min(x) max(x) min(x) max(x)]);
set(h,'LineWidth',2)
tstr=sprintf('Response\n');
title(tstr)
xlabel('Time [s]')
ylabel('Voltage [V]');
legend(h,'Output','Location','southwest');
set(gca,'FontSize',14);
set(gca,'FontWeight','Bold');
set(gca,'LineWidth',2)
%set(gca,'Xtick',tmarks)
grid on
eval(['print -depsc ' picpath '/Matlabfig1.eps']);
EOF
fi
#############################################################################
# Slides generation
#############################################################################
if [ "${SLIDES}" == "1" ]; then
#############Slides latex file############################################
CURRENTFILE="${SLIDEPATH}/${TOP_ENTITY}.tex"
SLIDETITLE=`echo ${TOP_ENTITY} | sed 's/_/ /g'`
echo "Creating ${CURRENTFILE}"
#Generate preamble
cat <<EOF > ${CURRENTFILE}
\PassOptionsToPackage{ELEC}{aaltologo}
%\documentclass[first=dgreen,second=purple,logo=bluequo,normaltitle]{aaltoslides}
\documentclass[logo=bluequo]{aaltoslides}
%\documentclass{aaltoslides} % DEFAULT
%\documentclass[first=purple,second=lgreen,logo=bquo,normaltitle,nofoot]{aaltoslides} % SOME OPTION EXAMPLES
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{amssymb,amsmath}
\usepackage{url}
\usepackage{lastpage}
\usepackage{epstopdf}
%\usepackage[pdfpagemode=None,colorlinks=true,urlcolor=red, linkcolor=black,citecolor=black,pdfstartview=FitH]{hyperref}
\usepackage{mdframed}
\usepackage{caption}
\usepackage{apacite}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,shadows,arrows}
\tikzset{
every overlay node/.style={
%draw=black,fill=white,rounded corners,
anchor=north west, inner sep=0pt,
},
}
\def\tikzoverlay{%
\tikz[remember picture, overlay]\node[every overlay node]
}%
%%%% This for easy placemnet of figure inside a block
\newcommand{\putfig}[3][1.0]{
\begin{block}{#3}
\includegraphics[width=#1\linewidth,height=#1\textheight,keepaspectratio]{#2}
\end{block}
}
%%%%
%%%% To insert lecture date
\newcommand{\lectdate}{\today}
%%%%
\title{${SLIDETITLE}}
\author[Marko Kosunen]{Marko Kosunen}
\institute[MNT]{Department of Electronics and Nanoengineering\\\\
Aalto University, School of Electrical Engineering\\\\marko.kosunen@aalto.fi}
\aaltofootertext{${SLIDETITLE}}{\lectdate}{\arabic{page}/\pageref{LastPage}\ }
\date{\lectdate}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generates the titleframe
\aaltotitleframe
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOF
for FILE in Matlabfig1.eps; do
cat <<EOF >> ${CURRENTFILE}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
\frametitle{${SLIDETITLE}}
\begin{center}
\includegraphics[width=0.7\linewidth]{./Pics/${FILE}}
\end{center}
\end{frame}
EOF
done
echo "\end{document}" >> ${CURRENTFILE}
fi
############################# MAKEFILE ####################################
CURRENTFILE="${ROOTPATH}/Makefile"
echo "Creating ${CURRENTFILE}"
cat <<EOF > ${CURRENTFILE}
#Directories
TOP_ENTITY= ${TOP_ENTITY}
MATLABPATH= ${MATLABPATH}
PICPATH= ${PICPATH}
SLIDEPATH= ${SLIDEPATH}
#Commands
MATLAB= ${MATLAB}
MATLABI= ${MATLABI}
MATLABG= ${MATLABG}
TOUCH=touch -r
CMDFILES=\$(MATLABPATH)/\$(TOP_ENTITY).m
.PHONY: matlabg matlabi matlab slides all
all: matlab slides
#No dependencies for slides. These are just always created with make all
slides:
ln -sf \$(PICPATH)/*.eps \$(SLIDEPATH)/Pics/
cd \$(SLIDEPATH) && ./makearticle \$(TOP_ENTITY).tex && cd ..
#If results are stored in the .mat file
##matlab: \$(CMDFILES:\$(CMDPATH)/%.m=\$(MATLABPATH)/Matfiles/%.mat)
matlab: \$(CMDFILES)
\$(MATLAB) -r ' addpath \$(MATLABPATH); \$(TOP_ENTITY); quit;'
#interactive submission
matlabi: \$(CMDFILES)
\$(MATLABI) -r ' addpath \$(MATLABPATH); \$(TOP_ENTITY); quit;'
#interactive submission, leave gui open
matlabg: \$(CMDFILES)
\$(MATLABG) -r ' addpath \$(MATLABPATH); \$(TOP_ENTITY);'
clean:
rm -f \$(SLIDEPATH)/Pics/*.eps
rm -f \$(PICPATH)/*.eps
rm -f \$(SLIDEPATH)/Pdffiles/*.pdf
EOF
##################Hereafter some files you should not need to modify ################################