LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Exercise: Parking Fees

Hello, I'm trying to write a program that calculates the parking fees for customers who parked their cars in a city garage, assuming that no cars are parked longer than 24 hours. I'm having more trouble than I originally thought. Lets say the following is the parking rates for a garage: 0-1 Hours - $ 7.00

1-2 Hours - $ 8.00

2-3 Hours - $ 9.00

3-4 Hours - $10.00

4-5 Hours - $ 12.00

5-6 Hours - $ 14.00

6-7 Hours - $ 35.00*

7-24 Hours - $40.00**

*with validation rate will be reduced to $16

**with validation rate will be reduced to $20 

0 Kudos
Message 1 of 6
(2,498 Views)

What trouble are you having?  Ask a specific question.  Post your VI so we can see what you've done and where you are stuck.

 

I would recommend you learn more about LabVIEW from here. How to Learn LV

Message 2 of 6
(2,492 Views)

I dont know how to start this problem other that use case structure and for loops.

0 Kudos
Message 3 of 6
(2,480 Views)

It'll be hard to provide help with that.  What's your input look like? 

0 Kudos
Message 4 of 6
(2,448 Views)

2 Datetime controls, start- and stoptime
1 subtract
2 array constants, one with (upper) time limits, one with corresponding cost.
1 Threshold array
1 Index array.
1 Cost output.
Profit.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 6
(2,410 Views)

I'd have suggested the same method (perhaps without the timestamps and subtract, and just a Numeric Control, but that depends on the input format of course), but I didn't because I figured that Threshold 1D Array can be a bit tricky.

 

In this case, I think you'd also want a "Round towards +Inf" with the way you described your arrays?

I managed to get it to work with the lower bounds of the price brackets and a Round toward -Inf node, but maybe up is better...

 

My only point is that Threshold can be a bit difficult. Although you'd probably still need to Threshold 1D Array to build a bunch of cases in a case structure... (unless your input is integer minutes?)


GCentral
0 Kudos
Message 6 of 6
(2,389 Views)