# Pid without Toolkit

## 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

I'm just wondering, since the LV PID Toolkit VIs are not block diagram protected, so if I just take the content and copy it on a new VI's block diagram, and send you that VI, do I then breach any copyright laws?

I saw that trick but (example) in PID.vi i have a function that recall the toolkit..

Anyway i think I solved in another way, if I'll have trouble i can try that way! Thank you

Another minor issue.

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 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.

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

If you need to plot a frequency spectrum, you should use FFT Power Spectrum.

frequency is visualized as Y and time as X

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

Edited by ufo900

If you can make up a VI that simulates the HW-signals, it's easier to help you out and for me to understand what you are looking for.

If you can make up a VI that simulates the HW-signals, it's easier to help you out and for me to understand what you are looking for.

here you go

vicreate.vi

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

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

frequency is visualized as Y and time as X how to visualize the frequency as X and amplitude as Y?

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

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

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.

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..

I'm just wondering, since the LV PID Toolkit VIs are not block diagram protected, so if I just take the content and copy it on a new VI's block diagram, and send you that VI, do I then breach any copyright laws?

Yes you do!

Yes you do!

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?

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?

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.

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.

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.

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.

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

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.

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

little up

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×