Jump to content

Pid without Toolkit


ufo900

Recommended Posts

Hi!

I need to implement a temperature control by changing the voltage of a power supply connected to a heater.

I don't have PID toolkit, but I know how PID theorically works.

Attached: VIs (Untitled 1 the principal one) [cannot upload zip file]

Any suggestion, help or hints are appreciated.

Thank you

Untitled 1.vi

HP6XXXA.LLB

ni435x.llb

ni435xcm.llb

NI435Xu.llb

Link to comment

I need to graph the spectrum of the temperature wave..

I did the amplitude and phase spectrum but anything changed: no graph visualized..

How to do that?

I don't understand what you mean.

Do you just need to plot the temperature?

In my PID graphs, I normally plot the Control signal (maybe voltage 0-10v) and also the temperature.

I use different Y scales for the two plots.

Link to comment

I don't understand what you mean.

Do you just need to plot the temperature?

In my PID graphs, I normally plot the Control signal (maybe voltage 0-10v) and also the temperature.

I use different Y scales for the two plots.

ok I understand that, but i need to plot the spectrum of the signal, the frequencies of the signal.. don't know how to explain in a different way :)

Link to comment

I need to implement a temperature control by changing the voltage of a power supply connected to a heater.

I don't have PID toolkit, but I know how PID theorically works.

Years ago I implemented the algorithm from this link. It’s not that hard to write in LabVIEW. It’s my oldest bit of code still in use (and I would be embarrassed to post it), but I’ve found it very reliable.

— James

Link to comment

Years ago I implemented the algorithm from this link. It’s not that hard to write in LabVIEW. It’s my oldest bit of code still in use (and I would be embarrassed to post it), but I’ve found it very reliable.

— James

well thank you but i already implemented the pid control.

I have another issue now as you can see above here :)

Link to comment

Sounds like you need to use an XY Graph or XY Chart.

well i did but nothing changed.

maybe i can explain better:

I need to graph the spectrum of the temperature wave (input of a NI 4351 connected to a termocouple) (Vi attached named temperatura.vi)

I did the FFT amplitude and phase spectrum and it visualizes the spectrum in X=0 and Y=frequency (i guess)

But i need to graph the frequency of the signal as in the example in the attached VI (vicreate.vi).

How to do that, using the incoming instrumental signal?

Someone told me to use filter anti.aliasing and other stuff but how to implement in the attached code?

Thank you

temperatura.vi

Link to comment

Ok, let me try to see if I'm understanding.

You have a signal (a temperature in this case) that is oscillating in some fashion - possibly not sinusoidally - and you want to track the frequency of this oscillation over a period of time (which one assumes must be longer than the period of the osciallation) to look, for example, for a drift in the frequency of the oscillation.

Assuming this is correct, what you need to do is to take a sample of your data that is longer than the expected oscillation period but shorter than the time over which you expect the frequency to change. Take an FFT Power spectrum of this sample. This gives you the signal as Y(f) vs f where f is the frequency (which you would normally plot on the X axis). You want the value of f for which Y(f) is maximum as that will represent the fundamental frequency of the oscillation. You then repeat this process at different times, generating a plot of f vs t.

Link to comment

Ok, let me try to see if I'm understanding.

You have a signal (a temperature in this case) that is oscillating in some fashion - possibly not sinusoidally - and you want to track the frequency of this oscillation over a period of time (which one assumes must be longer than the period of the osciallation) to look, for example, for a drift in the frequency of the oscillation.

Assuming this is correct, what you need to do is to take a sample of your data that is longer than the expected oscillation period but shorter than the time over which you expect the frequency to change. Take an FFT Power spectrum of this sample. This gives you the signal as Y(f) vs f where f is the frequency (which you would normally plot on the X axis). You want the value of f for which Y(f) is maximum as that will represent the fundamental frequency of the oscillation. You then repeat this process at different times, generating a plot of f vs t.

well the oscillation of the signal is "casual" if it is not touched (it depends on the real temperature of the ambient) but i need to control voltage of a heater to make the oscillation of the temperature zero (costant value), one frequency (sine oscillation) or in a way that the user is defining (square or something).

the problem is actually this: how to write the code, starting from the temperature array ending to the graph..

Link to comment

Okay, If I open the VIs memorise it and then rewrites it without looking at the code while doing it, is that also a breach?

Well ask OpenSource programmers! Many think that looking at non-free code is already more than enough to endanger an Open Source project. Wine for instance has a clear policy there. Anyone having had access to Windows source code is not welcome to provide any code patches. They can do testing, documentation and such things but source code patches are refused if project leaders have any suspicion that the person sending in the patch might have been exposed to that code either through the Microsoft shared source initiative or the illegally leaked source code a few years ago. Also they state explicitly that someone having looked at the (incomplete) source code of the C runtime or MFC library, that comes with every Visual Studio installation for many years, should not attempt to provide any patches to code related to these areas. If the submitted code raises suspicions of such influence, it is refused. They even have for many years refused code patches from people involved in the ReactOS project, another Open Source project trying to create a Windows compatible kernel but not building on Linux but directly sitting on top of the BIOS interface, meaning it is a fully featured OS in itself, because some of the contributors to that project have more or less openly admitted to the use of disassembling Windows for reverse engineering purposes. So not just exposure to source code is a serious risk to creating copyright challenged source code but also looking at the compiled product of such source code to closely. Some Open Source programmers even refuse to look at GPL source code since they believe that it poses a risk if you do not plan to release your own source code under (L)GPL yourself, but under a different possibly more permissive open source license like BSD. Copying GPL source code in anything non-GPL is anyhow a sure way of copyright violation. Memorizing source code and recreating it is more complicated but could be in many jurisdictions a serious legal risk already. And very often the question is not who is more right, but who has a longer financial breath to go through all the legal procedures.

So be careful offering to recreate copyrighted code. NI may not be interested to go after you in general, or where you currently live or for whatever other reason, but many little things like this could build up to something undesirable in the future. Also you have to think about such things anyhow. Just doing it has always the danger of the so called sliding perception. If this hasn't caused problems today I should be fine going a little further tomorrow and even further next week and before you are aware of it you operate in truly dangerous areas.

  • Like 1
Link to comment

So be careful offering to recreate copyrighted code.

Sure, I wouldn't do it, but it's very hard to know where the line goes sometimes.

Especially for the PID VIs, there aren't many ways implement it. And if you haven't looked at the source code your code might end up looking very similar anyway.

Link to comment

Sure, I wouldn't do it, but it's very hard to know where the line goes sometimes.

Especially for the PID VIs, there aren't many ways implement it. And if you haven't looked at the source code your code might end up looking very similar anyway.

:D PID being a certain algorithme, indeed has a high chance to come up with similar code. But to be safe it is definitely a good idea to go from the text book description of the algorithme and not from looking at another implementation of it. Open Source development for instance usually allows for so called clean room development. It means it is considered permissible for someone to use reverse engineering practices to produce a textbook description of the interface and its requirements and someone else using that description to implement the code. But the reverse engineer has to be careful to not describe the internal algorithm in more details than absolutely necessary to allow for a compatible implementation. The implementation of an algorithme can be copyrighted, the workings of it not, that is possibly a case for patent protection, another can of worms. But much of the confusion about copyright also comes from a confusion between copyright and patent right. One protects the form, or specific implementation of an idea, the other more the content of the idea itself.

Link to comment

that''s right, but anyone could help me solving the problem? Thank you all

Sorry, we got into another discussion there :-)

So back to your original question.

"how to visualize the frequency as X and amplitude as Y? "

When using a FFT power spectrum, the X axis is in frequency.

It starts at Frequency 0 Hz and every x value has a delta f increment.

Link to comment

Sorry, we got into another discussion there :-)

So back to your original question.

"how to visualize the frequency as X and amplitude as Y? "

When using a FFT power spectrum, the X axis is in frequency.

It starts at Frequency 0 Hz and every x value has a delta f increment.

thank you about that but now I have another "PID problem".

I have some issues to apply PID into my system..

I can do a PID control by simulating a system only in temperature but issues if I want a voltage control that depends of temperature value.

Attached here PID subVIs I use and the program with the other subVI.

Hope you can help me apply PID into it.

Thank you

VIs(1).zip

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.