Announcement

Collapse
No announcement yet.

math on thermal couple card

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • math on thermal couple card

    I was wondering if anyone out there has ever used a f0-128 co-processor card to perform mathematical operations on temperature brought in by af fo-04thm thermal couple input. I am having trouble reading out the correct numbers when i perform complex math on the readout values.

    problem background:

    I am trying to calculate the enthalpy based off of dry and wet bulb temperatures, so that i can further calculate the correct mixing ratio of air to automate a vent to circulate air flow. Anyways the math involved used complex exponential math and i am unable to figure out what operands i need to use in my BASIC program to spit the processed numbers back into my DL06. I have got it working before when using constant values so i suspect that my problems are coming from the fact that i am attempting to perform this math on a double word. I do not have to much experience with this so bear with me.

    If anyone has any advice or can point me in the right direction with this i would greatly appreciate it.. i've been trying to figure out what i've been doing wrong for a couple weeks and it is very frustrating.


    This is my program so far

    10 REM initialize vars

    15 REM WET BULB
    20 A1=S06_VB(2000)*.1
    25 REM DRY BULB
    30 B1=S06_VB(2002)*.1
    35 REM ATMOSPHERIC PRESSURE
    40 C1=101

    45 REM SUB ROUTINES

    50 G1=17.2693882*A1
    60 H1=A1+237.30
    70 I1=G1/H1
    80 D1=0.61078*EXP(I1)
    90 E1=0.62198*(D1/(C1-D1))
    100 F1=(1.006*B1+E1*(2501+1.775*B1))*10

    110 REM SCALING READOUT VALUES

    120 X1=E1*1000
    140 Z1=D1*100

    145 REM READOUT VALUES

    150 S06_VR(2022)=X1 //humidity ratio
    160 S06_VR(2024)=Z1 //saturation vapor pressure
    170 S06_VR(2023)=F1 // enthalpy


  • #2
    This line looks like a typo:
    170 S06_VR(2023)=F1 // enthalpy

    Was this supposed to be V2026?

    Each floating point value in the PLC requires 2 V-memory locations so this S06_VR(2023)=F1 will write to V2023 and V2024. However this will conflict with these two writes:
    150 S06_VR(2022)=X1 //humidity ratio
    >This writes to V2022 and V2023

    160 S06_VR(2024)=Z1 //saturation vapor pressure
    >This writes to V2024 and V2025


    I suggest adding some PRINT statements to the program to verify the intermediate results.


    10 REM initialize vars

    15 REM WET BULB
    20 A1=S06_VB(2000)*.1
    REM
    22 PRINT1 "Dry Bulb = ",A1
    REM
    25 REM DRY BULB
    30 B1=S06_VB(2002)*.1
    REM
    32 PRINT1 "Atomosperic Pressure = ",B1
    REM
    35 REM ATMOSPHERIC PRESSURE
    40 C1=101

    45 REM SUB ROUTINES

    50 G1=17.2693882*A1
    60 H1=A1+237.30
    70 I1=G1/H1
    80 D1=0.61078*EXP(I1)
    90 E1=0.62198*(D1/(C1-D1))
    100 F1=(1.006*B1+E1*(2501+1.775*B1))*10
    REM
    102 PRINT1 "Enthalpy = ",F1
    REM

    110 REM SCALING READOUT VALUES
    120 X1=E1*1000
    REM
    122 PRINT1 "Humidity Ratio = ",X1
    REM
    140 Z1=D1*100
    REM
    142 PRINT1 "Saturation Vapor Pressure = ",Z1
    REM

    145 REM READOUT VALUES

    150 S06_VR(2022)=X1 //humidity ratio
    160 S06_VR(2024)=Z1 //saturation vapor pressure
    170 S06_VR(2023)=F1 // enthalpy

    Comment

    Working...
    X