5. Petla for, przebiegi czasowe, struktury, wzory.pdf

(913 KB) Pobierz
Microsoft Word - PW 5. Petla for, przebiegi czasowe, struktury, wzory.doc
prof. dr hab. Krzysztof Jemielniak
PRZYRZĄDY
WIRTUALNE
Część 5
Pętla for, przebiegi
czasowe, struktury,
wzory
http://www.cim.pw.edu.pl/labview
k.jemielniak@wip.pw.edu.pl
http://www.cim.pw.edu.pl/kjemiel
ST 149, tel. 660 8656
Politechnika Warszawska, Wydział Inżynierii Produkcji, Instytut Technologii Maszyn
Warszawa, 2003
PRZYRZĄDY
WIRTUALNE
122216445.040.png 122216445.041.png
 
122216445.042.png 122216445.001.png
Pętla For
Wykonuje diagram wewnątrz
pętli zadaną liczbę razy
Terminal zadanej liczby przebiegów
(wejście numeryczne)
Licznik iteracji (wyjście numeryczne)
podaje liczbę wykonanych iteracji,
poczynając od 0 (tu 0..9)
Można dodać rejestry przesuwne, jeśli
potrzebne jest przekazywanie wartości
jednej iteracji do następnej
Politechnika Warszawska, Wydział Inżynierii Produkcji, Instytut Technologii Maszyn
For Loops
A For Loop, shown at left, executes a subdiagram a set number of times. The value in the count terminal (an
input terminal) represented by the N, indicates how many times to repeat the subdiagram. The iteration
terminal (an output terminal), shown at left, contains the number of completed iterations. The iteration count
always starts at zero. During the first iteration, the iteration terminal returns 0.
You can add shift registers if you need to retain values from one iteration to the next.
Difference between While Loops and For Loops:
While Loops run until a condition is met.
For Loops run a predetermined number of times.
122216445.002.png 122216445.003.png
 
122216445.004.png 122216445.005.png 122216445.006.png 122216445.007.png
Węzeł sprzężenia zwrotnego (Feedback Node)
45
Węzeł zawiera dane z
poprzedniej iteracji!
45
36
Politechnika Warszawska, Wydział Inżynierii Produkcji, Instytut Technologii Maszyn
The Feedback Node, shown at left, appears automatically only in a For Loop or While Loop when you wire
the output of a subVI, function, or group of subVIs and functions to the input of that same VI, function, or
group. Like a shift register, the Feedback Node stores data when the loop completes an iteration, sends that
value to the next iteration of the loop, and transfers any data type. Use the Feedback Node to avoid
unnecessarily long wires in loops. The Feedback Node arrow indicates in which direction the data flows
along the wire.
You also can select the Feedback Node and place it only inside a For Loop or While Loop. If you place the
Feedback Node on the wire before you branch the wire that connects the data to the tunnel, the Feedback
Node passes each value to the tunnel. If you place the Feedback Node on the wire after you branch the wire
that connects data to the tunnel, the Feedback Node passes each value back to the input of the VI or function
and then passes the last value to the tunnel.
122216445.008.png 122216445.009.png
 
122216445.010.png 122216445.011.png 122216445.012.png 122216445.013.png 122216445.014.png 122216445.015.png
Przebiegi czasowe (Waveform Charts)
WaveformChart –to specjalny
rodzaj wykresu służący do
wyświetlania przebiegu wartości
w czasie
Politechnika Warszawska, Wydział Inżynierii Produkcji, Instytut Technologii Maszyn
The waveform chart is a special numeric indicator that displays one or more plots. The waveform chart is
located on the Controls»Graph Indicators palette. Waveform charts can display single or multiple plots.
The following front panel shows an example of a multi-plot waveform chart.
You can change the min and max values of either the x or y axis by double clicking on the value with the
labeling tool and typing the new value. Similarly, you can change the label of the axis. You can also right
click the plot legend and change the style, shape, and color of the trace that is displayed on the chart.
Łączenie przewodów do przebiegów czasowych
Przebiegi pojedyncze
Przebiegi wielu zmiennych
Politechnika Warszawska, Wydział Inżynierii Produkcji, Instytut Technologii Maszyn
You can wire a scalar output directly to a waveform chart to display one plot. To display multiple plots on
one chart, use the Merge Signals function found in the Functions >> Signal Manipulation palette. The
Merge Signal function bundles multiple outputs to plot on the waveform chart. To add more plots, use the
Positioning tool to resize the Merge Signal function.
The context help contains very good information on how the different ways to wire data into charts.
122216445.016.png 122216445.017.png
 
122216445.018.png 122216445.019.png 122216445.020.png 122216445.021.png 122216445.022.png
 
122216445.023.png 122216445.024.png 122216445.025.png 122216445.026.png 122216445.027.png 122216445.028.png 122216445.029.png
Charts – przykłady
Politechnika Warszawska, Wydział Inżynierii Produkcji, Instytut Technologii Maszyn
This VI illustrates the different kinds of charts and the data types that they can accept. Charts can accept a
single point at a time or multiple points at a time. Also, charts can display multiple overlayed or stacked
plots. To change between strip, scope, and sweep update modes, right click on the chart and select
Advanced->Update Mode.
Ćwiczenie: Przebieg ruchomej średniej.VI
Zmodyfikuj Ruchoma średnia.vi tak, by widoczny by ł przebieg tej
średniej w czasie. Zapisz jako Przebieg ruchomej średniej.vi
Politechnika Warszawska, Wydział Inżynierii Produkcji, Instytut Technologii Maszyn
122216445.030.png 122216445.031.png
 
122216445.032.png 122216445.033.png 122216445.034.png
 
122216445.035.png 122216445.036.png 122216445.037.png 122216445.038.png 122216445.039.png
Zgłoś jeśli naruszono regulamin