LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reseting timer depending on boolean input

Dear All,

I am working on the following problem:


 Truck Weight Station Interface

 


Trucks pull into a weight station in Acme town every day in order to be issued permits for their loads.  The town gives out three different permits to the trucks.

  • Low-Load stickers are for trucks under 1 ton
  • Mid-Load stickers are for trucks between 1 and 4 tons
  • Heavy-Load stickers are for trucks over 4 tons.

 

The weigh station is run by an operator in the booth.  He needs software to help him control the lights and scales to direct trucks into the station, and assist him in disbursing stickers/permits to drivers.

_Lights_

 


StationOpen -  if operator is ready to weigh trucks, he flips a switch to activate the light next to the road.  If the light is not on, the truck should see a ‘GO’ signal and proceed through the station without weighing.

 

Wait – Tells next truck to wait if there is already a truck being weighed.

 

Stop/Go – Tells truck to drive up and stop on scale/drive off of scale.

 

Scale Reading – if scale is on, and truck is on scale, it will display weight, it resets to 0 when idle or when truck exits scale

 

_Additional User Interface _

 


TextOut – Text field for displaying permit sticker. It displays the truck’s actual weight and permit type in the format:

 

- <Type> Truck Permit –

Actual Weight: #.# tons

Where the <Type> field could be “Low Load”, “Mid Load”, or “High Load” and the #.# is the measured weight rounded off to the nearest 10th.

Stop Button – operator can stop program at any time stop button response time must be 200ms or less.

Print/OK Button – operator must print permit/sticker for each truck after it has been weighed. Truck will not see “GO” signal until permit printed.

Station Active Button – operator must turn on light on highway to alert trucks to pull in, Button updates light within 200ms. If Station Active Button is not pressed (light is not on) then any trucks waiting see “GO” signal to pass through without weighing.


_Sensors_

Truck Arriving – Truck coming into station.  Simulate with a Boolean switch. If a truck is already being measured, set the Wait light. Otherwise do nothing.

Truck Loading – Truck driving onto scales. Simulate with a Boolean switch.

Truck Leaving – Truck driving off of scales. Simulate with a Boolean switch.


_General Tips for this program_

The scale measurement can be represented by a random number between 0 and 5. 

 

To ensure each truck is stopped, the software will have them roll forward until they trigger the loading signal, first to T, and then to F (they’ve rolled past sensor).  Then the software will wait half a second before taking a measurement. 

 

If either the load or unload signal is triggered at any point during the waiting, reset the wait to start again.

 

Otherwise after measurement is taken, wait for operator to press “Print/OK button” and inform the truck to “GO”. Wait another half second for safety before alerting the next truck of its action.  Turn off Wait light, and set (Go/Stop) signal.

  
If there is a truck waiting, proceed to processing next truck until all trucks processed or until Stop or Station Active buttons are updated to stop the weigh in process. " 



I have developed the entire program with almost all the features. However, I have problem reseting the timer when either truck loading or truck leaving sensors are activated in the waiting period that starts before taking the weight measurement of the truck. I would really appreciate if any one could help me in developing this logic.


Thank you very much in advance. Please let me know if my problem needs further clarification.


With Regards,

Amit Darwhekar

 




Message Edited by Amit Darwhekar on 01-30-2008 01:27 PM
0 Kudos
Message 1 of 4
(3,024 Views)

Hi Amit,

That sounds like a fun program to develop.  How are you timing the wait currently?  Does the program wait for half a second without checking the status of the sensors?  Instead of using a Wait or Time Delay VI, you can place the Elapsed Time VI in a while loop.  It includes a Reset input which you can connect to your load/unload booleans.  Hope this helps!

Jennifer R.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 4
(2,974 Views)
Hi Jennifer,

Thank you very much for your suggestion. I have started working on the logic as per your suggestion. So far I am sure it will work. Earlier, I used the Wait (ms) function to produce the delay. My program used to produce the delay only if truck arriving and truck loading sensors are activated. Now, I have slightly changed the logic and have used the elapsed time function to produce the delay. I have attached the VI with this post for your reference. In this program, I also need to develop the logic for latching output of the truck loading sensor. I know how it could be done in PLC programming but since I am very  new to LabVIEW I am finding it difficult to develop the logic for latching. I would appreciate any hint or suggestion in this regard.

Thank you very much for the valuable help. I look forward to hearing from you.

With Regards,

Amit

P.S. I hope the program will work. Let me know if it does not. This is the first time I have packed all files in a zip file and have attached with a post.


Message Edited by Amit Darwhekar on 02-01-2008 11:02 AM
0 Kudos
Message 3 of 4
(2,959 Views)
Hi Amit,
 
I was able to run your code just fine.  It looks like you're a fast learner if you're very new to LabVIEW.  Below are a few comments:
 
1. The Elapsed Time value seemed to be set to 5 sec instead of 0.5. 
2. You may want to add Wait (ms) VIs to the loops containing the Truck Leaving sensor and the Print button so they don't use as much of the CPU.
3. You can set the mechanical action of the Boolean controls to Switch or Latch.  Right click the control on the front panel and select Mechanical Action. 
4. An event structure, under Structures on the Functions Palette, may be useful for this program.  If you right click the event structure and Edit Events Handled by This Case, you can create Value Change events for your sensors.
 
Hopefully that gives you some more ideas. 
Jennifer R.
National Instruments
Applications Engineer
0 Kudos
Message 4 of 4
(2,925 Views)