Embodiment
The present invention is further detailed explanation below in conjunction with drawings and Examples.
As shown in Figure 2, the experimental apparatus of this Automatic Control Theory mainly comprises a PC, mainly comprises the functional module of LabView, is used for and the function that has played virtual oscilloscope and virtual signal generator after primary module is connected; The identical little module of one set constructor is used to insert required components and parts and can constitutes various links; A primary module mainly comprises Switching Power Supply, AD/DA module and serial communication modular; Wherein, the functional module of LabView produces source signal and sends to primary module by serial communication modular, and become simulating signal by the AD/DA module converts, experimental box by constituting after amplifying by the identical little module of a set constructor, the signal of output becomes digital signal by the AD/DA module converts, returns PC by serial communication modular again.
The principle of work of system:
Utilized the virtual instrument concept of LabView software in this system, utilize the functional module of LabView, produce source signal, promptly be equivalent to the effect of signal generator, by serial ports the signal that signal generator produces is sent to slave computer then, promptly the Single Chip Microcomputer (SCM) system of being made up of Cygnal F320 receives this signal, because the signal that PC sends over is a data-signal, therefore 12 D/A conversions that carry by Cygnal F320, convert simulating signal to, case (can overlap various links with circuit module in the experimental box by experiment after amplifying, comprise inertial element, proportional component, integral element, differentiation element, delay link and single order leading, second order vibration etc., and as can be known from the theory of principle of automatic control, the system of any complexity all can be made up of these basic modules, just the control system of any complexity is simulated after all can being overlapped by these circuit modules), signal is by after the system, the A/D conversion that the signal (being response signal) of output carries through Cygnal F320, be back to PC by serial ports again, at host computer, we utilize LabView to develop oscillograph, oscillograph (is that pumping signal compares with signal and the source signal that receives, can carry out time-domain analysis or frequency analysis easily, PC has the very strong data processing and the function of analysis, can improve the efficient and the effect of experiment greatly; Need not open the PC mainframe box during experiment, very easy to use; Simultaneously, we utilize LabView to carry at host computer control and ICP/IP protocol have also been developed remote communication module, and long-range user needs only the authentication by system, but can carry out the experiment of remote automatic control principle by the Internet net.
In addition, when carrying out system compensation, we can add corresponding correcting circuit link in circuit module, promptly proofread and correct firmly, also can add corresponding module in upper computer software, with hardware circuit, implement " soft " of system proofreaied and correct; If remove host computer, the experimental box part also can be used for traditional principle of automatic control experiment, promptly insert real signal generator, by experiment after case (system that the promptly simulated) output, insert real oscillograph again, response signal (output) can be shown, thereby carry out corresponding time domain or frequency-domain analysis; If remove slave computer, the upper computer software part also can carry out testing the experiment of various principle of automatic control by software simulation.
The characteristics of system:
Native system has been given full play to the advantage of PC, finishes collection of experiment data, storage and computing by PC, just experimental result and the theoretical folding value of dividing can be compared when experiment, has improved conventional efficient.Owing to be under the Windows environment, to use making software; man-machine interface is very friendly, and is easy and simple to handle, also comprised experimental projects such as root locus drafting that traditional means of experiment can't finish, Bode diagram drafting simultaneously; and can be used with softwares such as teaching coursewares, strengthened experiment effect greatly.This experimental provision also has the experimental program flexible configuration, is convenient to expansion and carries out advantages such as other experiments.Upper and lower computer all can alone become system, or realizes soft simulation or die plan, also can be used as other purposes at PC when not doing experiment, thereby has in fact saved equipment investment.
Automatic Control Theory or control engineering test employed equipment by PC, control chamber and printer (optional) automatically and form, high-performance single-chip microcomputer and virtual instrument technique have fully been used, feature richness, easy and simple to handle, beautiful human computer interface allow the student reach the purpose of principle of automatic control requirement of experiment in the shortest class hour.
PC as host computer adopts virtual instrument technique can play the effect of signal generation, measurement, demonstration, system's control and data processing according to different experiments respectively.Native system can also carry out software emulation, can under the situation that is not connected to external circuit, carry out software emulation to each experiment, and the function of simulation hardware has also been expanded in this emulation greatly, the user can set up model by direct input transport function, and PC can be made system's time domain, frequency domain characteristic figure fast according to this model.In addition, but the grabgraf function rapid saving experimental data that this experimental system provides has not only been saved valuable time in classroom, also is convenient to the student and does the experiment report.The powerful accurate function of native system can also be used for the dynamic design of actual robot control system(RCS) except that being used for experiment, can be used as the student and control the design software that Course Exercise is easy to learn and use automatically.
This Experiment on Auto-Control system has utilized and has utilized the TCP/IP technology to realize remote data acquisition among the LabView, can realize the tele-experimentation of Automatic Control Theory.This is extremely helpful to remote teaching from now on.
Experimental box has comprised a plurality of computing amplification modules, by allotment electric capacity, resistance, switch, can constitute the controlled device of multifrequency nature.High performance Cygnal mixed signal ISP FLASH microcontroller has been adopted in experimental box inside, and integrated A/D, D/A translation function adopt RS232 serial ports and PC to communicate.
The design of whole hardware
The hybrid simulation hardware components that designs and produces for the applicant as shown in Figure 3.Comprise a primary module, some little modules, multiple inside is packaged with the joint of components and parts such as resistance capacitance, and the double end audio frequency wiring used of the colour signal wiring that connects between the module and module for power supply.Primary module adopts the 220V mains-supplied, carries out the AC/DC conversion by switch power module.Primary module one side is drawn three lines, and blue line is the DA output line, and red line is an AD sampling incoming line, and black line is used for each little module is powered.Because little module adopts the OP07 operational amplifier, power supply needs+5V ,-5V, GND, adopt the encapsulation of audio frequency head can to accomplish that just in time single line exports three voltages simultaneously, and avoided three lines to export the situation of easy wiring error.
Fig. 4 gives an example for line, and two little modules are wherein arranged, and the little module in the left side is configured to an inertial element, and the little module in the right is configured to a phase inverter, be used for less than 0 conversion of signals for greater than 0 signal.The DA signal of primary module is connected to the input end of left side little module, the AD line is connected to the output end of the right little module, power lead is connected to the powerin end of left side little module, also the output termination of left side little module to be gone into the input end on the right then, the powerout on the left side be met the powerin on the right.Like this, the hybrid simulation hardware of an inertial element has just been put up.
1.1 main module circuit design
The hardware circuit of slave computer main control chip as shown in Figure 5.
Main devices has three: AS1117 chip, SP3223E level transferring chip and C8051F330 single-chip microcomputer.The AS1117 chip with transformer input+the 5V voltage transitions is+3.3V, as the power supply of C8051F330 single-chip microcomputer.SP3223E is intelligent RS-232 transceiver, can carry out signal between RS232 and Transistor-Transistor Logic level under 3V drives and transmit.
The C8051F330 single-chip microcomputer is to be produced by the U.S. Cygnal company that general headquarters are positioned at Texas, USA.This Cygnal company has upgraded former 51 single chip computer architectures, has designed the CIP-51 kernel with autonomous property right, makes 51 single-chip microcomputers shine new vitality, and its travelling speed is up to per second 25MIPS.
Cygnal C8051F series monolithic is integrated mixed signal SOC (system on a chip) SOC (System on Chip), have and MCS-51 kernel and the compatible fully microcontroller of instruction set, except digital peripherals parts with standard 8051, also integrated analog component and other digital peripherals and functional part commonly used in the data acquistion and control system in the sheet.
This instrument has adopted C8051F330, and this chip has numerous advantages of Cygnal C8051F series monolithic, integrated ADC and the DAC of 10 200ksps, stable performance.We are with his AD sample effect with after AD chip 0809 makes comparisons, the AD that finds C8051F330 is highly stable, make 40 to 50 times effect as long as the sample mean of doing 3 to 4 times just can reach 0809, and improve two than 0809 precision, sampling rate is also up to 200k.More valuable is that price is very cheap.
Among the last figure, POWERin inserts outside+5V direct supply, after AS1117 (voltage regulator) regulates, output+3.3V voltage, to single-chip microcomputer power supply .C1, C2 is a filter capacitor, and R1 is to show single-chip microcomputer normal power supply state for the circuit of regulating resistance .+3.3V+R2RLED+CND composition; The principle of work of C8051F330 reaches respectively forms the explanatory note of face as follows: in the JTAG module, 1 pin connects+the 3.3V power supply, is its operating voltage, 2,3,9 pin ground connection, and 4 pins link to each other with the P2.0/C20 mouth of single-chip microcomputer C8051F330, use for procedure simulation; 6 pins link to each other with the P2.0/C20 mouth of single-chip microcomputer C8051F330 after connecing R6 resistance, download for program and use; 5,7 pins and RESET key, capacitor C 5 and resistance R 4 etc. has been formed reset circuit, and resetting with .SP3223E for Single Chip Microcomputer (SCM) system is intelligent RS-232 transceiver, can carry out signal between RS232 and Transistor-Transistor Logic level under 3V drives and transmit.Among the JP4, the P0.4 of 1,3 pin and single-chip microcomputer C8051F330, P0.5 links to each other, and 13,15 pins with SP3223E link to each other simultaneously, 5,7 pins and P1.1, the P1.1 of P1.2 and C8051F330, P1.2 links to each other, and 12,10 pins with SP3223E link to each other simultaneously; 2,4,6,8 pins of JP4 link to each other with 13,15,12,10 of SP3223 chip respectively.Signal flow is: the signal generator of host computer virtual instrument sends signal (pumping signal or input signal), be sent to down bit single-chip system through serial ports, slave computer is after the D/A conversion, signal is delivered to experimental box by P0.1, flow through after the experimental box, after delivering to the built-in A/D of single-chip microcomputer conversion by single-chip microcomputer P0.1 mouth, deliver to by serial ports in the virtual instrument of host computer.
Fig. 6 is a native system program of lower computer process flow diagram, and the baud rate of serial communication is 19200, and the every 5ms of host computer sends out 10 DA values to slave computer, carries out the DA conversion after slave computer is accepted, and then does 50 sample means and reduces interference, again mean value is sent back to host computer.This external program has begun to do the mutual inspection of upper and lower computer, and the communication of guaranteeing on the one hand is correct, has played the effect of simple and easy hardware lock on the other hand.
1.2 little module circuit design
Control system is interconnected by various components to be formed, and used unit, parts and the function of different control system is inequality, as machinery, electronics, hydraulic pressure, air pressure with photoelectricity etc.For the dynamic perfromance of analytic system, must reasonably classify to the unit, the parts that vary.Character by transport function knows how not different the physical arrangement of argument, parts is, as long as its transport function is identical, dynamic perfromance is just inevitable identical.According to transport function whether identical unit of classifying, parts be called link, and forming control system and representative basic link be exactly typical link.Below respectively several typical links and transport function thereof are carried out.Attempt to find out their similitude, for its hardware design provides thinking.
(1) proportional component (claiming amplifying element again), all output quantities are directly proportional with input quantity, export undistorted again also the delay and the link of reflection input pari passu is called proportional component (as Fig. 7).
Its transport function is
The lever of nonelastic distortion, the electron-amplifier of disregarding non-linear and inertia, tech-generator etc. all can be thought proportional component.
(2) inertial element claims the cycle link again, generally comprises an energy-storage travelling wave tube and a dissipative cell (as Fig. 8).Because of containing energy-storage travelling wave tube, so can not reappear immediately to the input signal of sudden change.
Its transport function is
Wherein
Can be considered inertial element as single appearance liquid level control system, electrothermal furnace furnace temperature with change in voltage system and Dan Rongchong blow-off system.
(3) integral element, characteristics are that output quantity is an input quantity to the accumulation of time, and output amplitude is linear growth, in the system all have store or the element of accumulation characteristic all has the characteristic (as Fig. 9) of integral element.
Its transport function is
T=RC wherein
Systems such as the electronic integrator in the actual engineering, tank liquid level, oven temperature, motor speed all belong to integral element.
(4) differentiation element, the differential of the output reflection input of differentiation element, as when being input as unit-step function, output is exactly impulse function, and this is impossible in practice, so the impossible individualism of differentiation element, and it is simultaneous with other link.Differentiation element claims differentiation element again, is divided into two kinds of citation forms, promptly theoretical differentiation element and actual differentiation element (as Figure 10).
Its transport function is G (s)=Ts, wherein T=RC
2
(5) ratio+differentiation element also claims the PD link
Its transport function is G (s)=K (Ts+1), wherein
(6) proportional+integral link also claims the PI link
Its transport function is
Wherein
Can know by analysis these six links, each link all has and only has an operational amplifier, and they have similarity on circuit, thereby can consider to adopt unified modular design, reach the configuration of different links by different components and parts wiring.In practical design, we have adopted following PCB schematic diagram, as shown in figure 13.
Operational amplifier adopts paster OP07, and the power supply between the module adopts previous module to give the mode of a back module for power supply.This mode has requirement to power supply, in case the power supply that a module load increases will influence other several modules is wherein arranged, causes having disturbing entering, so adopt the electric capacity of one 10 microfarad and one 0.1 microfarad to carry out filtering here.
Advantage by above combination is that the system of any complexity can be formed by above simple module combinations.Therefore native system can carry out the simulation and analysis of control performance to complication system.
1.3 the realization of upper computer software
Upper computer software is mainly finished the generation of virtual signal, with the serial communication (comprising detection and correction etc.) of slave computer, virtual oscilloscope and data processing, functions such as telecommunication.
1.3.1 the realization of detection and calibration function
In this experimental apparatus, System self-test carries out as follows: host computer sends hardware detection word " U " by serial ports to slave computer, with the double host computer that is sent back to of the hardware detection word that receives, whether what host computer was relatively received character string was that " UU " judges whether slave computer connects correctly after slave computer was accepted.If acceptance error then jump out message box, " communication failure or serial ports are made mistakes, and please the scrutiny system connect in prompting.Detect once more by " determining ".As by " cancellation ", make mistakes for avoiding system, the relevant experiment content of forbidding hardware.Correctly just enter the system compensation subprogram if receive.
The system compensation subprogram before this must be earlier DA and AD short circuit, and our purpose is also to be 0 input in the time of will allowing 0 output of DA pass to AD, and the full scale output of DA also is full scale input when passing to AD.So, send out 10 0 earlier and export to DA, the value that collects is done on average, this mean value is composed to global variable and is used for doing system's zeroing correction, then sends out 10 255 again and gives DA, and the AD value of receiving is done on average, this mean value is also composed to global variable, is used for doing system's ratio adjustment.The global variable hardware flags will be changed to 0 in addition, expression has correctly connected lower computer hardware.
Zeroing of concrete system and ratio adjustment at first need to prove, because AD is 10, thereby each AD sampled value slave computer needs to deliver to host computer by the serial ports asynchronous communication at twice, thereby the serial ports that at every turn circulates is to read two bytes.The array that sampling is obtained deducts system's zeroing value then, has so just removed the situation on floating ground, then multiply by system's ratio adjustment value again, has just finished zeroing and ratio adjustment.
The mathematical principle of proofreading and correct: host computer sends 10 0 and 10 255 step signal of forming to the DA of slave computer, then AD is obtained signal (being made as f (t)) and analyzes, and finds to have the phenomenon of floating ground and signal span deficiency.Can calculate zeroing value a and signal span b this moment, then the signal f (t) that receives deducted zeroing value a, multiply by coefficient c/b again, can obtain reasonable calibration result.
What also require emphasis any is exactly to allow slave computer with the double host computer that is uploaded to of hardware detection word why.This is because if the TXD and the RXD of short circuit PC serial ports, though do not connect hardware circuit, software can be received U equally, like this erroneous judgement will be arranged, but host computer is if slave computer is sent out U twice, this moment TXD and the RXD host computer procedure of can not out-tricking by simple short circuit PC serial ports.Slave computer test section program is as follows.
…
While (RI0==0); // accept the hardware detection word of host computer
RI0=0;
check=SBUF0;
SBUF0=check; // the hardware detection word of receiving is sent back to host computer
while(TI0==0);
TI0=0;
SBUF0=check; // send out once again.Also can be in the time of can avoiding the communication of serial ports unit by situation about detecting
while(TI0==0);
TI0=0;
…
1.3.2 time-domain analysis Module Design
In general, we design control system at a certain class input signal.Some system, as room temperature system or Water Level Regulating System, its input signal is room temperature or the height of water level that requires, this is that the deviser is known.But in most of the cases, the input signal of control system changes in unpredictable mode.For example, in Pantser Rups Tegen Luchtdoelen, the position of enemy plane and speed can't be expected, make the input signal of gun control system have stochastic pattern, thereby have brought difficulty for the performance requirement of the system that stipulates and analysis and design.For the ease of analyzing and designing, also compare simultaneously for the ease of performance to various control system, we need suppose the input function form that some are basic, are referred to as typical input signal.So-called typical input signal is the input signal form that often runs into according to system, more Utopian basic input functions in addition on mathematical description.Type signal commonly used has unit step signal, slope (speed) signal, unit acceleration (para-curve) signal.
For time-domain analysis, we need as required type signal to be generated the array form on host computer, again it is sent to slave computer with fixed frequency one by one from serial ports, and the result that slave computer is sampled does corresponding record, then two groups of data are compared display analysis, and provide hold function in the mode of figure.
Step signal, pulse signal, ramp signal and acceleration signal are the generation module of four kinds of type signals, all are to produce signal with the form of array.Signal shows and preserves module, adopts the jpeg form to preserve at present, and handle preserving mistake.
The hardware system of experiment is a second-order system, and the unit of X-axis is sampling interval, is 5ms at present, thereby can analyze rise time, time delay, time to peak, adjusting time and overshoot easily on time domain.Host computer produces a step signal as signal generator, and this step signal is sent to slave computer from serial ports through behind proportional zoom of amplitude, and slave computer carries out the DA conversion one by one, and obtains and be returned to host computer after the AD value of response and show.The precision and the effect of this experimental system are very desirable as can be seen from observed figure.
1.3.3 frequency-domain analysis Module Design
Signal in the control system can be expressed as the synthetic of different frequency sinusoidal signal.The performance of system responses under the frequency characteristic reflection sinusoidal signal effect of control system.The classical way of applying frequency characteristic research linear system is called frequency domain analysis.Though our purpose is the research system, for the work of design frequency-domain analysis module, the certain signal Processing of more most work, particularly discrete digital Signal Processing.
The frequency domain characteristic that obtains system can adopt several different methods, and generally commonly used is by obtaining system transter, substituting s with j ω again and promptly get frequency characteristic.Native system is a hybrid simulation system, and what host computer was handled is discrete signal, thereby it seems that from host computer to be processed is a discrete system.And we can gather response signal simultaneously by to system's input signal in discrete signal recovery acquisition system, and two groups of signals are carried out fast fourier transform respectively, and the plural array that obtains has promptly been expressed the frequency characteristic of system.
As long as the pumping signal of input has each frequency component, can adopt the individual pulse signal in theory as excitation.But in real system,, add that PC can't compare accurately system by a signals sampling value to find the solution, thereby we adopt and comprise the white noise sequence of various frequency components as pumping signal because desirable pulse signal is unavailable.
Host computer has produced a white noise sequence, passes to slave computer with fixed frequency one by one by serial ports, and slave computer receives that whenever the point of no symbol 8 bit representations just carries out the DA conversion, has so just generated the white noise signal of response.The white noise signal that generates is input to the hardware input end of hybrid simulation, output terminal in hybrid simulation produces white noise by the response signal behind the hardware system simultaneously, this signal is caught with fixing sampling rate by the AD converter of slave computer, transfer back to host computer by serial ports simultaneously, so just obtained white noise corresponding sequence corresponding to the white noise sequence of front.
PC then is multiplied by window function to white noise corresponding sequence and white noise sequence respectively.The purpose that multiply by window function is in order to reduce the energy leakage of frequency spectrum at HFS, because the signal that we handle is not desirable periodic signal, sampling number is also few, connecting together at a plurality of sequence datas is the sign mutation that will appear at the linking point place, cause the appearance of HFS energy, the window function that adds is generally the two ends amplitude near 0 function, go to take advantage of each sequence with such window function, couple together then and just make the amplitude of tie point, so just avoided the problem of spectrum leakage all near 0.
Two sequences that are multiplied by window function are carried out fast Fourier transform (FFT) respectively, time-domain signal is transformed into frequency field to get on, to handle sequence that the white noise response sequence obtains then divided by handling the sequence that white noise sequence obtains, just available is a sequence of complex numbers, this sequence of complex numbers is by after root mean square (RMS) average treatment, again each plural number is represented with amplitude and angle, just obtained phase frequency figure and amplitude frequency diagram.
Will emphasize a bit that also because this method adopts very out of true of unitary sampling, so this program adopted repeatedly sampling, and the method that connects the repeatedly sample sequence of handling by the Hanning window function reaches precision preferably.
1.3.4 the optimization of sampling and response
When doing the time domain specification experiment, though lower to sampling number and frequency requirement, if do not carry out the time-delay of 500 microseconds in Fig. 6 b interrupt response process flow diagram, still can cause the obvious shake and the noise of sampling.The time-delay that therefore must respond through experiment, as long as we find to carry out the peak value that the time-delay of 500 microseconds just can be avoided toning for the first time, is carried out 50 AD according to the flow process of the description of front again and is sampled this moment, finally can reach reasonable effect.
In addition, we have utilized and have utilized the TCP technology to realize remote data acquisition among the LabView, can realize the tele-experimentation of Automatic Control Theory.This provides support preferably for remote teaching from now on.
Because LabVIEW provides a series of TCP nodes (power function) that are used to realize network data transmission.Write server software, control DAQ equipment is finished data acquisition, utilizes the programming of TCP node that data are published on the network then.In client software, utilize the TCP node to receive these data and can realize remote data acquisition.The flow process of two machine communication as shown in figure 16.This method is actually the transmission that realizes test data by programming.
DataSocket be of releasing of NI company based on the TCP/IP standard towards measuring and the new technology of the online real time high-speed exchanges data of automation engineering, can be used in the PC or the sharing and issue of real time data between a plurality of application programs in the network.DataSocket utilizes dstp (DataSocket Transfer Protocol) agreement, resource locator URL to carry out network service.The DataSocket comparatively complicated TCP/IP programming on bottom layer of having forgone has overcome the slower shortcoming of transfer rate, simplifies even exempted the Internet programming greatly.
In the LabVIEW version more than the LabVIEW6i, all controls have all increased a specific properties that is called DataSocket Connection, utilize this attribute, can realize the communication of the DataSocket between corresponding two even a plurality of generic control on the different PCs.
The DataSocket URL address of this control can be set in the configuration dialog box of the DataSocket of control Connection attribute, and the form of address is as follows: dstp: //servername/dataname, for example: dstp: //lht/wave.If be the identical LabVIEW control of two types in two PCs be provided with identical DataSocket ConnectionURL address (for example all be dstp: //lht/wave), and its connection type (Connection Type) all is made as Publish and Subscribe, these two controls are just coupled together by DataSocket, it is synchronous that the value of these two controls can keep fully, variation has taken place in one of them control, and another control also same variation can take place synchronously.
Utilize this specific character of DataSocket, just can realize remote data acquisition: utilize server software control DAQ equipment to finish data acquisition, test data is put in the array control, in client-side software, utilize same array control to receive these data, by further programming these data are carried out relevant treatment then by DataSocket Server.In fact this method is exactly to utilize the data of the data sharing acquisition server end of DataSocket.
In addition to the implementation, the present invention can also have other embodiments.All employings are equal to the technical scheme of replacement or equivalent transformation formation, all drop on the protection domain of requirement of the present invention.