


Summary:In the microcomputer batching system, the working principle and computer control principle of the double-scale batching system are given, and the software design flow chart and the program code for realizing multi-thread control are given.This method has been applied to feed processing and production, playing a vital role in improving production speed and productivity.
The automatic dosage system adopts three-level computer control, connects the dosage units distributed in various places through industrial field bus, realizes the networked management of dosage system, and realizes the management of formula and raw materials, real-time monitoring of production and the management of summary reports of various data on the upper computer, which has the advantages of flexible structure, good man-machine interface, and integrates control and management in one. The dosage function is comprehensive, stable and reliable, can meet the requirements of various dosage production.
In feed processing enterprises, automatic dosage according to the controller has three types of microcomputer, microcontroller and PLC. Dosing software is suitable for microcomputer feeding system, the system has a simple structure, clear control principle, easy and intuitive operation, flexible parameter settings, data management is powerful and so on, in the small and medium-sized feed processing enterprises have been widely used.
1 double scale dosage working principle
In the process of feed preparation and production, one of the important ways to improve the production speed is to realize multi-scale batching, i.e., 2 or more kinds of raw materials are added to the secret bucket at the same time. Assuming that the formula of a certain kind of feed consists of n kinds of raw materials, and the average time for each kind of raw material to be added into the weighing head is t, then theoretically, the batching speed of double secret can be doubled than that of single scale.
Dual structure of the dosage system working principle, bin 11 ~ bin 1n in the raw materials through the corresponding dosage device added to the scale bucket 1, bin 21 ~ bin 2m in the raw materials through the corresponding dosage device added to the scale bucket 2, the scale bucket 1 and the bucket 2 in the preparation of each raw material is complete, open the door to release the material to the mixer mixing and churning, the scale head shut down to continue the next batch of production; mixing machine mixing to the specified time, open the door to release the material to the finished product warehouse, and then close the door, continue the next batch of production; mixing machine mixing to the specified time, open the door to release the After the mixer mixes for a specified time, the door will be opened and the material will be put into the finished product warehouse, then the door will be closed to continue the work of the next batch.
2 double scale dosage computer control principle
According to the above working principle, the computer control principle can be designed, the computer through IO interface A, collects the weight data of weighing bucket sent by the weight indicator; through IO interface B, controls the start and stop of the batching machine; through I/O interface C, on the one hand, it can control the opening and closing door of the weighing bucket and mixer, mixing mixing, and on the other hand, it can also detect the working state of the weighing bucket door and the door of the mixer.
3 double scale batching production design flow chart
According to the working principle of double scales dosage production, the left and right two scales at the same time dosage winter fog a thread. Only when the two scales are finished dosing, can be put into the mixer, so the two scales open the door to release the material needs to be synchronized thread processing; when the material in the hopper to the mixer, the left and right two scales continue to dosage, the mixer needs to be stirred timing and switching the door, so the control of the mixer needs to be the work of the third thread.
4 The realization of the control program of the double scale dosage system
In the microcomputer dosage machine to realize multiple scales at the same time dosage method is to use multi-thread technology. The following describes the method of developing the software of double-weighing dosage system under Windows operating system with C++Builder6.0 as the development tool and utilizing multi-threading technology.
4.1 Establishment of Multi-threading
4 Dosage system with double scale structure
There are three threads: two weighing hopper dosage threads and a mixer stirring thread. The threads are created with the C/C++ runtime library function beginthreadex.
4.2 Synchronization of threads
Synchronization of threads has two meanings: one is the coordination of two or more threads to coordinate their execution process based on certain conditions; the other is the mutually exclusive use of resources to avoid data overwriting.
In the dual scale dosage system, only when both scales have finished dosing can the door be opened and put into the mixer, so the two scales need to be synchronized to open the door and release the material.
In the program, when the left and right two scales finished dosing, through the SetEvent () function will be two thread end event object event_scale set to signal state, with WaitForMultipleObiects () function to wait for and receive the end of the two scales of the signal state, which dwMilliseconds parameter is set to INFINITE, indicating that only after the signals of both the left and right scales are received, the execution continues downwards.
4.3 Establishing Critical Zones
Critical areas are mainly used for the mutually exclusive use of resources to avoid data coverage, belonging to a way of thread synchronization.
In the production of ingredients, each raw material to add the completion of the need to write its quantity and name in the database, at this time in order to avoid two threads at the same time to write operations on the database, you can use the critical area for protection.
5 Conclusion
In the microcomputer automatic dosage system, through the use of multi-threading technology to control the dual scale structure of the dosage system, can significantly improve the dosage speed and productivity. At present, it has been installed and applied in more than 70 feed processing enterprises in Hebei and the surrounding area, and the on-site operation results show that the software runs stably and reliably with fast production speed and obvious effect.