Basic Channel Function


Recommended Posts

Hi, I'm completely new to DF and have been assigned with the task of developing a control system for a wet chemical scrubbing system. I am having difficulty creating a value to use as a setpoint to compare real I/O data to; in order to trigger other functions.

I have been told V channels are not the way forward so I have set up a new channel named in this case Recirc_pH_SP. As I want to set the channel with an initial value I have been told to use the addvalue() function , but so far have only managed the following. "Recirc_pH_SP.addvalue(5)" This does set the channel to 5 as I require, but does not display the value in the variable value field. Presumably as i require "[0]" somewhere in my expression. I also need the user to be able to modify this value during runtime as they see fit.

Any help much appreciated!

Mark

Link to comment
Share on other sites

If you just need to store a set point and don't need any history on it, just use a variable. In your startup sequence, just put:

global recirc_ph_SP = 5

(assuming you want to init it to 5). Then in the variable value control you can just put:

recirc_ph_SP

You can change the value as well.

Link to comment
Share on other sites

The easiest way is to use a channel. A regular channel. Not a V channel. Make it Device Type "Test", I/O type "D to A" and make sure if you use multiple ones, you give them unique channel numbers. Then, you can set the value:

recirc_ph_SP = 5

and retrieve the value:

recirc_ph_SP

Don't do "global" because that will create a variable with the same name.

Note that it is slightly slower to use a test D/A channel and = than it is to use a test A/D channel (with timing = 0) and addvalue(). But unless you are going to change this value quickly (say > 20 times a second), I don't think its really going to be an issue.

Link to comment
Share on other sites

  • 3 years later...

Morning,

I think this thread maybe just what I'm looking for.  I have a torque transducer channel (A-D) and a Encoder channel (timer).  They both have conversion to give Nm and RPM on the channel but I wish to do logging of a function of the two (watts).  Displays nicely in a graph already but gues i need a channel to be able to log watts.  Ques is that the timer is 'timing' around 800hz but it was mentioned above that there could be problems over 20hz.  Is the above method suitable or am i going to run into trouble?

 

Many thanks in advance, great support.

 

Martin

Link to comment
Share on other sites

The timer may count 800hz, but are you querying the device for the counts 800 times a second?  I'm guessing no since I doubt the hardware supports it unless you are streaming.  The Timer uses its own internal clock to count 800hz signals, so that is not the same as the 20hz limit for querying the hardware.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.