11-26-2011 03:50 PM
Sorry for making a new topic... I am going into panic mode because I only have 4 days left to get this working and I am completely lost. I need to make a calibration schema for my project. It is a power meter, that tames in 4 inputs (V+ V- and I+ I-) and calculates power from that. I have that working, but now my professor wants me to make it calibrate. So he wants a button/switch that goes from run to calibrate. If its in calibrate, he wants the user to enter the minimum and maximum values of both V and I and have the meter scale between those values. All I have added is the button and the 4 textboxes with a string to number converter. I am completely lost on how to do this. Please help me!
11-26-2011 05:48 PM
Are you sure that you understood the professor correctly? Calibration normally involves connecting known values to the measurement system and then adjusting the readings to match those values. What you described sounds more like setting the scales on the charts.
Without the Arduino VIs, it is hard to tell what your program is doing. Why do you read Anlog In 3 twice? If it is a reference for the other two inputs, just wire the output of one read to both Subtract functions.
The Compound Arithmetic function fouind on both the Numeric and Boolean palettes can be expanded and set to OR mode. Use it to replace the 6 OR gates wired to the conditional terminal of the while loop.
Lynn
11-27-2011 12:05 PM
@johnsold wrote:
Are you sure that you understood the professor correctly?
Lynn
Here is more information about what the professor wants.
11-27-2011 12:27 PM
Thanks Steve. I guess he is going to do a calibration after all.
Lynn
11-28-2011 05:16 PM
Hi Trgehring,
I would also suggest that you implement a basic state machine architecture as Steve Chandler has recommended in your previous thread. In addition to the link which Steve provided (http://zone.ni.com/devzone/cda/tut/p/id/3024), you can access the standard state machine template from LabVIEW by going to File > New > VI > From Template > Design Patterns > Standard State Machine to get you started quickly.
In this template, you will see a case structure enclosed in a while loop. Each case in the case structure represents a state that your system can be in. Within each state, you must specify the next state the system should transition to after the present state. As suggested by Steve, you can have a "Run" state which acquires data and specifies the next state to be either "Run" or "Calibrate" based on the value of a toggle switch in the front panel. Within the "Calibrate" state you can then use a Dialog Button VI to prompt the user to connect the battery, and then transition to the next appropriate state. Let me know if you have any further questions regarding this issue.
11-29-2011 03:08 AM
Thanks for the help! That state machine is quite handy 🙂 So I'm attaching the new copy of my VI. Basically I used the array that Lynn suggested instead of the series of OR gates, and I used a state machine for calibration mode. In each state, it is promting the user to enter numeric data. This is then fed through numeric gates and is sent back up to calculate the power. I am getting some erros that I do not know how to fix though. It says that some tunnels are not connected in each state. Well, I only have 1/4 tunnels wired in each state, so how do I fix that? Its also saying the case structure selector os wrong type, and that some cases have no selectors. What does that mean?
11-29-2011 08:51 AM
Sorry forgot to attatch file...
11-29-2011 10:37 AM
Well you are trying but that is not quite it. By wiring the iteration terminal direct to the case selector you effectively have a stacked sequence structure.
Take a close look at this. Study it until you completely understand how it works. The things you may need to study in the help that comes with LabVIEW are clusters, shift registers and custom controls. I didn't include any custom controls but there is a cluster that should be a typedef. There are three types of custom controls - control, typedef and strict typedef. A control is something you can create and reuse but when you use it there is no link back to the definition. If you update the custom control then you will have to replace every instance in your code where you used it. The next type is a typedef. Updating the typedef will update all instances in your code. The third is a strict typedef. It is the same as a typedef but all properties will update including things such as control size, position, color, cluster autosizing, etc.
To answer your question about tunnels, you have to wire something in each case or you will get an error. You can right click and select use defalt if unwired but that will not work for what you are doing. The value of all tunnels will be that of the last iteration of the loop. Everything will be 0 except the Min Current since it is the last case to execute before the loop ends. That is where shift registers come in. Wiring to the right side of a shift register makes that value available on the left side in the next loop iteration.
This snippet is also attached in LabVIEW 8.2 format.