Results 1 to 12 of 12
  1. #1

    Distech Free prog problem

    REM Can someone run this code please and tell me what's wrong with line 23 REM MIXEDAIR_SETPOINT_VARIABLE = MIXEDAIR_SETPOINT_CONSTANT.


    REM AHU Control for
    REM Control Points List
    REM Inputs Outputs

    REM 1 SUPPLY_FAN_STATUS SUPPLY_FAN
    REM 2 RETURN_FAN_STATUS
    REM 3 AFS_FILTER
    REM 4 SF_VFD_FLT
    REM 5 RF_VFD_FLT
    REM 6
    REM 7 PRESSURE
    REM 8
    REM 9 RET_RH
    REM 10 RETURN_TP SUPPLY_DRIVE
    REM 11 MIXED_AIR_TP VLV_COOL
    REM 12 SUPPLY_TP FRESH_AIR_DAMPER



    REM Variables and Constants Note: V is for Variable and C is for Constant in names.

    VFD_SETPOINT_VARIABLE = VFD_SETPOINT_CONSTANT
    MIXEDAIR_SETPOINT_VARIABLE = MIXEDAIR_SETPOINT_CONSTANT

    REM Outputs to CO's

    SUPPLY_DRIVE = CO1
    VLV_COOL = CO2
    FRESH_AIR_DAMPER = CO3

    REM Inputs

    RETURN_FAN_DIG_STATUS = RETURN_FAN_STATUS
    SUPPLY_FAN_DIG_STATUS = SUPPLY_FAN_STATUS


    REM nvi's

    REM TEMP Multipliers

    IF ( nviFP_02_OSA_TEMP ) = ECONOMIZER_CONSTANT
    THEN VLV_COOL = MIXEDAIR_SETPOINT_CONSTANT

    ENDIF

    END

  2. #2
    Join Date
    Mar 2003
    Location
    NY
    Posts
    2,152
    That line of code looks OK, check your spelling in the constant and variable assignments. I'm curious why you are assigning the constant to a variable and not using the constant directly.

    This line of code is wrong : IF (nviFP_02_OSA_TEMP ) = ECONOMIZER_CONSTANT
    It should look like this : IF ( nviFP_02_OSA_TEMP = ECONOMIZER_CONSTANT)

    This is also incorrect in the sense that you cannot use an network variable in the code. You must assign it to a variable first
    such as, nviFP_02_OSA_TEMP = OSA_TEMP
    Last edited by dapper; 08-27-2007 at 06:30 AM.

  3. #3
    Dapper,

    Thanks,

    I got it fixed.

    I am confused as the Free Prog manual does not do a good job of explaining what Variables and Constants are. I though thought that a Constant is where you would place the actual setpoint. I thought that a Variable is what is required for the CO to be able to read the set point. If not then what's the difference?

    FYI,

    I have read the Free Prog manual back to front at least four times and all it does is tell you how to do Cut, Copy and Paste over and over.

  4. #4
    Join Date
    Mar 2003
    Location
    NY
    Posts
    2,152
    I use Constants for setpoints as well but the CO can use a constant. The primary difference is that the value of a Variable can be manipulated in the code and the Constant can not be. This is why they are generally used for setpoints. You dont want the code to change the value.
    The other difference with Constants is that they cannot be altered from a web interface, only through a network management tool or a Distech EC-Display.

  5. #5
    Are you saying that with something like A JACE, I can change a constant? But without a JACE I can't? If you don't have a JACE then how else can you do it other than using A LONtool like Lonwatcher 3 - which means you don't need any variables because you can get to the constant.

    Am I missing something here? I can't get any straight forward answers except from you.

    Can you show me an example of when you need the variable and when you don't?

  6. #6
    Join Date
    Aug 2006
    Location
    New England
    Posts
    520
    Constants can be changed through a web interface, but they are packaged in a string of numbers and you'd need javascript to separate them and reassemble them in an iLON100. I don't use Jaces, so I can't tell you if they can separate out the individual constant values from the UNVTs that contain the values.

    As Dapper says, variables can be changed in code, so you can assign a network variable value to the internal variable by writing e.g.:

    Internal_Variable = nviNetwork_Variable

    so when you give a valid value to nviNetworkVariable, that value gets assigned to the internal variable (usually, you have to add some math to convert to correct values, depending on SNVT type). Also, things like reset setpoints would have to be a variable, not a constant because the value is the result of a calculation. In any case, you can always change a constant by using the plugin.

  7. #7
    So are you saying that an nvi cannot be linked to a constant?

    And I just read your post three times. I appreciate the answer, but I feel like it went from English to Japanese, then to Chinese and back to English.

  8. #8
    Join Date
    Mar 2007
    Location
    Netherlands
    Posts
    33
    Outtacontrol
    It is very easy constants are used for setpoints dead bands which you can use in the code or in the pid controllers. Varaibles are the values that are not fixed but they are for instance the resut of a formula in the code. NVI,s are variable so can use the directly in the code or like them to a variable like OAT= nviOut. dont forget the there is a floating point issue if use a SNVT_temp_P you have to devide the snvt vulue by 10 OAT=nviOUT/10.
    To have acces to variables and constants you can use LonDisplay but there is also a snvt called nviModify but then you need a lonmanagment tool wih browser. I use mostly a EC-display and when I use a Ilon 100 I use nvi for setpoints. Don,t forget to put the nvi in persistent. this is in case you lost cooms with the ilon than our last value is still there.
    If you have instaaled the plug-in there are samples in C:\LonWorks\import\Distech\FreeProg\Code_Library

    Good luck

  9. #9
    Join Date
    Feb 2005
    Posts
    1,247
    So are you saying that an nvi cannot be linked to a constant?
    Why would you want to this? If you want your nvi to be your setpoint then click the persistant check box beside the nvi, now its value is kept through power cycles. This is for the case that your are setting this nvi through lonworks browser style application (not bound). If you are actually binding a value to nvi, then make sure your sending node has a reasonable heart beat like 30sec. and there is no need to use persistant check box, actually you can not use the check box if nvi is bound.
    If the above is confusing to you, I am afraid you need to review the user guides again, because it seems you are not quite understanding the core concepts yet.

    For everyone's infromation,
    Jaces can set all the interval values of free progs.

  10. #10
    Amigo,

    I know what persistent is. Start at the beginning of the thread and you'll see where I'm going with this.

  11. #11
    Join Date
    Aug 2006
    Location
    New England
    Posts
    520
    Quote Originally Posted by outtacontrol View Post
    So are you saying that an nvi cannot be linked to a constant?
    Correct. The simple answer is that a constant is constant. If you want to change it, open the plugin (or wizard) and change the value. If you want to be able to change a value from someplace other than the plugin (like a user interface), use a variable or network variable or both.

  12. #12
    Join Date
    Mar 2003
    Location
    NY
    Posts
    2,152
    OK, I'll try an example, Building Occupancy Schedule

    Building_Schedule (nvi) - network variable {cannot be used as is in code}
    Building_Sched (variable) - variable for above nvi
    Supply_Setpoint (variable) - setpoint for CO
    Supply_Air_Temp (input) - referrence for CO
    Chilled_Water_Valve - output for CO
    Occ_Supply_Setpoint (constant) = 55
    UnOcc_Supply_Setpoint (constant) = 75

    code here:
    Building_Sched = Building_Schedule (intitate Building_Sched to nvi value)
    If(Building_Sched = ON)
    Supply_Setpoint = Occ_Supply_Setpoint (Set Supply_Setpoint to value of Occ constant)
    Else
    Supply_Setpoint = UnOcc_Supply_Setpoint (Set Supply_Setpoint to value of UnOcc constant)
    Endif

    Building_Sched is a variable because it will change based on scheduler nvi.
    Supply_Air_Setpoint is a variable that will hold the value of the Occ or UnOcc constant when Schedule changes.
    Occ_Supply_Setpoint and UnOcc_Supply_Setpoint are constants that should never be changed. Other examples might be Outdoor_Air_Lockout and Economizer_ChangeOver_Setpoint

    Hope this helps!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comfortech Show Promo Image

Related Forums

Plumbing Talks | Contractor Magazine
Forums | Electrical Construction & Maintenance (EC&M) Magazine
Comfortech365 Virtual Event