â05-27-2018 02:45 PM
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
â05-27-2018 02:51 PM
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
â05-27-2018 03:31 PM
I dont know how to start this problem other that use case structure and for loops.
â05-27-2018 06:02 PM
It'll be hard to provide help with that. What's your input look like?
â05-28-2018 08:28 AM
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
â05-28-2018 01:50 PM - edited â05-28-2018 01:56 PM
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?)