A kind of on-off testing system and method based on programmable controller
Technical field
The present invention relates to switching on and shutting down testing field more particularly to a kind of on-off testing systems based on programmable controller
And method.
Background technique
With the progress of computer technology, gradually use information equipment replaces traditional manual work to people, daily
In work, the state that height relies on has been presented to information equipment by people.It is raw in order to provide reliable and stable equipment to client
Manufacturer is produced after the production work for completing equipment, can also carry out a series of tests to the equipment.Wherein, switching on and shutting down test is to survey
Test-manufacture an important tests of quality.
Switching on and shutting down test is to verify the power on/off function of product by powering on/off to product progress is frequently multiple.
Current existing method for testing open/close machine mainly uses switching on and shutting down jig and its matched switching on and shutting down to control software
Come carry out.
Switching on and shutting down jig be realized using relay circuit power on and power down.Relay coil in switching on and shutting down jig
It is powered, by galvanomagnetic-effect adhesive armature, so that contact closure, power on circuitry.After coil blackout, armature is returned by springback
Position originally, so that contact disconnects, down circuitry.And the movement of relay is to control software by switching on and shutting down to control.
Switching on and shutting down control software can to IP address, runing time, testing time, set by the parameter of some keys such as ratio
It sets, and the on-off of relay is controlled by serial ports realization.
However, in actual operation, discovery switching on and shutting down jig not power down can occurs regularly and obtain phenomenon, lead to the test
Item can not be successfully progress.The main reason for phenomenon occur is the spring aging inside the electromagnetic relay in switching on and shutting down jig,
Cause in coil blackout, spring can not be bounced normally.
In existing patent document, some technical solutions about switching on and shutting down test are also related to.
As provided by Publication No. CN201510940964 " a kind of method for testing open/close machine and system ", which includes
Switch machine controller, image information acquisition device and server.Switch machine controller for control display device starting-up to be tested,
Shutdown is standby;Image information acquisition device is used in the display device starting-up to be tested, obtains display equipment to be tested
Start-up picture information, and the start-up picture information is uploaded into the server, start-up picture information includes start-up picture.Clothes
Business device be used for receive image information acquisition device upload start-up picture information, and by start-up picture information start-up picture with
Default start-up picture is compared, and determines the start-up picture of display equipment to be tested with the presence or absence of abnormal.The system is opened in equipment
By being compared the start-up picture in start-up picture information with default start-up picture with determination display equipment to be tested after machine
Start-up picture be inaccurate with the presence or absence of abnormal method, and not can be carried out when exception occurs in equipment after completely record and
Abnormal conditions are performed corresponding processing.
For another example provided by Publication No. CN 201210131715 " a kind of on-off test device and method ", the device
Including an input module, a control module, a switch module, an AC DC conversion module and a detection module, switch module
It is connected between control module and AC DC conversion module, switch module is for connecting an AC power source, AC DC conversion
Module inputs mould for being connected between control module and computer main board for connecting a computer main board to be measured, detection module
Block link control module is used for control module input test parameter, and detection module is used to detect the power-up state of computer main board,
And will test result and be sent to control module, control module is used for after receiving test parameter according to testing result to control
The on-off of switch module, to control power supply or power-off of the AC power source to computer main board.The system needs that AC DC is arranged
Conversion module, and test process is cumbersome, is not suitable for the switching on and shutting down test for carrying out a large amount of repeatability.
For another example provided by Publication No. CN200810169159 " a kind of method for testing open/close machine and switching on and shutting down test system
System " is it is suitable for testing test system through network and remote power control device by distance host, wherein this test system
With baseboard management controller and operating system.This method includes that control remote power control device is connected to remote power supply control
Power supply line between device processed and test system becomes channel status and initializes baseboard management controller, and this method further includes
Test system is activated through baseboard management controller and executes the boot program of the operating system of test system, and this method is also wrapped
The shutdown programm that test system execution operating system is controlled after completing boot program is included to close test system and control
Remote power control device makes power supply line become off state.The on-off testing system needs network connection, when the switch
The failed opening operation system of machine test macro or not it is predetermined be re-closing off shutoff operation system in number when, can be automatic defeated
Malfunction error signal, need to artificially solve, and when the error occurs, will increase the testing time.
Summary of the invention
In view of the above-mentioned problems existing in the prior art, the present invention provides a kind of, and the switching on and shutting down based on programmable controller are surveyed
Test system and method, the present invention carry out switching on and shutting down test to product using the timing and tally function of programmable controller, save
Time improves testing efficiency.
To reach above-mentioned technical purpose, the present invention is adopted the following technical scheme that:
A kind of on-off testing system based on programmable controller, it includes the end PC, programmable controller, insert row, PC
End is used for input control information, and programmable controller is used to receive the control information of the end PC transmission, and thereby executing test, insert row is used
In connection programmable controller and product.
Further, programmable controller includes for setting determining for runing time, ping logical time, switch closure times
When device.
Further, programmable controller further includes the counting for setting testing time, the frequency of failure, number of success
Device.
The invention also discloses a kind of method for testing open/close machine based on programmable controller, it includes the following steps:
The end information input PC will be controlled;Control information is sent to programmable controller, and programmable controller receives control
Start to execute test after information processed;The test process includes that testing time counts test, runs timing test, frequency of failure meter
Number test, ping lead to timing test, and number of success counts test, and switch closes timing test;Programmable controller passes through insert row
It is connected to product.
Further, if testing time counts test and completes, then it represents that testing time reaches presumptive test number, terminates to survey
Examination;If not completing, the judgement whether operation timing is completed is carried out.
Further, if operation timing test is completed, then it represents that test process is not fully completed in runing time, and test is lost
It loses, the frequency of failure adds one;If not completing, the judgement whether completed when ping is amounted to is carried out.
Further, it is completed if ping leads to timing test, then it represents that be successfully tested, number of success counter adds one, goes forward side by side
Row switch closes the judgement whether timing is completed.
Further, it is completed if switch closes timing test, carries out reset work.
Further, resetting work includes running timer, and ping leads to timer and switch closes the reset of timer.
Further, after the completion of resetting work, testing time counter adds one, and repeats the above test process, under starting
Primary test.
The present invention is based on the on-off testing system of programmable controller and method, technical solution utilizes PLC technology
The timing of device and tally function carry out switching on and shutting down test to product, can save the time, improve testing efficiency.
Detailed description of the invention
Fig. 1 is structural framing schematic diagram of the invention.
Fig. 2 is testing process schematic diagram of the invention.
Specific embodiment
Following is a specific embodiment of the present invention in conjunction with the accompanying drawings, technical scheme of the present invention will be further described,
However, the present invention is not limited to these examples.
Embodiment 1
The present embodiment provides a kind of on-off testing system based on programmable controller as shown in Figure 1, the system packets
Include the end PC 100, programmable controller 200, insert row 300.
Staff inputs pre-set control information by the end PC 100.Programmable controller 200 receives the end PC
The 100 control information sent, and automatically begin to execute test.Programmable controller 200 is connected by insert row 300 and test product
It connects.
Programmable controller is a kind of electronic system of digital operation, specially applies and designs in industrial settings,
It is used to executing storage logical operation and sequential control, timing, counting and arithmetic fortune using the memory that can be programmed
The instruction of the operations such as calculation, and by the input (I) and output (O) interface of number or simulation, control various types of mechanical equipments
Or production process.The present invention is mainly the timing using programmable controller and counts this two big function to carry out switching on and shutting down control
System.
Using programmable controller as control unit, its advantage is the present embodiment:
Firstly, PLC function is strong, the ratio of performance to price is high, and user is easy to use, adaptable.
Have in one PLC it is thousands of can programmed element for users to use, extremely complex control function may be implemented
Energy.Compared with the relay system of identical function, there is the very high ratio of performance to price.
In addition, PLC can also be networked by communication, decentralised control, centralized management are realized.
Secondly, PLC high reliablity, strong antijamming capability.
Traditional relay control system has used a large amount of intermediate relay, the time relay.Not due to contact contact
It is good, it is easy to appear failure.PLC replaces intermediate relay and the time relay with software, only be left with output and input it is related
A small amount of hardware element, wiring may decrease to 1/10th of relay control system hereinafter, greatly reducing because of contact contact not
Failure caused by good.PLC has used a series of hardware and software interference protection measures, has very strong anti-interference ability.
Also, PLC maintenance load is small, easy to maintenance.
The failure rate of PLC is very low, and has perfect fault diagnosis functions.PLC or the input unit and execution machine of outside
When structure breaks down, it can quickly and easily be looked into according to the information of light emitting diode or programming software offer on signaling module
The reason of bright failure, can promptly be debugged with the method for replacement module.
Finally, PLC is small in size, low energy consumption.
Complicated control system uses after PLC, it is possible to reduce a large amount of intermediate relay and the time relay.PLC control
For system compared with relay control system, wiring dosage is few, and installation wiring working hour is short, in addition the diminution of switchgear volume.Therefore,
A large amount of expense can be saved.
In the present invention, 200 internal structure of programmable controller includes for setting runing time, ping logical time, switch
The timer of shut-in time.
Runing time refers to the scheduled product single testing time.
Ping is logical to refer to that network is connected state between two equipment, sends a data packet, other end energy from one end
Enough receive, just represent two equipment can ping it is logical.
Switch, which is closed, indicates that single test terminates.
When carrying out switching on and shutting down test, leading to that time, switch closure times are configured to runing time, ping can be by can
The timing function of programmable controller is completed.
There are many type of timer in programmable controller, and different timers is selected to have a little difference in programming
Not, but its purpose is the same.
Timer can be divided into three kinds in S7-200 series of PLC: connect back off timer (On-Delay Timer, abbreviation
TON), off delay timer (Off-Delay Timer, abbreviation TOF), maintenance connect back off timer TONR.
Connect back off timer TON working principle are as follows: when instruction is true, the timer as unit of time base value into
Row counts.
The working principle of off delay timer TOF are as follows: when instruction be fictitious time, the timer as unit of time base value into
Row counts.
Maintenance connection back off timer TONR working principle are as follows: when instruction is true, as unit of time base value into
Row counts, and instructs when becoming false or re-powering, and accumulated value is constant.
The timer that the present invention uses connects delay timer TON between the single time to connect back off timer TON
Every timing, when power up cycle or first scan, locator position is OFF, current value 0.When input terminal is connected, timer position
For OFF, current value timing since 0, when current value reaches setting value, timer position is ON, and current value still continuous counter arrives
32767.Input terminal disconnects, and timer automatically resets, i.e., timer position is OFF, current value 0.
Connect the instruction format of back off timer TON are as follows: TON Txxxx, PT.It needs to provide in the use of TON instruction
Once parameter:
1) timer (Timer): timer element used in indicating;
2) Shi Ji (Time Base): increment value when timer, it determines the precision of timer;
3) preset value (Preset): for setting delay time.
4) aggregate-value (Accum): it is a dynamic value, indicates timer current delay time.
It is respectively runing time timer that the present invention uses three connection back off timers during the test, when ping leads to
Between timer, switch closure times timer, specific testing procedure is as follows:
T1: after circuit is connected, runing time timer starts timing;
T2: after runing time timer starts timing, ping leads to time timer and starts timing;
After T3:ping leads to time timer timing, switch closure times timer starts timing;Switch closure times
After timer timing, all timers reset, and start to test next time, repeat step T1 and T2.
In PLC control system, typical counter function has:
1) product for manufacturing or detecting is counted;
2) it calculates and is pumped into the material position for maintaining storage tank with the gallonage of let-down vessel;
3) timer is used in combination and tracks one section of long time.
There are three counters can be used for programmable controller: counting up device CTU, down counter CTD, up-down counter CTUD.
Need to use programmable controller in the present invention counts up device CTU to realize to testing time, number of success, mistake
Lose the counting of number.
When counting up device CTU first scan, counter position is OFF, current value 0.Counting the every of pulse input end CU
A rising edge, counter count 1 time, and current value increases a unit.When current value reaches setting value, counter position is ON, when
Preceding value can continue to stop counting after counting down to 32 767.The RESET input effectively or to counter executes reset instruction, counter
It automatically resets, i.e., counter position is OFF, current value 0.
Testing time counting refers to the total testing time of product.
Number of success refers to the successful number of product test.
The frequency of failure refers to the number of product test failure.
Needing to count up device CTU using three in invention is respectively testing time counter, frequency of failure counter, success
Number counter, the specific steps are as follows:
N1: after switch closure times timer timing, testing time counter adds one;
N2: after runing time timer timing, frequency of failure counter adds one;
After N3:ping leads to time timer timing, number of success counter adds one;
N4: if testing time counter reaches defined testing time, test terminates.
The present embodiment is during the test only comprising the runing time timer in three timers, and test detailed process is such as
Under:
After test starts, first determine whether that testing time counting tests whether to complete, if testing time counts test and completes, i.e.,
The standard testing number for reaching expected setting, terminates to test at this time.If testing time counts test and do not complete, continue next
Step.
After judging that testing time counting test does not complete, then judge to run whether timing test is completed.
If running timing test to complete, then it represents that test process is not fully completed in runing time, test crash, failure time
Number plus one;If running timing test not completing, number of success counter adds one, and carries out reset work to runing time timer
Make.
After the completion of resetting work, the above testing process is repeated, starts to test next time.
Embodiment 2
This embodiment differs from embodiment 1 in that: the present embodiment includes in three timers during the test
Runing time timer and ping lead to time timer, and test detailed process is as follows:
After test starts, first determine whether that testing time counting tests whether to complete, if testing time counts test and completes, i.e.,
The standard testing number for reaching expected setting, terminates to test at this time.If testing time counts test and do not complete, continue next
Step.
After judging that testing time counting test does not complete, then judge to run whether timing test is completed.If running timing to survey
Examination is completed, then it represents that test process is not fully completed in runing time, and test crash, the frequency of failure adds one;If running timing to survey
Examination does not complete, then judges to test whether to complete when ping is amounted to.
It is completed if being tested when ping is amounted to, then it represents that be successfully tested, number of success counter adds one, and right
Runing time timer, ping lead to time timer and carry out reset work.
After the completion of resetting work, the above testing process is repeated, starts to test next time.
The other contents of the present embodiment can refer to embodiment 1.
Embodiment 3
The present embodiment and embodiment 1 or embodiment 2 the difference is that: the present embodiment includes all three during the test
A timer.
As shown in Fig. 2, test detailed process is as follows:
Testing time counter controls the beginning and end of test item.After test starts, testing time meter is first determined whether
Number tests whether to complete, if testing time counts test and completes, that is, reaches the standard testing number of expected setting, terminates to survey at this time
Examination.If testing time counts test and do not complete, continue in next step.
Ping lead to time timer and runing time Timer Controlling number of success counter and frequency of failure counter.
After judging that testing time counting test does not complete, then judge to run whether timing test is completed.
If running timing test to complete, then it represents that test process is not fully completed in runing time, test crash, failure time
Number plus one;If running timing test not completing, judge to test whether to complete when ping is amounted to.
It is completed if being tested when ping is amounted to, then it represents that be successfully tested, number of success counter adds one, and continues judgement switch
Close whether timing test is completed.
If switch close timing test complete, by switch closure times timer complete to runing time timer,
Ping leads to the reset work of time timer and switch closure times timer.
After the completion of resetting work, the above process is repeated, starts to test next time.
The other contents of the present embodiment can refer to embodiment 1 or embodiment 2.
In technical solution of the present invention, programmable controller (Programmable Logic Controller, letter are utilized
Claim PLC) switching on and shutting down test is carried out to product, it has a characteristic that
1. function is strong, the ratio of performance to price is high, and user is easy to use, adaptable.Have in one PLC it is thousands of for
Extremely complex control function may be implemented in the programmed element that user uses.Compared with the relay system of identical function, have
The very high ratio of performance to price.PLC can be networked by communication, realize decentralised control, centralized management.
2. high reliablity, strong antijamming capability.Traditional relay control system used a large amount of intermediate relay, when
Between relay.Due to poor contact of contacts, it is easy to appear failure.PLC replaces intermediate relay and the time relay with software, only
It is remaining with output and input related a small amount of hardware element, wiring may decrease to 1/10th of relay control system hereinafter,
Failure caused by greatly reducing because of poor contact of contacts.PLC has used a series of hardware and software interference protection measures, has very
Strong anti-interference ability.
3. maintenance load is small, easy to maintenance.The failure rate of PLC is very low, and has perfect fault diagnosis functions.PLC
Or external input unit and executing agency be when breaking down, it can be according to the light emitting diode or programming software on signaling module
The information of offer, the reason of quickly and easily finding out failure, can promptly be debugged with the method for replacement module.
4. small in size, low energy consumption.Complicated control system uses after PLC, it is possible to reduce a large amount of intermediate relay and when
Between relay.For PLC control system compared with relay control system, wiring dosage is few, and installation wiring working hour is short, in addition switchgear
The diminution of volume.Therefore, a large amount of expense can be saved.
In conclusion measuring technology scheme of the present invention, uses programmable controller to carry out switching on and shutting down test, it can be effectively
It avoids the problem that switching on and shutting down jig not power down during traditional test, so as to save the time, and improves testing efficiency.
Specific embodiment described herein is only an example for the spirit of the invention.The neck of technology belonging to the present invention
The technical staff in domain can make various modifications or additions to the described embodiments or replace by a similar method
In generation, however, it does not deviate from the spirit of the invention or beyond the scope of the appended claims.