' Program name: UmiatBase_2009-09-21.cr1 'Modification Of: UmiatBase_2009-09-18.cr1 'Modified By: AMcHugh 'Date Modified 21 September 2009 'Modifications: made on and off switching voltages public variables. 'Modification Of: UmiatBase_2009-09-09.cr1 'Modified By: AMcHugh 'Date Modified 08 September 2009 'Modifications: Changed Initializing instructions to turn all 3 AC devices "on" as default. ' Added 0.2 volts hyterisus to On logic voltages. ' Changed counts from 60 to 720 to change running average from 10 minutes to 120 (2 hours) 'Modification Of: UmiatBase_2009-09-02c.cr1 'Modified By: R.Paetzold 'Date Modified 09 September 2009 'Modifications: Commented out instruction that set CS10 offsets to zero if they were low. Now outputs actual value. 'Modification Of: UmiatBase_2009-09-02a.cr1 'Modified By: R.Paetzold 'Date Modified 05 September 2009 'Modifications: Changed Running Average of System Battery Voltage to correct error. 'Modification Of: UmiatBase_2009-09-02.cr1 'Modified By: R.Paetzold 'Date Modified 02 September 2009 'Modifications: Changed relay controls for cameras, camera heaters, and TPS power to use an ' hourly running average system battery voltage instead of an instanteous system ' battery voltage. ' Changed reading CS10 currents to reflect four wraps of wire around the torus ' and changed the offset from -1250 to 0. Four wraps were used instead on one ' in an attempt to reduce noise. 'Modification Of: UmiatBase_2009-080-31.cr1 'Modified By: R.Paetzold 'Date Modified 02 September 2009 'Modifications: Changed All AC Current lower limit to 0.15 Amps 'Modification Of: UmiatBase_2009-080-31.cr1 'Modification Of: UmiatBase_2009-080-28b.cr1 'Modified By: MLilly 'Date Modified: 02September2009 'Modifications: removed spaces after i_sig in variable arrays i_sig(1,1) in CS10 variable decleration section and measurement section 'Modified By: MLilly 'Date Modified: 01September2009 'Modifications: set AC Current lower limit to 0.2 Amps, Corrected Voltage Measurements on multiplexer for Battery Bank measurements, ' set to mv2500 for Battery Bank A and B 'Modified By: AMcHugh 'Date Modified: 29Aug2009 'Modifications: added battery bank control and other edits ' The ScanInterval must be changed from 10 sec to 60 sec ' A few instructions in the Battery Bank switching control must be uncommented. ' They have the long ''''''''''''''''''''''''''''''''' string in front of them. ' much of the battery control ifs need to be fixed and adjusted. they have not been tested and probably don't work. 'Transform Version: 0.5 'Transform file: C:\Program Files\Campbellsci\LoggerNet\CR10X.TRN Version: 1.3 'This program was converted from C:\Documents and Settings\Austin McHugh\My Documents\GWS\Projects\North Slope Lakes\North Slope Lake Stations\Umiat Base Station\Umiat Base datalogger programs\UMIAT BASE-NOTTD_2006.12.04.CSI 'using Campbell Scientific's Transformer application. ' 'NOTES: TIME SET TO ALASKA STANDARD TIME ' POSITIVE MEASURED BATTERY BANK CURRENT INDICATES THE BATTERIES ARE CHARGING ' NEGATIVE MEASURED BATTERY BANK CURRENT INDICATES THE BATTERIES ARE DISCHARGING 'INSERT FIXED RESISTOR (Vx1 to SE1) VALUE (kOHM) HERE Const Rf_1 = 1.0 'YSI thermistor conversion: 'kOHM to deg C Const x = 0.0014654354 Const y = 0.0002386780 Const z = 0.0000001000 Const a = false Const b = true Const off = false Const on = true Const yes = true Const no = false ' constant for the CS10 measurement Const line_frq = 60.0 ' target line fundamental frequency in Hz Const num_cyc = 3 ' number of 60-cycle periods to measure Const dt = 1000 ' burst sample interval in usec Const num_samples = Round (num_cyc/line_frq/dt*1e6, 0) Dim i_phase ' the line current Dim i_sig(2,num_samples)' to hold three burst measurements, each 100 samples long 'MRL changed above line to take out spaces, 9/2/09, had error message with space after i_sig (2, num_samples) Dim Initialized Dim Therm(16) Dim i Dim D(16) Dim SW12V ' This is used as a flag to watch SW12V status because the CheckPort instruction won't check Port 9 (SW12V) Public MinIntoDay Public StationID ' Station ID number, USER INPUT Public BattVolts_V ' Logger battery voltage (V) Public LoggerTemp_C ' Datalogger Panel Temperature (deg C) Public KnackAT_C ' HMP45C AIR TEMPERATURE (deg C) Public KnackRH ' HMP45C RELATIVE HUMIDITY (percent) Public BattBankMode As String * 2 ' auto or manual Public BattBankManControl As String * 2 ' a or b Public BattBankStatus As String * 2 ' a or b Public SystemBattVolts ' this voltage is the voltage the system is running on. this depends on whether bank B or A is swithced in. Public YestAvgSystemBV 'this is yesterdays average system battery volts Public RunAvgSystemBV 'this is a running average over the preceeding hour of the average system battery volts ADDED 09/02/2009 RFP Public BattBankA_V ' Battery Bank Voltage (V), 20 batteries in 4 boxes wired in parallel Public BattBankB_V ' Battery Bank B Voltage (V), 40 batteries in ? boxes wired in parallel Public SolarPanel_V ' Solar Panel Output Voltage (V), 2 groups, of 3 panels wired in series, wired in parallel Public SolarCurrent_A ' Solar Panel Output Current (A) Public WindGen_V(3) ' Wind Turbine #1,2, and 3 Output Voltage (V) Public WindCurent_A(3) ' Wind Turbine #1, 2, and 3 Output Current (A) Public Dump1T_C, Dump2T_C, Dump3T_C ' temperature of 3 dump loads Public BattACurrent_A ' Battery Current (A), Positive indicates batteries are charging, Negative indicates batteries are discharging Public BattBCurrent_A ' Battery Bank B Current (A), Positive indicates batteries are charging, Negative indicates batteries are discharging Public MstBattCurrent_A ' This is the combined current related to bank A or B. Public LoggerBattCurrent_A ' ' Battery Current (A), Positive indicates batteries are charging, Negative indicates batteries are discharging Public Cameras_Aac, SatModem_Aac, TPS_Aac, CamerasHeat_Aac Public CameraPowerMode As String *2 ' manual or auto Public CameraPowerManControl As String * 2 ' on OR off Public CameraPowerStatus As String * 2 ' on or off Public CameraOffVolts, CameraOnVolts Public CameraPowerOnMID ' time as Minutes Into Day to turn cameras On Public CameraPowerOffMID ' time as Minutes Into Day to turn cameras Off Public TPS_PowerMode As String * 2' manual or auto Public TPS_PowerManControl As String * 2 ' on or off Public TPS_PowerStatus As String * 2 ' on or off Public TPSonVolts, TPSoffVolts Public CameraHeatMode As String * 2 ' manual or auto Public CameraHeatManControl As String * 2 ' on or off Public CameraHeatStatus As String * 2 ' on or off Public CameraHeatOnVolts, CameraHeatOffVolts Public CameraHtOnMID ' time as Minutes Into Day to turn Camera Heat On Public CameraHtOffMID ' time as Minutes Into Day to turn Camera Heat Off Public Temp_C(16) Public Therm_kOhm(16) Public WindShuntOhm ' Wind Turbine Output Shunt Resistance (ohm), SAME VALUE FOR ALL 3 TURBINES, USER INPUT Public LoggerBattShuntOhm ' Logger Battery Shunt Resistance (ohm) Public SolarShuntOhm ' Solar Panel Output Shunt Resistance (ohm) Public BattAShuntOhm ' Battery Bank Shunt Resistance (ohm) Public BattBShuntOhm ' Battery Bank Shunt Resistance (ohm) Public MstBattShuntOhm ' Master Battery Shunt resistance (ohm) Public WindGenShunt_mV(3) ' Wind Turbine #1,2, and 3 Output Shunt Output (mV) Public LoggerBattShunt_mV ' Logger Battery Shunt Output (mV) Public SolarShunt_mV ' Solar Panel Output Shunt Output (mV) Public BattBankAshunt_mV ' Battery Bank Shunt Output (mV) Public BattBankBshunt_mV ' Battery Bank Shunt Output (mV) Public MstBattShunt_mV ' master bank shunt output (mV) ' Real time variable assigned Public rTime(9) 'declare as public and dimension rTime to 9 Alias rTime(1) = Year 'assign the alias Year to rTime(1) Alias rTime(2) = Month 'assign the alias Month to rTime(2) Alias rTime(3) = DOM 'assign the alias Day to rTime(3) Alias rTime(4) = Hour 'assign the alias Hour to rTime(4) Alias rTime(5) = Minute 'assign the alias Minute to rTime(5) Alias rTime(6) = Second 'assign the alias Second to rTime(6) Alias rTime(7) = uSecond 'assign the alias uSecond to rTime(7) Alias rTime(8) = WeekDay 'assign the alias WeekDay to rTime(8) Alias rTime(9) = Day_of_Year 'assign the alias Day_of_Year to rTime(9) Alias Temp_C(1) = BBAT1_C_1 ' Battery Box #1 Bank A Thermistor #1 Temperature (deg C) Alias Temp_C(2) = BBAT1_C_2 ' Battery Box #1 Bank A Thermistor #2 Temperature (deg C) Alias Temp_C(3) = BBAT2_C_1 ' Battery Box #2 Bank A Thermistor #1 Temperature (deg C) Alias Temp_C(4) = BBAT2_C_2 ' Battery Box #2 Bank A Thermistor #2 Temperature (deg C) Alias Temp_C(5) = BBAT3_C_1 ' Battery Box #3 Bank A Thermistor #1 Temperature (deg C) Alias Temp_C(6) = BBAT3_C_2 ' Battery Box #3 Bank A Thermistor #2 Temperature (deg C) Alias Temp_C(7) = BBAT4_C_1 ' Battery Box #4 Bank A Thermistor #1 Temperature (deg C) Alias Temp_C(8) = BBAT4_C_2 ' Battery Box #4 Bank A Thermistor #2 Temperature (deg C) Alias Temp_C(9) = Enc1_C_1 ' PS2DC Thermistor #1 Temperature (deg C) Alias Temp_C(10) = Enc2_C ' PS2DC Thermistor #2 Temperature (deg C) ' These are TBA. 'Alias Temp_C(11) = BBBT5_C_1 ' Battery Box #? Bank B Thermistor #1 Temperature (deg C) 'Alias Temp_C(12) = BBBT5_C_2 ' Battery Box #? Bank B Thermistor #2 Temperature (deg C) 'Alias Temp_C(13) = BBBT6_C_1 ' Battery Box #? Bank B Thermistor #1 Temperature (deg C) 'Alias Temp_C(14) = BBBT6_C_2 ' Battery Box #? Bank B Thermistor #2 Temperature (deg C) 'Alias Temp_C(15) = BBBT7_C_1 ' Battery Box #? Bank B Thermistor #1 Temperature (deg C) 'Alias Temp_C(16) = BBBT8_C_1 ' Battery Box #? Bank B Thermistor #1 Temperature (deg C) DataTable (TwoMinWd,1,1440) DataInterval (0,2,Min,0) Sample (1,StationID,fp2) Sample (3,WindGen_V(1),FP2) Sample (3,WindCurent_A(1),FP2) EndTable DataTable (HourlyDiag,1,-1) DataInterval(0,60,Min,0) Sample (1,StationID,fp2) Average (1,BattVolts_V,FP2,False) Maximum (1,BattVolts_V,FP2,False,False) Minimum (1,BattVolts_V,FP2,False,False) Average (1,LoggerTemp_C,FP2,False) Maximum (1,LoggerTemp_C,FP2,False,False) Minimum (1,LoggerTemp_C,FP2,False,False) Sample (1,Dump1T_C,FP2) Average (1,Dump1T_C,FP2,False) Maximum (1,Dump1T_C,FP2,False,False) Minimum (1,Dump1T_C,FP2,False,False) Sample (1,Dump2T_C,FP2) Average (1,Dump2T_C,FP2,False) Maximum (1,Dump2T_C,FP2,False,False) Minimum (1,Dump2T_C,FP2,False,False) Sample (1,Dump3T_C,FP2) Average (1,Dump3T_C,FP2,False) Maximum (1,Dump3T_C,FP2,False,False) Minimum (1,Dump3T_C,FP2,False,False) Sample (1,CameraPowerMode,FP2) Sample (1,CameraPowerStatus,FP2) Sample (1,CameraPowerOnMID,FP2) Sample (1,CameraPowerOffMID,FP2) Sample (1,TPS_PowerMode,FP2) Sample (1,TPS_PowerStatus,FP2) Sample (1,CameraHeatMode,FP2) Sample (1,CameraHeatStatus,FP2) Sample (1,CameraHtOnMID,FP2) Sample (1,CameraHtOffMID,FP2) Sample (14,Temp_C(),FP2) EndTable DataTable (HourlyOut,1,-1) DataInterval(0,60,Min,0) Sample(1, StationID, FP2) Sample (1,BattACurrent_A,FP2) Average (1,BattACurrent_A,FP2,False) Maximum (1,BattACurrent_A,FP2,False,False) Minimum (1,BattACurrent_A,FP2,False,False) Sample (1,BattBCurrent_A,FP2) Average (1,BattBCurrent_A,FP2,False) Maximum (1,BattBCurrent_A,FP2,False,False) Minimum (1,BattBCurrent_A,FP2,False,False) Sample (1,LoggerBattCurrent_A,FP2) Average (1,LoggerBattCurrent_A,FP2,False) Maximum (1,LoggerBattCurrent_A,FP2,False,False) Minimum (1,LoggerBattCurrent_A,FP2,False,False) Sample (1,Cameras_Aac,FP2) Average (1,Cameras_Aac,FP2,False) Maximum (1,Cameras_Aac,FP2,False,False) Minimum (1,Cameras_Aac,FP2,False,False) Sample (1,SatModem_Aac,FP2) Average (1,SatModem_Aac,FP2,False) Maximum (1,SatModem_Aac,FP2,False,False) Minimum (1,SatModem_Aac,FP2,False,False) Sample (1,TPS_Aac,FP2) Average (1,TPS_Aac,FP2,False) Maximum (1,TPS_Aac,FP2,False,False) Minimum (1,TPS_Aac,FP2,False,False) Sample (1,CamerasHeat_Aac,FP2) Average (1,CamerasHeat_Aac,FP2,False) Maximum (1,CamerasHeat_Aac,FP2,False,False) Minimum (1,CamerasHeat_Aac,FP2,False,False) Sample (1,SolarCurrent_A,FP2) Average (1,SolarCurrent_A,FP2,False) Maximum (1,SolarCurrent_A,FP2,False,False) Minimum (1,SolarCurrent_A,FP2,False,False) Sample (3,WindCurent_A(),FP2) Average (3,WindCurent_A(),FP2,False) Maximum (3,WindCurent_A(),FP2,False,False) Minimum (3,WindCurent_A(),FP2,False,False) Sample (1,BattBankA_V,FP2) Average (1,BattBankA_V,FP2,False) Maximum (1,BattBankA_V,FP2,False,False) Minimum (1,BattBankA_V,FP2,False,False) Sample (1,BattBankB_V,FP2) Average (1,BattBankB_V,FP2,False) Maximum (1,BattBankB_V,FP2,False,False) Minimum (1,BattBankB_V,FP2,False,False) Sample (1,SolarPanel_V,FP2) Average (1,SolarPanel_V,FP2,False) Maximum (1,SolarPanel_V,FP2,False,False) Minimum (1,SolarPanel_V,FP2,False,False) Sample (3,WindGen_V(),FP2) Average (3,WindGen_V(),FP2,False) Maximum (3,WindGen_V(),FP2,False,False) Minimum (3,WindGen_V(),FP2,False,False) Sample (1,KnackRH,FP2) Average (1,KnackRH,FP2,False) Sample (1,KnackAT_C,FP2) Average (1,KnackAT_C,FP2,False) EndTable DataTable (RawDataOut,1,-1) DataInterval (0,60,Min,0) Sample(1, StationID, FP2) Sample(3, WindGenShunt_mV(1), FP2) Sample (1,LoggerBattShunt_mV,FP2) Sample(1, SolarShunt_mV, FP2) Sample(1, BattBankAshunt_mV, FP2) Sample (1,BattBankBshunt_mV,FP2) Sample (16,Therm_kOhm(),FP2) Sample (1,BattBankStatus,FP2) EndTable DataTable (DailyOut,1,-1) DataInterval (0,1440,Min,0) Sample(1, StationID, FP2) Average (1,BattACurrent_A,FP2,False) Maximum (1,BattACurrent_A,FP2,False,False) Minimum (1,BattACurrent_A,FP2,False,False) Average (1,BattBCurrent_A,FP2,False) Maximum (1,BattBCurrent_A,FP2,False,False) Minimum (1,BattBCurrent_A,FP2,False,False) Average (1,LoggerBattCurrent_A,FP2,False) Maximum (1,LoggerBattCurrent_A,FP2,False,False) Minimum (1,LoggerBattCurrent_A,FP2,False,False) Average (1,Cameras_Aac,FP2,False) Maximum (1,Cameras_Aac,FP2,False,False) Minimum (1,Cameras_Aac,FP2,False,False) Average (1,SatModem_Aac,FP2,False) Maximum (1,SatModem_Aac,FP2,False,False) Minimum (1,SatModem_Aac,FP2,False,False) Average (1,TPS_Aac,FP2,False) Maximum (1,TPS_Aac,FP2,False,False) Minimum (1,TPS_Aac,FP2,False,False) Average (1,CamerasHeat_Aac,FP2,False) Maximum (1,CamerasHeat_Aac,FP2,False,False) Minimum (1,CamerasHeat_Aac,FP2,False,False) Average (1,SolarCurrent_A,FP2,False) Maximum (1,SolarCurrent_A,FP2,False,False) Minimum (1,SolarCurrent_A,FP2,False,False) Average (3,WindCurent_A(),FP2,False) Maximum (3,WindCurent_A(),FP2,False,False) Minimum (3,WindCurent_A(),FP2,False,False) Average (1,SystemBattVolts,FP2,False) Maximum (1,SystemBattVolts,FP2,False,False) Minimum (1,SystemBattVolts,FP2,False,False) Average (1,BattBankA_V,FP2,False) Maximum (1,BattBankA_V,FP2,False,False) Minimum (1,BattBankA_V,FP2,False,False) Average (1,BattBankB_V,FP2,False) Maximum (1,BattBankB_V,FP2,False,False) Minimum (1,BattBankB_V,FP2,False,False) Average (1,SolarPanel_V,FP2,False) Maximum (1,SolarPanel_V,FP2,False,False) Minimum (1,SolarPanel_V,FP2,False,False) Average (3,WindGen_V(),FP2,False) Maximum (3,WindGen_V(),FP2,False,False) Minimum (3,WindGen_V(),FP2,False,False) Average (1,KnackAT_C,FP2,False) Maximum (1,KnackAT_C,FP2,False,False) Minimum (1,KnackAT_C,FP2,False,False) Average (1,KnackRH,FP2,False) Maximum (1,KnackRH,FP2,False,False) Minimum (1,KnackRH,FP2,False,False) EndTable BeginProg Scan(10,Sec, 3, 0) ''''''''''''''''''<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 10 for testing, change to 60 StationID = 141 ' SET STATION ID ' get the real time into variables RealTime (rTime) ' compute Minutes Into Day from hours and minutes into the hour. MinIntoDay = (Hour * 60) + Minute ' initialize the default (power up) conditions If Initialized = 0 Then CameraHeatManControl = "on" CameraHeatMode = "manual" CameraHeatOnVolts = 12.5 CameraHeatOffVolts = 12.3 CameraHtOnMID = 720 ' 1200 noon CameraHtOffMID = 780 ' 1300 CameraPowerManControl = "on" CameraPowerMode = "manual" CameraOnVolts = 12.2 CameraOffVolts = 12.0 CameraPowerOnMID = 360 ' 0600 CameraPowerOffMID = 1320 ' 2200 BattBankMode = "manual" BattBankManControl = "b" TPS_PowerManControl = "on" TPS_PowerMode = "manual" TPSonVolts = 12.2 TPSoffVolts = 12.0 Initialized = 1 EndIf '''''''''''''''''''''''''''''''''''''''''''''''''''' ' ' ' READ INDIVIDUAL SENSORS ' ' ' '''''''''''''''''''''''''''''''''''''''''''''''''''' ' MEASURE BATTERY VOLTAGE (V) Battery(BattVolts_V) 'MEASURE DATALOGGER PANEL TEMPERATURE (deg C) PanelTemp(LoggerTemp_C, 250) ' MEASURE AIR TEMPERATURE & RELATIVE HUMIDITY WITH HMP45C 'MEASURE AIR TEMPERATURE, HMP45C (deg C) VoltSe(KnackAT_C, 1, mV2500, 6, False, 0, 250, 0.1, -40) 'MEASURE RELATIVE HUMIDITY, HMP45C (percent) VoltSe(KnackRH, 1, mV2500, 5, False, 0, 250, 0.1, 0) 'Measure third TC for Dump temperature. TCDiff (Dump3T_C,1,AutorangeC,6,TypeK,LoggerTemp_C,True ,0,250,1.0,0) '''''''''''''''''''''''''''''''''''''''''''''''''''' ' ' ' READ CS10 CURRENTS ' ' ' '''''''''''''''''''''''''''''''''''''''''''''''''''' VoltSe (i_sig(1, 1),num_samples,mV2500,-7,True,dt,0,1.0,0) 'Changed offset to 0 from -1250 09/02/2009 RFP StdDevSpa (i_phase, num_samples, i_sig(1, 1)) i_phase = i_phase * 0.05 ' convert to amps; ' Changed 0.2 multiplier for the CS10-L to 0.05 to reflect 4 wraps of wire around torus 09/02/2009 RFP ' If i_phase < 0.15 Then i_phase = 0 'Filter low end noise when current near zero COMMENTED OUT 09/09/09 Paetzold Cameras_Aac = i_phase ' rename the general current label to new name VoltSe (i_sig(1, 1),num_samples,mV2500,-8,True,dt,0,1.0,0) 'Changed offset to 0 from -1250 09/02/2009 RFP StdDevSpa (i_phase, num_samples, i_sig(1, 1)) i_phase = i_phase * 0.05 ' convert to amps; ' Changed 0.2 multiplier for the CS10-L to 0.05 to reflect 4 wraps of wire around torus 09/02/2009 RFP ' If i_phase < 0.15 Then i_phase = 0 'Filter low end noise when current near zero COMMENTED OUT 09/09/09 Paetzold SatModem_Aac = i_phase ' rename the general current label to new name VoltSe (i_sig(1, 1),num_samples,mV2500,-9,True,dt,0,1.0,0) 'Changed offset to 0 from -1250 09/02/2009 RFP StdDevSpa (i_phase, num_samples, i_sig(1, 1)) i_phase = i_phase * 0.05 ' convert to amps; ' Changed 0.2 multiplier for the CS10-L to 0.05 to reflect 4 wraps of wire around torus 09/02/2009 RFP ' If i_phase < 0.15 Then i_phase = 0 'Filter low end noise when current near zero COMMENTED OUT 09/09/09 Paetzold TPS_Aac = i_phase ' rename the general current label to new name VoltSe (i_sig(1, 1),num_samples,mV2500,-10,True,dt,0,1.0,0) 'Changed offset to 0 from -1250 09/02/2009 RFP StdDevSpa (i_phase, num_samples, i_sig(1, 1)) i_phase = i_phase * 0.05 ' convert to amps; ' Changed 0.2 multiplier for the CS10-L to 0.05 to reflect 4 wraps of wire around torus 09/02/2009 RFP ' If i_phase < 0.15 Then i_phase = 0 'Filter low end noise when current near zero COMMENTED OUT 09/09/09 Paetzold CamerasHeat_Aac = i_phase ' rename the general current label to new name ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; '; ;; '; BEGIN MULTIPLEXER SECTION ;; '; ;; ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 'TURN MULTIPLEXER OFF (From instruction P86 parameter 1) PortSet(1, 0) Delay (0,10,mSec) 'TURN MULTIPLEXER ON PortSet(1, 1) 'BEGIN THERMISTOR LOOP i = 1 SubScan (0,Sec,16) 'ADVANCE MULTIPLEXER INPUT GROUP (From instruction P86 parameter 1) PulsePort(4,10000) 'READ BATTERY BOX THERMISTORS (mV X 0.0004) 'TO SCALE TO EXCITATION VOLTAGE FOR X (From instruction P4 parameter 8) BrHalf(Therm(i), 1, mV2500, 1, VX1, 1, 2500,True,0,_60Hz, 1, 0) i = i + 1 NextSubScan 'CONVERT MEASURED VOLTAGE RATIO TO RESISTANCE (kOHM) FOR 36 GWS THERMISTORS For i=1 To 16 Therm_kOhm(i) = Rf_1*Therm(i)/(1-Therm(i)) Next i 'CONVERT GWS THERMISTOR RESISTANCE TO deg C FOR 36 GWS THERMISTORS For i=1 To 16 D(i) = LN (1000*Therm_kOhm(i)) 'ln resistance (ohm) Temp_C(I) = (1/(x + y*D(i) + z*(D(i))^3)) - 273.15 'Steinhart & Hart Equation Next i ' Start voltage readings on the multiplexer ' Reset mux to start back on Set 1. 'TURN MULTIPLEXER OFF PortSet(1,0) 'TURN MULTIPLEXER ON PortSet(1, 1) 'ADVANCE MULTIPLEXER to Set 1 PulsePort(4,10000) 'Read dump 1 tc temp TCDiff (Dump1T_C,1,AutorangeC,2,TypeK,LoggerTemp_C,True ,0,250,1.0,0) 'ADVANCE MULTIPLEXER to Set 2 PulsePort(4,10000) 'Read dump 2 tc temp TCDiff (Dump2T_C,1,AutorangeC,2,TypeK,LoggerTemp_C,True ,0,250,1.0,0) 'ADVANCE MULTIPLEXER to Set 3 PulsePort(4,10000) 'READ Logger BATTERY SHUNT VOLTAGE (mV), POSITIVE INDICATES CHARGING, NEGATIVE INDICATES DISCHARGING VoltDiff(LoggerBattShunt_mV, 1,AutorangeC, 2, True, 0, 250, 1, 0) 'ADVANCE MULTIPLEXER INPUT GROUP to Set 4 PulsePort(4,10000) 'READ BATTERY BANK B SHUNT VOLTAGE (mV), POSITIVE INDICATES CHARGING, NEGATIVE INDICATES DISCHARGING VoltDiff(BattBankBshunt_mV, 1,AutorangeC, 2, True, 0, 250, 1, 0) 'ADVANCE MULTIPLEXER INPUT GROUP to Set 5-7 ' READ WIND TURBINE CURRENT OUTPUT 'BEGIN WIND TURBINE SHUNT VOLTAGE LOOP i = 1 SubScan (0,Sec,3) 'ADVANCE MULTIPLEXER INPUT GROUP (From instruction P86 parameter 1) PulsePort(4,10000) 'READ WIND TURBINE VOLTAGES (V) VoltDiff(WindGenShunt_mV(i), 1,AutorangeC, 2, True, 0, 250, 1, 0) i = i + 1 NextSubScan 'ADVANCE MULTIPLEXER INPUT GROUP to set 8 PulsePort(4,10000) 'READ BATTERY BANK VOLTAGE (V) VoltDiff(BattBankB_V, 1,mv2500, 2, True, 0, 250, 0.02, 0) ' change previous mv2500C to mv2500 'ADVANCE MULTIPLEXER INPUT GROUP to set 9 PulsePort(4,10000) 'READ SOLAR PANEL VOLTAGE (V) VoltDiff(SolarPanel_V, 1,mv5000, 2, True, 0, 250, 0.02, 0) 'ADVANCE MULTIPLEXER INPUT GROUP set 10 PulsePort(4,10000) 'READ BATTERY BANK VOLTAGE (V) VoltDiff(BattBankA_V, 1,mv2500, 2, True, 0, 250, 0.02, 0) ' change previous mv2500C to mv2500 'BEGIN WIND TURBINE VOLTAGE LOOP set 11-13 i = 1 SubScan (0,Sec,3) 'ADVANCE MULTIPLEXER INPUT GROUP (From instruction P86 parameter 1) PulsePort(4,10000) 'READ WIND TURBINE VOLTAGES (V) VoltDiff(WindGen_V(i), 1,mv5000, 2, True, 0, 250, 0.02, 0) 'END WIND TURBINE VOLTAGE LOOP i = i + 1 NextSubScan 'ADVANCE MULTIPLEXER INPUT GROUP set 14 PulsePort(4,10000) 'READ BATTERY BANK SHUNT VOLTAGE (mV), POSITIVE INDICATES CHARGING, NEGATIVE INDICATES DISCHARGING VoltDiff(BattBankAshunt_mV, 1,AutorangeC, 2, True, 0, 250, 1, 0) 'ADVANCE MULTIPLEXER INPUT GROUP set 15 PulsePort(4,10000) 'READ COMBINED SOLAR PANEL SHUNT VOLTAGE (mV) VoltDiff(SolarShunt_mV, 1,AutorangeC, 2, True, 0, 250, 1, 0) 'ADVANCE MULTIPLEXER INPUT GROUP set 16 PulsePort(4,10000) 'READ Master battery SHUNT VOLTAGE (mV) VoltDiff(MstBattShunt_mV, 1,AutorangeC, 2, True, 0, 250, 1, 0) 'TURN MULTIPLEXER OFF (From instruction P86 parameter 1) PortSet(1, 0) ';;;;;;;;;;;;;;;;;;;;;;;;;;;;; '; ;; '; DATA CONVERSIONS ;; '; ;; ';;;;;;;;;;;;;;;;;;;;;;;;;;;;; 'RESISTANCE OF WIND TURBINE SHUNT (ohm) 50mV/500A WindShuntOhm = 0.0001 ' Resistance of logger battery shunt (ohm) 50mV/10A LoggerBattShuntOhm = 0.005 'RESISTANCE OF SOLAR PANEL OUTPUT SHUNT (ohm) 100mV/100A SolarShuntOhm = .001 ' Resistance of battery A shunt (ohm) 50mV/500A BattAShuntOhm = 0.0001 ' Resistance of battery B shunt (ohm) 50mV/500A BattBShuntOhm = 0.0001 'RESISTANCE OF MasterBattery SHUNT (ohm) 50mV/500A MstBattShuntOhm = 0.0001 'CALCULATE WIND TURBINE #1 OUTPUT CURRENT (amp) WindCurent_A(1) = (WindGenShunt_mV(1) / WindShuntOhm)/1000 'CALCULATE WIND TURBINE #2 OUTPUT CURRENT (amp) WindCurent_A(2) = (WindGenShunt_mV(2) / WindShuntOhm)/1000 'CALCULATE WIND TURBINE #3 OUTPUT CURRENT (amp) WindCurent_A(3) = (WindGenShunt_mV(3) / WindShuntOhm)/1000 ' Calculate logger current. LoggerBattCurrent_A = (LoggerBattShunt_mV /LoggerBattShuntOhm) / 1000 'CALCULATE SOLAR PANEL OUTPUT CURRENT (amp) SolarCurrent_A = (SolarShunt_mV / SolarShuntOhm)/1000 'CALCULATE BATTERY BANK CURRENT (amp), POSITIVE INDICATES CHARGING, NEGATIVE INDICATES DISCHARGING BattACurrent_A = (BattBankAshunt_mV / BattAShuntOhm)/1000 'CALCULATE BATTERY BANK B CURRENT (amp), POSITIVE INDICATES CHARGING, NEGATIVE INDICATES DISCHARGING BattBCurrent_A = (BattBankBshunt_mV / BattBShuntOhm)/1000 'CALCULATE Master BATTERY CURRENT (amp), POSITIVE INDICATES CHARGING, NEGATIVE INDICATES DISCHARGING MstBattCurrent_A = (MstBattShunt_mV / MstBattShuntOhm)/1000 ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; '; ;; '; RELAY CONTROLS ;; '; ;; ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ' The public variables BattBankMode and BattBankManControl controls which battery bank is switched in. ' If BattBankMode is manual and BattBankManControl is set to A, A is connected, if B, B. ' The default setting is B. If BattBankMode = "manual" AND BattBankManControl = "b" Then PortSet(5, 0) ' Bank B connected --- Default If BattBankMode = "manual" AND BattBankManControl = "a" Then PortSet(5, 1) ' Bank A connected ' get the daily average system battery voltage from yesterday ' the system battery voltage is the voltage of the bank, a or b, that the system is running on. ' it is used to evaluate the charge state of the batteries. YestAvgSystemBV = DailyOut.SystemBattVolts_Avg ' if YestAvgSystemBV is < 12.4 then not charged ' if YestAvgSystemBV is > 13.4 then charged ' daily at noon, check to switch battery banks. '''''''''''''''' If IfTime (720, 1440,Min) Then ''''''''''''''''' If BattBankMode = "auto" AND BattBankStatus = "b" AND BattBankB_V < 12.0 AND YestAvgSystemBV < 12.4 Then PortSet (5,1) ' A connected ' If BattBankMode = "auto" AND BattBankStatus = "a" AND BattBankA_V < 11.7 AND YestAvgSystemBV < 12.4 Then PortSet (5,0) ' B connected ' If BattBankMode = "auto" AND BattBankStatus = "b" AND BattBankB_V > 12.8 AND YestAvgSystemBV > 13.4 Then PortSet (5,1) ' A connected ' If BattBankMode = "auto" AND BattBankStatus = "a" AND BattBankA_V > 12.7 AND YestAvgSystemBV > 13.4 Then PortSet (5,0) ' B connected ' If BattBankMode = "auto" AND BattBankA_V > 12.7 AND BattBankB_V > 12.8 Then PortSet (5,0) ' B connected ''''''''''''''''' EndIf ' Get the battery bank status from status of port 5 BattBankStatus = CheckPort(5) If BattBankStatus Then BattBankStatus = "a" Else BattBankStatus = "b" ' set the variable SystemBattVolts equal to the voltage of the battery that is switched in to power the system. If BattBankStatus = "a" Then SystemBattVolts = BattBankA_V If BattBankStatus = "b" Then SystemBattVolts = BattBankB_V ' Calculate Running Average System Battery Volts CHANGED 09/05/2009 RFP AvgRun (RunAvgSystemBV,1,SystemBattVolts,720) ' changed from 10 minutes to 720 18Sep2009 AMcHugh ' Modem Control ' Without any other control RESET MODEM ONCE PER WEEK ' Port 9 is SW12V. With Port 9 = 0, Modem is On. ' SW12V controls the modem relay. The modem relay is a Normally Closed relay which means, when de-energized the contacts are closed. ' When SW12V is on, the relay is open and the modem is off. By default, SW12V is off and the modem is on. ' Once a week, at 1 minute past midnight on saturday night (sunday morning), the modem is turned off for one scan interval. If WeekDay = 1 AND MinIntoDay = 1 Then PortSet (9,1) ' Turn Modem Off Else PortSet (9,0) ' Else turn modem On for all other times. EndIf ' CAMERA CONTROLS 'CameraPowerMode has two states, manual and auto. 'If in manual, CameraPowerManControl determines if the cameras (Cameras #1, #2 & #3) are On or Off. 'If in auto and SystemBattVolts > 11.8, the cameras are turned on at CameraPowerOnMID and turned Of at CameraPowerOffMID. MID stands for Minutes Into the Day. 'The relay that controls the camera power is Port 2. 'If the SystemBattVolts < 11.8, the cameras will be turn off. ' The port status is followed by CameraPowerStatus If CameraPowerMode = "manual" AND CameraPowerManControl = "off" Then PortSet(2, 0) If CameraPowerMode = "manual" AND CameraPowerManControl = "on" AND RunAvgSystemBV > CameraOnVolts Then PortSet(2, 1) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP If CameraPowerMode = "auto" AND RunAvgSystemBV > CameraOnVolts AND MinIntoDay = CameraPowerOnMID Then PortSet(2, 1) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP If CameraPowerMode = "auto" AND MinIntoDay = CameraPowerOffMID Then PortSet(2, 0) If RunAvgSystemBV < CameraOffVolts Then PortSet (2,0) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP CameraPowerStatus = CheckPort (2) If CameraPowerStatus Then CameraPowerStatus = "on" Else CameraPowerStatus = "off" ' TPS Power Control ' TPS_ManControl has two states, manual and auto. ' if in manual, TPS_PowerManControl determines if the TSP power is on or off. ' If TPS_Power is on, the power is on, if off, off. ' If the SystemBattVolts < 12.1, the TPS is turned off. If TPS_PowerMode = "manual" AND TPS_PowerManControl = "off" Then PortSet(3, 0) If TPS_PowerMode = "manual" AND TPS_PowerManControl = "on" AND RunAvgSystemBV > TPSonVolts Then PortSet(3, 1) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP If TPS_PowerMode = "auto" AND RunAvgSystemBV > TPSonVolts Then PortSet(3, 1) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP If RunAvgSystemBV < TPSoffVolts Then PortSet (3,0) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP TPS_PowerStatus = CheckPort (3) If TPS_PowerStatus Then TPS_PowerStatus = "on" Else TPS_PowerStatus = "off" ' Control CAMERA HEATERS 'CameraHeatMode has two states, manual and auto. 'If in manual, CameraHeatManControl determines if the heaters are On or Off. 'If in auto and SystemBattVolts > 12.3, the heaters are turned on at CameraHtOnMID and turned Off at CameraHtOffMID. MID stands for Minutes Into the Day. 'If in auto and the camera are off, the camera heaters will not turn on. 'The relay that controls the camera heaters is Port 6. 'If the SystemBattVolts < 12.3, the camera heat is turned off. If CameraHeatMode = "manual" AND CameraHeatManControl = "off" Then PortSet(6, 0) If CameraHeatMode = "manual" AND CameraHeatManControl = "on" AND RunAvgSystemBV > CameraHeatOnVolts Then PortSet(6, 1) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP If CameraHeatMode = "auto" AND RunAvgSystemBV > CameraHeatOnVolts AND CameraPowerStatus = "on" AND MinIntoDay = CameraHtOnMID Then PortSet(6, 1) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP If CameraHeatMode = "auto" AND MinIntoDay = CameraHtOffMID Then PortSet(6, 0) If CameraHeatMode = "auto" AND CameraPowerStatus = "off" Then PortSet (6,0) If RunAvgSystemBV < CameraHeatOffVolts Then PortSet (6,0) 'CHANGED SystemBattVolts to RunAvgSystemBV 09/02/2009 RFP CameraHeatStatus = CheckPort (6) If CameraHeatStatus Then CameraHeatStatus = "on" Else CameraHeatStatus = "off" CallTable TwoMinWd CallTable HourlyDiag CallTable HourlyOut CallTable RawDataOut CallTable DailyOut NextScan EndProg