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

12 May 2009

Informacion posiblemente interesante para aguien


A continuación unos enlaces a sitios que pueden ser de interés.

-Crear Modelos 3D de forma sencilla:
http://sketchup.google.com/intl/es/product/gsu.html


-Ejemplos aplicacion LabVIEW


http://www.mediafire.com/file/5my0zwejmge/examples_LabView.zip

Descargados de MIT OCW (Open Course Ware)

-Material Curso procesado de imagen.

http://www.mediafire.com/file/d4jwzlj3jtw/MaterialCursoImagenes.zip

23 April 2009

Open Course Ware (OCW)


Hay una iniciativa desde el MIT (Massachusetts Institute of Technology) que consiste en compartir en Internet los contenidos de los cursos.


Adjunto una charla en video organizada en la universidad de Valencia

http://mmedia.uv.es/buildhtml?user=viherma&name=ocw_roderic.mp4

Descripción en wikipedia:

http://es.wikipedia.org/wiki/OpenCourseWare

La iniciativa del MIT original:

http://ocw.mit.edu/OcwWeb/web/home/home/index.htm

21 April 2009

Compartir el matlab 7.0


Como estudiante de ingeniería uso un programa habitualmente llamado MATLAB para realizar las practicas. Como no es siempre inmediato encontrar dicho programa voy a incluirlo aquí por si alguien lo necesita.

-Los archivos para la descarga están creados con el Splitter.exe ( http://espanol.splitter.vze.com/ )en trozos de 97 Mbytes (el limite por archivo en mediafire son 100Mb) para poder subirlo al servidor de

http://www.mediafire.com

de forma gratuita.

Solo hay que abrir el .exe una vez se han descargado todos los trozos tenienidolos en la misma carpeta que el .exe

El procedimiento para descomprimirlo es el siguiente:

1º-Descargar todos los trozos (un total de 11)

2º-Abrir el archivo "matlab7_zip.exe" teniendo en el mismo directorio todos los volumenes del paquete

3º-Descomprimir el archivo creado "matlab7.zip" con cualquier descompresor de .zip (aqui uno cualquiera)

4º- En la carpeta "matlab 7 cd1" abrir el archivo "setup.exe"



Aquí el link a la carpeta en el servidor de mediafire:

http://www.mediafire.com/?sharekey=baccec7057ec0cdcd1014a7a667fa2b40f87e6ea9ff5e20e5be6ba49b5870170


18 April 2009

Microelectrónica en la Universitat de València


En la universidad de Valencia hay una asignatura llamada microelectrónica, en la cual se usa un libro con la base teórica de dicha asignatura, hay ejemplares en la biblioteca, pero solo puedo tenerlos prestados durante un corto periodo de tiempo. (una semana) Por ello ha buscado en la red la versión del libro en .pdf y como es un libro usado internacionalmente para enseñar microelectrónica, no ha sido dificil encontrarlo en la red.
Por supuesto, el libro está en Inglés.
El link de descarga a continuación:



-Design of Analog CMOS Integrated Circuits (Behzad Razavi)

http://www.mediafire.com/?wlmtzqyjtlm

Fisica de Ondas (Acústica y más) Libros on-line y listas reproducción OCW MIT


Libros Acústica en Inglés

Como han desaparecido los libros de la biblioteca en los que habia pensado basarme para redactar la primera parte del proyecto, me he puesto a buscar en internét que podía encontrar para realizar esta tarea, y he encontrado los libros que se pueden descargar en los siguientes enlaces:

-Engineering Acoustics

Michael Moser
Engineering Acoustics
An Introduction to Noise Control


http://www.mediafire.com/file/1wzztmzzy3t/Engineering Acoustics - An Introduction to Noise Control (2009) (Malestrom).pdf

-FUNDAMENTALS OF ACOUSTICS

Fundamentals of Acoustics 4th ed - L. Kinsler, et al., (Wiley, 2000) WW


http://www.mediafire.com/?xjwyji5yryg

-ACOUSTICS

Acoustics_-_L._Beranek_marcado

http://www.filefactory.com/file/agca8d7/n/Acoustics_-_L_Beranek_marcado_pdf

-ANTENAS (este libro no es de acústica, pero es de antenas, y por eso la parte de propagación es muy similar a la del sonido, ya que el tratamiento matemático es el mismo "ondas")

Este libro es el que se usa en la asignatura de Microondas y Antenas de la Universitat de València.


http://www.mediafire.com/?gdzmuzywnmz


Además he encontrado un curso muy interesante de Vibraciones y Ondas en YouTube, bajo licencia Creative Commons grabado en el MIT (Masacusets Institute Of Technology) dentro del programa OCW (Open Course Ware)

http://www.youtube.com/watch?v=9kSUGGIQPJU&feature=SeriesPlayList&p=854AA255B15C574C&index=0