This commit is contained in:
Robin Clark 2012-11-18 22:22:02 +00:00
parent 21c251f25c
commit a5f7b59abc

View File

@ -401,7 +401,7 @@ $$fm ( CMATV ) = \{ HIGH , LOW, V\_ERR \} .$$
\paragraph{Functional Group - Software - Read\_ADC - RADC}
\label{readADC}
The software function $Read\_ADC$ uses the ADC hardware analysed
as the {\dc} CMATV above.
@ -642,7 +642,7 @@ A differential of the error value is calculated and multiplied by a D constant.
The error value its self is multiplied by a P constant, and all three of these are added
to obtain the output required.
\subsection{Design Stage: Implementation on a micro-controller.}
When writing a computer program it is always useful to
When designing a computer program it is often useful to
produce a structured analysis `Yourdon' context diagram~\cite{Yourdon:1989:MSA:62004}, see figure~\ref{fig:context_diagram_PID}.
The Yourdon methodology also gives us a guide as to which software
functions should be called to control the process, or in `C' terms be the main function.
@ -660,7 +660,7 @@ we will need and ADC and MUX.
For the output, we can use a Pulse Width Modulator (PWM) output. This is a common module found on micro-controllers
allowing a variable power output. PWM's ADC's and MUX's are commonly built into cheap micro-controllers~\cite{pic18f2523}.
We can now build more detail into the Yourdon diagram, with the afferent flow coming through the MUX and ADC on the micro-controller, and the afferent
channelled through a PWM module, again built into the micro-controller.
channelled through a PWM module, again built into the micro-controller, see figure~\ref{fig:context_diagram2_PID}.
\begin{figure}[h]+
\centering
\includegraphics[width=300pt]{./CH5_Examples/context_diagram2_PID.png}
@ -668,9 +668,9 @@ channelled through a PWM module, again built into the micro-controller.
\caption{Yourdon Context Diagram for PID Temperature Controller.}
\label{fig:context_diagram2_PID}
\end{figure}
The Yourdon methodology allows us to zoom into transform bubbles and analyse them in more
detail, the controlling software requires definition.
we follow the data streams through the process, creating transform bubbles as required.
The Yourdon methodology allows us to zoom into data transform bubbles and analyse them in more
detail. the controlling software requires definition and we now zoom into and define this in terms of software functions.
We follow the data streams through the process, creating transform bubbles as required.
In all `bare~metal' software architectures, we need a rudimentary operating system, often referred to as the monitor.
PID, because the algorithm depends heavily on integration, is time sensitive
and we therefore need to invoke at at specific intervals.
@ -696,15 +696,13 @@ forming the software call tree hierarchy, see figure~\ref{fig:context_calltree}.
\label{fig:context_calltree}
\end{figure}
This is clearly going to be the monitor function.
This will examine the timer value, and call the PID function, which will call first
the determine\_set\_point\_error function with that calling convert\_ADC\_to\_T
which calls Read\_ADC (the function developed in the earlier example).
With the set point error value the PID function will call the output control function with its PID
demand. On returning to the monitor function, it will return the PID demand value.
%
Now we have the system design we have all the components, hardware elements and software functions
that will be used in the temperature controller.
We can list these and begin, from the bottom-up
@ -720,6 +718,7 @@ Identified electronic components:
\item TIMER --- Internal micro controller timer
\item HEATER --- Heating element, essentially a resistor.
\item Pt100 --- Pt100 Temperature sensor, as analysed in section~\ref{sec:Pt100}.
\item PWM --- Internal micro controller pulse width modulation module
\item micro-controller --- the medium for running the software
\end{itemize}
@ -735,7 +734,69 @@ Identified Software Components:
With the call tree structure, we can now analyse these
components from the bottom-up.
components from the bottom-up, starting with the electronics.
\subsection{Temperature Controller Hardware Elements FMMD}
\paragraph{ACDMUX and Read\_ADC}
We re-use this derived component from section~\ref{readADC}.
$$ fm(RADC) = \{ VV\_ERR, HIGH, LOW \} .$$
\paragraph{TIMER}
The internal timer in use is a register which when read
returns an incremented time value.
Using two's complement mathematics, by subtracting
the time we last read it, we can calculate the interval
between readings (assuming the timer has not completely wrapped around).
We can say that a timer can fail by
incrementing its value at an incorrect rate, or can stop incrementing.
$$ fm(TIMER) = \{ STOPPED, INCORRECT\_INTERVAL \}$$
\paragraph{HEATER}
A heating element is typically some configuration of resistive wire.
It therefore has the same failure modes as a resistor and we can state
$$fm(HEATER) = \{ OPEN, SHORT \}$$
\paragraph{Pt100 Platinum Temperature Sensor}
The Pt100 four wire configuration is analysed in section~\ref{sec:Pt100}
$$ fm(Pt100) = \{ OUT\_OF\_RANGE \} $$
\paragraph{PWM}
The PWM in use is a hardware register written to with an integer value.
It then applies a mark space ratio proportional to that value providing
a means of applying varying amounts of power. When the PWM
action is halted the digital output pin associated with it will typically be held in a high or low state.
We therefore state:
$$ fm(PWM) = \{ HIGH, LOW \}.$$
\paragraph{Micro-Controller}
The Micro controller is a complex piece of highly integrated electronics.
Typically, along with a micro-processor with PROM and RAM, they have many I/O modules including UARTS, PWM, ADCMUX, CAN
General I/O and interrupt lines to name but a few.
In this project we are using the ADCMUX, TIMER, PWM and the general purpose computing facilities.
We have to therefore consider the general~computing, CLOCK, PROM and RAM failure modes.
$$fm (micro-controller) =\{ PROM\_FAULT, RAM\_FAULT, CPU\_FAULT, ALU\_FAULT, CLOCK\_STOPPED \}.$$
\subsection{Temperature Controller Software Elements FMMD}
We must start from the bottom-up with the software, and consider the hardware elements
used (if any) by each software function.
Starting at the bottom
@ -781,19 +842,5 @@ detect ADC\_STUCK\_AT and MUX\_FAIL failure modes.
A software specification for a hardware interface will concentrate on
how to interpret raw readings, or what signals to apply for actuators.
Using FMMD we can determine an accurate failure model for the interface as well~\cite{sfmeainterface}.
%
%Detailing this however, is beyond the scope %and page-count
%of this paper.
%Its solved. Hoooo-ray !!!!!!!!!!!!!!!!!!!!!!!!
\vspace{20pt}
%typeset in {\Huge \LaTeX} \today