Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Controlling Analog Output with NTC Sensor

Anonymous
2012-12-05
2012-12-14
  • Anonymous - 2012-12-05

    Originally created by: Supra^

    Hello again!

    Currently i'm working on a solution for controlling motor valves through temperature. I immediately thought about the Wago 750-881 controller, which i have been using for many other projects. I assume it is possible to control the output value (0-10V) to activate for example from 25-30c? e.g. 25c=0V, 26c=2V, 27=4V.....30=10V. However, i didn't find any functions to do this direct.

    I have already placed an order on the parts for the system, and cards for the Wago controller (4xAO 0-10V, 4xAI NTC), just want to be sure it can be done with the wago, and hopefully relatively simple? Any tips on which functions to use is also appreciated, i usually work with Function Blocks.

     
  • shooter - 2012-12-05

    yes very good possible.
    and very simple to make, you can go even better by pid control or (with fuzzy)
    just make a flow sheet and i will send you a program as a begin.

     
  • Anonymous - 2012-12-10

    Originally created by: Supra^

    Thanks shooter for the fast answer. The real problem for me is to get everything started because i've got no experience in how to make a variable analog output signal. At the time i cannot supply any good flowchart, but the principle is as follows:

    Components
    Wago 750-881 Controller
    Wago 750-464 AI (NTC10k specific)
    Wago 750-562 AO 0-10V
    Wago 750-600 End module


    Motor valve with control signal input 0-10V (0-100%)
    NTC10k temperature probe

    So, i measure temperature from the NTC sensor, and when it reaches a specific setpoint (too high temperature) it will start to open the valve, i.e. the voltage will be >0V.

    I thought of testing this first with the HYSTERESIS FB, but it only gives BOOL as output. As i would like to test this also, the question is, how to tell that the BOOL value should be 0V when FALSE, and 10V when TRUE?

    The final version should be able to open the motor valve in steps, depending on the temperature (as described in my first post), e.g:

    25.0c = 0V
    25.5c = 1V
    26.0c = 2V
    26.5c = 3V
    27.0c = 4V
    27.5c = 5V
    28.0c = 6V
    28.5c = 7V
    29.0c = 8V
    29.5c = 9V
    30.0c = 10V

    A PID-based control is not considered at the moment, because i have no way to be sure the PID control will turn off when the temperature is back to OK again.

     
  • shooter - 2012-12-10

    so use scale (or from w www.oscat.de w or make it yourself:

    output=outputoffset+(outputspan)(input-inputoffset)/(inputspan)
    this looks complex but is really simple.
    outputoffset is 0V
    outputspan= 10-0=10
    inputoffset=25
    inputspan=30-25=5
    input= 23.4 example
    now
    output= 0+(10)
    (27.4-25)/5=4.8

    this can be done several times so your input is real 274 as a word.
    first convert this WORD_TO_REAL
    divide by 10 to get correct temperature
    then above scheme
    then make output
    oops wago server not working.
    this is a little tricky as the i do not know the setting.
    something like start is 2 and end is 32565 or close to this look in the datasheet.
    you can do same again.
    now with 32563 as outputspan for example.
    then convert this back to a word with REAL_TO_WORD (use F2) and put this to your output
    rtemp:=(WORD_TO_REAL(win1))/10;
    (when you type above the program will ask for below)
    win1 has address %IW0 type is word
    rtemp is type real

    conv1:=outputoffset1+(outputspan1)(rtemp-inputoffset1)/(inputspan1)
    again it will ask now also give the constants in the definition.
    conv2:=outputoffset2+(outputspan2)
    (conv1-inputoffset2)/(inputspan2)

    out1 address is %QW0 type is WORD;
    out1:=conv2;

    if this is too difficult, just give all numbers and i will write you a simple demo.
    but probably you understand above.

     
  • Anonymous - 2012-12-14

    Originally created by: Supra^

    Hello again!

    Here's what i managed to get done this morning.

    It definitely works just the way i wanted, and it was very easily accomplished with the oscat library

    I will try to get the program done next week so i can test and tweak it. I'm also working on a visualisation that would allow to change the LCP1_low and LCP1_high variables AND that the variables would be remembered by the controller even after a reboot. The question is, which one should i use, RETAIN or PERSISTENT? And what's the difference between these two? Because in Finnish they translate to the same word and meaning

    IMG: Bild

     
  • shooter - 2012-12-14

    yes correct, i would only hve the zero and the high 65535 also in a VAR, then you can change them online, or from any visualisation.

     
  • Strucc - 2012-12-14

    RETAIN variables are stored in a reserved memory location, preserving values even after a power failure (start / stop / reset). PERSISTENT means, that the variables try to remain in the same location in case of a new software download as well... so after a download event a RETAIN PERSISTENT variable won't change value... (if possible).

     
  • shooter - 2012-12-14

    he just had the simple numbers in his program, so unable to change, i do know the story about persistent, but this does not work when using 65535 for example.

     

Log in to post a comment.