Académique Documents
Professionnel Documents
Culture Documents
Disciplina EP2_MT
PONTIFCIA UNIVERSIDADE CATLICA DE MINAS GERAIS Instituto Politcnico/IPUC Curso de Engenharia Mecatrnica
Projeto 1: Acionamento CC
ETAPAS DE DESENVOLVIMENTO: 1. Carga mecnica: sistemas rotacionais, acoplamento rgidos e no rgidos e modelagem e simulao; 2. Mquina de corrente contnua: converso eletromecnica, mquina CC,
caracterstica torque versus velocidade e modelagem e simulao; 3. Fonte de alimentao / Conversores estticos: retificador controlado (tiristores), conversor indireto de tenso (diodos mais transistores) e modelagem e simulao; 4. Circuitos de comando e controle: comando dos transistores, controle em malha aberta e malha fechada modelagem e simulao e sistemas eletrnicos.
CRONOGRAMA DE DESENVOLVIMENTO E ACOMPANHAMENTO E AVALIAO: 1. Semana 1: Simulao utilizando o SystemVision; 2. Semana 2: Apresentao do sistema eletrnico Arduino e estudo e montagem dos mdulos; 3. Semana 3: Apresentao do programa de linguagem grfica LabView e do toolkit do Arduino; 4. Semana 4: Implementao do programa e primeiros testes; 5. Semana 5: testes e resultados obtidos 6. Semana 6: entrega relatrio final
Grupo 1: Marcos Vincius dos Santos Rocha Cristiano Athayde Braga Diniz Daniel de Oliveira Nogueira
1. Faa o tutorial Parametric and Statistical Analyses, disponvel neste documento e capture, explique, analise e comente as janelas dos circuitos e resultados obtidos; 2. Carga mecnica: descreva o modelo VHDL-AMS da carga mecnica utilizada; 3. Mquina de corrente contnua: descreva o modelo VHDL-MAS da mquina CC utilizada; 4. Fonte de alimentao / Conversores estticos: descreva o funcionamento da ponte H utilizada; 5. Salve o projeto com o seguinte nome: BeyondSPICE_Posio; 6. Troque a mquina CC, cuja sada posio, por uma mquina CC com sada em velocidade. Refaa o tutorial.
1. Descreva as principais caractersticas do sistema de desenvolvimento ARDUINO, tais como especificaes, pinos digitais de entrada/ sada, PWMs, entradas analgicas e memrias; 2. Descreva as principais caractersticas do Shield L298 de acionamento de mquinas CC Ponte H. Descreva o diagrama de blocos do integrado L298; 3. Descreva o princpio de funcionamento do motor CC e descreva as principais caractersticas do motor CC a ser utilizado no projeto; 4. Com base nos diagramas esquemticos do ARDUINO, do Shield L298 e do motor CC, desenhe um diagrama da sua aplicao; 5. Considerando como exemplos os programas a seguir para acionamento de um motor CC, descreva a lgica dos programas; 6. Monte o sistema do ARDUINO, Shield L298 e motor CC. Descarregue o programa no ARDUINO e anlise o seu funcionamento. 7. Com o osciloscpio, capture e anlise as principais formas de ondas do sistema; 8. Faa a redao do relatrio sobre este experimento.
int pin2 = 2; int pin3 = 3; void setup (){ pinMode(pin3,OUTPUT); pinMode(pin2,OUTPUT); } void loop(){ { digitalWrite(pin2,HIGH); digitalWrite(pin3,LOW); delay(2000); digitalWrite(pin3,HIGH); digitalWrite(pin2,LOW); delay(2000); } }
// IN4
int pin4 = 4; // enable da ponte B em high // Definindo variveis de controle de velocidade e sentido dos motores const int Motor1 = 6; //PWM motor 1 //const int DirMotor1 = 2;// Direo motor 1 //Definindo PWM como zero int pwm =0; void setup (){ pinMode(pin3,OUTPUT); 8
pinMode(pin2,OUTPUT); pinMode(pin4,OUTPUT); } void loop(){ { digitalWrite(pin4,HIGH); digitalWrite(pin2,LOW); //digitalWrite(pin3,LOW); analogWrite(Motor1, 90); delay(10000); //digitalWrite(pin3,HIGH); //digitalWrite(pin2,LOW); delay(2000); } } PROGRAMA 3 Partida Suave:
// IN4
// Definindo variveis de controle de velocidade e sentido dos motores const int Motor1 = 6; //PWM motor 1 //const int DirMotor1 = 2;// Direo motor 1 //Definindo PWM como zero
int pwm =0; int i = 0; void setup (){ pinMode(pin3,OUTPUT); pinMode(pin2,OUTPUT); pinMode(pin4,OUTPUT); } void loop(){ { i = i + 10; digitalWrite(pin4,HIGH); digitalWrite(pin2,LOW); //digitalWrite(pin3,LOW); analogWrite(Motor1, i); //delay(10000); //digitalWrite(pin3,HIGH); //digitalWrite(pin2,LOW); delay(1000); } }
int pin4 = 4; // enable da ponte B em high // Definindo variveis de controle de velocidade e sentido dos motores const int Motor1 = 6; //PWM motor 1 IN4 const int Motor2 = 3; //PWM motor 2 IN3 //Definindo PWM como zero int pwm =0; int i = 0; void setup (){ pinMode(pin4,OUTPUT); pinMode(Motor1, OUTPUT); pinMode(Motor2, OUTPUT); } void loop(){ { do{ i = i + 10; digitalWrite(pin4,HIGH); digitalWrite(Motor1,LOW); analogWrite(Motor2, i); delay(1000); }while(i<250); digitalWrite(pin4,HIGH); digitalWrite(Motor1,LOW); analogWrite(Motor2, i); 1
delay(3000); do{ i = i - 10; digitalWrite(pin4,HIGH); digitalWrite(Motor1,LOW); analogWrite(Motor2, i); delay(1000); }while(i>=0); do{ i = i + 10; digitalWrite(pin4,HIGH); digitalWrite(Motor2,LOW); analogWrite(Motor1, i); delay(1000); }while(i<250); digitalWrite(pin4,HIGH); digitalWrite(Motor2,LOW); analogWrite(Motor1, i); delay(3000); do{ i = i - 10; digitalWrite(pin4,HIGH); digitalWrite(Motor2,LOW); analogWrite(Motor1, i); delay(1000); }while(i>=0);
} }
Getting Started
Switch Modeling
Characteriztion
&
PCB/Library Setup
Read S-Parameters
In this tutorial you will use Parameter Sweeps, Sensitivity, Monte Carlo and Worst-Case analyses in SystemVision to analyze the performance of a simple H-Bridge Motor Controller. This example combines SPICE models for the electronics with VHDL-AMS models for the motor and loads. The ability to simulate these together is made possible by SystemVisions support for multiple industry standard languages. Combining this with
Parametric Analyses makes SystemVision a powerful tool for robust mixed-technology system design. Related Documents: For further information on the subjects discussed in this exercise, please refer to the SystemVision Help (Help > SystemVision Help). Open Beyond SPICE Project The first step for designing and simulating a design is to open a SystemVision project. If you have already gone through the initial steps of this tutorial and created this project, you should just open the project as follows: select File > Open > Project, browse to the location you specified when creating the project, and open the Beyond_Spice.dproj file. You can then continue this tutorial wherever you left off. When you open any of the pre-installed SystemVision tutorials (like the Beyond SPICE project) for the first time, you will follow these steps. 1. Select File > New 2. Click on the Project tab in the New dialog. 3. Click on the TutorialProjects folder under Categories. 4. Select the Parametric icon under Types. The name of the project, Beyond_Spice, will appear in the Name field. 5. Browse into a location where you would like to copy the Beyond_Spice project files. 6. Click OK. The Beyond_Spice project files are copied to the location you specified, and the project is then loaded into SystemVision and is ready to run.
To open this project in the future, select File > Open > Project, browse to the location you specified when creating the project, and open the Beyond_Spice.dproj file. H-bridge Motor Controller The design tb_hbridge_spice_ams, shown in Figure 1, is an H-bridge circuit combining SPICE level transistors with digital (VHDL) stimulus and VHDL-AMS drivers, DC motor and loads. Using SystemVision, the power of VHDL-AMS can be seamlessly integrated with existing SPICE models or subcircuits, to provide a multi-language, mixedtechnology system simulation.
Figure 1 - tb_hbridge_spice_ams schematic. Design Selection/Exploration 1. From the Simulation tab, click on TestBenches > tb_hbridge_spice_ams to open the schematic.
2. Explore some of the component models. For example, select the DC Motor Symbol and right-click > Push VHDL to view the VHDL-AMS model (repeat for other VHDL-AMS models as desired). 3. View some of the model properties that have been assigned to various symbols: Double-click on a VHDL-AMS or SPICE model to access model attributes . Simulating the Circuit (Nominal Simulation) First you will perform a nominal simulation to verify that the circuit is operating as intended. 1. Return to the schematic and from the menu, select Simulation > Simulate to invoke the Simulation Control window (there is also a simulation icon available on the icon bar). 2. In the Simulations tab enable the Time-Domain Analysis and set End Time to 1 sec e em Run colocar nominal. 3. Leave the settings in the Results tab as they are. The Results tab allows you to select the signals for viewing. The default selection for this design is Selected Waveforms, with which individual waveforms have been selected for analysis. 4. Click on the Multi-Run tab, and select Nominal for the Multi-Run Type, if necessary. The Multi-Run tab is for performing variations on component parameters. 5. No settings will be needed for the Advanced tab. The Advanced tab is used for advanced simulation settings (normally not required).
6. Click the OK button to run the simulation. Viewing Results The simulation results will automatically be loaded into the Waveform Analyzer upon completion of a successful simulation (if not, look in the Output Window for any error messages). Individual signals can be viewed by double-clicking with the left-mouse button or by using the drag-and-drop feature. You can also plot a signal from the schematic by selecting the desired signal and using right-click > Plot Waveform. 1. Use one of these methods to plot the digital command signals d_fcmd and d_rcmd indicated by the symbol next to the waveform name.
2. Next plot the motor current ydcmotor1/i. Notice the effect of the back-emf voltage as modeled in the motor equations, which levels out the current as the motor spins. 3. Plot the waveform position. This is the position of the motor shaft over time. Notice that the motor does not return to its original position due to the short length of the reverse command signal. 4. Verify that the waveforms match those shown in Figure 2. 5. Bring up a new graph window by selecting File > New. This window will be used shortly.
dada a partida no motor em aproximadamente 0,2s para o sentido positivo (dc_fcmd). Inicialmente tem-se um pico devido inercia do indutor. O motor permanece neste sentido durante 0,2 segundos. O sentido inverso est defasado de 0,2 segundo do sentido direto, entretanto o sentido reverso tem durao de 0,1 segundo. Isso implica que ele no consegue retornar posio inicial permanecento na metade do caminho.
Parameter Sweeps Parameter sweeps are useful for automatically varying specific circuit parameters and running simulations. Setup Sweeps You will next examine the effects of the component parameters on the motor position. You will do this by sweeping a parameter (motor winding resistance) over a specified range. 1. Return to the tb_hbridge_spice_ams schematic and from the menu, select Simulation > Simulate to invoke the Simulation Control window 2. Select the Multi-Run tab. 3. Change the Multi-Run Type to Sweep Values. 4. Click on the Parameter Edit button to invoke the Sweep Parameter dialog. 5. Click on the browse button () to invoke the Select Parameter dialog. 6. Select ydcmotor1.r_wind and click OK. 2
7. Set the Sweep Type to List and the Sweep List to 50.0 100.0 200.0. 8. Click the Replace current sweep parameters checkbox. This will remove any previous sweep commands. The dialog should appear similar to that shown in Figure 3.
Figure 3 - Sweep parameter dialog box. 9. Click OK in the Sweep Parameter dialog. 10. Click OK in the Simulation Control dialog. 11. When the simulation runs are complete, plot the digital command signals (d_fcmd and d_rcmd) along with the motor position as shown in Figure 4. Note the sweep values shown are annotations that were added manually.
Performing Measurements As expected, these results show that the winding resistance has a significant effect on the final angular position. SystemVision allows you to quantify relationships between system performance and component parameters by performing measurements on the simulation results. In this section you will re-run the previous analysis with additional sweep values. The extra data that is generated will allow you to create correlation plots. 1. Re-invoke the Simulation Control dialog and click on the Multi-Run tab. 2. Click the Parameter Edit button and modify the existing fields as follows: Parameter: E(ydcmotor1,r_wind) (unchanged from previous analysis) Sweep Type: Increment Sweep Start: 10.0
Sweep Increment: 10.0 3. Click the Replace current sweep parameters checkbox. 4. Click OK in the Sweep Parameter dialog. 5. Click OK in the Simulation Control dialog. 6. When the simulation runs complete, plot the position waveform into a new graph (select File > New to create a new graph window). 7. Click the Add Cursor button twice to place two cursors (C1 and C2) at locations
and fill in the dialog as shown in Figure 6 to measurement results to the graph.
Figure 6 - Measurement Tool for Risetime Measurement. 9. Click Apply. The measurements are annotated to the graph.
The measurement can be moved from one waveform to another by clicking on the handle at either the top or bottom of the result markers, and holding and dragging to another waveform. All measurement results can be viewed by rightclicking with the cursor over the measurement and selecting Measurement Results. 10. In the Measurement Tool, select the Plot New Waveform option under Measurement Results and re-apply to create a plot of Risetime vs. motor winding resistance. 11. In necessary, click Continue in the Open New Window dialog.
You now have a waveform that displays Risetime as a function of motor winding resistance. 12. Bring back up the graph window with the waveforms shown in Figure 5. 13. Reposition the cursors so that they enclose the falling edges of the swept waveforms. 14. In the Measurement Tool, select Falltime as the Measurement. 15. Be sure to specify that the measurement is to be performed between the cursors. 16. Re-apply to create a plot of Falltime vs. motor winding resistance. 17. The results are shown in Figure 7. The waveforms were super-imposed by copying and pasting (or dragging) a waveform from one graph window to another graph window. The individual measurement points can be displayed by selecting the waveform name (in the signal pane) and selecting right-click > Data Point > Symbols.
Figure 7 clearly shows the effect the value the motor winding resistance has on the shaft position rise- and fall-times when used with the H-bridge driver circuit. This is a simple example of how SystemVision can be used to turn simulation data into engineering information that can be used to help improve a system design. Note that rise- and fall-times are measured relative to the minimum and maximum value of each individual waveform, which explains why fluctuations such as those shown above are possible (as opposed to a continuous increasing or decreasing pattern). 18. Exit out of the Waveform Analyzer. Do not save the waveforms.
19. Descrio dos cdigos em VHDL: 19.1. Descrio do bloco clock pulse: No SystemVision, o Bloco Clock Pulse tem a seguinte representao grfica: 3
Abaixo segue o cdigo em VHDL que descreve as funcionalidades do bloco Clock Pulse. O smbolo \* *\ representa delimitao de comentrios dos integrantes deste relatrio. library IEEE; use IEEE.std_logic_1164.all; \* Determina qual biblioteca dever ser utilizada. Contm a maioria dos comandos utilizados na linguagem VHDL*\ entity clock_pulse is \* a parte principal do projeto, a interface do Sistema que descreve as entradas e sadas. Neste caso a entrada o bloco clock_pulse. generic (initial_delay : time; -- Delay Time [Sec] width period : time; -- pulse width [Sec] : time); -- Period [Sec]
\* generic : Declarado na entity para definir constantes. Neste caso, as constantes so width e period, que so dados de entrada a serem determinados pelo usurio. *\ port (out_state : out std_logic); end entity clock_pulse; architecture ideal of clock_pulse is 3
signal out_signal : std_logic; constant off_time : time := period - width; \* generic : Operao para determinar a constante de tempo *\ \* -----------------------------------------------------------------------------------------------*\ Begin \* Inicia o processo de criao do sinal de sada do clock.*\ -- purpose: Creates events on signal "out_signal" -- type : combinational -- inputs : -- outputs: out_signal CreateEvent : process Begin \* Incio do processo de repetio que dar origem ao clock pulse .*\ out_signal <= '0'; \* Inicia o sinal de sada em nvel lgico 0.*\ wait for initial_delay; \* Chama initial_delay, que gastar tempo.*\ loop \* Inicia o loop que determina a configurao do sinal de clock.*\ out_signal <= '1'; \* Manda o clock do nvel lgico 0 para 1.*\ wait for width; \* Determina o quanto o sinal de sada permanece em 1.*\ out_signal <= '0'; \* Manda o clock do nvel lgico 1 para 0.*\ wait for off_time; \* Determina o quanto o sinal de sada permanece em 0.*\ end loop; \* Finaliza o processo de repetio que cria o loop.*\ 3
end process CreateEvent; out_state <= out_signal; end architecture ideal; \* Finaliza a rotina que determina as caractersticas do clock pulse*\
* Model 2N3904 \* Determina qual transistor dever ser utilizado na simulao.*\ .MODEL 2N3904 NPN ( IS=11.3161F + BF=174.8327 NF=1.017 VAF=102.2265 IKF=64.3415M + ISE=59.1356F NE=1.5412 BR=23.1889 NR=1.024 + VAR=12.7191 IKR=0.1342 ISC=13.4919P NC=1.5092 + RB=5 IRB=8.8078M RBM=2.2344 RE=0.4831 + RC=1.3075 CJE=6.622P VJE=0.5954 MJE=0.2753 + TF=75.9047P XTF=3.5 ITF=11.5542M CJC=3.42P + VJC=0.5 MJC=0.2024 TR=10.7163N EG=1.11 ) \* Este cdigo determina as caractersticas intrnsecas do transistor escolhido para a simulao e em cada ponto descreve um parmetro caracterstico dele*\
- Use proposed IEEE natures and packages library IEEE; \*Bibliotecapadro que contm comandos de execuo para linguagem VHDL */ use IEEE.mechanical_systems.all; \*Permite utilizar definies e comandos que no esto na biblioteca padro. Neste caso usa uma biblioteca especifica para comandos ou definies mecnicas do motor DC */
use IEEE.electrical_systems.all; \*Permite utilizar definies e comandos que no esto na biblioteca padro. Neste caso usa uma biblioteca especifica para comandos ou definies elticas do motor DC */
\*Determina o o ngulo inicial do eixo do motor */ r_wind : resistance; -- Motor winding resistance [Ohm]
\*Determina o momento de inrcia da carga do motor dc */ port (terminal p1, p2 : electrical; terminal shaft_rot : rotational); end entity DCMotor_r; -------------------------------------------------------------------------------- Basic Architecture -- Motor equations: V = Kt*W + I*Rwind + L*dI/dt -T = -Kt*I + D*W + J*dW/dt 3
------------------------------------------------------------------------------architecture basic of DCMotor_r is quantity v across i through p1 to p2; quantity theta across torq through shaft_rot to rotational_ref; begin if domain = quiescent_domain and pos_ic /= real'low use theta == pos_ic; v == kt*theta'dot + i*r_wind + l*i'dot; \* Observa o valor da posio angular do eixo e partir dele calcula a velocidade angular *\ else torq == -1.0*kt*i + d*theta'dot + j*theta'dot'dot; \* Calcula o valor do torque a partir da variao do ngulo do eixo *\
v == kt*theta'dot + i*r_wind + l*i'dot; \* Calcula o valor da velocidade a partir da variao do ngulo do eixo *\
19.4.Descrio do cdigo VHDL que descreve o bloco do momento de inrcia Figura 08: Bloco da Carga (momento de inrcia)
-- Use proposed IEEE natures and packages library IEEE; use IEEE.mechanical_systems.all; entity inertia_r is generic (j : moment_inertia); -- Value of moment of inertia [Kg*m^2] \* Determina o valor do momento de inrcia de massa (j) da carga acoplada ao eixo*\ port (terminal rot1 : rotational); end entity inertia_r; -------------------------------------------------------------------------------- Ideal architecture -- Tload = J*dW/dt ------------------------------------------------------------------------------architecture ideal of inertia_r is
quantity theta across torq through rot1 to rotational_ref; begin torq == j * theta'dot'dot; \* Calcula o valor do torque a partir da variao do ngulo do eixo e do momento de inrcia da carga *\ end architecture ideal; ------------------------------------------------------------------------------- Copyright (c) 2003 Mentor Graphics Corporation
19.5. Descrio do cdigo que modela o fim de curso rotacional: library IEEE; use IEEE.MATH_REAL.all; use IEEE.MECHANICAL_SYSTEMS.all; entity stop_r is generic ( k_stop : stiffness; \*Constante de rigidez de parada do motor*\ \*Constante de amortecimento de parada do
port ( terminal ang1, ang2 : rotational); end entity stop_r; architecture ideal of stop_r is quantity velocity : velocity; quantity ang across trq through ang1 to ang2; begin velocity == ang'dot; \*Define a velocidade angular em funo da derivada da posio angular no tempo *\ if ang'above(ang_max) use trq == k_stop * (ang - ang_max) + (damp_stop * velocity); ; \*Calcula trq em funo da velocidade, do amortecimento de parada, da diferena entre a posio angular mxima e a atual e da rigidez de parada *\ elsif ang'above(ang_min) use trq == 0.0; else trq == k_stop * (ang - ang_min) + (damp_stop * velocity); \*Calcula trq em funo da velocidade, do amortecimento de parada, da diferena entre a posio angular mnima e a atual e da rigidez de parada *\ end use; break on ang'above(ang_min), ang'above(ang_max);
end architecture ideal; -------------------------------------------------------------------------------- Copyright (c) 2003 Mentor Graphics Corporation
Simulao para velocidade angular. Substituiu-se o motor cujo controle era feito para posicionamento pelo de controle de velocidade, e por conseguinte substituiu-se a carga correspondente. Component--> atuadores e motores motor dc revoluo Copiar e posicionar sobre a rea de trabalho sem retirar o motor cujo controle foi de posio.
Simulao:
A curva em branco representa a velocidade. As curvas em azul representam o qual sentido da rotao (direto ou inverso de acordo com conveno ) e a ltima curva representa a corrente.
Simulao paramtrica 4