-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathInstallationNotes.tex
144 lines (137 loc) · 8.2 KB
/
InstallationNotes.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
\documentclass{article}
\usepackage[margin=0.8in]{geometry}
\usepackage[T1]{fontenc}
\usepackage{inconsolata}
\usepackage{color}
\definecolor{bluekeywords}{rgb}{0.13,0.13,1}
\definecolor{greencomments}{rgb}{0,0.5,0}
\definecolor{redstrings}{rgb}{0.9,0,0}
\usepackage{listings}
\lstset{language=[Sharp]C,
showspaces=false,
showtabs=false,
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
escapeinside={(*@}{@*)},
commentstyle=\color{greencomments},
keywordstyle=\color{bluekeywords},
stringstyle=\color{redstrings},
basicstyle=\ttfamily
}
\title{Installation notes for EDM Suite }
\author{Jimmy Stammers and Jack Devlin}
\date{13/4/2016}
\newcommand{\cons}[1]{\fontencoding{consola}}
\begin{document}
\maketitle
\section{General Information}
The EDMSuite was originally written to control a molecular beam experiment and over the years has been developed into a more general-purpose control software. The bulk of the code is designed to be independent of hardware, to remove the dependency on build requirements for specific computers. The references to hardware are included in higher-levels of the code.
\section{Installation Instructions}
\subsection{Requirements}
\begin{itemize}
\item Microsoft Visual Studio 2013, install from
https://imperial.onthehub.com/WebStore/ProductsByMajorVersionList.aspx, sign in with imperial ID
\item National Instruments Measurement Studio 2015, download from NI. License code is in 015, Bay 2 filing cabinet.
\item National Instruments drivers, these depend on the hardware you want to run. Look at the pages on the NI website for the cards that you have. These will definitely include NI-DAQmx. Use the latest version of these drivers. Tested successfully with DAQmx version 15.5.45.109
\item git, download from https://git-scm.com/
\item edmSuite - available from http://github.com/coldmatter/EDMSuite
\end{itemize}
\subsection{Steps for Installation}
\begin{enumerate}
\item Install Visual Studio 2013
\item Install Measurement Studio 2015
\item Launch Visual Studio and the edmSuite solution \lstinline|EDMSuite.sln|. When first opening, a dialogue may ask if you would like to automatically update references to newer installed versions.
\item Every project requires a \lstinline|licenses.licx| file, which is generated by measurement studio. This can be done automatically using the generate licenses command in the Measurement Studio tab, but you may need to manually create a blank file in each project folder.
\item Choose the configuration \lstinline|analysis| which does not depend on any hardware. Build this to verify correct installation.
\end{enumerate}
\section{Configuring EDMSuite for the Specific Computer}
\subsection{Defining the Computer as an Environment}
In the \lstinline|DAQ.environs| method add a \lstinline|case| of the following form
\begin{lstlisting}
case "your-computer":
Hardware = new YourHardware();
FileSystem = new YourFileSystem();
Debug = false;
break;
\end{lstlisting}
\subsection{Defining the Hardware Class}
\begin{enumerate}
\item Create a new class in the DAQ project \lstinline|YourHardware.cs|. This class requires \lstinline|NationalInstruments.DAQmx| and \lstinline|DAQ.pattern| and is in \lstinline|namespace DAQ.HAL|. The class inherits from \lstinline|DAQ.HAL.Hardware|. DAQ boards are added using
\begin{lstlisting}
Boards.Add("namestring","boardlocation");
\end{lstlisting}
where \lstinline|"boardlocation" | is the device name in NI-MAX.
\item Define a string for each board, e.g.
\begin{lstlisting}
string boardName = (string)Boards["namestring"];
\end{lstlisting}
\item Add Digital/Analogue I/O channels, e.g.
\begin{lstlisting}
AddDigitalOutputChannel("name", boardName, portNo, lineNo);
\end{lstlisting}
\item You can look at \lstinline|PXIEDMHardware.cs| for an example
\end{enumerate}
\subsection{Defining the File System}
\begin{enumerate}
\item Create a new class in the DAQ project \lstinline|YourFileSystem.cs|. This class is in \lstinline|namespace DAQ| and inherits from \lstinline|DAQ.Environment.FileSystem|.
\item Paths are added in the following way
\begin{lstlisting}
Paths.Add("yourPath","drive:\\folder\\subfolder")
\end{lstlisting}
\item Add data paths to the \lstinline|DataSearchPaths| object
\begin{lstlisting}
DataSearchPaths.Add(Paths["yourDataPath"]);
\end{lstlisting}
\end{enumerate}
\subsection{Make a new Configuration}
\begin{enumerate}
\item Navigate to the configuration manager
\item Add a new build configuration and select the required projects. This must at least have \lstinline|DAQ|, \lstinline|SharedCode|.
\item Now build this configuration to check that you have all the NI drivers. If there are references that are not found, you may need to download additional drivers.
\end{enumerate}
\section{Controlling your Hardware}
Create a class in DAQ called \lstinline|YourHardwareController.cs|. Set this to be the start-up project.
\subsection{Creating and Modifying Tasks}
\begin{itemize}
\item Each channel must be defined as an object of the type \lstinline|Task|, which is located in \lstinline|NationalInstruments.DAQmx|. These tasks are created using methods of the following form
\begin{lstlisting}
private Task CreateAnalogInputTask(string channel)
{
Task task = new Task("NAVHCIn"+channel);
((AnalogInputChannel)Environs.Hardware.AnalogInputChannels[channel]).AddToTask(
task,
0,
10
);
task.Control(TaskAction.Verify);
return task;
}
\end{lstlisting}
With similar methods for digital and/or output tasks. It may also be useful to define methods which create analogue tasks with a specified range. In the above case, the low value is set to 0 and the high is set to 10.
\item Set methods are defined in a similar way
\begin{lstlisting}
private void SetAnalogOutput(Task task, double voltage)
{
AnalogSingleChannelWriter writer = new AnalogSingleChannelWriter(task.Stream);
writer.WriteSingleSample(true, voltage);
task.Control(TaskAction.Unreserve);
}
\end{lstlisting}
as are read methods
\begin{lstlisting}
private double ReadAnalogInput(Task task)
{
AnalogSingleChannelReader reader = new AnalogSingleChannelReader(task.Stream);
double val = reader.ReadSingleSample();
task.Control(TaskAction.Unreserve);
return val;
}
\end{lstlisting}
For analogue channels, there is also a method which reads multiple samples at a user-defined sampling rate and returns their mean value.
\item When the digital tasks are created, they are added to Hash tables \lstinline|digitalTasks| or \lstinline|digitalInputTasks|, so these must also be defined
\end{itemize}
\subsection{Configuring the GUI}
In \lstinline|YourHardwareController|, create a method \lstinline|public void Start()|, which is the initialises the hardware controller. All the analogue and digital tasks are created here and the window is created using \lstinline|ControlWindow()|. After this, define methods \lstinline|internal void WindowLoaded()| and \lstinline|internal void WindowClosed()| which run after starting and closing the application respectively. In the controller window, a toolbox can be used to add components such as buttons, text fields and check boxes. As an example, I created a text box named \lstinline|bFieldTextBox| and defined a method in the controller class \lstinline|BFieldCurrent| which parses the value from this text box. A function \lstinline|UpdateBfield()| then outputs this as a voltage to the task \lstinline|bfieldCurrentOutputTask|. This is called in the method \lstinline|button1_Click| found in the \lstinline|ControlWindow| class. In the \lstinline|ControlWindow.Designer|, Visual Studio automatically generates definitions for the various controllable objects. By default these are private, but if they are required by other classes, then they must be redefined as public objects. Before the application can launch, a \lstinline|Runner| class must be written which contains the \lstinline|Main()| sequence that initialises and starts the hardware controller. In here, it is also possible to include remote access control so that the hardware controller can be controlled via other applications through TCP.
\subsection{Including Vision Acquistion}
\end{document}