How many threads for weighbridge system

It is a weighing system that measures the weight loaded in the truck,

The traffic light is red on starting and the barrier remains closed, after verification of the truck, the barrier is opened by pressing the switch button. As the truck enters, the traffic light turns red again and the barrier closes. There are three position sensors which tell the position of the truck so when the truck crosses from the first sensor, the truck is told to move forward.When the truck is between the first and second sensors, the truck is told that it is not in the correct position, move forward. If the truck passes the third sensor before measuring, the truck is told you are not in the correct position, please reverse. The truck should be parked in the middle to measure the weight. First and third sensor should be low and second sensor should be high then weight can be measured. After the weight is measured, the exit barrier should open and as soon as the truck exits, the barrier should be closed again. It can also be operated manually in case of any fault in the system. Switches are provided for each barrier and light.

Can you give an idea of ​​the minimum number of threads I should create to design this system?

The minimum number would be zero.

I’m a little surprised. I am thinking that at least 2 have to be create, one for automatic operation and another for manual operation.

If we will do everything in a single main loop and if a fault occurs in the system then how will we operate the system manually?

No, I agree with Richard Barry. There are no operations that need to be done simultaneously or with tight timing requirements, so the old classing “Big Loop” structure would work just fine.

There is no need for separate tasks for automatic and manual operations (and that might actually make things tougher), but you just let the system accept multiple sources of input to advance to the next step, either the automatic sequence (if not disabled by a fault test) or the manual advance command.

Yes, there MIGHT be places where dividing things into different tasks might make things simpler or clearer, but there is no real “Need” for such actions.

1 Like