Abelko RTD-04
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 3
- Uppdaterad
- 2013-08-27
- Skapad
- 2013-08-27
- Kategori
- AEACom, IO enheter
- Visningar
- 7370
Beskrivning
Typdefinition för Abelkos tempmodul RTD04.
Bruksanvisning
Juridisk information
Alla skript tillhandahålls i befintligt skick och all användning sker på eget ansvar. Felaktig använding kan leda till skadad eller förstörd utrustning.
Skript kod
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
AEADEVICE RTD04 NAMED "RTD04" TYPEID 40001 IS
% RTD04 Type definition
PARAMETER
Type_T1 :"Sensor 1 type" [""] INT;
Offs_T1 :"Sensor 1 offset" ["°C"] DEC2;
Type_T2 :"Sensor 2 type" [""] INT;
Offs_T2 :"Sensor 2 offset" ["°C"] DEC2;
Type_T3 :"Sensor 3 type" [""] INT;
Offs_T3 :"Sensor 3 offset" ["°C"] DEC2;
Type_T4 :"Sensor 4 type" [""] INT;
Offs_T4 :"Sensor 4 offset" ["°C"] DEC2;
PUBLIC
T1 :"Temp T1" ["°C"];
T2 :"Temp T2" ["°C"];
T3 :"Temp T3" ["°C"];
T4 :"Temp T4" ["°C"];
S_T1 :"Status T1" [""] INT;
S_T2 :"Status T2" [""] INT;
S_T3 :"Status T3" [""] INT;
S_T4 :"Status T4" [""] INT;
CSN :"CSN" [""] INT;
PRIVATE
R_T1;
R_T2;
R_T3;
R_T4;
AckNr_Out;
AckNr_In;
Input;
R;
T;
Type;
R2;
R3;
R5;
R7;
LNR;
MESSAGE MAXSIZE 28
DATA[0] = WORD(4670); %DevType
DATA[2] = BYTE(0); %Mode
DATA[3] -> BYTE(CSN := DATA;); %CSN
DATA[4] = BYTE(0); %NCounters
DATA[5] = BYTE(4); %NFloats
DATA[6] = BYTE(0); %NBytes
DATA[7] -> BYTE(AckNr_In := DATA;); %AckNr
DATA[8] -> FLOAT(R_T1 := DATA;);
DATA[12] -> FLOAT(R_T2 := DATA;);
DATA[16] -> FLOAT(R_T3 := DATA;);
DATA[20] -> FLOAT(R_T4 := DATA;);
DATA[24] -> BYTE(S_T1 := DATA;);
DATA[25] -> BYTE(S_T2 := DATA;);
DATA[26] -> BYTE(S_T3 := DATA;);
DATA[27] -> BYTE(S_T4 := DATA;);
ACKNOWLEDGE
DATA[0] := WORD(4670); %DevType
DATA[2] := BYTE(0); %Mode Request
DATA[3] := BYTE(AckNr_Out); %AckNr
END;
GROUP AllRTD04 OF MAX 10 AEACOM TYPEID 40001
% RTD04 Group script
SELECT ALL
ITERATOR CalcTemp
ALIAS
BEGIN
IF Input = 1 THEN
Type := Type_T2;
R := R_T2;
ELSIF Input = 2 THEN
Type := Type_T3;
R := R_T3;
ELSIF Input = 3 THEN
Type := Type_T4;
R := R_T4;
ELSE
Type := Type_T1;
R := R_T1;
Input := 0;
ENDIF;
IF Type = 1 THEN %Pt100 EN 50 751 alpha 0.00385
T := 3383.809524 - 0.08658008660 * (1758480889 - 2310000 * R)^0.5;
ELSIF Type = 2 THEN %Pt100 alpha 0.00375
T := 3164.451827 - 8305.647840 * (0.169241 - 0.000240800 * R)^0.5;
ELSIF Type = 3 THEN %Pt100 alpha 0.00392
T := 3392.940594 - 8527.911855 * (0.1817473668 - 0.00023452400 * R)^0.5;
ELSIF Type = 4 THEN %Pt1000 EN 50 751 alpha 0.00385
T := 3383.809524 - 865.8008660 * (17.58480889 - 0.00231 * R)^0.5;
ELSIF Type = 5 THEN %Pt1000 alpha 0.00375
T := 3164.451827 - 830.5647840 * (16.9241 - 0.002408 * R)^0.5;
ELSIF Type = 6 THEN %Pt1000 alpha 0.00392
T := 3392.940594 - 852.7911855 * (18.17473668 - 0.00234524 * R)^0.5;
ELSIF Type = 7 THEN %Ni1000 DIN
R5:= R*R*R*R*R;
R7:= R5*R*R;
T := (-412.6) + (140.41 * (1 + (0.00764 * R))^0.5) - (0.0000000000000000625 * R5) - (0.00000000000000000000000125 * R7);
ELSIF Type = 8 THEN %Ni1000 LG
R2:= R*R;
R3:= R2*R;
T := (-300.0187) + (R * 0.3888) - (R2 * 0.00010355) + (R3 * 0.000000014749);
ELSIF Type = 9 THEN %QAC31/32 old
R2:= R*R;
R3:= R2*R;
IF R <= 622.27 THEN
T := 1840.822526461981 - (8.81283638032425 * R) + (0.01481833026842 * R2) - (0.000008693645718129028 * R3);
ELSIF R <= 655.74 THEN
T := 18284.57180623524 - (87.53497076730491 * R) + (0.14047361791540 * R2) - (0.00007556728104760220 * R3);
ELSE
T := 447598.5593294129 - (2034.707401563966 * R) + (3.08435262703205 * R2) - (0.00155918519608 * R3);
ENDIF;
ELSIF Type = 10 THEN %NTC575 (QAC3132)
R2:= R*R;
R3:= R2*R;
IF R <= 616.7 THEN
T := 1984.368236149433 - (9.45847603610924 * R) + (0.01577267911992 * R2) - (0.000009153756833227248 * R3);
ELSIF R <= 675.5 THEN
T := 13500.31890121417 - (64.89024643188350 * R) + (0.10472492893027 * R2) - (0.00005674169841769381 * R3);
ELSE
T := -8135.044676629710 + (25.40018648262130 * R) - (0.01986043031034 * R2);
ENDIF;
ELSIF Type = 11 THEN %FWT1G
T := (-264.6311531847244) + (R * 0.13733939226662) - (R * R * 0.000008300189626466234);
ELSIF Type = 12 THEN %FOT35
LNR:= LN(R);
T := 245.7686957352614 - (R * 0.0002180214076186565) + (R * R * 0.000000001160703041443256) + (0.07334532481221 * LNR * LNR * LNR) - (34.06632737942485 * LNR);
ELSIF Type = 13 THEN %TAC ECU
LNR:= LN(R);
T := (-273.15) + (1 / (0.00114944558407 + (0.0002941176088004037 * LNR) - (0.0000000000002525998855897292 * LNR* LNR* LNR)));
ELSIF Type = 14 THEN %Satchwell DOT
R2 := R*R;
R3 := R2*R;
IF R >= 7661 THEN
T := 508885.1065949351 - (19.71706149035526 * R) + (0.001301247481832191 * R2) - (0.00000003594831664363352 * R3) - (3738912.809188366 / LN(R));
ELSIF R >= 1193 THEN
T := (-128.4611061637296) - (0.007002012490937275 * R) + (0.0000006986512762901833 * R2) - (0.00000000006639391744752032 * R3) + (1529.490359465714 / LN(R));
ELSE
T := (-339.6118638033802) + (0.09063945312481900 * R) - (0.00006415896542404209 * R2) + (0.00000001784096838726073 * R3) + (2639.015168861766 / LN(R));
ENDIF;
ELSIF Type = 15 THEN %Satchwell DW1204 DWS1202
R2 := R*R;
R3 := R2*R;
IF R >= 2236 THEN
T := 39382.90132075548 - (6.021252248143583 * R) + (0.0013733544102798 * R2) - (0.0000001313622917888568 * R3) - (241223.6906016618 / LN(R));
ELSIF R >= 974 THEN
T := (-888.2657030489725) + (0.1056691176426888 * R) - (0.00002987131417113171 * R2) + (0.000000002522599122874649 * R3) + (6271.371860366971 / LN(R));
ELSE
T := (-9517.677682528738) + (4.164299211339042 * R) - (0.002604874308355931 * R2) + (0.0000006794599871065049 * R3) + (50956.91507092444 / LN(R));
ENDIF;
ELSIF Type = 16 THEN %Satchwell DO2202
R2 := R*R;
R3 := R2*R;
T := (-1021.199118881201) + (0.04569968689660045 * R) + (0.00002069764420667956 * R2) - (0.00000000981645089002807 * R3) + (6869.504979681983 / LN(R));
ELSIF Type = 17 THEN %IVT
LNR:= LN(R);
T := (-273.15) + (1 / (0.001311184263438729 + (0.0002338997792885658 * LNR) + (0.0000001077046283506101 * LNR * LNR * LNR)));
ELSIF Type = 18 THEN %NIBE
LNR:= LN(R);
T := (-273.15) + (1 / (0.001387800349275742 + (0.0002400761437010071 * LNR) + (0.00000008613539226217632 * LNR * LNR * LNR)));
ELSIF Type = 19 THEN %KTY 10/7
R2 := R*R;
R3 := R2*R;
T := 311.5439406854249 + (0.04844211701143084 * R) - (0.000002908837846165819 * R2) + (0.0000000001362467604839759 * R3) - (2848.566087438425 / LN(R));
ELSIF Type = 20 THEN %Bodendammen
LNR:= LN(R);
T := (-273.15) + (1 / (0.001466426327478712 + (0.0002385193263772018 * LNR) + (0.0000001006014722395608 * LNR * LNR * LNR)));
ELSIF Type = 21 THEN %T7043 Honywell
LNR:= LN(R);
T := (-273.15) + (1 / (0.001705367599798446 + (0.0002527653342936799 * LNR) + (0.0000000005227580950721076 * LNR * LNR * LNR)));
ELSE
T := R;
ENDIF;
IF Input = 1 THEN
T2 := T - Offs_T2;
ELSIF Input = 2 THEN
T3 := T - Offs_T3;
ELSIF Input = 3 THEN
T4 := T - Offs_T4;
ELSE
T1 := T - Offs_T1;
ENDIF;
Input := Input +1;
END;
END;
ROUTINE UpdateRTD04
%Calls AllRTD04.CalcTemp to calculate temperatures from resistance measurements
BEGIN
%One call for each input
CALL AllRTD04.CalcTemp;
CALL AllRTD04.CalcTemp;
CALL AllRTD04.CalcTemp;
CALL AllRTD04.CalcTemp;
END;
%
AEADEVICE RTD04 NAMED "RTD04" TYPEID 40001 IS
% RTD04 Type definition
PARAMETER
Type_T1 :"Sensor 1 type" [""] INT;
Offs_T1 :"Sensor 1 offset" ["°C"] DEC2;
Type_T2 :"Sensor 2 type" [""] INT;
Offs_T2 :"Sensor 2 offset" ["°C"] DEC2;
Type_T3 :"Sensor 3 type" [""] INT;
Offs_T3 :"Sensor 3 offset" ["°C"] DEC2;
Type_T4 :"Sensor 4 type" [""] INT;
Offs_T4 :"Sensor 4 offset" ["°C"] DEC2;
PUBLIC
T1 :"Temp T1" ["°C"];
T2 :"Temp T2" ["°C"];
T3 :"Temp T3" ["°C"];
T4 :"Temp T4" ["°C"];
S_T1 :"Status T1" [""] INT;
S_T2 :"Status T2" [""] INT;
S_T3 :"Status T3" [""] INT;
S_T4 :"Status T4" [""] INT;
CSN :"CSN" [""] INT;
PRIVATE
R_T1;
R_T2;
R_T3;
R_T4;
AckNr_Out;
AckNr_In;
Input;
R;
T;
Type;
R2;
R3;
R5;
R7;
LNR;
MESSAGE MAXSIZE 28
DATA[0] = WORD(4670); %DevType
DATA[2] = BYTE(0); %Mode
DATA[3] -> BYTE(CSN := DATA;); %CSN
DATA[4] = BYTE(0); %NCounters
DATA[5] = BYTE(4); %NFloats
DATA[6] = BYTE(0); %NBytes
DATA[7] -> BYTE(AckNr_In := DATA;); %AckNr
DATA[8] -> FLOAT(R_T1 := DATA;);
DATA[12] -> FLOAT(R_T2 := DATA;);
DATA[16] -> FLOAT(R_T3 := DATA;);
DATA[20] -> FLOAT(R_T4 := DATA;);
DATA[24] -> BYTE(S_T1 := DATA;);
DATA[25] -> BYTE(S_T2 := DATA;);
DATA[26] -> BYTE(S_T3 := DATA;);
DATA[27] -> BYTE(S_T4 := DATA;);
ACKNOWLEDGE
DATA[0] := WORD(4670); %DevType
DATA[2] := BYTE(0); %Mode Request
DATA[3] := BYTE(AckNr_Out); %AckNr
END;
GROUP AllRTD04 OF MAX 10 AEACOM TYPEID 40001
% RTD04 Group script
SELECT ALL
ITERATOR CalcTemp
ALIAS
BEGIN
IF Input = 1 THEN
Type := Type_T2;
R := R_T2;
ELSIF Input = 2 THEN
Type := Type_T3;
R := R_T3;
ELSIF Input = 3 THEN
Type := Type_T4;
R := R_T4;
ELSE
Type := Type_T1;
R := R_T1;
Input := 0;
ENDIF;
IF Type = 1 THEN %Pt100 EN 50 751 alpha 0.00385
T := 3383.809524 - 0.08658008660 * (1758480889 - 2310000 * R)^0.5;
ELSIF Type = 2 THEN %Pt100 alpha 0.00375
T := 3164.451827 - 8305.647840 * (0.169241 - 0.000240800 * R)^0.5;
ELSIF Type = 3 THEN %Pt100 alpha 0.00392
T := 3392.940594 - 8527.911855 * (0.1817473668 - 0.00023452400 * R)^0.5;
ELSIF Type = 4 THEN %Pt1000 EN 50 751 alpha 0.00385
T := 3383.809524 - 865.8008660 * (17.58480889 - 0.00231 * R)^0.5;
ELSIF Type = 5 THEN %Pt1000 alpha 0.00375
T := 3164.451827 - 830.5647840 * (16.9241 - 0.002408 * R)^0.5;
ELSIF Type = 6 THEN %Pt1000 alpha 0.00392
T := 3392.940594 - 852.7911855 * (18.17473668 - 0.00234524 * R)^0.5;
ELSIF Type = 7 THEN %Ni1000 DIN
R5:= R*R*R*R*R;
R7:= R5*R*R;
T := (-412.6) + (140.41 * (1 + (0.00764 * R))^0.5) - (0.0000000000000000625 * R5) - (0.00000000000000000000000125 * R7);
ELSIF Type = 8 THEN %Ni1000 LG
R2:= R*R;
R3:= R2*R;
T := (-300.0187) + (R * 0.3888) - (R2 * 0.00010355) + (R3 * 0.000000014749);
ELSIF Type = 9 THEN %QAC31/32 old
R2:= R*R;
R3:= R2*R;
IF R <= 622.27 THEN
T := 1840.822526461981 - (8.81283638032425 * R) + (0.01481833026842 * R2) - (0.000008693645718129028 * R3);
ELSIF R <= 655.74 THEN
T := 18284.57180623524 - (87.53497076730491 * R) + (0.14047361791540 * R2) - (0.00007556728104760220 * R3);
ELSE
T := 447598.5593294129 - (2034.707401563966 * R) + (3.08435262703205 * R2) - (0.00155918519608 * R3);
ENDIF;
ELSIF Type = 10 THEN %NTC575 (QAC3132)
R2:= R*R;
R3:= R2*R;
IF R <= 616.7 THEN
T := 1984.368236149433 - (9.45847603610924 * R) + (0.01577267911992 * R2) - (0.000009153756833227248 * R3);
ELSIF R <= 675.5 THEN
T := 13500.31890121417 - (64.89024643188350 * R) + (0.10472492893027 * R2) - (0.00005674169841769381 * R3);
ELSE
T := -8135.044676629710 + (25.40018648262130 * R) - (0.01986043031034 * R2);
ENDIF;
ELSIF Type = 11 THEN %FWT1G
T := (-264.6311531847244) + (R * 0.13733939226662) - (R * R * 0.000008300189626466234);
ELSIF Type = 12 THEN %FOT35
LNR:= LN(R);
T := 245.7686957352614 - (R * 0.0002180214076186565) + (R * R * 0.000000001160703041443256) + (0.07334532481221 * LNR * LNR * LNR) - (34.06632737942485 * LNR);
ELSIF Type = 13 THEN %TAC ECU
LNR:= LN(R);
T := (-273.15) + (1 / (0.00114944558407 + (0.0002941176088004037 * LNR) - (0.0000000000002525998855897292 * LNR* LNR* LNR)));
ELSIF Type = 14 THEN %Satchwell DOT
R2 := R*R;
R3 := R2*R;
IF R >= 7661 THEN
T := 508885.1065949351 - (19.71706149035526 * R) + (0.001301247481832191 * R2) - (0.00000003594831664363352 * R3) - (3738912.809188366 / LN(R));
ELSIF R >= 1193 THEN
T := (-128.4611061637296) - (0.007002012490937275 * R) + (0.0000006986512762901833 * R2) - (0.00000000006639391744752032 * R3) + (1529.490359465714 / LN(R));
ELSE
T := (-339.6118638033802) + (0.09063945312481900 * R) - (0.00006415896542404209 * R2) + (0.00000001784096838726073 * R3) + (2639.015168861766 / LN(R));
ENDIF;
ELSIF Type = 15 THEN %Satchwell DW1204 DWS1202
R2 := R*R;
R3 := R2*R;
IF R >= 2236 THEN
T := 39382.90132075548 - (6.021252248143583 * R) + (0.0013733544102798 * R2) - (0.0000001313622917888568 * R3) - (241223.6906016618 / LN(R));
ELSIF R >= 974 THEN
T := (-888.2657030489725) + (0.1056691176426888 * R) - (0.00002987131417113171 * R2) + (0.000000002522599122874649 * R3) + (6271.371860366971 / LN(R));
ELSE
T := (-9517.677682528738) + (4.164299211339042 * R) - (0.002604874308355931 * R2) + (0.0000006794599871065049 * R3) + (50956.91507092444 / LN(R));
ENDIF;
ELSIF Type = 16 THEN %Satchwell DO2202
R2 := R*R;
R3 := R2*R;
T := (-1021.199118881201) + (0.04569968689660045 * R) + (0.00002069764420667956 * R2) - (0.00000000981645089002807 * R3) + (6869.504979681983 / LN(R));
ELSIF Type = 17 THEN %IVT
LNR:= LN(R);
T := (-273.15) + (1 / (0.001311184263438729 + (0.0002338997792885658 * LNR) + (0.0000001077046283506101 * LNR * LNR * LNR)));
ELSIF Type = 18 THEN %NIBE
LNR:= LN(R);
T := (-273.15) + (1 / (0.001387800349275742 + (0.0002400761437010071 * LNR) + (0.00000008613539226217632 * LNR * LNR * LNR)));
ELSIF Type = 19 THEN %KTY 10/7
R2 := R*R;
R3 := R2*R;
T := 311.5439406854249 + (0.04844211701143084 * R) - (0.000002908837846165819 * R2) + (0.0000000001362467604839759 * R3) - (2848.566087438425 / LN(R));
ELSIF Type = 20 THEN %Bodendammen
LNR:= LN(R);
T := (-273.15) + (1 / (0.001466426327478712 + (0.0002385193263772018 * LNR) + (0.0000001006014722395608 * LNR * LNR * LNR)));
ELSIF Type = 21 THEN %T7043 Honywell
LNR:= LN(R);
T := (-273.15) + (1 / (0.001705367599798446 + (0.0002527653342936799 * LNR) + (0.0000000005227580950721076 * LNR * LNR * LNR)));
ELSE
T := R;
ENDIF;
IF Input = 1 THEN
T2 := T - Offs_T2;
ELSIF Input = 2 THEN
T3 := T - Offs_T3;
ELSIF Input = 3 THEN
T4 := T - Offs_T4;
ELSE
T1 := T - Offs_T1;
ENDIF;
Input := Input +1;
END;
END;
ROUTINE UpdateRTD04
%Calls AllRTD04.CalcTemp to calculate temperatures from resistance measurements
BEGIN
%One call for each input
CALL AllRTD04.CalcTemp;
CALL AllRTD04.CalcTemp;
CALL AllRTD04.CalcTemp;
CALL AllRTD04.CalcTemp;
END;
Användarnas noteringar
Du måste vara inloggad för att göra en notering. Bli medlem eller logga in. Vi använder en moderator som godkänner noteringarna innan de visas.