12 June 2009

Estructura Memoria PFC

A continuación la estructura de la memoria del PFC. Para realizarla he combinado varias fuentes:
-Asignatura Proyectos de la titulación ITTSE
-Estructura de un trabajo final de estudios TUT "Tampere University of Technology"
-Adaptación para mi PFC de criterio propio.

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*-*-*-*-*
-Resumen
-Prologo
-Tabla de Contenidos
-Abreviaciones y Notación usada
-Introducción
- Objetivos y Justificación de los mismos
- Antecedentes y Estado del Arte
- Base Teórica, Puntos de Partida
-Desarrollo técnico
- Metodología y Proceso Técnico
- Soluciones Posibles
- Solución Adoptada
- Discusión y Justificación
-Diseño Prototipo
-Conclusiones
- Viabilidad
- Recomendaciones del Proyectista
-Referencias
- Fuentes
- Bibliografía
-Epilogo
-Anexos
- Hipótesis en detalle
- Métodos en detalle
- Cálculos en detalle
- Programas,Algoritmos en detalle
- Esquemas en detalle
- Datos adicionales
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Al director del proyecto le parece bien.
Al empezar a redactar puede que varíe algun punto del indice propuesto, pero este es el "esqueleto" sobre el que construiré el documento.

08 June 2009

Bicicletas electricas


Un link donde se recopila información sobre las bicicletas eléctricas


http://www.tuexperto.com/tag/bicicleta/

07 June 2009

Trabajar con transductores ultrasonicos aereos


He encontrado informacón básica sobre los transductores para sistemas SONAR de transmisión aérea en la siguientes URL's (inglés):

http://www.massa.com/air_articles.htm
http://www.senscomp.com/specsheets.htm
http://www.educypedia.be/electronics/sensorsultra.htm
http://www.educypedia.be/electronics/circuitssound.htm

IC's de apicación SONAR en URL:

http://search.datasheetcatalog.net/key/SONAR
http://www.chipsinfo.com/search.php?q=sonar&b=Search
mas

Es posible que use parte de esta información para mi PFC

02 June 2009

Presentación en microondas y antenas

Presentación en asignatura microondas y antenas, sobre similitudes y diferencias entre electromagnetismo y acústica

En la clase de microondas y antenas existía la posibilidad de presentar un informe sobre articulos traducidos de revistas cientificas, yo elegí un tema relacionado con mi PFC.

Actualizando datos PFC


1º) El dilema de la plataforma software para el desarrollo del proyecto:

Me he tenido que pantear utilizar varias plataformas para desarrollar mi PFC:

LabView: Se trata de una herramienta de desarrollo gráfica de National Instruments.

Matlab: Una potente herramienta de desarrollo usada extensamente en Ingeniería.

Visual C++: Complilador del lenguaje C++ con herramientas Visuales.


2º) Experimentacion con la tarjeta de sonido

Para poder decidir que plataforma he de usar me he puesto a experimentar con algunas de ellas, en concreto conozco la existencia de la Data Adquisition ToolBoox del MatLab, en la que existen algunas funciones para el control de la tarjeta de sonido. Lo que podría permitirme experimentar con la tarjeta de sonido algunas de las funciones, del proyecto.
A continuación el codigo matlab (.m) donde se pueden observar mis pruebas.
He conseguido muestrear a 96KHz con este programa, pero otros programas me indican que hay frecuencias de muestreo permitidas en mi hardware de hasta 192Khz lo que me permitiria cubrir la banda entre 30KHz y 60KHz que segun mis fuentes, es la más comunmente usada por los Murcielagos ecolocalizadores...

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

clear all
close all
AO = analogoutput('winsound');
AI = analoginput('winsound');
chanout1 = addchannel(AO,1);
chanin1 = addchannel(AI,1);
chanin2 = addchannel(AI,2);
durationout = 2;
durationin = 2; %2 second acquisition

set(AO,'SampleRate',96000)
set(AI,'SampleRate',96000)
set(AO,'TriggerType','Manual')
set(AI,'TriggerType','Manual')
ActualRateout = get(AO,'SampleRate');
ActualRatein = get(AI,'SampleRate');
blocksizein = get(AI,'SamplesPerTrigger');
set(AI,'SamplesPerTrigger',durationin*ActualRatein)
len = ActualRateout*durationout;
Fsin = ActualRatein;

dataout = sin(linspace(0,2*pi*6000,len))';
putdata(AO,dataout)
start(AO)
trigger(AO)
start(AI)
trigger(AI)
wait(AI,durationin + 1)
datain = getdata(AI);
wait(AO,5)


[f,mag] = daqdocfft(datain,Fsin,blocksizein);
plot(f,mag)
grid on
ylabel('Magnitude (dB)')
xlabel('Frequency (Hz)')
title('Frequency Components of Tuning Fork')
sound(datain,Fsin)

%out = daqhwinfo('winsound')
%out = daqhwinfo(AO)
%out = daqhwinfo(AI)
delete(AO)
clear AO
delete(AI)
clear AI

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

Las pruebas están hechas con la ayuda proporcionada con el programa Matlab

3º) Pruebas con MatLab ELAB 080

Ya que dispongo del Hardware de Pruebas ELAB-080 me he puesto a estudiar como llamar las funciones en lenguaje C, proporcinadas por el fabricante de este dispositivo incluidas en la biblioteca de enlace dinamico llamada ElabDLL.dll desde el MatLab

http://www.mathworks.com/company/newsletters/news_notes/win03/patterns.html


El Primer paso, es crear un fichero de cabecera de C llamado ElabDLL.h cullo contenido consiste en los prototipos de las funciones en lenguaje C y cullo contenido detallo a continuación:

-+-+-+-+-+-+-+-+-+-+

bool GetHWStatus();
bool GetSerialNumber(long *SerialNumber);
int SetAnalogChannels(int CH1Gain, int CH2Gain, bool CH1Couple, bool CH2Couple, bool CH1Multiplier, bool CH2Multiplier);
long SetDSODCOffsets(double CH1DCOffVoltage, double CH2DCOffVoltage);
double SetDSOLASampleRate(double DesiredFreq);
int CaptureDSOData(unsigned int total_blocks, unsigned int pre_trigger_blocks, unsigned int trigger_channel, double trigger_value, unsigned int auto_roll, long OverrideOtherClocks);
long RetrieveDSOData(unsigned char whatchannels, double *DSOCH1, double *DSOCH2, unsigned short *LADATA, unsigned char Nth_Sample);
float SetUPPS1(float Voltage);
float SetUPPS2(float Voltage);
int GetUPPSOverload();
double SetProgClocks (char Switch, double Frequency1, double Frequency2, double *Freq1Actual, double *Freq2Actual, long OverrideClocks);
long SetupAWG(double *AnalogVoltage, short *DigitalData, long BufferSize, double DCOffsetVoltage, double SampleFrequency, long Use4xGain, double OutputImpedance, long Repeat,long Triggered, long OverrideOtherClocks);
long AWGStart(long OverrideOtherClocks);
long AWGStop();

-+-+-+-+-+-+-+-+-+-+-+-

Despues creo un Script de MatLab para probar llamar a cada una de las funciones... No es funcional aún pero muestro el contenido de mis tests realizados hasta ahora:

-+-+-+-+-+-+-+-+-+-+-+-+

%uso de las funciones en la libreria ElabDLL

[notfound,warnings]=loadlibrary('ElabDLL.dll', 'ElabDLL.h')
libfunctions ElabDLL
libfunctions ElabDLL -full
libfunctionsview ElabDLL

%1
%C prototipe
%bool GetHWStatus()
%Matlab Prototipe
%bool GetHWStatus

a=calllib('ElabDLL', 'GetHWStatus')

%2
%C prototipe
%bool GetSerialNumber(long *SerialNumber)
%Matlab Prototipe
%[bool, longPtr] GetSerialNumber(longPtr)

x = 15;
xp = libpointer('longPtr', x);
get(xp)
b=calllib('ElabDLL', 'GetSerialNumber',xp)
get(xp, 'Value')

%3
%C prototipe
%int SetAnalogChannels(int CH1Gain, int CH2Gain, bool CH1Couple, bool CH2Couple, bool CH1Multiplier, bool CH2Multiplier)
%Matlab Prototipe
%int32 SetAnalogChannels(int32, int32, bool, bool, bool, bool)

intA=200; %Ch1 mV/div Possible values are 10, 20, 50, 100, 200, 500
intB=200; %Ch2 mV/div Possible values are 10, 20, 50, 100, 200, 500
boolA=0; %Ch1 DC(1)/AC(0)
boolB=0; %Ch2 DC(1)/AC(0)
boolC=0; %Ch1 probe 10X(1)/1X(0)
boolD=0; %Ch2 probe 10X(1)/1X(0)
ReturnInt=calllib('ElabDLL', 'SetAnalogChannels', intA, intB, boolA, boolB, boolC, boolD)

% ReturnInt=1 Ch1 incorrect value =2 Ch2 incorrect value =0 Success

%4
%C prototipe
%long SetDSODCOffsets(double CH1DCOffVoltage, double CH2DCOffVoltage)
%Matlab Prototipe
%long SetDSODCOffsets(double, double)

% The range allowed is +/- (5*V/div setting).
% Thus in 5V/div, you can set to +/-
% 25V, in 20mV/div, this can be set to +/- 100mV.

doubleA=0; %Ch1 offset
doubleB=0; %Ch2 offset
ReturnLong=calllib('ElabDLL', 'SetDSODCOffsets', doubleA, doubleB)

%revisar !!!!!

%5
%C prototipe
%double SetDSOLASampleRate(double DesiredFreq)
%Matlab Prototipe
%double SetDSOLASampleRate(double)

doubleA=200000; %Frecuencia de muestreo del DSO desde 8KHz a 400MHz
ReturnDouble=calllib('ElabDLL', 'SetDSOLASampleRate', doubleA)
% returndoble Devuelve el valor asignado para el muestreo

%6
%C prototipe
%int CaptureDSOData(unsigned int total_blocks, unsigned int pre_trigger_blocks, unsigned int trigger_channel, double trigger_value, unsigned int auto_roll, long OverrideOtherClocks)
%Matlab Prototipe
%REVISAR int32 CaptureDSOData(uint32, uint32, uint32, double, uint32, long)

uintA=7; %Numero de Bloques 1 a 32 de 1K
uintB=1; %Numero de bloques antes del trigger
uintC=1; % 0 no Trigger, 1 Ch2, 2 Ch2, 3 LA
doubleA=0;
%This value is in volts if the trigger is a DSO trigger, and in bits if a
%LA trigger. The trigger must be “on screen”, which is +/- 5 divisions from the current DC
%offset. If the trigger is an LA trigger, only the least significant 4 bits are used, and one of
%these bits must be a “1”
uintD=1; % if 1 auto trigger, if 0 whait fpr the trigger
longA=1; % si es 0 no fuerza el cambio de los valores de reloj, 1 fuerza cambio de valores de relojes en el dispositivo...
ReturnInt=calllib('ElabDLL', 'CaptureDSOData',uintA, uintB, uintC, doubleA, uintD, longA)

%7
%C prototipe
%long RetrieveDSOData(unsigned char whatchannels, double *DSOCH1, double *DSOCH2, unsigned short *LADATA, unsigned char Nth_Sample)
%Matlab Prototipe
%REVISAR [long, doublePtr, doublePtr, uint16Ptr] RetrieveDSOData(uint8, doublePtr, doublePtr, uint16Ptr, uint8)

uintA=1; %Mascara de bits con los canales que se leeran The LSB is DSO CH1, bit 1 is DSO CH2, bit 2 is LA CH0-7, bit 3 is LA CH8-15
x = zeros(1, 7000);
doublePtrA = libpointer('doublePtr',x);
doublePtrB = libpointer('doublePtr',x);
uint16PtrA = libpointer('uint16Ptr',x);
uintB=1; %Allows the programmer to download only every Xth Set to “1” to download all data. Can range from 1-255
ReturnLong=calllib('ElabDLL', 'RetrieveDSOData', uintA, doublePtrA, doublePtrB, uint16PtrA, uintB)
get(doublePtrA)

%8
%C prototipe
%float SetUPPS1(float Voltage)
%Matlab Prototipe
%single SetUPPS1(single)

singleA=4.1;
ReturnSingle=calllib('ElabDLL', 'SetUPPS1', singleA)

%9
%C prototipe
%float SetUPPS2(float Voltage)
%Matlab Prototipe
%single SetUPPS2(single)

singleA=9;
ReturnSingle=calllib('ElabDLL', 'SetUPPS2', singleA)

%10
%C prototipe
%int GetUPPSOverload()
%Matlab Prototipe
%int32 GetUPPSOverload

ReturnInt=calllib('ElabDLL', 'GetUPPSOverload')

%11
%C prototipe
%double SetProgClocks (char Switch, double Frequency1, double Frequency2, double *Freq1Actual, double *Freq2Actual, long OverrideClocks)
%Matlab Prototipe
%[double, doublePtr, doublePtr] SetProgClocks(int8, double, double, doublePtr, doublePtr, long)

intA=1; %0 for programable cloks off, 1 for turn on the cloks
doubleA=40000000; %configura valor reloj 1
doubleB=50000000; %configura valor reloj 2
x = 0;
doublePtrA = libpointer('doublePtr', x); %retrorna valor establecido de reloj 1
doublePtrB = libpointer('doublePtr', x); %retrorna valor establecido de reloj 2
longA=1; %0 devuelve un error si no se puede configurar, con 1 la función fuerza el cambio de valor en los relojes

ReturnDouble=calllib('ElabDLL', 'SetProgClocks',intA, doubleA, doubleB, doublePtrA, doublePtrB, longA)
get(doublePtrA) %muestra contenido del puntero y su tipo doublePtrA
% 0 failure, 1 success

%12
%C prototipe
%long SetupAWG(double *AnalogVoltage, short *DigitalData, long BufferSize, double DCOffsetVoltage, double SampleFrequency, long Use4xGain, double OutputImpedance, long Repeat,long Triggered, long OverrideOtherClocks)
%Matlab Prototipe
%[long, doublePtr, int16Ptr] SetupAWG(doublePtr, int16Ptr, long, double, double, long, double, long, long, long)

x = 0;
doublePtrA = libpointer('doublePtr', x); %analog data +-1.25V or +-5V
int16PtrA = libpointer('int16Ptr', x); %digital data (5 bits)
longA=0; %Number of samples to play
doubleA=0; % DC offset
doubleB=50000; % play frecuency
longB=0; % 0 para modo 1X , 1 para modo 4X , steep 2.5mV / 10mV
doubleC=50; %impedancia de Salida
longC=1; % 1 to repeat the wave, 0 for only one time
longD=0; % 1 to play only if trigger input is on, 0 to play when AWGStart is Called
longE=1; % 0 to return fail if can't perform the clock change, 1 if force the change
ReturnLong=calllib('ElabDLL', 'SetupAWG', doublePtrA, int16PtrA, longA, doubleA, doubleB, longB, doubleC, longC, longD, longE)
get(doublePtrA) %muestra contenido del puntero y su tipo doublePtrA
% “1” if successful, “0” if failure occurs.

%13
%C prototipe
%long AWGStart(long OverrideOtherClocks)
%Matlab Prototipe
%long AWGStart(long)
longA=0;% 0 to return fail if can't perform the clock change, 1 if force the change
ReturnLong=calllib('ElabDLL', 'AWGStart', longA)
% “1” if successful, “0” if failure occurs.

%14
%C prototipe
%long AWGStop()
%Matlab Prototipe
%long AWGStop
ReturnLongt=calllib('ElabDLL', 'AWGStop')
% “1” if successful, “0” if failure occurs.

% unloadlibrary ElabDLL

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Acerca de Este programa para controlar mi hardware tengo mis dudas ya que leí en la "ayuda" matlab la siguiente nota:

"The MATLAB Interface to Shared Libraries does not support library functions that have function pointer inputs. "

Comentandolo con el fabricante del hardware me contestó esto:

"I am unable to comment on another companies product. I would contact their support directly. I do know that customers have used MatLab and our dll successfully. I don't know if Matlab has changed what they allow their software to interface with or not."

Así que no descarto ninguna alternativa aún