updated duty cycle in PWM/PID temperature control

Hi fellow users of Labview,.

I control the temperature in a box by reading the temperature (voltage) of a PT100 element and output pulses PWM with PCI 6221 counter to close the circuit of a relay to solid state to power my heating unit.

Using PID (not quite yet set in the code below), I expect the cycle also adapt according to the proximity we are at the point (i.e. it would be pulse refine put it to not be 50% when sound near the set point, but rather be like 10% so it is not exceeded). Right now my code does nothing at the time when the process variable exceeds the set value (I have the operating factor set to 1E-5 in this case, mainly off the coast, because if I don't do this, the counter always pulse outputs...)

How to integrate the update of the PWM pulses in my code?

Thank you!

HessenMob

I think I solved the problem.

As a new person on these forums, I didn't know how to remove my post...

An updated version is attached below!

Any thoughts on how to tune the K_p, K_i, K_d settings?

Thank you

HessenMob

Tags: NI Software

Similar Questions

  • Changing the duty cycle of PWM on during the race

    Hello

    I am trying to generate a my C Code PWM signal.

    It works fine except for the fact that I can not change the operating factor during execution of the generation of PWM signals.

    Here's what I do:

    //Init DAQmxCreateTask("masterP",&task_pwmout);
    DAQmxCreateCOPulseChanFreq(task_pwmout,taskchans1,NULL,DAQmx_Val_Hz , DAQmx_Val_Low , 0.0,freq,duty);
    DAQmxCfgImplicitTiming(task_pwmout,DAQmx_Val_ContSamps,1000);
    DAQmxStartTask(task_pwmout);
    
    ...//Stop DAQmxStopTask(task_pwmout);
    

    It works well, but the duty cycle is fixed.

    I tried to change the cyclical report but it seems that the only way it works is like this:

    //Init DAQmxCreateTask("masterP",&task_pwmout);
    DAQmxCreateCOPulseChanFreq(task_pwmout,taskchans1,NULL,DAQmx_Val_Hz , DAQmx_Val_Low , 0.0,freq,duty);
    DAQmxCfgImplicitTiming(task_pwmout,DAQmx_Val_ContSamps,1000);
    DAQmxStartTask(task_pwmout);
    ...
    //Change Duty Cycle DAQmxStopTask(task_pwmout);
    DAQmxSetCOPulseDutyCyc(task_pwmout,taskchans1,duty);
    DAQmxStartTask(task_pwmout);
    ...
    //Stop DAQmxStopTask(task_pwmout);
    

    I have to stop the task, set the new cycle and restart the task.

    Unfortunately, it takes some time (~ 100 ms) which means that during this time, the PWM is turned off.

    Is there a way to change the smoother operating factor, so there is no gap between?

    Thanks in advance.

    Christian

    Hi Christian,

    You are right. Stop a restart of the task is a very slow way to adjust the pulse width. This page describes the option adjust the factor of market during execution by using the function "DAQmxWriteCtrFreqScalar". By calling this function in a loop, after the start of your task, you will be able to adjust the frequency and factor use of your task, simply by changing the settings.

    I would like to know if it works for you.

    Concerning

  • duty cycle PWM of PID.

    I'm trying to find examples of PID controlling the duty cycle of PWM. Is there a simple example? Helps share if you have.

    I coundn't find this topic in the viewfinder of the example


  • Duty cycle issues update

    I use a counter that is generated by a PCI-6110 to switch a relay to solid state that enables or disables a heating unit. I update the duty cycle based on the output of a PID controller (0 - 100 output of PID VI gets scaled to a cycle of 0.001 to 0.99). The question is after two iterations, the written property node is no longer the output of PID on the scale to the task and it seems 0 as the default value.

    Many meter generation examples use event structures to detect a change in the duty cycle and pass that to the task. But structures event detect changes in values if the value is written in a local variable and not typed in a CNC? I feel that the answer should be 'Yes'... but in the case I tested it seems to be 'no '.

    Don't adjust the precision of a digital indicator / control limits the number of significant digits does a calculation? I would limit my duty cycle to 2 decimal places - i.e. 0.3342 and 0,3313 the two would be 0.33. In this way the cycle is not unnecessarily updated.

    The temperature is read by a PCI-4351... which may arise under? blocks if you have not installed the drivers.

    arcranda wrote:

    Many meter generation examples use event structures to detect a change in the duty cycle and pass that to the task. But structures event detect changes in values if the value is written in a local variable and not typed in a digital control?.

    To have a triggered event when a value is changed programmatically, create a Value property node (signaling) and the new value of wire to it.  This will trigger a change of value for this variable event.

    arcranda wrote:

    Don't adjust the precision of a digital indicator / control limits the number of significant digits does a calculation? I would limit my duty cycle to 2 decimal places - i.e. 0.3342 and 0,3313 the two would be 0.33. In this way the cycle is not unnecessarily updated.

    .

    Changing the properties of display to show only 2 decimal places does not change the numeric value stored in memory.  You would have to round up the digital to two decimal places.  To do this is to multiply the number by 100, change of an integer (this will lose the remaining decimals), then divide the result by 100 to get again the two decimal places.  When changing to an integer, you will need to round to the nearest integer to make 0.3299 0.33.

  • without using DAQ how a PID controller for temperature control

    Mr President.

    IAM trying to make a PID controller for temperature control in labview. But I have no devices data acquisition. Then without using DAQ how a PID controller.please suggest some useful block diagram.plz give me an answer. I tried one, but not working.below attached is my work.

    as a learning exercise, some devices can be simulated in the Explorer to measure (performance measure explore, right click on devices, select Create new.) Select simulated device and choose your device, you can search by product code for example 4070 for a dmm)

    I hope this helps you begin to learn labview, depending on how advanced you can I strongly suggest looking in training of core 2 and core 1 but also by looking at the examples that come with labview

  • measure PWM duty cycle

    Hi all

    I have never done in time real before LabVIEW and have a pretty simple question.

    I know that there is a measure of pulse width as VI in the palette of waveform and it can be used to measure the duty cycle and frequency of the PWM. My question is, is it necessary to use this measure of vi on a platform time pulse width real (compactRIO, compactDAQ etc...) so that it works? In other words, can I just use normal LabVIEW to measure the duty cycle and frequency of the PWM?

    Is there an alternative to the duty cycle and frequency of measurement without using compactRIO or compactDAQ platform? My concern is because I did no real time programming and the deadline is tight and there is not a lot to invest in learning programming in real time.

    I just want to know the experiences of others who have done it before.

    Thank you

    Yours sincerely,

    chati

    Oh yes RT is not really necessary for sample DAQ of things like that.  If you have a condition like assess each cycle of a PWM, and if the signal falls then to send a command within the period of a cycle, then you want RT or FPGA to respond deterministically.  But if you agree with a bunch of samples taken, then evaluate the data after having been taken then a cheap DAQ card probably will work fine.

    Speed can be a matter of concern.  Lets say you have a square wave of 1 kHz at 50% duty cycle.  If you enjoy at 2 kHz, then you should be able to see that the signal is weak for a sample, then up for a sample and you can determine that the signal is at duty cycle of 50%.  But if you have your wave to the duty cycle of 10%, while most of the time, you will see two samples of low, thinking that it's 0% duty cycle, but then from time to time you will get a top and a bottom and get 50% of reading, who don't agree.

    This is why it is recommended that you enjoy at a rate at least 10 times faster than your input signal.  So if you have an example of signal of 1 kHz to 10 kHz.  Then, if your duty cycle is 10%, you will see a small sample of top and 9.  But even that might not be enough if you need to have more precision to your measurement.  Fortunately, NEITHER sells cheap and expensive material for that.  The hardware cheaper that might work for you is the following:

    http://sine.NI.com/NIPs/CDs/view/p/lang/en/NID/212383

    or perhaps cela

    http://sine.NI.com/NIPs/CDs/view/p/lang/en/NID/212384

    But you probably want to call OR and describe your situation and they can recommend the best material to use if you are not familiar with their offers.  Depending on your situation, you may be able to use an Arduino too.  NOR has a toolbox where it can collect samples and send them via USB.  The sent message can be the rated frequency and the duty cycle, but once again it is quite limited and does not have any help from NEITHER a material point stand, they provide just the box tool.

  • Change of the dynamic Cycle for PWM

    Hello people of LabView warned there!
    I'm doing PWM for the servo using LabView.
    I was able to manually move my servo with this: http://www.ni.com/white-paper/2991/en

    My goal is to automate the position of the servo as a movement of sinuisoidal and to do,

    I need to automate the cycle to oscillate in 5% ~ 10% automatically over time.
    I looked into stuff like:

    http://forums.NI.com/T5/counter-timer/PCI-6602-PWM-generation-dynamic-sine-duty-cycle/TD-p/1522442

    But it was not too helpful, that I was getting too error-200301.

    I want to be able to move the position of the servo to ~ 10 Hz, if it's important and the FREQ square to wave the

    servo signal (PWM) must be 50 Hz.

    Any help? Thank you!

    ____________________________________
    Attached, that's what I'm trying to do. The sinusoidal movement of the servo is (supposed to be) really pair upwards with

    a counsel of the BNC-2120 of the analog output. The part of the servo control is separated on the upper part.

    The error occurs on the first iteration of the loop? What is the initial delay value on? If the initial delay is greater than the length of the loop, you can still get this error.

    This is important if you use a (ms) waiting rather than wait for the next "millisecond" several?

    And checking against the local variable duty cycle is still useless. You should check against the previous cycle which was set, not the local variable cycle duty.

  • Agilent 33500 B configuration of duty cycle

    I use the function generator to Agilent/Keysigt 33511 B to produce a square wave with offset, amplitude and frequency specified. However, I'm unable to set the duty cycle. Is there a VI to control this setting?

    Hi jmountney

    If you use this driver , I think that there is a function named .vi configures signals Standard Advanced (square) and it has an entry for the duty Cycle, so I think this could help you.

  • Frequency of signal and pulse duration varying as to reduce the duty cycle

    To sum up my problem, I am creating a period and the controlled voltage pulse sequence, but as I decrease my cyclical report, the distance between each pulse begins to become irregular. More precisely:

    I want to have three pulses, each a positive amplitude specified, long, with 23 ms between each 80 microseconds. After these three impulses, I would have a negative pulse of 3 * than amplitude, followed again by Ms. 23 this cycle must be repeated 260 times.

    I tried first of all to create the positive impulses to help simulate Signal VI, assigning a square wave with a frequency of 43.327556, an offset of 0.5 and the amplitude of 0.5. And the operating cycle as the default value of 50%, the signal seems to be normal (constant frequency and the duration of each pulse is equal;) "I'm in a position with an oscilloscope).  However, when you set the duty cycle for. 3466%, the time between each pulse varies and some legumes are longer than others. I wrote the data able to file directly from fake Signal VI to ensure that he was not only a problem of scope, but it seemed that writing to a file of measure has not sample enough points for me to accurately measure. Even decrease the market barely 10% factor, I see the question arise already.

    So my question is, I'm doing something wrong here? It is a kind offset of Labview to try to perform a duty cycle that small? And are there any alternatives to the way I have this set up? I thought I would try to use a train of pulses instead, but I'm not very familiar with this and I know, you can't control the amplitude of the pulses.

    Any help is appreciated! Thank you very much.

    My guess is that you are limited by the sample rate. If the difference between the two signals time is less than the sampling period (1 frequency / sampling), you will not be able to generate the signals you want.

    Please tell us the sampling rate, you use and the settings that work and those that do not. If your data file is not too big, please post so that we can see some data. Post your VI can help too. Check the default settings before you save the VI.

    Lynn

  • guidance inertia temperature control

    Dear people,

    I would ask for advice from experienced people in control theory.

    Recently, I'm working on a very interesting device, it is called inertial guidance vacuum calorimeter (there is a type of isothermal calorimeter). I'm doing a new LabView program for this camera, and I try to increase its stability/accuracy as much as I can. This calorimeter can measure heat sample level micro-watt powers. The principle of measurement is the following (see attached diagram):

    We want to measure the heat flowing from the outside door-sample, this is done via Peltier (thermoelectric sensor) sensor. To obtain valid data, temperature must be very precisely constant everywhere in the calorimeter (isothermal method). The inner parts of the calorimeter thermally protected against ambient temperature with blank shields and high radiation. Double room empty closed circulates water through a heat exchanger, the heat reservoir.

    For thermal stability, there are 3 loops controlled:

    1 control loop. : this controls using PID, (method of classic platinum resistance 4W) constant water temperature

    2 control loop. : this is the first step to stabilize the temperature of the inner part, PID loop classic platinum resistance and drives a pump to Peltier heat between the support and the "base". This can achieve only a constancy of temperature around 0.1 mK.

    3 control loop. : when the ultimate stability is reached with the control loop 2, it is off, and his conduct of the current production constant value. Now the loop3 begins, and that's the tricky part: there is a cylindrical copper heavy 'inertial mass' with high calorific value (much higher then the base) standing on the base. Because it has a high calorific, even temperature fluctuations very tiny in the performance of temperature-controlled database a measurable voltage in the thermoelectric sensor between inertial mass and the base. This value is measured by the meter nanovoltage (Keithley). So I use this value to control the heat under the base pumps.  In principle, if there is no heat flowing between inertial mass and the base, we are in thermal equilibrium.

    With this concept, it is possible the stability of temperature range well below nanokelvins!

    Recently, I play with the control settings, but only using simple PID controls (I have the PID toolkit). The method explained above is a kind of analogy of inertial guidance in mechanical control. I wonder if someone could give me advice or direction how I could further improve the stability of this control. Perhaps some more advanced control system? Feed-forward?

    Thank you very much for the advice,

    Kind regards

    If I follow correctly, the feedback control loop 3 is measured using the Keithley via GPIB.  And these readings take approximately 0.6 seconds. The control loop cannot work faster than the measurement system (unless you want a lot more unstable!).  Most high precision instruments offer a compromise between resolution and speed.  I took a look at the profile of 2182 and it seems you may have need of any resolution, so accelerate may not be an option.

    The approach of bottle neck is probably a good with all that you have done so far.  It will help you to avoid putting too much time into something that won't make much improvement.

    Another thought: how noisy/drifty are power supplies/amplifiers driving Peltier devices?  I worked on a system several years ago, where the objective was stability uK ~ 10 and noise and drift in the power circuits were the main limitations.  Most of the engineers designing such devices never think of parts per million or fractions.  Especially with the slow return of nanovoltmeter, drift or noise in the power circuts could be important.  Also look at how the constant output mode that the external loops are open loop constantly.

    Lynn

  • Duty cycle of measurement using digital inputs DAQ

    Hi all!

    My system has a PXI-8269 card and I want to measure the duty cycle of the Digital PWM signal generated by a device.

    To acquire this signal, I'll use a digital DAQ (PFIx) instead of a counter of data acquisition (CTRx) (they are already used for other applications).

    The search of the database of examples, I found live who use meters. So I wonder if it is possible to do that and how could I.

    Thank you!

    Sorry, the correct reference is PXI-6289.

    I was determined to acquire a digital waveform, converting it to an analog waveform and then using the correct function in the range of functions->-> Analog wave.

    Thank you!

  • Strict & Duty cycle value changes - every time

    Hi all

    IM using pcie 6320 to measure the frequency and the use of a signal.i factor tied my vi & data measured for reference. Values in red, is my frequency and duty cycle but values real changes for all the 1 sec. Please correct me if I am wrong.

    You must set the CI. Pulse. Freq.DigFltr.Enable and CI. Pulse. Freq.DigFltr.MinPulseWidth.

    You have selected CI. Freq.DigFltr.Enable CI. Freq.DigFltr.MinPulseWidth.

    These are two different types of task meter entry (although they are called unfortunately very similar to the other).

    Best regards

  • How to generate the digital output of the variable duty cycle and clock source being contrary?

    I want to generate a digital pulse every front amount of my pulse counters. He must have a variable duty cycle. until now, I've been able to generate a digital output, but I can't change its duty cycle.

    pls tell how I should proceed?

    Thank you in advance...


  • Get the duty cycle of DAQ to analog voltage input module

    Hello.

    I'm new to labview. I have an analog voltage input data acquisition module. I try to get the duty cycle of a square (generated from a function generator). What is the best way to go about this? When I use the vi to acquire an analog wave cyclical report, the values are incorrect.

    Post your VI as well as real data of your signals so we can see what is happening.

    Lynn

  • Waveforms digital output duty cycle glitches

    I try to use a square wave converted to digital output to operate some solenoids but seeing some problems with the cycle on the digital waveforms. The output frequency will always be of the order of 1 Hz and duty cycle must be adjustable to integer values. I have attached a simplified below, demonstration that shows the digital/analogue output VI I used initially. the problem with this VI, is that if I choose a cycle that is not a multiple integer of my samples for waveform I get seeds. If I use the Boolean digital VI table this problem disappears in my simplified code, but in my real program the problem reappears.

    This image shows the waveform analog generated as well as the digital output that results.

    In the digital waveforms, you can see that the duty cycle of 50% is sometimes applied during the single loop (~.2us) instead of more than 1 sec iteration, although the curve of actual load indicated in the table at the bottom seems to suggest that LV ignores this glitch (somehow). As I said, the problem disappears if the duty cycle is an integer multiple of the sample/loop. Timing of the loop is torn apart by other e/s to 2 000 Hz/400 samples per loop and 100 Hz/20 samples per loop (large enough VI otherwise I would include it). Obviously, I could change them to get 50% as a multiple, but this does not solve the problem if user needs to adjust from there.

    Can someone point me in the right direction here? I'm sure that there is a stupid/easy solution, but I can't seem to get.

    Thank you!

    You might try turning the inputs A and B of waveform of the VI of the digital samples append.  It seems that A should be the fate of the shift register data (the original data) and B should be added (the new waveform) data anyway, at least conceptually.

    Paul P.

    Engineering applications

Maybe you are looking for

  • DeskJet 2541: Cannot install Deskjet 2541

    I recently changed my wifi information and was not able to change the information on my printer. I uninstalled it to see if it would work if I installed it as a new printer but I have lost the guide cable and start with that printer is delivered. I t

  • XP Home "Disk Cleanup" utility

    I used the 'Disk cleanup' utility for the maintenance of the machine. Have all the boxes checked but the 32 KB in "files WebClient/Publisher temporary ' does not, never. It does not seem to exceed this amount. Someone at - it information on how to er

  • How to increase the speed of the PC without adding RAM

    PLEASE HOW CAN INCREASE THE SPEED TO RUN THE PC WITHOUT ADDING MORE RAM

  • Blue screen problems

    Hi, I have tried to check the forums and found somewhat similar problems but nothing that I could understand to do to fix my own. My computer will be bluescreen something like once a week and I'm not sure of the cause into something more listed in th

  • BlackBerry smartphones save contacts on memory card

    How to save my contacts on the memory card? Thank you!