Home

stc simulator - Solarthermalworld.org

image

Contents

1. 1 3 0 mathtemp 0 005434431407362 pow float sumadc1 2 0 mathtemp 3 42056952004796 float sumadc1 mathtemp 1752 29254309834 1 signed short int mathtemp mathtemp 0 00000273 1 1984329 pow float sumadc 1 4 0 mathtemp 0 0194388633179569 pow float sumadc1 3 0 mathtemp 51 8906752847686 pow float sumadc1 2 0 mathtemp 61571 2006129863 float sumadc1 mathtemp 27398743 425479 1 signed short int mathtemp if sumadc2 1690 else mathtemp 0 00000000000058244 pow float sumadc2 5 0 mathtemp 0 00000000281568562 pow float sumadc2 4 0 mathtemp 0 0000055156724076 pow float sumadc2 3 0 mathtemp 0 00561707930690793 pow float sumadc2 2 0 mathtemp 3 5006271502258 float sumadc2 mathtemp 1765 26105212894 tempsens2 signed short int mathtemp mathtemp 0 000001786899713 pow float sumadc2 4 0 mathtemp 0 0124091806685994 pow float sumadc2 3 0 mathtemp 32 32293853072 pow float sumadc2 2 0 mathtemp 37425 3414366233 float sumadc2 mathtemp 16251527 2286374 tempsens2 signed short int mathtemp j if sumadc3 1690 else 1 mathtemp 0 00000000000058244 pow float sumadc3 5 0 mathtemp 0 0000000028 1568562 pow float sumadc3 4 0 mathtemp 0 0000055 156724076 pow float sumadc3 3 0 mathtemp 0 00561707930690793 pow float sumadc3 2 0 mathtemp
2. int adcread2 0 tadcread2 8 int adcread3 0 tadcread3 8 int adcread4 0 adcread4 8 H int adcread5 0 tadcread5 8 int adcread6 0 tadcread6 8 int adcread7 0 tadcread7 8 int adcread8 0 adcread8 8 int adcread9 0 Fadcread9 8 adcreadl k AdcValues 0 adcread2 k AdcValues 1 adcread3 k AdcValues 2 adcread4 k AdcValues 3 adcread5 k AdcValues 4 adcread6 k AdcValues 5 adcread7 k AdcValues 6 adcread8 k AdcValues 7 adcread9 k AdcValues 8 adcread10 k AdcValues 9 adcread1 AdcValues 10 adcread12 k AdcValues 1 1 if k lt 9 k else k 0 sumadc1 unsigned short tadcread1 1 adcread1 9 adcread1 2 H sumadc2 unsigned short adcread2 1 H adcread2 9 adcread2 2 H sumadc3 unsigned short Fadcread3 1 H adcread3 9 Fadcread3 2 H sumadc4 unsigned short Fadcread4 1 H adcread4 9 adcread4 2 H sumadcs5 unsigned short tadcread5 1 adcread5 9 adcread5 2 H sumadc6 unsigned short adcread6 1 4 adcread6 9 adcread6 2 4 sumadc7 unsigned short tadcread7 1 adcread7 9 adcread7 2 H sumadc8 unsigned short adcread8 1 4 adcread8 9 Fadcread8 2 H sumadc9 unsigned short tadcread9 1 adcread9 9 flowtick1 flowtick2 0 adcread1 3 H adcread2 3 H adcread3 3 H a
3. _ 5 PORTC_RC6 define PORTC_RC7 define TRISC_RCO define TRISC RCI define TRISC RC2 define TRISC RC3 define TRISC_RC4 define TRISC RC5 define TRISC RC6 define TRISC RC7 define PORTD define PORTD RDI define PORTD RD2 define PORTD RD3 define PORTD RD4 define PORTD RD5 define PORTD RD6 define PORTD RD7 define TRISD RDO define TRISD RDI define TRISD RD2 define TRISD RD3 define TRISD 4 define TRISD RD5 define TRISD RD6 define TRISD RD7 define PORTE REO define PORTE REI define PORTE RE2 define PORTE define PORTE REA define PORTE RES define PORTE RE6 define PORTE RE7 define TRISE REO define TRISE REI define TRISE RE2 define TRISE define TRISE REA define TRISE RES define TRISE RE6 define TRISE RE7 define PORTF RFO define PORTF RFI define RF2 define PORTF_RF3 define 4 define 5 define RF6 define define TRISF RFO define TRISF RFI 5 RC6 RC7 TRISCO TRISCI TRISC2 TRISC3 TRISC4 TRISCS5 TRISC6 TRISC7 RE7 TRISEO TRISE1 TRISE2 TRISE3 TRISE4 TRISES TRISE6 TRISE7 TRISFO TRISF1 117 define TRISF TRISF2 define TRISF_RF3 TRISF3 define TRISF_RF4 TRISF4 define TRISF_RF5 TRISF5 define TRISF_RF6 TRISF6 define TRISF_RF7 TRISF7 define PORTG_RGO RGO define PORTG RGI RGI define PORTG 02 RG2 define PORTG_RG3 RG3
4. static volatile near unsigned char TXREG OxFAD CPUS with dual SPI units if defined 18F6527 defined 18F6627 ifndef SSPCONI define SSPCONI SSPICONI endif ifndef SSPCON2 define SSPCON2 SSPICON2 endif ifndef SSPBUF define SSPBUF SSPIBUF endif ifndef BCLIF define BCLIF BCLIIF endif ifndef BAUDCON define BAUDCON BAUDCONI endif ifndef SPBRGH define SPBRGH 1 endif ifndef TXSTA define TXSTA TXSTAI endif ifndef RCSTA define RCSTA RCSTAI 115 endif ifndef RCREG define RCREG endif ifndef SPBRG define SPBRG endif ifndef SSPSTAT define SSPSTAT endif ifndef SSPADD define SSPADD endif endif Bit Definitions define PORTA_RAO define PORTA RAI define PORTA RA2 define PORTA RA3 define PORTA 4 define PORTA RAS define TRISA RAO define TRISA RAI define TRISA RA2 define TRISA RA3 define TRISA 4 define TRISA RAS define PORTB RBO define PORTB RBI define PORTB RB2 define PORTB RB3 define PORTB_RB4 define PORTB RB5 define PORTB RB6 define PORTB RB7 define define TRISB RBI define RB2 define TRISB_RB3 define 4 define TRISB RBS define RB6 define RB7 define RCO define PORTC RCI define PORTC RC2 define PORTC RC3 define PORTC 4 SPBRGI SSPISTAT SSPIADD RC4 116
5. 2 Central Texas falls in the region that receives 5 0 5 5 kWhr per day on average This is equivalent to 208 33 229 17 W m of irradiance that is available for heating water analyze the economic impact of a solar water heating system the three main things that need to be considered are the operating cost of a standard non solar power augmented system the cost of adding a solar powered system and the operating cost that would be offset by adding a solar powered system Appendix E outlines an in depth conceptual analysis and feasibility study for a sample residential solar thermal collector system being used in Waco Texas A typical water heating installation only includes a water heating tank which stores and maintains the temperature of water to be used in the household Two important factors affecting the cost of a conventional water heating system are the efficiency of the heating tank and the price of the energy used to heat the water There are other factors that affect operating cost but their impact would be seen with a solar powered system as well thus they do not play a part in the economic analysis The efficiency of water heaters depends on the size of the tank and the source of the energy to provide the heat Tank size is dependent on needed capacity or first hour capacity which is the peak amount of hot water that would be needed in a one hour period For a typical four person family this can vary from 40
6. 20 0 20 40 60 80 100 120 Temperature C Figure 7 ADC count versus temperature response curve The points where the voltage is zero occurring at 0 180 and 360 are referred to as zero cross points A TRIAC acts like a gate controlling when power is allowed to flow through it The three pins on a TRIAC are power in power out and a gate pin While the gate pin is pulsed high power is allowed to flow from inlet to outlet If the gate pin falls low power will continue to flow until a zero crossing of the current This characteristic allows a user to turn the power on at a specific point in the power curve half cycle and have it stop at the next zero cross if a pulse is applied to the gate pin The amount of time the pulse is delayed from the start of the half wave is called the firing delay A shorter firing delay corresponds to more power being output to the load due to more of the wave being sent A detailed method for calculating the firing delay can be found in Appendix B 14 The firing delay the STCS uses needs to be calibrated periodically To calibrate the system there are two push buttons on the board that allow the firing delay to be changed by increasing or decreasing a firing delay modifier value If an output power is requested that has a known firing delay the user can use an oscilloscope to see the waveform and adjust the delay modifier amount by pressing and holding one of the two buttons Once the proper firi
7. j else if PORTC RC5 0 amp amp PORTB RB7 1 1 i 500 while 1 0 1 delayval i else if PORTC_RCS5 1 amp amp PORTB_RB7 1 1 XEEBeginRead EEPROM CONTROL OxFFF0 delayval2 XEERead delayval3 XEERead XEEEndRead delayval3 delayval2 8 delayval3 if delayval delayval3 delayval2 delayval gt gt 8 delayval3 delayval delayval2 lt lt 8 XEEBeginWrite EEPROM CONTROL OxFFF0 XEEWrite delayval2 XEEWrite delayval3 XEEEndWrite button ctr 0 PORTC 1 2 1 i 500000 while i 0 j 1 1 4000 0 CLRWDT j j PORTC 0 PORTC RC2 0 j j CLRWDT j button ctr 0 INI For DHCP information display how many times we have renewed the IP configuration since last reset if DHCPBindCount myDHCPBindCount if DEBUG MAIN gt LOG INFO 94 debugPutMsg 2 mxd 2 DHCP Bind Count D debugPutByteHex DHCPBindCount endif Display new IP address if DEBUG_MAIN gt LOG_INFO debugPutMsg 3 mxd 3 DHCP complete IP D D D D debugPutByteHex AppConfig MyIPAddr v 0 debugPutByteHex AppConfig MyIP A ddr v 1 debugPutByteHex AppConfig MyIP A ddr v 2 debugPutByteHex AppConfig MyIP A ddr v 3 endif myDHCPBindCount DHCPBindCount if defined STACK_ USE ANNOUNCE AnnouncelP endif static void ProcessIO void Convert next AD
8. 3 5006271502258 float sumadc3 mathtemp 1765 26105212894 tempsens3 signed short int mathtemp mathtemp 0 000001786899713 pow float sumadc3 4 0 mathtemp 0 0124091806685994 pow float sumadc3 3 0 mathtemp 32 32293853072 pow float sumadc3 2 0 mathtemp 37425 3414366233 float sumadc3 mathtemp 16251527 2286374 105 tempsens3 signed short int mathtemp if sumadc4 lt 1690 mathtemp 0 00000000000058244 pow float sumadc4 5 0 mathtemp 0 0000000028 1568562 pow float sumadc4 4 0 mathtemp 0 0000055 156724076 pow float sumadc4 3 0 mathtemp 0 00561707930690793 pow float sumadc4 2 0 mathtemp 3 5006271502258 float sumadc4 mathtemp 1765 26105212894 tempsens4 signed short int mathtemp else mathtemp 0 000001786899713 pow float sumadc4 4 0 mathtemp 0 0124091806685994 pow float sumadc4 3 0 mathtemp 32 32293853072 pow float sumadc4 2 0 mathtemp 37425 3414366233 float sumadc4 mathtemp 16251527 2286374 tempsens4 signed short int mathtemp if sumadc5 lt 1630 4 mathtemp 0 00000000000070673 pow float sumadc5 5 0 mathtemp 0 000000003 17675615 pow float sumadc5 4 0 mathtemp 0 00000579381911871 pow float sumadc5 3 0 mathtemp 0 00553711614386062 pow float sumadc5 2 0 mathtemp 3 32513525690608 float sumadc5 mathtemp 1721 35016038486 tempsens5 signed short int mathtemp else ma
9. Time To Live in Seconds When defined the code will be compiled for optimal speed If not defined code is defined for smallest size define IP SPEED OPTIMIZE ok oF oe addtogroup mod conf projdefs b IP For details on configuring the IP module ref ip conf click here x t 9k ok sk ok ok sk E sk ok ok afe afe ale ale ok ale Mac Configuration Yk IESE ale ske ale ske ale ale I ICE A When STACK USE FAST NIC is defined a bit longer but faster code is used define STACK USE FAST NIC When defined the code will be compiled for optimal speed If not defined code 15 defined for smallest size define MAC SPEED OPTIMIZE STACK DISABLES can be defined if interrupts are to be disabled during the MAC access routines define STACK DISABLES INTS NIC DISABLE INTO can be defined if the MAC should NOT use INTO connected to PIC port for it s hnterrupt request status line When defined INTO is tri stated and the PIC port pin connected to ht can be used as a general purpose user IO pin The PIC port pin that becomes available is For SBC44EC this has no affect no PIC pins are connected to the interrupt pins For SBC45EC this has no affect PIC pins are connected to
10. defined 18F452 4 18458 defined 18F458 define CLOCK_ FREQ 200000001 Hz elif defined __18F6621 defined _18F6621 defined __18F6527 defined 18F6527 defined __18F6627 defined 18F6627 defined 18 6680 defined 18F6680 define CLOCK_ FREQ 40000000L Hz addtogroup mod conf projdefs Q code define DEBUG OFF endcode Configures if debug information is written out onto the serial port For the production version of this project this define should NOT be defined lt br gt Debug Configuration When uncommenting any of the following line remember to uncomment a debug implementation in debug h For example uncommend serint h and link serint c with project lt br gt For details see ref mod sys debug Debugging module Set Debug Log levels to one of the following LOG OFF LOG DEBUG LOG INFO LOG WARN LOG ERROR LOG FATAL define DEBUG OFF release Ensure this is included ifdef DEBUG OFF define DEBUG ANNOUNCE LOG OFF define DEBUG_APPCFG LOG OFF define DEBUG_CMD LOG OFF define DEBUG DHCP LOG OFF define DEBUG DNS LOG OFF define DEBUG FTP LOG OFF define DEBUG FSEE LOG OFF define DEBUG LOG OFF define LOG OFF define DEBUG HTTPEXEC LOG OFF define DEBUG IP LOG_OFF define DEBUG MAC OFF define DEBUG MAIN LOG OFF define DEBUG NBNS LOG OFF define DEBUG STACKTSK LOG OFF define
11. return FALSE endif Initialize the boards hardware static void InitializeBoard void if defined MCHP C18 amp amp defined __18F458 defined __18F448 defined __18F6680 N defined HITECH C18 amp amp defined 18F458 defined 18F448 defined _18F6680 CMCON 0x07 Comparators off 2 111 for PIC 18F448 18F458 18F6680 endif Enable 4 x PLL if configuration bits are set to do so defined MCHP_C18 amp amp defined __18F6621 OSCCON 0x04 Enable PLL PLLEN 1 while OSCCON_LOCK 0 Wait until PLL is stable LOCK 1 Seeing that this code does currently not work with Hi Tech compiler disable this feature OSCCON_SCS1 1 Switch on software 4 PLL if flag is set in configuration data appefgGetc APPCFG_SYSFLAGS amp APPCFG SYSFLAGS PLLON OSCCON_SCS1 1 Ill endif Setup timer as a free running 16 bit timer Is incremented every 10015 Is used to measure events in code 1xxx xxxx Enable read write as 16bit times is a buffer that is loaded when TMRIL is accessed xx00 xxxx No prescaler xxxx Timer oscillator disabled RCO and RC1 xxxx Internal clock source Fosc 4 40 4 10MHz for a 40MHz clock xxxx xxx Timer 1 on TICON 0x81 Disable external pull ups INTCON2_RBPU 1 97 Enable interrupts TOCON 0 INTCON
12. else error Board type not defined endif addtogroup mod conf projdefs code define UDP SOCKETS endcode Number of available UDP sockets to be created xj if defined BRD_SBC44EC defined BRD_SBC45EC define MAX UDP SOCKETS 2 elif defined BRD_SBC65EC defined BRD SBC68EC define MAX UDP SOCKETS 4 else error Board type not defined endif if MAX SOCKETS lt 0 MAX SOCKETS gt 255 error Invalid MAX SOCKETS value specified endif if MAX UDP SOCKETS lt 0 MAX UDP SOCKETS gt 255 error Invlaid UDP SOCKETS value specified endif if defined STACK USE SLIP The MAC TX BUFFER COUNT must be equal to MAX SOCKETS 1 for high priority messages or else calls to TCPPut may fail when multiple TCP sockets have data pending in the output buffer that hasn t been acked Changing this value is recommended only if the rammifications of doing so are properly understood if defined NON MCHP MAC define MAC TX BUFFER SIZE 1024 define MAC TX BUFFER COUNT 3 else define MAC TX BUFFER SIZE 576 define MAC TX BUFFER COUNT MAX SOCKETS 1 136 endif else For SLIP there can only be one transmit and one receive buffer Both buffer must fit in one bank If bigger buffer is required you must manually locate tx and rx buffer in different bank or modify your linker script file to support arrays bigger than 256 bytes e define MAC T
13. timerhigh lt lt 8 TMR3H timerhigh TMR3L timerlow INTCON3_INTIIF 0 T3CON_TMR30N 1 88 interrupt that controls the 1st and 2nd triacs if PIRI TMRIIF t TMRION 0 if myerror 0 if Elon PORTG_RG0 1 j if E2on PORTG 1 j 176 while i 0 1 2 5 PORTG_RG0 PORTG_RG1 0 j PIRI TMRIIF 0 TMR3 interrupt that controls the 3rd and 4th triacs if PIR2 TMR3IF _ 0 if myerror 0 1 if E3on PORTG 02 1 if E4on PORTG_RG3 1 j 1 6 while i 0 i PORTG RG2 RG3 0 PIR2 TMR3IF 0 INT2 is used to detect the rising edge of an external flow meter if INTCON3 INT2IF 1 flowtickl 1 INTCON3_INT2IF 0 INT3 is used to detect the rising edge of an external flow meter if INTCON3 INT3IF flowtick2 1 INTCON3_INT3IF 0 ifdef SER USE INTERRUPT USART Receive RCIF amp amp RCIE serRxIsr 89 USART Transmit TXIF amp amp PIE TXIE serTxIsr endif if defined MCHP C18 pragma code highVector HIVECTOR ADR void HighVector void i asm goto HighISR endasm j pragma code return to default code section endif Fast User process Place all high priority code that has to be called often in this function This function is called often and should be very f
14. 2 miso 55 mile Wi ree gt W1 e RA6 Green ece e 503 MP1 5 2 6598 63 bd cse pac 9 15 B B e 528 RDC6 anc wa 25 em Figure G 1 STCS control board layout 81 Board Schematic 9002 S172 uo3 108 AUT JOE INUIS 4J4O49 IIOD2 IeuJ ul eros 5 A AGT e en 2 ese netted ON I bp Figure G 2 STCS control board schematic 82 Parts List Table G 1 STCS parts list Manufacturer Part Mouser Part Description Quantity 62409 1 571 624091 0 25 Male Disconnect Tab 30 63860 1 571 638601 0 187 Male Disconnect Tab 7 340 35 505 80 340 335 51 3 3uF 50 Capacitors 14 22 23 2031 538 22 23 2031 3 pin 0 1 Male Header 9 151 8000 151 8000 2 pin Jumpers 12 PN2222A T R 771 PN2222AT R NPN transistor 4 MOC3052M 512 MOC3052M TRIAC Drivers 4 1N4733A TR 78 1N4733A Zener Diodes 12 MC33204PG
15. 3 50063 ADC 1765 26 1 7868997 x10 x ADC 1 2409181 107 x 32 322939 ADC 37425 341x ADC 1 6251527 107 Tin OS ADC lt 173 ADC gt 173 0 lt ADC lt 163 ADC 163 0 lt lt 169 gt 169 23 The equations in Table 1 are the ones used in the code for the microcontroller thus are provided for reference The end result the attached PC would see from these equations would be a value for the temperature times ten If an R25 thermistor is plugged into an auxiliary user supplied port on the STCS the temperature can be calculated using the equations in Table 2 The values that are returned in the status update for the auxiliary inputs are the ADC counts multiplied by ten Using these ADC count values with Table 2 will allow the user to calculate the temperature value corresponding to the ADC count value The temperature calculated with the equations in Table 2 is the regular temperature not the temperature multiplied by ten Table 2 Equations for calculating temperature of auxiliary inputs 5 82441x107 x 2 81569 107 x ADC 4 5 51567 107 x 5 61708x10 ADC 0 350063 ADC 176 526 1 7868997 107 x ADC 1 2409181x 107 k ADC 3 2322939 ADC 3742 5341 ADC 1 6251527 10 T 0 lt ADC lt 169 ADC gt 169 Flow Meter Reading The two flow meter inputs are handled by externally triggered interrupts which when trigge
16. Oscilloscope probes connected across heating element wires 43 The STCS by default will not deliver power to the heating elements when it is powered on Sending a UDP packet that contains the ASCII string P18633E1111 will turn the power to the heating elements on at what is expected to be half power The time between when the last half cycle ends and the power turns back on or the firing delay should be 4 16 ms as shown in Figure A 6 lt a Agilent Technologies P du Figure A 6 Oscilloscope screen showing 4 16 ms firing delay To adjust the firing delay the STCS uses press and hold one of the two buttons on the STCS circuit board shown in Figure A 7 to increase or decrease the delay Once the firing delay is set to 4 16 ms press and hold both buttons simultaneously until the status LEDs begin to flash This will store the delay value on the EEPROM so that it can be read by the microcontroller any time after the power to the STCS has been shut off 44 Increase Delay gt paa Figure A 7 Firing delay adjustment buttons To verify that the set up process completed correctly reset the power to the STCS and resend the ASCII string P18633E1111 If the waveform on the oscilloscope matches the waveform from before the power was reset the set up process was completed the value has been stored and the STCS is now ready for use Maintaining the STCS If the STCS is incorrectly reporting an error for fluid not
17. sample stack does not provide such facility Interested users must do this on their own 5 if defined STACK USE SLIP if defined STACK_ USE DHCP error DHCP cannot be used when SLIP is enabled endif endif addtogroup mod conf projdefs code define MY DEFAULT ADDR BYTE n define MY DEFAULT IP ADDR BYTE2 n define MY DEFAULT IP ADDR BYTE3 n define MY DEFAULT IP ADDR BYTEA n endcode Use these defines to define the default IP address of the device define MY DEFAULT IP ADDR BYTEI 192 define MY DEFAULT IP ADDR BYTE2 168 define MY DEFAULT IP ADDR BYTE3 0 if defined DEMO_ MODE define MY DEFAULT IP ADDR BYTE4 50 else define MY DEFAULT ADDR BYTE4 126 endif addtogroup mod conf projdefs code define MY STATIC BYTEI n define MY STATIC BYTE2 n define MY STATIC BYTE3 n define MY STATIC BYTEA n endcode Use these defines to define the default static IP address that is used if no DHCP server is found 133 define MY STATIC IP 1 appcfgGetc APPCFG IPO define MY STATIC IP BYTE2 appcfgGetc APPCFG_IP1 define MY STATIC IP BYTE3 appcfgGetc APPCFG 1 2 define STATIC IP BYTEA appcfgGetc APPCFG IP3 addtogroup mod conf projdefs Q code define MY DEFAU define MY DEFAU define MY DEFAU define MY DEFAU define MY DEFAU define MY DEFAU define MY DEFAU
18. 16 bit ifndef WIN32 typedef unsigned short long SWORD 24 bit else typedef short int SWORD endif typedef unsigned long DWORD 32 bit typedef union BYTE VAL struct 108 unsigned int b0 1 unsigned int b1 1 unsigned int b2 1 unsigned int 63 1 unsigned int 64 1 unsigned int b5 1 unsigned int b6 1 unsigned int b7 1 bits BYTE Val BYTE VAL typedef union SWORD VAL SWORD Val struct BYTE LSB BYTE MSB BYTE USB byte BYTE v 3 SWORD VAL typedef struct WORD ARRAY BYTE offset0 BYTE offsetl WORD ARRAY define WORD LSB a unsigned char WORD_ARRAY a offset0 define WORD MSB a unsigned char WORD ARRAY a offsetl typedefunion WORD VAL WORD Val struct BYTE LSB BYTE MSB byte BYTE v 2 WORD VAL define LSB a a v 0 define MSB a a v 1 typedef union DWORD VAL DWORD Val struct BYTE LOLSB BYTE LOMSB BYTE HILSB BYTE HIMSB 109 byte struct WORD LSW WORD MSW word BYTE v 4 DWORD VAL define LOWER LSB a a v 0 define LOWER MSB a a v 1 define UPPER LSB a a v 2 define UPPER MSB a a v 3 define CLEAR BIT theByte mask theByte amp mask define SET BIT theByte mask theByte mask define IS SET theByte mask theByte amp mask define IS BIT CLEAR theByte mask theByte amp mask 0 typedef BYTE BUFFER defin
19. 24 00 Sample Ti To 25 00 C Sample To Cp 4184 J kg C m 0 01759 kg s oTi 1 01740 1 42898 C Sensitivity coeff mass flow 4184 J kg Sense coeff Ti 448 52480 Sense coeff To 448 52480 W PC Uncertainty due to mass flow 73 59346 W Uncertainty due to Ti 456 32763 W Uncertainty due to To 640 93428 W 60 790 22000 w mass flow Ti and 80 APPENDIX Control Board Design Information Board Layout e ADC3 ADC4 e 9 2 52 e ecioe H CHO H ecize 9 5 6 9 rs eren ef JMP6 e R38 par c e e e Ceo ee e RAl1 Q1 e e RAI e e e e e e J s amp a Soo e Sie I 8 e zje s MD jets e e RAG LeN L1H LiHout ee LiHin eiim eiim eim PSUout Modtronix Board 2 LIN zi al eo ed RAS RA U
20. 69 13 74 82 40 72 82 49 82 4 79 47 74 48 68 81 63 97 120 120 120 120 120 120 120 120 120 120 120 120 2026214 1 825 645 1923814 1697 194 1557656 1344049 1293 277 1296 380 1352 457 1569 447 1708 005 1 931 882 Thus the total estimated energy used over the period of a year on heating water comes to 19526025 Btu One Btu is the amount of energy required to heat one pound of water one degree Fahrenheit The Btu usage per month was calculated using E1 The average water main temperatures come from information provided by simulations run by TRNSYS Btu gal month month El Now that a needed load value has been established the initial design of the system can begin A rough estimate of the performance of a solar thermal collection system in different cities across the United States can be found in Table 1 3 of 11 62 Since Waco Texas is not found in the table the performance values for collectors in Fort Worth Texas are used The average flat plate collector receives 186000 Bru ft x yr which is a worst case estimate Using this average performance value an initial collector size can be estimated using E2 where Load is the estimated annual load is the expected annual performance and F is the solar fraction which is the percentage of the total load that is expected to be offset by the solar collector system The val
21. C18 amp amp defined HITECH_C18 error Invalid Compiler selection endif defined MCHP C18 amp amp defined HITECH_C18 amp amp defined WIN32 error Compiler not supported if defined MCHP C18 include pl8cxxx h p18cxxx h must have current processor defined include lt stddef h gt offsetof macro endif 107 if defined HITECH_C18 include lt pic18 h gt include lt stdio h gt include lt stddef h gt For offsetof macro endif if defined __18CXX Microchip C18 compiler define PERSISTENT elif defined HITECH_C18 HiTech PICC18 Compiler define PERSISTENT persistent endif include lt stdlib h gt Set some defines that are processor related if defined __18F452 defined 18F452 defined __18F458 defined 18F458 define EEPROM_SIZE 256 elif defined __18F6621 defined _18F6621 defined 18 6527 defined 18F6527 V defined 1826627 defined 18F6627 V defined 1826680 defined 18F6680 define EEPROM SIZE 1024 endif Modify following macros depending on your interrupt usage define ENABLE INTERRUPTS INTCON GIEH 1 define DISBALE INTERRUPTS INTCON GIEH 0 VIAM T TT TT I Data Types undef BOOL undef TRUE undef FALSE undef BYTE undef WORD undef DWORD typedef enum BOOL FALSE 0 BOOL typedef unsigned char BYTE 8 bit typedef unsigned short int WORD
22. DEBUG LOG OFF define DEBUG TCPUTILS LOG OFF define DEBUG LOG OFF 128 define DEBUG_UDP LOG_OFF define DEBUG_UDPUTILS LOG OFF else define DEBUG ANNOUNCE LOG WARN define DEBUG_APPCFG LOG WARN define DEBUG_CMD LOG_WARN define DEBUG DHCP LOG DEBUG define DEBUG DNS LOG WARN define DEBUG FTP LOG WARN define DEBUG FSEE LOG_INFO define DEBUG GEN LOG WARN define DEBUG_HTTP LOG INFO define DEBUG HTTPEXEC LOG WARN define DEBUG IP LOG WARN define DEBUG MAC LOG DEBUG define DEBUG MAIN LOG DEBUG define DEBUG NBNS LOG DEBUG define DEBUG_STACKTSK LOG INFO define DEBUG LOG INFO define DEBUG_TCPUTILS LOG INFO define DEBUG TFTPC LOG WARN define DEBUG UDP LOG INFO define DEBUG UDPUTILS LOG INFO endif The following message macros will write message to the General tab define debugPutGenMsg msgCode debugPut2Bytes 0xD9 msgCode define debugPutGenRomStr msgCode msgStr debugMsgRomStr 0xD9 msgCode msgStr define debugPutGenRomStr msgCode msgStr debugPut2Bytes 0xD9 msgCode debugPutRomString msgStr addtogroup mod conf projdefs Q code define BRD SBC6SEC endcode Defines the Modtronix SBC board that this code is compiled for Possible defines are BRD SBC44EC BRD SBC45EC BRD SBC65EC BRD SBC68EC This define is often defined in the MPLAB project file define BRD_SBC65EC addtogroup mod conf projdefs Q cod
23. ENABLED FE TE sk sk addtogroup mod conf projdefs b FTP For details on configuring the FTP module ref ftp conf click here SEBS ok ok afe ale ale ake ale ak ok ok ok sk ok afe afe ale ale ok afe ale aje ale ak ok ok ale ak ok ale kok k FRAM Configuration Yk kok sk sk ale afe ale afe ok ak ok ale ok ok ok 9k k This may work with either true hardware SPI or a bitbang software SPI implementation If you uncomment the following the software hmplementation will be used if defined BRD_SBC68EC define SOFTWARE SPI 1 elif defined BRD_SBC65EC Don t define for SBC65EC it has a hardware SPI port define SOFTWARE SPI 1 endif the following defines which IO pins are used for the various SPI signals to the FRAM You can change them to suit your configuration pin definitions is CS d 4 is SO 4 5 is SI d 6 is define FRAM SPI CS PORTF define FRAM SPI TRI CS TRISF RF7 122 define FRAM SPI BIT SI PORTD RDS define FRAM SPI TRI SI TRISD RD5 define FRAM SPI BIT SO PORTD RD4 define FRAM SPI TRI SO TRISD RD4 define FRAM SPI BIT SCK PORTD RD6 define FRAM SPI TRI SCK TRISD RD6 clock speed only relev
24. In other words a bank of four 4000W elements will have a minimum average power output of 128W If even finer control is necessary three elements may be switched off and a single one operated as low as 32W Converting d toa P number is simply a matter of multiplying d by the number of 0 2 microsecond increments in 1 second and rounding to the nearest integer 1 e round 5x10 xd B7 50 APPENDIX Solar Thermal Collector Simulator Communication Standards Summary This document specifies the protocol that should be used to transmit data to and receive data from the STCS The STCS unit is an on demand water heater that has been modified to respond to external computer commands through a communication interface Thus the STCS in conjunction with an external computer controller can be operated as if it were a small solar thermal collector array Communication Standard All communications with the STCS embedded controller are carried by standard Ethernet UPD IP packets over IOBASE T wiring Communication packet fields are defined next Packet fields carry ASCII strings designed to be human readable so that 3 party UDP IP transceivers be used to help debug transmissions Heater Power Level input received BY unit The STCS has four resistive heating elements fed by two input circuits Users may choose to install elements of various power levels as long as each draws a maximum of 30 Amps RMS Each individual elem
25. a computer with a program that is capable of sending and receiving standard Ethernet UPD packets over IOBASE T wiring Once the STCS has been installed and the plumbing and electrical supplies have been connected there is a one time set up that has to be performed for the system to operate accurately The maintenance procedure will keep the system running accurately and error free Interfacing with the STCS The program that the will be used to send and receive UDP packets to and from the STCS needs to have the ability to interpret what is sent and received as ASCII strings The two ASCII strings that can be transmitted that the STCS recognizes are a request for a status update and a value that corresponds to output power as shown in Table A 1 When the STCS receives a request for a status update and no error is present it will respond with an ASCII string that contains the temperature of the five thermistors the ADC count for the seven auxiliary user supplied inputs and the count for the two flow meters If an error is present and the STCS receives a request for a status update it will respond with an ASCII string that corresponds to which error has occurred The three types of errors that the STCS can detect are a thermistor that is sensing a temperature that is greater than 93 3 C if there is no fluid in the chambers and if the is a leak inside the system 39 Table ASCII strings transmitted to the STCS Request for Status Up
26. allowing the values for each channel to be easily used elsewhere in the code A circular ten point average is kept for all the ADC values by keeping track of the previous nine values and adding them to the current value This helps to help minimize noise in the sampling of the thermistors or other devices that may be connected to the STCS The outcome of this is the average of the ADC values multiplied by ten which allows the first decimal place to be reported Temperature Reporting For the five ADC values that represent the thermistors in the STCS the temperature is calculated and returned as the temperature multiplied by ten also allowing the first decimal place to be reported The temperature versus ADC value curve seen in Figure 12 is difficult to with fit a polynomial so the curve is broken into two parts allowing polynomials to more accurately fit both sections 120 100 80 0 60 5 e 5 o 40 E 20 0 20 1 0 20 40 60 80 100 120 140 160 180 200 ADC count Figure 12 Sample temperature versus ADC count response curve 22 Since the inlet and outlet temperatures are used in the calculation of the output power more accuracy is needed in their measurements than in the three intermediate temperatures To achieve the increased accuracy needed the inlet and outlet temperatures were calibrated independently
27. being in the chambers but fluid has been confirmed to be present maintenance may need to be performed The fluid level sensor consists of a pair of screws that have current passed from one to the other through the fluid If water if present in the chambers of the STCS there will be a path for the current to take and no error will be detected Over time corrosion can build up on the screws blocking the current which will appear to the microcontroller as if water was not present The maintenance procedure will require a TORX T 20 screwdriver to remove the fluid level sensor screws Before proceeding make sure the power to the system has been shut off and that there is no fluid in the chambers of the STCS Remove the screws shown in Figure A 8 and pull the quick disconnect ends of the wires attached Remove any oxidation from the ends of the screws and reinstall them back in the STCS Then reconnect the quick disconnect ends to their original locations 45 Figure 8 Fluid level sensor screws 46 APPENDIX Average Power Output versus TRIAC Delay Since heating elements present purely real loads the sinusoidal currents and voltages through and across each load remain in phase Consequently the real instantaneous power dissipated by the load is P t V sin oXt I sin et BI where is the peak not RMS line voltage Z the peak current and 120 Thus the average power delivered to the load is given by P
28. bytes EZZZ E ZZZ ASCII formatted E indicates error message ASCII formatted error code e OTn Over temperature condition at thermistor n where n is 1 2 3 4 5 Temperatures above 93 3 C will trigger this error code and the unit will deactivate output power until temperatures return to the safe range Temperatures over 93 3 C may also require a manual reset of the unit s thermal circuit breaker NFC No fluid in heater chamber If no circulator fluid can be detected the unit will report NFC and deactivate all output power until fluid is detected Fluid is detected using a conductivity measurement Note that this precludes the use of oils or de ionized water as a circulator fluid e LDD Leak detected If a fluid leak is detected the unit will deactivate all output power until the leak is fixed 41 Figures A 1 and A 2 show examples of commands being transmitted to the STCS while Figures A 3 and A 4 show sample responses received from the STCS C Documents and Settings bolton Desktop gt pcattcp t u p 4000 s c 192 168 0 1 26 PCAUSA Test TCP Utility U2 01 01 08 UDP Transmit Test Transmit UDP gt 192 168 0 126 4000 Buffer Size 8192 Alignment 16384 0 Send Mode Read from STDIN R C WINDOWS system32 cmd exe pcattcp t u p 4000 C Documents and Settings bolton Desktop gt pcattcp t u p 4000 s c 192 168 0 1 25 PCAUSA Test TCP Utility U2 01
29. can be downloaded for free from the PCAUSA website http www pcausa com Utilities ttcpzip exe The Internet Protocol IP address of the STCS is 192 168 0 126 It listens for incoming UDP packets on port 4000 and responds to status requests on port 4001 40 Table A 2 ASCII strings received the STCS Status Update Packet Format 72 bytes AXXXXAXXXXAXXXXAXXXXAXXXXAyyyy AyyyyQOnnnnnOnnnnn A XXXX yyyy nnnnn ASCII formatted A delimiter separates four digit temperatures and analog readings There are 12 A characters in a status update message The five thermistor inputs report as a four digit ASCII value that represents the temperature multiplied by 10 For negative temperature values the first character is replaced with a This value can be between 999 and 9999 The general purpose analog inputs report as a four digit ASCII value that represents the ADC count value multiplied by 10 This value can be between 0000 and 2550 8 bit resolution ASCII formatted Q delimiter separates five digit pulse accumulator flow meter counts Each accumulator is reported as a five digit ASCII value between 0 and 65 535 16 bit register The first value is accumulator 1 and the second is accumulator 2 Pulse registers accumulate on rising edges Accumulator inputs are 5 volt compatible but will trigger on rising edges of 3 3 volt logic as well Error Code Packet Format 4
30. circuit board to accommodate placement of power control circuitry and to mate with preexisting mounting holes The thermistors that are included in the original system are R25 meaning at 25 C the resistance is 10 000 ohms R25 thermistors are standard for use in water heating and in solar applications The over temperature sensor is a hardware safety switch that is set to open and thus disconnect power to the heating elements at 93 3 C The fluid level detection device is a pair of contacts that protrude into the chambers Current is passed from one contact through the fluid and to the other contact If no fluid is present in the chambers there will be no path for the current to take and the microcontroller will recognize this as an error These preexisting circuit components were still needed in the modified system so their functionality was preserved in the new design Figure 4 shows how the different hardware systems of the STCS connect Thermistors Auxiliary User Inputs Flow Meters Error Sensors Microcontroller Firing Delay Heating Buttons Elements Figure 4 System connection overview Heating Elements The fluid flows past four resistive heating elements that impart heat energy to the fluid The heating elements are commercially available standard water heating elements which makes replacement easier Since the elements are purely resistive there are no inductive loads to complicate the control
31. control over the amount of power added to the fluid pumped through the heater An external computer is required to control the power output and check the status of the simulator Communications with the STCS are accomplished using American Standard Code for Information Interchange ASCII encoded strings carried by standard Ethernet Universal Datagram Protocol UPD packets over IOBASE T wiring The STCS can transmit the temperatures being measured inside the simulator as well as error codes should an error such as a leak or over temperature condition occur in the system Parameters of a solar panel are input to the STCS so the performance of a specific panel can be simulated Information about the weather conditions is provided by an external user supplied weather data file The weather data file type chosen to be read was the Typical Meteorological Year 2 TMY2 This file contains the values for a location that represent the average conditions from 1961 to 1990 Using the measured temperatures from the simulator the parameters of the solar panels being modeled and the weather data the theoretical output power from a solar array can be calculated and transmitted to the STCS Chapter Descriptions This thesis documents a feasibility study of a residential solar thermal collector system in Central Texas as well as the design construction and test results of a solar thermal collector simulator The main idea behind developing this simulator is to a
32. define PORTG_RG4 RG4 define RG5 RG5 define RGO TRISGO define TRISG_RG1 TRISGI define 02 TRISG2 define TRISG_RG3 TRISG3 define TRISG_RG4 TRISG4 define TRISG_RG5 TRISGS5 define INTCON TMROIE TMROIE define INTCON TMROIF TMROIF define PIE TMRIIE define TMRIIF define INTCON_INTOIE INTOIE define INTCON INTOIF INTOIF define INTCON2 RBPU define TOCON TMROON TMROON define TICON TMRION TMRION define 2 TMR2ON TMR2ON define TMRAON TMR40N define SSPCON1_WCOL WCOL define SSPCON2_SEN SEN define SSPCON2 ACKSTAT ACKSTAT define SSPCON2_RSEN RSEN define SSPCON2 RCEN RCEN define SSPCON2 ACKEN ACKEN define SSPCON2 PEN PEN define SSPCON2 ACKDT ACKDT define SSPSTAT RW define SSPSTAT BF BF define INTCON GIEH GIEH define INTCON GIEL GIEL define IPR1_TMRIIP TMRIIP define RCON_IPEN IPEN CPUs with dual SPI units if defined 18F6527 defined 18F6627 ifndef BCLIF define BCLIF BCLIIF 118 endif ifndef TXIE define TXIE TX IIE endif ifndef RCIE define RCIE RCIIE endif ifndef TXIF define TXIF TXIIF endif ifndef RCIF define RCIF RCIIF endif endif define PIE TXIE define PIE RCIE RCIE define TXIF TXIF define RCIF RCIF define PIR2 BCLIF BCLIF define PIR3 TMRAIF TMRAIF define TXSTA_TRMT TRMT define TXSTA_BRGH BRGH d
33. exp we A M use p r DI3 m C X F U st p 1 exp e A xF U Cres test p where 75 is the flow rate of the fluid used in the simulation and m is the flow rate use test used in the rating process which is given on the rating sheet c is the specific heat of the fluid used and A 15 the area of the collector used in the rating process given on the 59 rating sheet F U is the simulated collector fin efficiency multiplied by the overall loss coefficient of the collector This value can be calculated using D14 FU xA R mi Crest D1 4 M est C p This useful power Q is the power that is sent to the STCS to be output to the fluid The actual output power differs from the useful power in both an actual panel array and in the STCS Actual output power is calculated using D15 Q m C T T D15 where T is the outlet temperature of the collector array or ofthe STCS Since the useful power depends on two external variables m and it can vary and thus needs to be use calculated much more frequently than the hourly insolation 60 APPENDIX Conceptual Analysis and Feasibility Study This appendix follows the steps that are outlined in sections one and two of 11 Section one goes through the requirements of the system the basic design of the system and a simple performance versus cost study Section two outlines a more
34. for durability quality of construction thermal expansion or contraction resistance and energy output Since the ratings have to be updated yearly for every panel computer simulations are employed to test the energy output portion of the validation process The software chosen to model these panels is TRNSYS due to its high accuracy in modeling energy systems Selections of panels are physically tested along with software simulations to verify the panel rating 28 results from TRNSYS Based on the accuracy associated with using TRNSYS to simulate the energy output of a panel it was decided that the results from the STCS could be compared to the simulated results from TRNSYS The calculations for the uncertainty of the power output by the STCS are shown in Appendix F along with the actual values for the STCS The total output power uncertainty is given by 3 Ue 73 6384 T 4256 8016 5978 936m 3 T is the outlet temperature in C 7 is the inlet temperature in C and is the flow rate of the fluid through the STCS in kg s Since each of these are variable the output power uncertainty changes based on all three inputs Repeatability Test Results After the simulations had been run on the STCS the data was compared to the data generated by the TRNSYS model and the accuracy was verified The graphs used to verify the results have the data from the TRNSYS model with the uncertainty interval shown and th
35. if defined STACK USE FTP SERVER define AVAILABLE SOCKETS3 AVAILABLE SOCKETS2 2 else define AVAILABLE SOCKETS3 AVAILABLE SOCKETS2 endif if AVAILABLE SOCKETS3 lt 0 error Mazimum TCP Socket count is not enough error Either increase MAX SOCKETS or decrease module socket usage endif define AVAILABLE_UDP_SOCKETS MAX UDP SOCKETS if definedSTACK USE DHCP define AVAILABLE UDP SOCKETS2 AVAILABLE UDP SOCKETS 1 else define AVAILABLE UDP SOCKETS2 AVAILABLE UDP SOCKETS endif definedSTACK USE SNMP SERVER define AVAILABLE UDP SOCKETS3 AVAILABLE UDP SOCKETS2 1 else define AVAILABLE UDP SOCKETS3 AVAILABLE UDP SOCKETS2 endif if definedSTACK USE TFTP CLIENT define AVAILABLE UDP SOCKETS4 AVAILABLE UDP SOCKETS2 else define AVAILABLE UDP SOCKETS4 AVAILABLE UDP SOCKETS3 endif if AVAILABLE UDP SOCKETSA lt 0 error Maximum UDP Socket count is not enough error Either increase UDP SOCKETS or decrease module UDP socket usage endif endif PROJDEFS_H_ 138 1 2 3 4 5 6 7 8 9 BIBLIOGRAPHY U S Department of Energy 2005 Sep A Consumer s Guide to Energy Efficiency and Renewable Energy Online Available http appsl eere energy gov consumer your home water heating index cfm mytopic 12760 National Renewable Energy Laboratory 2003 United States Solar Atlas Online Available http mapserve2 nrel gov website LAS
36. in full later in this appendix SOURCE FILES appcfg c arp c arptsk c cmd c delay c dhcp c dns c fsee c ftp c helpers c http c httpexec c i2c c icmp c ip c mac c mxwebsrvr c nbns c sercfg c serint c stacktsk c tcp c tick c udp c xeeprom c 84 HEADER FILES appcfg h arp h arptsk h cmd h compiler h delay h dhcp h dns h fsee h ftp h helpers h http h httpexec h i2c h icmp h ip h mac h math h nbns h projdefs h sercfg h sering h snmp h stacktsk h tcp h tick h udp h xeeprom h LINKER SCRIPT 1816621 v302 nobl Ilkr mxwebsrvr c define THIS IS STACK APPLICATION include lt string h gt include projdefs h include debug h include serint h include sercfg h include appcfg h include httpexec h include cmd h include math h 85 include net cpuconf h include net stacktsk h include net fsee h include net tick h include net helpers h include net delay h include net udp h include net xeeprom h if 5 USE DHCP include net dhcp h endif if defined STACK USE HTTP SERVER include net http h endif if defined STACK USE FTP SERVER include net ftp h endif if defined STACK USE ANNOUNCE include net announce h endif if definedSTACK USE NBNS include net nbns h endif Debug defines define debugPutMsg msgCode debugPut2Bytes 0xD6 msgCode define debugPutMsgRomStr msgCode str
37. of the power output The elements are rated to provide 18 kilowatts when using two separate 240 volt alternating current VAC 30 amp 10 circuits however in the experiments in this thesis the total power the heating elements can provide was reduced to 13 5 kilowatts due to two 208 VAC 30 amp circuits being used Thermistors Thermistors are semiconductor components whose resistance changes with respect to temperature Since the thermistor values are reported by a microcontroller s analog to digital conversion ADC unit any change in resistance has to be converted to a change in voltage that ranges between OV and 5V direct current DC To achieve this conversion an operational amplifier configuration is used to provide a constant current that constrains the voltage to the desired range A typical thermistor resistance versus temperature curve shown in Figure 5 is highly nonlinear in the range of temperatures that are of concern for solar thermal collector systems usually 20 C to 120 C To help make the response more linear in the region of interest a fixed resistor was added in parallel with the thermistor While the resulting resistance versus temperature curve shown in Figure 6 is not linear it gives a more useful AR AT response for the system than the original thermistor configuration The thermistors used in the original Seisco water heater were manufactured by Betatherm and were quoted as having a temperature accuracy of
38. system and actual costs for a representative system are calculated TRNSYS was used to model a two tank system and the simulated energy output was compared to the theoretical energy required for the residence Figure E 1 shows the simulation layout that was used for the system The system uses two 4012 solar collectors a collection tank with an integrated heat exchanger to hold the heat energy from the panels a conventional water heater that is fed from the solar collection tank and a pump to circulate the heating fluid through the collectors This same simulation design is used for both the solar system that augments an electrical powered water heater and the system that augments a gas power heater the only difference is the way the conventional water heater is configured in the simulation Table E 3 contains the results from the simulation run that uses the electrical conventional water heater In a realistic application the months when the solar fraction is 99 would represent the auxiliary heater not needing to be used 66 Outlet Conditions Figure E 1 TRNSYS project layout Table E 3 Results from TRNSYS simulation for electric heater system MMBtu MMBtu required from Solar Month needed auxiliary Fraction Jan 2 0262 0 4927 0 7568 Feb 1 8256 0 3559 0 8051 Mar 1 9238 0 1923 0 9000 Apr 1 6972 0 0726 0 9572 May 1 5577 0 0133 0 9914 Jun 1 3440 0 0024 0 9982 Jul 1 2933 0 0026 0 9980 Aug 1 2964 0 0000 1 0000
39. the interrupt pins For SBC65EC and SBC68EC this frees up PIC pin define NIC DISABLE INTO NIC DISABLE IOCHRDY can be defined if the MAC should NOT use the IOCHRDY signal on the RTL8019AS chip This will mean that an additional PIC pin will be available for general purpose use To use this port pin the 124 connection to the IOCHRDY signal on RTL8019AS must be broken This can be done via solder jumpers on certian SBC boards For SBC44EC PIC port pin B5 will be available for user IO Solder jumper SJ5 must be opened For SBC45EC PIC port pin A4 will be available for user IO Solder jumper SJ5 must be opened For SBC65EC and SBC68EC this frees up PIC pin RG4 This pin is currently however not routed to an connectors if definedBBRD SBCA4EC defined BRD SBCASEC define NIC DISABLE IOCHRDY elif defined BRD_SBC65EC defined BRD SBC68EC define NIC DISABLE IOCHRDY else error Board type not defined endif Keep a count of CNTR1 CNTR3 registers This can be used for debug purposes and can be disabled for release code define MAC CNTRI 3 Use access RAM variables to optiomize speed and code size There are only a limited amount of access RAM registers in the PIC processor If they are not used by any other code modules this define should be enabled seeing that it will speed up the MAC module quite a bit If they are not available an error message will be displayed duri
40. 00 tempsens3 100 100 48 udpTxBuf 13 tempsens3 100 tempsens3 10 10 48 udpTxBuf 14 tempsens3 10 48 if tempsens4 lt 0 udpTxBuf 16 45 tempsens4 tempsens4 1 else udpTxBuf 16 tempsens4 tempsens4 1000 1000 48 udpTxBuf 17 tempsens4 1000 tempsens4 100 100 48 udpTxBuf 18 tempsens4 100 tempsens4 10 10 48 udpTxBuf 19 tempsens4 10 48 if tempsens5 0 udpTxBuf 21 45 tempsens5 tempsens5S 1 else udpTxBuf 21 tempsens5 tempsens5 1000 1000 48 udpTxBuf 22 tempsens5 1000 tempsens5 100 100 48 udpTxBuf 23 tempsens5 100 tempsens5 10 10 48 udpTxBuf 24 tempsens5 10 48 if adcval6 lt 0 udpTxBuf 26 45 adcval6 adcval6 1 else udpTxBuf 26 adcval6 adcval6961000 1000 48 udpTxBuf 27 adcval6 1000 adcval6 100 100 48 udpTxBuf 28 adcval6 100 adcval6 10 10 48 udpTxBuf 29 adcval69610 48 if adcval7 0 udpTxBuf 31 45 adcval7 adcval7 1 else udpTxBuf 3 1 adeval7 adceval7 1000 1000 48 udpTxBuf 32 adcval7 1000 adeval7 100 100 48 udpTxBuf 33 adcval796100 adcval79610 10 48 udpTxBuf 34 adcval79610 48 if adcval8 0 udpTxBuf 36 45 adcval8 adcval8 1 else udpTxBuf 36 adcval8 adcval8961000 1000 48 101 udpTxBuf 37 adcval8 1000 adeval8 100 100 48 udpTxBuf 38 adcval8 100 adceva
41. 01 08 UDP Transmit Test Transmit UDP gt 192 168 0 126 4000 Buffer Size 8192 Alignment 16384 0 Read from STDIN P18633E1111 Figure A 2 A heater power level command being transmitted to the STCS ex C WINDOWS system32 cmd exe pcattcp r u p 4001 s C Documents and Settings bolton Desktop gt pcattcp r u p 4001 s PCAUSA Test TCP Utility U2 01 01 08 UDP Receive Test Protocol UDP Port 4001 Buffer Size 8192 Alignment 16384 0 00240002308021980219002408018408018408180001800n1 730A1 730A1910Q00000Q00000 Figure A 3 A sample status update received from the STCS C WINDOWS system32 cmd exe pcattcp r u p 4001 s C Documents and Settings bolton Desktop gt pcattcp r u p 4901 s PCAUSA Test TCP Utility U2 01 01 08 UDP Receive Test Protocol UDP Port 4001 Buffer Size 8192 Alignment 16384 0 Figure A sample error code being received from the STCS 42 Initial Set up the STCS The set up process calibrates the STCS output power so that it accurately corresponds to the value that is transmitted to it This process will require an oscilloscope to monitor the power output waveform and a computer with a program that is capable of sending UDP packets Once the STCS has been installed plumbed and wired properly the oscilloscope probes should be connected to the wires that lead to a heating element as shown in Figure A 5 P Figure A 5
42. 1 5 years to 70 pay for itself Assuming the cost of fuel increases 2 5 per year E8 can be used to find the revised amount of time it will take for the system to pay for itself 1 0 025 1 Cost Savings T 2 i 9 us 10 payback 10 T payback l0 0 where paybac 1 the number of years since the system was installed and n is the number of decimal places to be used in reporting 7 The easiest way to use E8 is to have a ayback recursive program check if the result of the summation is greater than or equal to the cost Using E8 the years required for the electrical heater system to pay for itself is reduced to 11 17 years and 10 2 years for the gas powered system Under the Texas tax code the increase in appraised value for the home that occurs from installing a solar collection system does not apply to the property tax that is paid 71 APPENDIX Uncertainty Calculations Method Used to Find Uncertainties The methods used for calculating the uncertainty in the power output are outlined by Moffat 5 Uncertainty refers to a possible value that an error may have while the term error refers to the difference between the measured value and the true value There are two types of uncertainty fixed and random Fixed uncertainty is due to the uncertainty in the measuring tool being used It is usually specified by the manufacturer but if no value is given the uncertainty can
43. 10 000 ohms 0 5 at 25 C but when tested at different temperatures they did not perform as expected To overcome the discrepancy between the manufacturer s data and actual performance theoretical models were built for the inlet and outlet thermistors as they provide information that is vital to the power calculation The other thermistors in the STCS were calibrated using the data provided by Betatherm 11 100000 0 90000 0 80000 0 70000 0 60000 0 50000 0 40000 0 Resistance 30000 0 20000 0 10000 0 0 0 20 0 20 40 60 80 100 120 Temperature C Figure 5 Original thermistor response curve 4000 3500 3000 2500 2000 1500 1000 Resistance Q 20 0 20 40 60 80 100 120 Temperature C Figure 6 New thermistor response curve A method for determining how a specific thermistor will perform has been developed by John S Steinhart and Stanley R Hart 6 The method involves taking temperature and resistance measurements at three distinct points and then solving three simultaneous Steinhart Hart equations 1 to obtain the three coefficients in the equation 12 T A Bin R C In R P 1 Once the coefficients A B and C have been solved the equation can be used over the entire range of the thermistor to find the temperature To provide the most accurate model of the temperature sensing hardware the thermistor and current supp
44. 2 999 996 66 1996 222 1996 991 996 000 992 68 0996 9990996 005 099 222 0996 190996 000 099 00 00 Orc yndyno enjoy rile 08 25 082 DINI ua pojoedxq 5218 punoq Ajurej1ooun ozis 0904 0904 0006 5216 noo jnoo snulu snid AW AN Jamod 34 5000 4000 3000 2000 H Power W 1000 gt 1000 T T T T T T T T T 0 0 2 0 4 0 6 0 8 1 1 2 1 4 1 6 1 8 2 Time hr Figure 18 Output from all five repeatability tests overlaid Equation 4 is the metric that was used to compare the power outputs of the trials The norms used are the Euclidean norm The result of this metric is the percentage difference between the outputs of the two trials being compared The result of the average of the comparisons shows that the output of the STCS is 91 5 repeatable Q ou lo 4 min i j Accuracy Test Results To verify the accuracy of the STCS a test was run that covered all the hours in a day that had sunlight available The test results are graphed in Figure 19 with the simulated data from the same hour range and uncertainty bounds provided by TRNSYS to show that the output of the STCS can accurately simulate a small solar thermal collector array over the period of a day 35 T
45. 3 V sin cot dt B2 VM s sin 2 d 201 0 lt 4 lt 2 207 where is 2 of a sine period or about 0 00833 and d is the TRIAC delay time i e phase angle measured from the preceding zero crossing Recognizing V T 2 as the RMS rated maximum load power i e the heating element power quoted by the manufacturer we can now see that choosing d between 0 and T will produce an 4 is graphed in average power output between zero and maximum power Function avg Figure B 1 normalized with 2 1 47 as a fraction of full power avg Triac delay d seconds x 10 Figure B 1 Average power versus TRIAC delay What is needed next is an algorithm to find d given a desired average power output P There is not a closed form solution because P d is transcendental in esired d One option is to approximate the expression with a polynomial of n order as a d a d a B3 Then setting P d P avg le sired 15 equivalent to finding the roots of a d a d Ha P 0 B4 n l desired Roots can usually be found reliably for n lt 10 and since the expression for P is monotonic d will be the one and only real root The limitation of this method is that 48 getting a good approximation of P avg d may require high order polynomial involving numerically very small or large numbers and the error t
46. 7 flowtick2 flowtick2 10000 10000 48 udpTxBuf 68 flowtick2 10000 flowtick2 1000 1000 48 udpTxBuf 69 flowtick2 1000 flowtick2 100 100 48 udpTxBuf 70 flowtick2 100 flowtick2 10 10 48 udpTxBuf 71 flowtick2 10 48 udpBufSize 72 102 else if myerror 0 udpTxBut 0 6 switch myerror case 0 case 1 case 2 case 3 case 4 case 5 case 6 case 7 default break udpBufSize 4 9 udpTxBuf 1 0 udpTxBuf 2 0 udpTxBuf 3 0 break udpTxBuf 1 79 udpTxBuf 2 84 udpTxBuf 3 49 break udpTxBuf 1 79 udpTxBuf 2 84 udpTxBuf 3 50 break udpTxBuf 1 79 udpTxBuf 2 84 udpTxBut 3 51 break udpTxBuf 1 79 udpTxBuf 2 84 udpTxBut 3 52 break udpTxBuf 1 79 2 84 udpTxBut 3 53 break udpTxBuf 1 78 udpTxBuf 2 70 udpTxBut 3 67 break udpTxBuf 1 76 udpTxBuf 2 udpTxBuf 3 68 break udpTxBuf 1 0 udpTxBuf 2 0 udpTxBuf 3 0 if UDPIsPutReady udpSocketUserTx UDPPutArray udpTxBuf udpBufSize 103 69 E 179 0 184 T 149 1 50 2 51 3 52 4 53 5 78 F 167 C 76 L 68 D UDPFlushQ udpBytesReceived 0 udpRxBuf 0 0 static void myTempSens void int adcread1 0 H tadcread1 8
47. 863 MC33204PG Rail to rail Op Amps 3 4308R 102 392LF 652 4308R 2LF 3 9K 3 9k isolated resistor network 12 LAMA6 14 QY 644 LAMA6 14 QY Screw Lugs 4 ROV05 361K S 2 650 ROV05 361K S 2 Varistors 2 2N2222A 511 2N2222A NPN transistor 2 Q6040K7 576 Q6040K7 TRIAC 4 202702 594 5093NW27K00J 3W 27k Resistor 2 ILD620 782 ILD620 Zero cross detect optocoupler 1 B3F 1022 653 B3F 1022 Push Buttons 2 T92P7D22 12 655 T92P7D22 12 Relays 2 PSA15LN3 120 R 552 PSA 15LN3 120 R Power Supply 1 09 65 2028 538 09 65 2028 2 pin 0 156 Male Header 1 09 50 7021 538 09 50 7021 2 pin 0 156 Female Plug 2 09 65 2058 538 09 65 2058 5 pin 0 156 Male Header 1 09 50 7051 538 09 50 7051 5 pin 0 156 Female Plug 2 08 52 0072 538 08 52 0072 0 156 Crimp Pins 10 19011 0007 538 19011 0007 0 25 Female Disconnect Tabs 24 RCSSLF D 3K92 66 RCSSLF D 3 92K 0 25W 3 92k 0 1 resistor 12 1N4001 50V 1A diode 2 0 25W 100k Resistor 4 0 25W 1k resistor 4 0 25W 200 resistor 4 0 25W 300 resistor 8 0 25W 330 resistor 2 0 25W 10k resistor 2 2 pin 0 1 Male header pins 7 2 row 10 pin 0 1 male header 2 red LED 1 green LED 1 83 APPENDIX Source Code Files Included in Project The files that are included in the project are listed below All these files as well as the project itself are available from the Modtronix Engineering website located at http www modtronix com product info php cPath 1 36 amp products 14 149 The files that were modified are shown
48. ABSTRACT Design of a Solar Thermal Collector Simulator Kirk G Bolton M S Mentor Ian A Gravagne Ph D The recent increased interest in renewable energy has created a need for research in the area of solar technology This has brought about many new opportunities for universities and research centers to build upon existing technology or develop new strategies for handling how energy systems function Both avenues of research could require an experimental test bench to verify and quantify results This thesis outlines the design and testing of a simulator for a small solar thermal collector array that can be used in a laboratory configuration to test other parts of a solar thermal collector system The simulator will be able to repeatedly produce given output power conditions so that other components in a typical solar thermal system can be tested with greater reliability Design of a Solar Thermal Collector by Kirk G Bolton B S A Thesis Approved by the Department of Electrical and Computer Engineering Kwang Y Lee Ph D Chairperson Submitted to the Graduate Faculty of Baylor University in Partial Fulfillment of the Requirements for the Degree of Master of Science in Electrical and Computer Engineering Approved by the Thesis Committee Ian A Gravagne Ph D Chairperson Kenneth W Van Treuren Ph D John M Davis Ph D Accepted by the Graduate School May 2009 J Larry Lyon Ph D Dean Page b
49. C channel and store result in adcChannel array if defined APP USE ADCS defined APP USE 10 amp amp ADC CHANNELS gt 0 static BYTE adcChannel Current ADC channel Value from 0 n We are allowed to update AdcValues buffer hf YmainFlags bits bFreezeADCBuf Increment to next ADC channel if adcChannel gt ADC CHANNELS adcChannel 0 Check if current ADC channel adcChannel is configured to be ADC channel if adcChannel lt ADCON1 amp 0 0 Convert next ADC Channel amp 0x3C ADCONDO adcChannel lt lt 2 ADCONO_ADON 1 Switch on ADC ADCONO GO 1 Go while ADCONO GO FAST USER PROCESS Wait for conversion to finish defined APP USE ADCS AdcValues adcChannel ADRESH elif defined APP USE 10 AdcValues adcChannel WORD ADRESH lt lt 8 ADRESL endif Not ADC channel to 0 95 else AdcValues adcChannel 0 endif static ROM char HTTPHDR_AUTHORIZATION AUTHORIZATION BASIC This function is a callback from HTTPServer task For each HTTP Header found in the HTTP Request message from the client this function is called The application has the chance to parse the received headers param httpInfo INFO structure of current HTTP connection param hdr Buffer containing NULL terminated header to handle param rqstRes Name of the Requested resource GET comman
50. E and information on similar solar thermal collection systems in the surrounding area the practicality of a system that augments an existing domestic water heater can be seen The relatively high initial cost and unfamiliarity with solar thermal collection systems the two biggest factors that keep most home owners from considering using this readily available resource to augment or replace such a large percentage of their overall energy usage CHAPTER THREE Hardware Overview Hardware Modification The STCS is a modification of a commercially available on demand water heater system manufactured by Seisco This heater was chosen because of the existing package size and system layout The Seisco model was the RA 18 which has four heat exchanger chambers for fluid to flow through in a serpentine fashion In its original configuration the RA 18 can provide up to 18 kilowatts of power for heating fluid The chambers have thermistors to report the temperature as well as a safety cut off device to monitor for an over temperature condition There are also sensors that monitor if there is fluid present in the chambers or if there is a leak somewhere in the device Control Board To be able to use the RA 18 to control the amount of power to be output a new control board was designed Many parts of the existing hardware were taken into account when designing the new board The new control board was designed to be the same size as the existing
51. GIEH 1 INTCON GIEL 1 Kirk s changes NTCON_INTOIE 1 NTCON2_INTEDG0 1 NTCON2 INTEDGI 1 NTCON2 INTEDG2 1 INT2 Edge Select 1 rising 0 falling NTCON2 INTEDG3 1 INT3 Edge Select 1 rising 0 falling 2 INT3IP 1 NTCON3_INTIIP 1 NTCON3_INT2IP 1 NTCON3_INTIE 1 NTCON3 INT2IE 0 INT2 Enable INTCON3 INT3IE 0 INT3 Enable PIE TMRIIE 1 PIE2 1 IPRI TMRIIP 1 IPR2_TMR3IP 1 RCON_IPEN 1 0610010000 T3CON 0610010000 changed from appcfg c commented out there I I I I I I I I I I TRISA 1 TRISA 1 TRISA RA2 1 TRISA 1 TRISA 5 1 1 1 2 1 TRISB 1 TRISB 4 5 1 TRISB 7 1 TRISC RCO 0 TRISC 0 TRISC RC2 0 TRISC RC5 1 TRISF OxFF TRISG RG0 0 TRISG 0 TRISG RG2 0 TRISG 0 WDTCON 0b00000001 98 static void myUDPInit void timerhigh timerlow 255 flowtick1 flowtick2 0 timerval 65535 button ctr 0 XEEBeginRead EEPROM CONTROL OxFFF0 delayval2 XEERead delayval3 XEERead XEEEndRead delayval delayval2 8 delayval3 Elon E2on E3on E4on 0 myerror 0 udpBufSize 0 udpServerNode2 MACAdadr v 0 0 udpServerNode2 MACAddr v 1 0 ud
52. MAJOR3 Number from 1 to 99 define APP VER MINOR 5 Number from 1 to 99 Define fast user process It can be an external function a Macro When it is an external fanction an extern function prototype must also be defined extern void fastUserProcess void define FAST USER 5 fastUserProcess define FAST USER PROCESSO 1 CLRWDT Module configuration addtogroup mod conf projdefs 120 section projdefs_modconf Module Configuration The following section describes how to configure modules included in this project t 9k ok sk ok ok sk E sk ok ok ok ok ok ok k Appcfg Configuration Yk sk sk sk sk afe 9k afe ale ale ake ak ok kkk Define if this application has an 8 bit ADC converter 10 bit ADC converter or at all define APP USE ADC8 define APP USE ADCIO Define buffer space that is reserved for ADC conversion values For a 8 bit ADC converted 1 byte hs reserved per channel For an 10 bit ADC 2 bytes are reserved per channel define ADC CHANNELS 12 E TE sk sk oF e sk oe oe oe oe ae oe ok ok oe ake eoe oe ok tei ke 2 ake a 9k ak oR ake ake 9k ok addtogroup mod conf projdefs ab Appcfg For details on configuring the Appcfg module ref mac conf click h
53. N2 ACKEN SSPCONO2bits ACKEN define SSPCON2 PEN SSPCONObits PEN define SSPCON2 ACKDT SSPCON2bits ACKDT define SSPSTAT R W SSPSTATbits R W define 55 5 BF SSPSTATbits BF define INTCON GIEH INTCONbits GIEH define INTCON_GIEL INTCONbits GIEL define PIE TXIE PIE1bits TXIE define PIRI PIR 1 bits TXIF define PIE RCIE PIEIbits RCIE define PIR 1 bits RCIF define 2 BCLIF PIR2bits BCLIF define PIR3 TMRAIF PIR3bits TMRAIF define IPR1_TMRIIP IPR1 bits TMRIIP define RCON_IPEN RCONbits IPEN define INTCON3 INTIIF INTCONGbits INTIIF 113 define T3CON TMR3ON T3CONbits TMR3ON define 2 TMR3IF PIR2bits TMR3IF define T3CON TMR3ON T3CONbits TMR3ON define INTCON3 INT2IF INTCONGbits INT2IF define INTCON2 INTEDGO INTCONQGbits INTEDGO define INTCON2 INTEDGI INTCONQGbits INTEDGI define INTCON2 INTEDG2 INTCONQGbits INTEDG2 define INTCON2 INTEDG3 INTCON2bits INTEDG3 define INTCON3 INTIIP INTCONGbits INTIIP define INTCON3 INT2IP INTCONGbits INT2IP define INTCON3 INTIIE INTCONGbits INTIIE define INTCON3 INT2IE INTCONGbits INT2IE define INTCON3 INT3IE INTCONGbits INT3IE define 2 TMR3IE PIE2bits TMR3IE define 2 TMR3IP IPR2bits TMR3IP define INTCON2 INT3IP INTCONQObits INT3IP define INTCON3 INT3IF INTCONGbits INT3IF if defined 1826621 define BAUDCON BAUDCONI define SPBRGH SPBRGHI endif define TXSTA_TRMT
54. NETFLAGS amp APPCFG NETFLAGS DHCP 0 Force IP address display update myDHCPBindCount 1 if definedSTACK USE DHCP DHCPDisable endif endif if DEBUG_MAIN gt LOG_DEBUG debugPutMsg 1 mxd 1 Starting main loop endif myUDPInit myTempSens Once all items are initialized go into infinite loop and let stack items execute their tasks 91 If application needs to perform its own task it should be done at the end of while loop Note that this is a co operative mult tasking mechanism where every task performs its tasks whether all in one shot or part of it and returns so that other tasks can do their job f a task needs very long time to do its job it must broken down into smaller pieces so that other tasks can have CPU time xj while 1 1 Clear timer 1 every cycle can be used to measure events Has a overflow of 65ms Get delay in this function with TMRIL lt lt 8 TMRIH 0 First write to TMR1H buffer TMRIL 0 This write will also update TMR1H with value written above to buffer Blink SYSTEM LED every second if appcfgGetc APPCFG SYSFLAGS amp APPCFG SYSFLAGS BLINKB6 if TickGetDiff8bit t gt TICKS TICKS PER SECOND TICK8 2 t TickGet8bit TRISB RB6 0 LATB6 1 j Enter each 10115 if TickGetDiff8bit tmr10ms gt 8 PER SECOND TICK8 100 tmr10ms Tic
55. NEWPV WATTS viewer htm American Council for an Energy Efficient Economy 2007 Aug Consumer Guide to Home Energy Savings Condensed Online Version Online Available http www aceee org consumerguide waterheating htm National Renewable Energy Laboratory Solar Resources for the U S Department of Defense Online Available http mapserve2 nrel gov website L48MarineCorp viewer htm R J Moffat Describing the Uncertainties in Experimental Results Experimental Thermal and Fluid Science vol 1 pp 3 17 Jan 1988 J S Steinhart and S R Hart Calibration Curves for Thermistors Deep Sea Research vol 15 pp 497 503 1968 S J Kline and F A McClintock Describing Uncertainties in Single Sample Experiments Mechanical Engineering vol 75 pp 3 8 Jan 1953 H W Coleman and W G Steele Designing an Experiment Detailed Uncertainty Analysis in Experimentation and Uncertainty Analysis for Engineers 279 ed New York Wiley Interscience 1999 ch 4 pp 83 129 J A Duffie and W A Beckman Solar Engineering of Thermal Processes 3 ed Hoboken NJ Wiley 2006 10 ASHRAE Handbook HVAC Applications 1995 Inch Pound ed ASHRAE Atlanta GA 1995 p 45 9 11 Active Solar Heating Systems Design Manual ASHRAE Atlanta GA 1988 12 Energy Efficient Design of Low Rise Residential Buildings ASHRAE Standard 90 2 2004 139
56. O LATFbits LATFI LATFbits LATF2 LATFbits LATF3 LATFbits LATFA LATFbits LATFS5 LATFbits LATF6 LATFbits LATF7 TRISFbits TRISFO TRISFbits TRISF1 TRISFbits TRISF2 TRISFbits TRISF3 TRISFbits TRISF4 TRISFbits TRISF5 TRISFbits TRISF6 TRISFbits TRISF7 PORTGbits RGO PORTGbits RG1 PORTGbits RG2 PORTGbits RG3 112 define PORTG_RG4 PORTGbits RG4 define PORTG 05 PORTGbits RG5 define LATGO LATGbits LATGO define LATGI LATGbits LATGI define LATG2 LATGbits LATG2 define LATG3 LATGbits LATG3 define LATG4 LATGbits LATG4 define LATGS LATGbits LATGS5 define TRISG_RGO TRISGbits TRISGO define TRISG_RG1 TRISGbits TRISGI define TRISG_RG2 TRISGbits TRISG2 define TRISG_RG3 TRISGbits TRISG3 define TRISG_RG4 TRISGbits TRISG4 define TRISG_RG5 TRISGbits TRISG5 define INTCON TMROIE INTCONbits TMROIE define INTCON TMROIF INTCONDbits TMROIF define TMRIIF PIRIbits TMRIIF define PIEL TMRIIE PIE bits TMR1IE define INTCON_INTOIE INTCONbits INTOIE define INTCON INTOIF INTCONbits INTOIF define INTCON2 RBPU INTCONObits RBPU define TOCON TMROON TOCONbits TMROON define TICON TMRION TICONbits TMRION define 2 TMR2ON T2CONbits TMR2ON define TMRAON T4CONbits TMRAON define SSPCONI WCOL SSPCONIbits WCOL define SSPCON2 SEN SSPCONObits SEN define SSPCON2 ACKSTAT SSPCON2bits ACKSTAT define SSPCON2 RSEN SSPCONObits RSEN define SSPCON2 RCEN SSPCONObits RCEN define SSPCO
57. PPCFG WEBFLAGS AUTH X Define as 1 1f Authentication required for all define AUTH REQ FOR ALL FILES appcfgGetc APPCFG WEB FLAGS amp APPCFG WEBFLAGS AUTH ALL Define as 1 1f Authentication required for all pages with GET Methods define HTTP AUTH REQ FOR GET appcfgGetc APPCFG WEB FLAGS amp APPCFG WEBFLAGS AUTH GET Define as 1 1f Authentication required for all Dynamic files define AUTH REQ FOR DYN appcfgGetc APPCFG_ WEB FLAGS amp APPCFG WEBFLAGS AUTH DYN Define as 1 1f Authentication required for all CGI files 123 define REQ FOR appcfgGetc APPCFG WEB FLAGS amp APPCFG WEBFLAGS AUTH CGI Define as 1 if Authentication required for all Secure Tags define AUTH REQ FOR SECTAG appcfgGetc APPCFG_WEB FLAGS amp APPCFG WEBFLAGS AUTH SECTAG Included this define if the user application will process HTTP headers It it does the HTTPProcessHdr callback function must be implemented by the user define HTTP_USER PROCESSES HEADERS FE TR sk addtogroup mod conf projdefs b HTTP For details on configuring the HTTP module ref http conf click here sk ok ok ok afe afe ale ok IP Configuration ok se e define MY IP TTL 100
58. Sep 1 3525 0 0478 0 9646 Oct 1 5694 0 0665 0 9577 Nov 1 7080 0 2799 0 8361 Dec 1 9319 0 4542 0 7649 Year 19 5260 1 9825 0 8985 Table E 4 contains the results for the TRNSYS simulation of the solar collector system that augments a natural gas powered conventional water heater As with the electrical 67 heater simulation the months when the solar fraction is 99 would represent a lack of the need for the auxiliary heater to be used Table E 4 Results from TRNSYS simulation for gas heater system MMBtu MMBtu required from Solar Month needed auxiliary Fraction Jan 2 0262 0 4899 0 7582 Feb 1 8256 0 3586 0 8036 Mar 1 9238 0 1951 0 8986 Apr 1 6972 0 0703 0 9586 May 1 5577 0 0130 0 9917 Jun 1 3440 0 0023 0 9983 Jul 1 2933 0 0026 0 9980 Aug 1 2964 0 0000 1 0000 Sep 1 3525 0 0462 0 9658 Oct 1 5694 0 0669 0 9574 Nov 1 7080 0 2815 0 8352 Dec 1 9319 0 4557 0 7641 Year 19 5260 1 9632 0 8995 Since the simulation used did not incorporate every part of an actual solar water heater installation the values for the energy saved should be adjusted Assuming the values given were 20 higher than the actual output would be a safe estimate for total energy saved and thus total money saved can be made Table E 5 has the original value for the energy gained from the solar collector system the adjusted value for the 2096 over estimate and the estimated money saved The money saved was calculated using the price for elect
59. Str debugMsgRomStr 0xD6 msgCode msgStr Version number n major part and can be 1 or 2 digets long mm 15 minor part and must be 2 digets long ROM char APP VER STR V3 06 BYTE myDHCPBindCount 0 if definedSTACK USE DHCP extern BYTE DHCPBindCount else If DHCP is not enabled force DHCP update define DHCPBindCount 1 endif TODO Remove this later if defined APP USE ADC8 extern BYTE AdcValues ADC_CHANNELS elif defined APP_USE_ADC10 86 extern WORD AdcValues ADC_CHANNELS endif static union struct 1 unsigned int bFreezeADCBuf 1 Stop updating AdcValues ADC buffer bits BYTE Val mainFlags static void InitializeBoard void static void ProcessIO void static UDP_SOCKET udpSocketUserRx INVALID_UDP_SOCKET static UDP SOCKET udpSocketUserTx INVALID UDP SOCKET static NODE INFO udpServerNode2 static void myUDPlInit void static void myUDPProc void static void myTempSens void static void mySafeProc void pragma udata MyVars one unsigned char k unsigned char j signed int tempsens tempsens2 tempsens3 tempsens4 tempsens5 unsigned short int adcval6 adcval7 adcval8 adcval9 adcvall0 adcvalll adcvall2 unsigned int timerhigh timerlow timertempl timertemp2 timerval unsigned int flowtick1 flowtick2 unsigned int delayval delayval2 delayval3 BOOL Elon 2 E3on E4on unsigned char myerror unsigned cha
60. TCP define STACK USE endif endif if defined STACK USE FTP SERVER amp amp defined STACK_CLIENT_ MODE define STACK CLIENT MODE endif if definedSTACK USE SNMP SERVER amp amp defined STACK_CLIENT_MODE define STACK CLIENT MODE endif When DHCP is enabled UDP must also be enabled WA if defined STACK USE DHCP defined STACK USE UDP define STACK USE UDP endif endif defined STACK USE SNMP SERVER amp amp defined STACK USE UDP define STACK USE UDP endif When IP Gleaning is enabled ICMP must also be enabled 5 USE GLEANING if defined STACK_ USE define STACK USE ICMP endif endif When TFTP Client is enabled UDP must also be enabled And client mode must also be enabled 132 defined STACK USE TFTP CLIENT amp amp defined STACK USE UDP define STACK USE UDP endif if defined STACK_USE_TFTP_CLIENT amp amp defined STACK_CLIENT_MODE define STACK CLIENT MODE endif DHCP requires unfragmented packet size of at least 328 bytes and while in SLIP mode our maximum packet size is less than 255 Hence disallow DHCP module while SLIP is in use Tf required one can use DHCP while SLIP is in use by modifying C18 linker scipt file such that C18 compiler can allocate a static array larger than 255 bytes Due to very specific application that would require this
61. TE REO define PORTE REI define PORTE RE2 define PORTE define PORTE REA define PORTE RES define PORTE RE6 define PORTE RE7 define LATEO define LATEI define LATE2 define LATE3 define LATE4 define 5 define LATE6 define LATE7 define TRISE REO define TRISE REI define TRISE RE2 define define TRISE REA define TRISE RES define TRISE RE6 define TRISE RE7 define PORTF_RFO define PORTF RFI define PORTF RF2 define PORTF RF3 define PORTF RF4 define PORTF_RF5 define PORTF RF6 define PORTF RF7 define LATFO define LATF1 define LATF2 define LATF3 define LATF4 define LATF5 define LATF6 define LATF7 define TRISF RFO define TRISF RFI define TRISF RF2 define TRISF define TRISF_RF4 define TRISF_RF5 define TRISF RF6 define TRISF RF7 define PORTG_RGO define PORTG RGI define PORTG RG2 define TRISDbits TRISD7 PORTEbits REO PORTEbits RE1 PORTEbits RE2 PORTEbits RE3 PORTEbits RE4 PORTEbits RE5 PORTEbits RE6 PORTEbits RE7 LATEbits LATEO LATEbits LATEI LATEbits LATE2 LATEbits LATE3 LATEbits LATEA LATEbits LATES LATEbits LATE6 LATEbits LATE7 TRISEbits TRISEO TRISEbits TRISE1 TRISEbits TRISE2 TRISEbits TRISE3 TRISEbits TRISE4 TRISEbits TRISE5 TRISEbits TRISE6 TRISEbits TRISE7 PORTFbits RFO PORTFbits RF1 PORTFbits RF2 PORTFbits RF3 PORTFbits RF4 PORTFbits RF5 PORTFbits RF6 PORTFbits RF7 LATFbits LATF
62. TXSTAbits TRMT define TXSTA_BRGH TXSTAbits BRGH define TXSTA1 TRMT TXSTAIbits TRMT define TXSTA1 BRGH TXSTAI1bits BRGH define 2 TRMT TXSTA2bits TRMT define TXSTA2 BRGH TXSTA2bits BRGH define RCSTA_CREN RCSTAbits CREN define RCSTA1 CREN RCSTA1bits CREN define RCSTA2_CREN RCSTA2bits CREN define ADCONO GO ADCONObits GO define ADCONO ADON ADCONObits ADON define RCON_POR RCONbits POR define WREN EECONIbits WREN define EECONI WR EECONIbits WR define EECONI RD EECONIbits RD define EECONI EEPGD EECONIbits EEPGD define EECONI CFGS EECONIbits CFGS define EECONI FREE EECONIbits FREE define OSCCON PLLEN OSCCONbits PLLEN define OSCCON_LOCK OSCCONbits LOCK define OSCCON_SCS1 define OSCCON SCSO endif if defined HITECH_C18 define ROM const OSCCONbits SCS1 OSCCONbits SCSO 114 Macros define memcmppgm2ram a b c b define memcpypgm2ram a b c b define stremp a b stremp a b define stremppgm a b strcmp a b define stremppgm2ram a b stremp a b define strempram2pgm a b strcmp a b define strcpy dst src strcpy dst src define strcepypgm dst src strcpy dst src define strepypgm2ram dst src strcpy dst src define strepyram2pgm dst src strcpy dst src extern void mymemcpy void d1 const void s1 unsigned char n extern char strupr char Fix for HITECH C define TXREG
63. UDP module gref conf click here x ok ok afe afe ale ake afe ale afe ok ok TCP Configuration Yk sk ski sk sk PE afe afe ale ok ale ok ok Maximum number of times a connection be retried before closing it down define MAX RETRY COUNTS 3 TCP Timeout value to begin with define START TIMEOUT VAL 1 TICK16 TICKS PER SECOND TICK 16 3 Define ports define TCP LOCAL PORT START NUMBER 1024 define TCP LOCAL PORT END NUMBER 5000 When defined the code will be compiled for optimal speed If not defined code 15 defined for smallest size define TCP SPEED OPTIMIZE When defined each TCP segment is sent twice This might cause the remote node to think that we timed out and retransmitted It could thus immediately send back an ACK and dramatically improve throuput define TCP SEND EACH SEGMENT TWICE Comment following line if StackTsk should wait for acknowledgement from remote host before transmitting another packet Commenting following line may reduce throughput 126 define TCP WAIT FOR ACK ok ok ak ok k 9k ok addtogroup mod_conf_projdefs b TCP For details on c
64. X BUFFER SIZE 250 define MAC TX BUFFER COUNT 1 endif Rests are Receive Buffers define RX BUFFER SIZE MAC_TX BUFFER SIZE if MAC_TX BUFFER SIZE lt 0 MAC TX BUFFER SIZE gt 1500 error Invalid MAC TX BUFFER SIZE value specified endif MAC_TX BUFFER SIZE MAC TX BUFFER COUNT gt 4 1024 error Not enough room for Receive buffer endif addtogroup mod conf projdefs Q code Zdefine CONNECTIONS endcode Maximum numbers of simultaneous HTTP connections allowed Each connection consumes 10 bytes if defined BRD_SBC44EC defined BRD_SBC45EC define MAX HTTP CONNECTIONS 2 elif defined BRD_SBC65EC defined BRD SBC68EC define MAX HTTP CONNECTIONS 6 else error Board type not defined endif if MAX HTTP CONNECTIONS gt FSEE MAX FILES if MAX HTTP CONNECTIONS FSEE MAX FILES gt 2 error Too little file handles defined error For better performance of the web server try and match HTTP Connections and file handles endif endif if MAX HTTP CONNECTIONS lt 0 MAX HTTP CONNECTIONS gt 255 error Invalid MAX HTTP CONNECTIONS value specified endif define AVAILABLE SOCKETS SOCKETS if defined STACK USE HTTP SERVER define AVAILABLE SOCKETS2 AVAILABLE SOCKETS MAK HTTP CONNECTIONS else define AVAILABLE SOCKETS2 MAX SOCKETS endif 137 When using FTP you must have at least two sockets free
65. a in units of W given by D9 and K is the incidence angle modifier for the radiation incident on the surface of the array which is calculated using 010 is the y intercept value of the efficiency equation that has been modified to reflect the difference between the flow rate used in the rating process and the flow rate used in the simulation test It is calculated using D11 FU is the slope value of the efficiency equation also modified to reflect the difference in flow rates This value is given by D12 1 G D9 Pm D9 1 K 1 b 1 D10 cos 0 58 where b is a constant called the incidence angle modifier coefficient and can be found on the SRCC Certification and Rating sheet for the panel being simulated under the Incident Angle Modifier section On the rating sheet the value is usually given as a negative value but 010 needs b as a positive value rxF a 01 1 where is the y intercept value for the efficiency equation given on Certification and Rating sheet for the collector r is the ratio by which the y intercept and slope of the efficiency equation are to be corrected for the difference in flow rate as is given by D13 FU rx FRU D12 where F U is the slope value for the efficiency equation given on the rating sheet for the collector This value is usually given as negative but 012 requires a positive value M C xFU 1
66. and financial support the engineering program at Baylor has provided I would like to thank Thomas Cemo for his contribution to the project and for the help he has given in the areas of mechanical engineering that I did not fully understand Finally I would like to thank Ashley Orr for his support and suggestions throughout my entire enrollment at Baylor Introduction Purpose of this Project The amount of energy that is used for residential water heating ranges from 14 to 25 of the total energy consumed in the home 1 This significant portion of a household s energy usage coupled with rising cost of energy provides a strong motivation for the implementation of residential solar thermal systems The purpose of this project is to design build and test a simulator for a small solar thermal collector array that can be used in a laboratory configuration to test other components of a solar thermal collector system The simulator will be able to repeatedly produce given output power corresponding to specific solar conditions so that a typical solar thermal system can be tested with greater reliability Figure 1 depicts a simple solar thermal collector system arrangement and what part of this system the simulator will replace Pump Figure 1 Basic solar thermal configuration System Description The Solar Thermal Collector Simulator STCS is an on demand water heater that has been modified to allow the user
67. ant for hardware SPI SPI FOSC xx depends on device and clock speed using SPI FOSC 16 will provide 2 5 MHz clock for FM25640 G using SPI FOSC 4 will provide a 10 MHz clock for FM25256 G define SPI ROLE SPI FOSC 4 define SPI ROLE SPI FOSC 16 oe oF ake oR o 9k ok addtogroup mod conf projdefs b FTP For details on configuring the FTP module ref ftp conf click here sk ok sk ok ok k sk ok ok afe afe ale ake EEEE EEEE EEEE ok Configuration Yk sk sk ok afe ale ale ake ok ale afe ale afe ake ale ale ok ICICI ICE The following should be defined in the projdefs h file OR on the command line Define the port used for the HTTP server default is 80 define DEFAULT_HTTPSRVR_PORT 80 Configured HTTP Server port define HTTPSRVR PORT WORD appcfgGetc APPCFG_HTTPSRVR_PORTH lt lt 8 WORD appcfgGetc APPCFG_HTTPSRVR_PORTL Define as 1 to parse replace xnn tags HTML files or 0 not to parse them define HTTP_PARSE FILETYPE HTML 0 Define as 1 to parse replace Voxnn tags JavaScript files or 0 not to parse them define HTTP_PARSE FILETYPE JS 0 Define as 1 if Authentication required for all files that start with X character define HTTP_AUTH REQ FOR X FILES appcfgGetc APPCFG_WEB FLAGS amp A
68. as heating system Table E 7 Prices for solar thermal collector system installation Table F 1 Mass flow rate uncertainty information Table F 2 Thermocouple uncertainty information Table F 3 Thermistor uncertainty information Table F 4 Thermistor calibration uncertainty totals Table F 5 Sampling uncertainty information vil 23 24 40 41 53 54 54 55 61 62 67 68 69 69 70 76 77 78 78 79 Table F 6 Total temperature reading uncertainties Table F 7 Sample total uncertainty calculation Table G 1 STCS parts list viii 80 80 83 LIST OF ABBREVIATIONS STCS solar thermal collector simulator ASCII American standard code for information interchange UDP universal datagram protocol TMY2 typical meteorological year 2 MMBtu millions of British Thermal Units volts alternating current ADC analog to digital converter DC direct current TRIAC triode for alternating current LED light emitting diode EEPROM electrically erasable programmable read only memory TRNSYS transient energy system simulation tool SRCC Solar Rating and Certification Corporation IP internet protocol RMS root mean square EF economic factor ACKNOWLEDGMENTS I would like to thank Dr Gravagne for the guidance and help he has given me over the course of my education and this project I am also thankful for the learning process
69. ast void fastUserProcess void CLRWDT Main entry point void main void static TICK8 t 0 static TICK8 tmr10ms 0 Initialize any application specific hardware InitializeBoard Initialize all stack related components Following steps must performed for all applications using PICmicro TCP IP Stack TickInit nitialize file system fsysInit Intialize HTTP Execution unit htpexecInit 90 Initialze serial port serInit Initialize Stack and application related NV variables appcfglnit appcfgUSARTY Configure the USART ifdef SER USE INTERRUPT Interrupt enabled serial ports have to be enabled serEnable endif lappcfgCpulO Configure the CPU s I O port pin directions input or output appcfgCpulOValues Configure the CPU s I O port pin default values appcfgADC Configure ADC unit appcfgPWM Configure PWM Channels Serial configuration menu display it for configured time and allow user to enter configuration menu scfInit appcfgGetc APPCFG_STARTUP_ SER DLY StackInit if definedSTACK USE HTTP SERVER HTTPInit endif if defined STACK USE FTP SERVER FTPInit Initializes UDP Command Port and UDP Command Responce emdUdpInit if defined STACK USE DHCP defined STACK_USE_IP_GLEANING DHCPReset nitialize DHCP module DHCP is NOT enabled if appcfgGetc APPCFG
70. be assumed to be one half of the smallest unit of measurement Random uncertainty is due to variability in testing Reporting the uncertainty of the output value is more commonly accepted than the error due to the inability to know the actual value that the measured value is representing The method involves taking the root sum square combination of terms that represent the uncertainty of various inputs to the equation that calculates the output power The calculations used to find the uncertainties in the different parts of the STCS can be found later in this appendix The power output to the water is calculated using F1 0 4 Fl Flow rate outlet temperature 7 and inlet temperature 7 are the three variables that have to measured in the system to calculate F1 To find the total uncertainty of the system the uncertainty of each variable that is measured must be calculated 72 The flow rate during the experiments shown in this thesis was reported by a flow meter measuring the flow of the system The meter sends a pulse to the STCS when 0 05 gallons have flowed through it There are two fixed uncertainties associated with using this flow meter the uncertainty of the flow sensor and the uncertainty of the sensor reader The uncertainty in the measurement of the flow rate is given by F2 E sensor reader The flow sensor has a reported accuracy of 1 of full range For the system
71. cs timertemp2 65535 udpRxBuf 7 udpRxBuf 8 udpRxBuf 9 udpRxBuf 10 48 if udpRxBuf 7 49 Elon 1 else Elon 0 if udpRxBuf 8 49 E2on 1 else 2 0 if udpRxBuf 9 49 1 else 0 if udpRxBuf 10 49 E4on 1 else E4on 0 else if udpRxBuf 0 82 82 R if udpSocketUserTx INVALID_UDP_SOCKET udpSocketUserTx UDPOpen WORD 4001 UDPGetNodeInfo WORD 4001 if myerror 0 udpTxBuf 0 udpTxBuf 5 udpTxBuf 10 udpTxBuf 15 udpTxBuf 20 udpTxBuf 25 udpT xBuf 30 udpTxBuf 35 udpTxBuf 40 udp TxBuf 45 udpTxBuf 50 udpTxBuf 55 65 udpTxBuf 60 udpTxBuf 66 81 81 Q if tempsens1 lt 0 udpTxBuf 1 45 45 1 tempsens 1 else udpTxBuf 1 J tempsens1 tempsens1 1000 1000 48 udpTxBuf 2 tempsens 1 1000 51 100 100 48 udpTxBuf 3 tempsens 1 100 tempsens 1 10 10 48 udpTxBuf 4 tempsens19610 48 if tempsens2 0 udpTxBut 6 45 tempsens2 tempsens2 1 else udpTxBuf 6 tempsens2 tempsens2 1000 1000 48 udpTxBuf 7 tempsens2 1000 tempsens2 100 100 48 udpTxBuf 8 tempsens2 100 tempsens2 10 10 48 udpTxBuf 9 tempsens2 10 48 100 if tempsens3 lt 0 udpTxBuf 11 45 tempsens3 tempsens3 1 else udpTxBuf 1 1 tempsens3 tempsens3 1000 1000 48 udpTxBuf 12 tempsens3 10
72. d s action All characters are in uppercase void HTTPProcessHdr HTTP_INFO httpInfo BYTE BYTE 5 BYTE i charunpw 20 for storing username and password seperated by char base64 25 Buffer for storing base64 result Check if buffer begins with ROM string ignore case if strBeginsWithIC char hdr HTTPHDR AUTHORIZATION i strcpyee2ram unpw APPCFG USERNAME 8 Returns number of bytes written excluding terminating null unpw it Overwrite terminating null with strcpyee2ram amp unpw i PASSWORDO 8 base64Encode char base64 char unpw strlen unpw if stremp char amp hdr sizeof HTTPHDR_AUTHORIZATION 1 base64 0 httpInfo gt flags bits bUserLoggedIn TRUE if DEBUG_MAIN gt LOG_DEBUG debugPutMsg 6 mxd 6 HTTP User Authenticated endif Implement callback for FTPVerify function if definedSTACK USE FTP SERVER USER NAME LEN gt USERNAME LEN error The FTP Username length can not be shorter then the APPCFG Username length endif BOOL FTPVerify char login char password if DEBUG MAIN gt LOG INFO 96 debugPutMsg 4 mxd 4 Received FTP Login Yos and Password Yos debugPutString login debugPutString password endif if strempee2ram login APPCFG_USERNAMED0 0 if strempee2ram password PASSWORDO 0 return TRUE
73. date Packet Format 1 byte R R ASCII formatted R for Request for status update Heater Power Level Packet Format 11 bytes PmmmmmEnnnn P ASCII formatted P for Power level mmmmm ASCII formatted five digit number between 00000 and 37266 corresponding to desired output power Characters other than numbers will turn off all output power P gt 37266 turns off all output power E ASCII formatted E for Element nnnn ASCII formatted four digit number of zeros and ones For example 0100 indicates that element 2 should operate at the specified power level but elements 1 3 and 4 should remain off Characters other than 17 will be interpreted as a 0 For the over temperature error the ASCII string will contain which thermistor is sensing the over temperature the strings for the fluid level error and the leak detection error contain which error occurred Table A 2 has an outline for how the packets received from the STCS will be structured The output power command is composed of a value corresponding to the requested output power and which of the four heating elements to turn on The output power value in the power command is the delay value the microcontroller uses to control what percentage of the power will be sent to the heating elements For information on how to calculate this delay value see Appendix B The program shown in this document is PCAUSA s Test TCP The program
74. dcread4 3 H adcread5 3 H adcread6 3 4 adcread7 3 H adcread8 3 H adcread9 2 H sumadc10 unsigned short int adcread10 0 adcread10 1 adcread10 2 adcread10 3 adcread10 4 adcread10 5 adcread10 6 a dcread10 7 adcread10 8 adcread10 9 adcread9 3 H 104 tadcread1 4 tadcread2 4 tadcread3 4 adcread4 4 H adcreadS 4 H adcread6 4 H adcread7 4 H tadcread8 4 tadcread1 5 adcread2 5 H tadcread3 5 Fadcread4 5 H Fadcread5 5 H tadcread6 5 Fadcread7 5 4 Fadcread8 5 H adcread9 4 H Fadcread9 5 H adcreadl 6 4 adcread2 6 4 adcread3 6 4 adcread4 6 4 adcread5 6 4 adcread6 6 4 adcread7 6 4 adcread8 6 4 1 7 tadcread2 7 adcread3 7 adcread4 7 tadcread5 7 adcread6 7 adcread7 7 tadcread8 7 adcread9 6 4 adcread9 7 sumadc11 unsigned short int adcread1 1 0 1 1 7 adcread11 8 adcread1 1 9 sumadc12 unsigned short tadcread1 1 1 adcread11 2 adcread1 1 3 adcread1 1 4 adcread1 1 5 adcread11 6 e int adcread12 0 4 e tadcread12 1 adcread12 2 adcread12 3 adcread12 4 adcread12 5 adcread12 6 deread12 7 adcread12 8 adcread12 9 if sumadc1 1730 else mathtemp 0 00000000000052329 pow float sumadc 1 5 0 mathtemp 0 00000000260072314 pow float sumadc1 4 0 mathtemp 0 00000523178 764528
75. define MY DEFAU define DEFAU define MY DEFAU define MY DEFAU define MY DEFAU define MY DEFAU define MY DEFAU endcode Use these defines to define the default Mask Gateway and Ethernet MAC address of this device define define define define define define define define define define define define define MY DEFAU MY DEFAU MY DEFAU MY DEFAU DEFAU LT MASK BYTE n LT MASK BYTE n LT MASK BYTE3 n LT MASK n LT GATE n LT GATE 2 n LT GATE BYTE3 n LT GATE BYTE4 n LT MAC BYTE n LT MAC BYTE n LT n LT n LT BYTES n LT MAC BYTE6 n MY DEFAULT MASK BYTEI MY DEFAULT MASK BYTE2 MY DEFAULT MASK BYTE3 MY DEFAULT MASK BYTE4 MY DEFAULT GATE BYTEI MY DEFAULT GATE BYTE2 MY DEFAULT GATE BYTE3 MY DEFAULT GATE BYTE4 LT MAC BYTEI LT MAC BYTE2 LT MAC BYTE3 LT MAC 4 LT MAC BYTES if defined DEMO MODE define MY DEFAULT MAC BYTE6 else define MY DEFAULT MAC BYTE6 endif addtogroup mod conf projdefs Q code define MY DEFAULT DNS BYTE n define MY DEFAULT DNS BYTE2 n define MY DEFAULT DNS BYTE3 n define MY DEFAULT DNS BYTEA n 0 00 0 00 0x00 MY DEFAULT IP ADDR BYTEI MY DEFAULT IP ADDR BYTE2 MY DEFAULT IP ADDR BYTE3 MY DEFAULT IP ADDR BYTE4 0x00 0x04 0xa3 0x00 0
76. defined BRD_SBC65EC defined BRD SBC68EC define SER TXBUF SIZE 128 Size of TX buffer must be 8 16 32 64 128 256 else error Board type not defined endif Uncomment this line if the transmit routines should wait for the bytes to be send via USART if tx buffer is full define SER WAIT FOR TXBUF Uncomment this line if the application does NOT configure the USART define BAUD RATE 9600 USART BAUD rate Comment this line if the application does NOT configures the USART define APP CONFIGURES SERPORT Our application does all serial port configuration FE TE tke oR addtogroup mod conf projdefs b Serint For details on configuring the Interrupt driven serial module ref conf click here sj ok ok k EEEE EEEE ok ale ake ok sk afe ale oF ale ale ok ak ok ok kk ake ake ake ale k UDP Configuration I I When defined the code will be compiled for optimal speed If not defined code is defined for smallest size define UDP SPEED OPTIMIZE FE TE spe oe SF addtogroup mod conf projdefs b UDP For details on configuring the
77. e the power output from the simulator can be repeated reliably Repeatability removes any variability involved with using an actual solar thermal collector due to the fact that actual weather conditions cannot be replicated easily Solar Feasibility in Central Texas A solar thermal collector system can be used to augment an existing water heating installation by preheating the water before it enters the main water heater When determining if a solar powered system would be feasible in an area the two main factors to consider are the amount of solar energy insolation which is available and the economics associated with installing the system The available insolation in an area will determine how much energy can be gained by a system and thus how long it will take for the energy offset to pay for the system The most common configuration for a non tracking solar thermal collector system in the United States has the collector panels facing south and tilted at an angle that is equal to the latitude of the location plus 15 The extra 15 helps the collector absorb more energy during the winter months because the sun is lower in the sky Figure 2 shows the yearly average available insolation across the state of Texas for a system that uses the latitude plus 15 for the slope of the collectors Flat Plate Tilted South at Latitude Plus 15 Degrees Figure 2 Total insolation on a tilted flat plate collector in
78. e A 3 Figure Figure A 5 Figure A 6 Figure A 7 Figure A 8 Figure B 1 Figure C 1 Figure E 1 Figure G 1 Figure G2 A heater power level command being transmitted to the STCS A sample status update received from the STCS A sample error code being received from the STCS Oscilloscope probes connected across heating element wires Oscilloscope screen showing 4 16 ms firing delay Firing delay adjustment buttons Fluid level sensor screws Average power versus TRIAC delay Firing delay TRNSYS project layout STCS control board layout STCS control board schematic vi 42 42 42 43 44 45 46 48 53 67 81 82 LIST OF TABLES Table 1 Equations used by the microcontroller for calculating reported temperatures Table 2 Equations for calculating temperature of auxiliary inputs Table A 1 ASCII strings transmitted to the STCS Table A 2 ASCII strings received from the STCS Table C 1 Power level command format Table C 2 System status format Table C 3 Request for status update format Table C 4 Error message format Table E 1 Typical Residential Usage of Hot Water per Week Table E 2 Monthly Residential Hot Water Usage Table E 3 Results from TRNSYS simulation for electric heater system Table E 4 Results from TRNSYS simulation for gas heater system Table E 5 Energy and money saved for the electrical heating system Table E 6 Energy and money saved for the g
79. e define EEPROM CONTROL n endcode This value 15 for Microchip 24LC256 256kb serial EEPROM define EEPROM CONTROL 0xa0 Number of bytes to be reserved before FSEE File System storage starts These bytes can be used by the user application to store application configurations data and any other required variables 129 After making any change to this variable the file system image must be recreated with correct block size define RESERVE BLOCK 64 Number of bytes to be reserved before FSFRAM File System storage starts These bytes can be used by the user application to store application configurations data and any other required variables After making any change to this variable the system image must be recreated with correct block size define FSFRAM RESERVE BLOCK 64 addtogroup mod_conf_projdefs code define STACK USE ICMP endcode Uncomment if stack is to use ICMP For details see ref mod_tcpip_base_icmp define STACK USE addtogroup mod conf projdefs Q code define STACK USE HTTP SERVER endcode Uncomment if stack is to have a HTTP server This is usually the case and this define 1s usually included For details see ref mod tcpip httpsrvr define STACK USE SERVER addtogroup mod conf projdefs code define STACK USE SLIP endcode Uncomment if stack should implem
80. e experimental data overlaid Figures 13 through 17 contain the results from five separate two hour tests to show the repeatability of the power output Figure 18 shows the output from all five repeatability test trials overlaid to show the relative closeness of the power output values To quantify how close the outputs were to one another a metric was used to compare every individual trial s output to the others The average of each of these comparisons was then taken to show how the STCS performed overall 29 QUO er sye y ur mod jndjn ams Du 00 2992 uonejnuis 666 992 228 1996 999 996 66r 992 566 1996 991 996 000 1996 228 0996 999 0996 005 0992 eee 0996 19L 099 000 099 00 00 jndjno enjoy punog Id MOT 081 081 5 hs A pA A 2 jndjno 2 0218 punoq Ajurej1ooun 0215 0904 0904 DD Y 0006 5216 noo jnoo snd m snuiur 30 sye AA mod py 220814 Du 00 2992 uonejnuis 666 992 228 1996 999 996 66 1996 222 1996 991 199 000 1992 228 0996 999 0996 005 099 222 099 494 099 000 099 00 004 Orel jndyno enjoy punoq Ajurej1ooun 081 091 a fx fs rS A P m m ER 8 2 pojoodxq 2 oe punoq Ajurej1ooun J
81. earing signatures is kept on file in the Graduate School Copyright 2009 by Kirk Bolton All rights reserved TABLE OF CONTENTS LIST OF FIGURES LIST OF TABLES LIST OF ABBREVIATIONS ACKNOWLEDGMENTS CHAPTER ONE Introduction Purpose of this Project System Description Chapter Descriptions CHAPTER TWO Theory behind the Project Usefulness of the Project Solar Feasibility in Central Texas CHAPTER THREE Hardware Overview Hardware Modification Control Board Heating Elements Thermistors Power Control Safety Relays Status LEDs Flow Meter Inputs Auxiliary ADC Inputs Power Supply Microcontroller Board CHAPTER FOUR Software Overview Microcontroller Board Power Control ADC Handling Temperature Reporting Flow Meter Reading iii vii ix NNR 19 19 20 22 22 24 UDP Communications 25 Error Handling 26 TRIAC Firing Delay 26 External Control Program 27 CHAPTER FIVE 28 Test Results and Verification 28 System Performance Goals 28 Repeatability Test Results 29 Accuracy Test Results 35 Test Conclusions 36 APPENDICES 38 A User s Manual 39 Interfacing with the STCS 39 Initial Set up of the STCS 43 Maintaining the STCS 45 B Average Power Output versus TRIAC Delay 47 C Solar Thermal Collector Simulator Communication Standards 51 DAvailable Insolation and Power 56 Available Insolation 56 Available Power 58 E Conceptual Analysis and Feasibility Study 61 Conceptual Analysis 61 Feasib
82. eatures into a single package that can be attached to the STCS circuit board The control board chosen for the STCS is a Singe Board Computer manufactured by Modtronix Engineering The SBC65EC shown in Figure 10 incorporates Ethernet connectivity a 64 kilobyte electrically erasable programmable read only memory EEPROM unit and a microcontroller that has 12 8 bit ADC inputs and 20 other user programmable digital inputs or outputs One benefit of using the SBC65EC is it comes with a basic code structure that allows the programmer the ability to modify existing source code instead of having to write new functions This code includes the necessary functions to use the Ethernet port and the ADC unit on the SBC65EC Another benefit of using the SBC65EC is the 40 pin daughter board connector that allows easier integration into an outside system 19 Figure 10 Modtronix SBC65EC The code that operates the microcontroller is a modification of the existing source code that comes from Modtronix The new code has sections that control the power output read the ADC values calculate the temperatures of the thermistors read the flow meters handle the incoming and outgoing universal datagram protocol UDP communications check for errors in the system and handle the changing of the TRIAC firing delay Figure 11 shows a flow diagram for how the microcontroller code operates Power Control The power output control code uses four differ
83. ecause it allows a user to program equations set up real time control loops and control external devices within a single programming window to calculate the output power and communicate with the STCS while adhering to a strict timing schedule The equations LabVIEW uses to calculate the output power can be found in Appendix D 27 Test Results and Verification System Performance Goals In order to verify that the STCS performs as intended several tests have to be run and the results compared against a reliable data source The two goals of the STCS are to accurately and repeatedly simulate the output of a small array of solar thermal collectors For both the accuracy and the repeatability of the system to be verified there has to be an accurate and reliable source of data for comparison The Transient Energy System Simulation Tool TRNSYS was used to provide the data for comparison to the performance of the STCS To test for accuracy the uncertainty of the power output was calculated and the output would need to fall within the error bounds To show the system is repeatable five trials were run with the same input parameters over the same two hour period of a theoretical day The power output from the five trials being close to each other would confirm the STCS s repeatability The Solar Rating and Certification Corporation SRCC tests and rates the majority of all solar thermal collectors available Panels are tested
84. ed MCHP C18 define CLRWDT CIrWdt define NOP Nop define RESET Reset define SLEEP Sleep define ROM rom define PORTA RAO PORTAbits RAO define PORTA RAI PORTAbits RAI define PORTA RA2 PORTAbits RA2 define PORTA RA3 PORTAbits RA3 define PORTA RA4 PORTAbits RA4 define PORTA RAS PORTAbits RA5 define LATAO LATAbits LATAO define LATAI LATAbits LATAI define LATA2 LATAbits LATA2 define LATA3 LATAbits LATA3 define LATA4 LATAbits LATA4 define LATAS LATAbits LATAS define TRISA RAO TRISAbits TRISAO define TRISA RAI TRISAbits TRISAI define TRISA RA2 TRISAbits TRISA2 define TRISA TRISAbits TRISA3 define TRISA_RA4 TRIS Abits TRISA4 define TRISA RAS TRISAbits TRISA5 define PORTB RBO PORTBbits RBO define PORTB RBI PORTBbits RB1 define PORTB RB2 PORTBbits RB2 define PORTB_RB3 PORTBbits RB3 define PORTB_RB4 PORTBbits RB4 define PORTB_RB5 PORTBbits RB5 define PORTB RB6 PORTBbits RB6 define PORTB_RB7 PORTBbits RB7 define LATBO LATBbits LATBO 110 define LATBI define LATB2 define LATB3 define LATB4 define 5 define LATB6 define LATB7 define TRISB_RBO define TRISB_RB1 define TRISB_RB2 define TRISB_RB3 define TRISB_RB4 define 5 define TRISB_RB6 define TRISB_RB7 define PORTC RCO define PORTC define PORTC RC2 define PORTC RC3 define PORTC_RC4 define PORTC_RC5 define PORTC_RC6 define PORTC_RC7 define LATCO define LATCI defi
85. edges of 3 3 volt logic as well Note that pulse accumulator registers are zeroed immediately after they are reported Peripheral Request input received BY unit The STCS will only report peripheral input values when requested Table C 3 Request for status update format Peripheral Request Packet Format 1 byte R ASCII formatted capital R triggers peripheral input request Error Codes output transmitted FROM unit If an error has occurred the STCS will issue error codes once a peripheral request 15 made Multiple error codes are sent as individual messages 54 Table C 4 Error message format Error Code Packet Format 4 bytes EZZZ E ZZZ ASCII formatted E indicates error message ASCII formatted error code OTn Over temperature condition at thermistor n where n is 1 2 3 4 or 5 Temperatures above 200 degrees F will trigger this error code and the unit will deactivate all power TRIACs until temperatures fall below 180 degrees F Temperatures over 200 degree F may also require a manual reset of the unit s thermal circuit breaker No fluid in heater chamber If no circulator fluid can be detected the unit will report NFC and deactivate all power TRIACS until fluid is detected Fluid is detected using a conductivity measurement Note that this precludes the use of oils or de ionized water as a circulator fluid LDD Leak detected If a fluid leak is detected the unit w
86. efine TKSTAI TRMTI define TXSTA1 BRGH BRGHI define TXSTA2_TRMT TRMT2 define TXSTA2_BRGH BRGH2 define RCSTA_CREN CREN define RCSTAI CREN CRENI define RCSTA2_CREN CREN2 define ADCONO GO GODONE define ADCONO ADON ADON define Nop asm NOP define RCON POR POR define WREN WREN define EECONI WR WR define EECONI RD RD define EECONI EEPGD EEPGD define EECON1_CFGS CFGS define EECONI FREE FREE if defined 18F6621 defined 18F6680 static near bit SCSO unsigned amp OSCCON 8 0 static near bit SCSI unsigned amp OSCCON 8 1 static near bit LOCK unsigned amp OSCCON 8 2 static near bit PLLEN unsigned amp OSCCON 8 3 119 endif define OSCCON_PLLEN PLLEN define OSCCON_LOCK LOCK define OSCCON_SCS1 SCSI define OSCCON SCS0 SCSO endif endif projdefs h ifndef_PROJDEFS H define PROJDEFS H Defines define NON MCHP MAC The DEMO Mode define is used to place the SBC65EC in demo mode In this mode some functions are disabled define DEMO MODE release Ensure this is commented out Include files include net compiler h include appcfg h Global variables defined in main application ifndef THIS IS STACK APPLICATION String must have format Vn mm or Vnn mm n major part and can be 1 or 2 digets long mm is minor part and must be 2 digets long extern ROM char APP VER STR endif define APP VER
87. ent interrupts two triggered by external sources and two triggered by internal 16 bit counters Since the phase of the two separate input power circuits will be different two different input power handling circuits are needed Each circuit consists of zero cross detection hardware a zero cross detection interrupt and an internal timer interrupt Each input power circuit powers two 20 of the heating elements and so control of two TRIACS are needed in the power handling circuits as well Figure 11 Software system overview The zero cross detection circuits send a five volt pulse to the microcontroller when the phase of the input power is either 0 or 180 This pulse triggers an interrupt that sets the firing delay value in an internal count up timer and starts the timer Once this timer counts up to its maximum value of 65535 it triggers an interrupt that turns the TRIAC on until the end of the half cycle The firing delay is received from an external PC and gets altered by the firing delay modifier value that is set by the firing delay adjustment buttons on the STCS This modification is necessary due to the fact that the pulse received from the zero cross detection circuitry is not received exactly at the point when the phase of the power is 0 or 180 The firing delay modifier also allows the STCS to provide more finely tuned output power 21 ADC Handling The code provided by Modtronix initializes and handles the ADC unit
88. ent s power level is controlled by a power TRIAC The TRIAC switches the element on at some point during each 4 cycle of AC input voltage and switches it off at the next zero crossing See Figure C 1 The point is always measured relative to the previous zero crossing and is also known as the phase 51 angle In this manner the element s average power ranges from nearly 100 zero phase angle to nearly 0 180 degree phase angle The STCS controller divides each cycle into 41 666 increments Each increment therefore corresponds to 0 0432 degrees of phase angle or 0 2 microseconds Because TRIACS cannot be reliably triggered too near a zero crossing the largest allowable phase angle is 880 microseconds before the next zero crossing in other words 7 453 ms or 161 degrees from the previous zero crossing Thus the power level communication standard simply specifies an ASCII formatted number P between 0 and 37 266 along with instructions about which element s to turn on P specifies the number of 0 2 microsecond intervals from the preceding zero crossing at which point the TRIACs will conduct Users should bear in mind that P 0 corresponds to virtually no delay or near 100 average power There is a slight delay while the TRIAC builds up enough gate current to trigger P 37 266 corresponds to 7 453 ms delay or about 0 8 of full power The symbol simply specifies below which elements are
89. ent the SLIP protocol For details see ref mod tcpip base slip define STACK USE SLIP addtogroup mod conf projdefs Q code define STACK USE GLEANING endcode Uncomment if stack should implement IP Gleaning For details see ref mod user ipgleaning define STACK USE IP GLEANING addtogroup mod conf projdefs code define STACK USE DHCP endcode Uncomment if stack should implement the DHCP protocol For details see ref mod tcpip user dhcp define STACK USE DHCP addtogroup mod conf projdefs code define STACK USE FTP SERVER endcode Uncomment if stack should implement a FTP server For details see ref mod tcpip user ftp define STACK USE FTP SERVER addtogroup mod conf projdefs code define STACK USE SNMP SERVER endcode 130 Uncomment if stack should implement the SNMP protocol define STACK USE SNMP SERVER addtogroup mod conf projdefs code define STACK USE TFTP CLIENT endcode Uncomment if stack should implement a TFTP client ay define STACK_USE_TFTP_CLIENT addtogroup mod conf projdefs code define STACK USE SMTP endcode Uncomment if stack should implement SMTP sj define STACK USE SMTP addtogroup mod conf projdefs Q code define STACK USE TCP endcode This define 1s automatically enabled disabled based on high level module selections If you need them with your custom applicat
90. ere Configuration Yk sk sk sk sk ale ok afe ale ale ake ok sk ok sk ale afe afe ale afe ale ICICI I kkk Default UDP Command Port define DEFAULT_CMD_UDPPORT 54123 Default UDP Command Responce Port define DEFAULT CMDRESP UDPPORT 54124 define CMD UDPPORT WORDJ appcfgGetc APPCFG CMD UDPPORTI1 8 WORD appcfgGetc APPCFG_CMD_UDPPORTO define CMDRESP_UDPPORT WORD appcfgGetc APPCFG_CMDRESP_UDPPORT1 lt lt 8 WORDJappcfgGetc APPCFG CMDRESP UDPPORTO ok ok ok ok afe ake ae ok DHCP Configuration Yk sk sk ok sk afe sk afe afe ale ak ok ok ale aje ok ale CK Defines DHCP ports define DHCP CLIENT PORT 68 define DHCP SERVER PORT 67 The stack uses the macro STACK IS DHCP ENABLED to determine if DHCP is enabled or not The user can for example assign this macro to check if a flag is set If not defined by the user it will be set to true define STACK IS DHCP ENABLED appcfgGetc APPCFG_NETFLAGS amp APPCFG NETFLAGS DHCP Timeouts define DHCP_TIMEOUT TICK16 4 TICK16 TICKS SECOND ok oe oe oe oe addtogroup mod conf projdefs b DHCP For details on configuri
91. g inputs obtained using 8 bit analog to digital conversion as well as two pulse accumulator inputs The first five analog inputs represent temperatures of various thermistors in the unit itself See Table A 2 The last seven analog inputs are available for external user supplied equipment such as additional 53 thermistors thermocouples level sensors etc Two pulse accumulator ports are available for reading flow meter outputs Table C 2 System status format Peripheral Input Packet Format 72 bytes AXXXXAXXXXAXXXXAXXXXAXXXXAyyyy AyyyyQOnnnnnOnnnnn A ASCII A delimiter separates 4 digit analog readings There 12 A characters in a peripheral input message XXXX The five thermistor inputs report as a 4 digit ASCII value that represents the temperature multiplied by 10 For negative temperature values the first character is replaced with a This value can be between 999 and 9999 yyyy The general purpose analog inputs report as a 4 digit ASCII value that represents the ADC value multiplied by 10 This value can be between 0 and 2550 8 bit resolution Q ASCII Q delimiter separates 5 digit pulse accumulator count nnnnn Each accumulator is reported as a 5 digit ASCII value between 0 and 65 535 16 bit register The first value is accumulator 1 and the second is accumulator 2 Pulse registers accumulate on rising edges Accumulator inputs are 5 volt compatible but will trigger on rising
92. giving unique ADC count to temperature equations for inlet and outlet seen in Table 1 The ADC count values used Table 1 are the ten point averages calculated by the ADC read unit and are expected to be ten times the ADC count value The temperatures that are calculated by the equations in Table 1 are ten times the temperatures allowing the first decimal point of the temperatures to be reported to a connected PC The remaining temperatures are only used to monitor for an over temperature condition so their accuracy is not as vital to the operation of the system To simplify the calibration process the three intermediate temperatures were calibrated using the same theoretical values for an R25 thermistor The temperatures calculated by the equations in Table 1 and the ADC count values used are all multiplied by ten Table 1 Equations used by the microcontroller for calculating reported temperatures 5 23294 1077 ADCS 2 60072 107 x ADC 5 23179 10 x 5 43443 x107 x ADC 3 42057 x ADC 1752 29 2 7311984x10 x ADC 1 9438863 107 x 51 890675 x ADC 61571 201 ADC 2 7398743 x10 7 067310 3 17676 x10 ADC 5 79382 107 x 5 53712 10 gt ADC 3 32514 ADC 1721 35 2 7047486 10 ADC 1 3414615 ADC 2219 5478x ADC 1 2253017x10 5 82441x10 ADCS 2 81569 107 ADCS 5 51567 107 x ADC 5 61708 107 x ADC
93. h is calculated using D4 g 23 457 sin 22 284 day 180 365 08 where day is the number of the day of the year tr 5 24 1 12 where is the solar time of the year and is calculated using D5 T ac Hr A L Li 501 year 60 D5 where Hr is the hour of the year L is the standard meridian for the local time zone year in radians L OC is the longitude of the location of the simulated collector array in radians and E is referred to as the equation of time and is calculated by D6 E 229 2 0 000075 0 001868 cos B 0 032077sinB D6 0 014615cos2B 0 04089 sin 2B where B is a value that is calculated using D7 2 day 1 D7 day 7 57 Available Power The available insolation is assumed to remain constant for an hour thus is only calculated at the beginning of each hour of the simulation Once the hourly insolation has been calculated the simulated panel array parameters are used to find the amount of power that will theoretically be provided to the fluid This theoretical power is called the useful power and is calculated using 08 A G K FLU T T 08 se where A is the area of the collector array being modeled 7 is the temperature of the fluid at the inlet of the collector array and T is the ambient temperature around the array G is the total irradiance per unit are
94. he difference between the real and its approximation will also be a high order polynomial and difficult to avg predict Root finding algorithms may also exhibit numerical instabilities for high order polynomials Another approach is to iteratively solve for d given P This method is viable lesired because P d is monotonic and its gradient always has the same sign The algorithm avg requires a guess for an initial solution d say 4 4 5 ms Then OP d C d IP Pusa B5 where is a constant on the order of 10 The algorithm repeats until error P 5 p avg k becomes small enough Note T l 2 B6 is always negative except at d 0 and d T meaning that 0 or d T are not good initial guesses for the search algorithm The benefit of this algorithm is that the search error is under direct control and always known The downside is that the algorithm may require many iterations to solve for d near the tails of the P curve However since there is little need to adjust power levels more often than once every few seconds or even once every 15 or 30 seconds iteration count should not be a problem 49 The analysis above also shows that a maximum allowable TRIAC phase angle less than 15 in fact not a serious limitation Maximum delay 7 45115 corresponds to about 0 8 of full power
95. id with the research and development of future projects that incorporate a small solar thermal collector array An overview of residential solar thermal collector utility and economic analysis is covered in chapter two The hardware and software system design specifics are discussed in chapters three and four Test results and verification are shown in chapter five as well as the uncertainty calculations for the system A user s manual that shows how to interface set up and maintain the STCS system can be found in Appendix A CHAPTER TWO Theory behind the Project Usefulness of the Project The need for research in the area of renewable energy has grown greatly in recent years due to an increase in the price of easily accessible energy sources This change has brought about many new opportunities for universities and research centers to build upon existing technology or develop new strategies for handling how energy systems function Both avenues of research could require an experimental test bench to verify and quantify results The STCS was created to aid in the development and progress of research in the field of solar fluid heating The main purpose of the project is to create a computer controlled water heater that can replace a small solar thermal collector array in a hypothetical installation Using the STCS in a system allows new hardware as well as new methods of controlling how the system behaves to be tested more accurately becaus
96. ility Study 66 F Uncertainty Calculations 72 Method Used to Find Uncertainties 72 Calculations and Data 76 G Control Board Design Information 81 Board Layout 81 Board Schematic 82 Parts List 83 H Source Code 84 Files Included in Project 84 mxwebsrvr c 85 compiler h 107 projdefs h 120 BIBLIOGRAPHY 139 Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 Figure 19 Figure A LIST OF FIGURES Basic solar thermal configuration Total insolation on a tilted flat plate collector Payback period in terms of years System connection overview Original thermistor response curve New thermistor response curve ADC count versus temperature response curve Auxiliary user supplied inputs STCS hardware Modtronix SBC65EC Software system overview Sample temperature versus ADC count response curve Output power in Watts from trial one Output power in Watts from trial two Output power in Watts from trial three Output power in Watts from trial four Output power in Watts from trial five Output from all five repeatability tests overlaid Output power in Watts from full day test 1 A request for status update command being transmitted to the STCS 10 12 12 14 17 18 20 21 22 30 31 32 39 34 35 37 42 Figure A 2 Figur
97. ill deactivate all power TRIACS until the leak is fixed 55 APPENDIX D Available Insolation and Power Available Insolation To find the available power a solar thermal collector can provide information about the weather location and orientation of the solar panel array being modeled are needed Before the power the panel can provide can be calculated the total power available from the sun or insolation must be found for each hour being simulated Equation D1 referred to as the isotropic diffuse model can be used to find the total insolation available 1 1 I I 050 I 1 D1 where is the direct normal radiation 1 is the diffuse horizontal radiation and 1 is the global horizontal radiation all found in the external weather data file The o term is the diffuse reflectance for the area surrounding the simulated collector array and 2 is the slope of the simulated array in radians The cosine of the angle of incidence of beam radiation on the surface of the simulated collector array cos 0 is calculated using D2 cos 0 sin sin cos B sin cos sin cosy cos cos cosfcoso D2 D cos cos cos 5 sin J sin y sin 0 56 where is the latitude of the location of the simulated collector array in radians and y is the simulated surface array azimuth angle in radians 6 is the declination angle of the sun calculated by D3 and 15 the hour angle whic
98. in depth feasibility study that incorporates computer simulations and actual pricing to finalize the design of the system The ultimate goal of this appendix is to show the feasibility cost and savings of installing a solar thermal collection system in Central Texas Conceptual Analysis Before the usefulness of a solar thermal collection system can be realized the amount of energy that is spent on heating water must first be calculated Table E 1 shows the estimated average hot water usage for a family of four over the period of a week The values for the gallons per use were taken from Table 4 in 10 Table 1 Typical Residential Usage of Hot Water per Week Total gallons Gallons per Uses per per use Use use week per week Food preparation 5 9 45 Hand dish washing 4 0 0 Automatic dishwasher 15 3 45 Clothes washer 32 4 128 Shower or bath 20 28 560 Face and hand washing 4 40 160 Total 938 61 The 938 gallons per week equates to average usage of 134 gallons of hot water used per day Using this value the monthly usages of hot water as well as the energy needed to heat this water are estimated in Table E 2 Table E 2 Monthly Residential Hot Water Usage Hot water Average mains Set point Btu per Month usage temperature F temperature F month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 4154 3752 4154 4020 4154 4020 4154 4154 4020 4154 4020 4154 61 23 61 38 64 20
99. ion E4 can be used to find the annual output give the estimated annual performance P annual gt and the calculated area of the collector output P xA E4 annual The system being designed would have an estimated annual output of 12 648 000 Bru yr The cost of generating this heat energy without the use of the collector system depends on the source of energy used the price of that energy and the efficiency 7 of the system that is used to heat the water The two main choices for energy to heat water in Waco Texas are natural gas and electricity As of October 2008 natural gas cost 45 29 per million Btu and electricity cost 40 96 per million Btu A system that uses natural gas for heating has an average efficiency of 60 while electrical systems have a much higher efficiency around 95 This lower efficiency means that more fuel will be needed to generate the same amount of heat Equation E5 is used to calculate the annual savings from using the collector system for both natural gas and electrical systems 64 tput price E5 Savings The greatest savings would be realized if the collector system were used to augment natural gas system due to its higher price and lower efficiency For the system described here the savings with a natural gas system would be 954 63 per year and the savings with an electrical system would be 545 34 per year Using the minimum and maximum cost estimation from E3 and
100. ion enable it here Uncomment if stack should implement the TCP protocol For details see ref mod tcpip base tcp define STACK USE addtogroup mod_conf_projdefs code define STACK USE UDP endcode This define is automatically enabled disabled based on high level module selections If you need them with your custom application enable it here Uncomment if stack should implement the UDP protocol For details see ref mod tcpip base udp define STACK USE UDP addtogroup mod conf projdefs code define STACK USE NBNS endcode Uncomment if stack should implement NBNS define STACK USE NBNS addtogroup mod conf projdefs code define STACK USE DNS endcode Uncomment if stack should implement DNS define STACK USE DNS When SLIP is used DHCP is not supported if definedSTACK USE SLIP undef STACK USE DHCP addtogroup mod conf projdefs code Zdefine STACK CLIENT MODE endcode Uncomment following line if this stack will be used in CLIENT mode In CLIENT mode some functions specific to client operation are enabled 131 define STACK CLIENT MODE When HTTP is enabled TCP must be enabled if defined STACK USE HTTP SERVER defined STACK_USE_TCP define STACK USE TCP endif endif When FTP is enabled TCP must be enabled if defined STACK USE FTP SERVER defined STACK_USE_
101. kGet8bit This task performs normal stack task including checking for incoming packet type of packet and calling appropriate stack entity to process it StackTask Process UDP Command Port and UDP Command Responce Port emdProcess defined STACK USE HTTP SERVER This is a TCP application It listens to TCP port 80 with one or more sockets and responds to remote requests HTTPServer endif if defined STACK USE SERVER FTPServer endif definedSTACK USE ANNOUNCE DiscoveryTask 92 endif if definedSTACK USE NBNS NBNSTask endif Add your application speicifc tasks here ProcessIO VIE ETT TII I II Start of Kirk s thesis code myTempSens Task to read temperature sensors myUDPProc Task to send and recieve UDP communications mySafeProc INT2 is used to detect the rising edge of an external flow meter if PORTB_RB2 1 if flowstate 1 flowtickl 1 flowstatel 1 else if PORTB_RB2 0 flowstatel amp 0 INT3 is used to detect the rising edge of an external flow meter if PORTB_RB3 1 if flowstate2 flowtick2 1 flowstate2 1 else if PORTB_RB3 0 while PORTC_RC5 1 _ 7 1 t flowstate2 amp 0 button_ctr if button_ctr gt 500000 if PORTC RC5 1 amp amp PORTB_RB7 0 i 500 while i 0 t 15 93 delayval
102. l 64 88546 64 72803 11190 88546 11163 72803 23 36867 C 23 37001 0 13133 C 0 12999 O O Table 4 Thermistor calibration uncertainty totals Ti To BTheal 1 015060 1 014888 78 Table F 5 Sampling uncertainty information Ti To Resistance Temp calc T A D Resistance Temp calc T A D Q C CC 0 CC C 10421 25 00039128 25 10399 25 0011546 24 10421 25 00039128 25 10399 25 0011546 24 10421 25 00039128 25 10398 25 0033744 24 10420 25 00259762 25 10398 25 0033744 24 10421 25 00039128 25 10398 25 0033744 24 10421 25 00039128 25 10397 25 0055945 24 10421 25 00039128 25 10398 25 0033744 24 10421 25 00039128 25 10397 25 0055945 24 10421 25 00039128 25 10397 25 0055945 24 10421 25 00039128 25 10398 25 0033744 24 10420 90 25 00061191 10397 90 25 0035965 Fixed Bdecade 0 5 0 5 Bres read 31 2827 Q 31 2137 Bres fixed 31 2867 31 2177 n 10 10 student s t 2 821 2 821 R avg 10420 9 10397 9 oR 0 31623 Q 0 73786 Q om R 0 10000 Q 0 23333 Sres random 0 28210 Q 0 65823 Q Bres 31 29 Q 31 22 Q 10452 18797 Q 10429 12464 Q 24 93170 24 93440 G 0 068913 E 0 069201 aC Stemp a d 0 00061191 uo 1 00359648 us Ba d total 0 068916 SC 1 005979 G 79 Table F 6 Total temperature reading uncertainties Utemp 1 01740 Ti us To 1 42898 C Table F 7 Sample total uncertainty calculation Mass Flow 0 1072 kg s Sample mass flow Ti
103. l8 10 10 48 udpTxBuf 39 adeval8 10 48 if adcval9 0 udpTxBuf 41 45 adcval9 adcval9 1 else udpTxBuf 41 adceval9 adcval9 1000 1000 48 udpTxBuf 42 adcval9 1000 adcval9 100 100 48 udpTxBuf 43 adcval996100 adcval99610 10 48 udpTxBuf 44 adcval99610 48 if adcvall0 0 udpTxBuf 46 45 110 adcvallO 1 else udpTxBuf 46 adcvall0 adcvall0961000 1000 48 udpTxBuf 47 adcvall0961000 adcvall096100 100 48 udpTxBuf 48 adcvall096100 adcvall09610 10 48 udpTxBuf 49 adeval10 10 48 if adcvalll 0 udpTxBuf 51 45 11 11 1 else 1 udpTxBuf 5 1 adevall 1 11 1000 1000 48 j udpTxBuf 52 adeval 1 1 1000 111 100 100 48 udpTxBuf 53 11 1 100 adeval 1 1 10 10 48 udpTxBuf 54 adeval11 10 48 if adcvall2 0 udpTxBuf 56 45 adcvall2 adcvall2 1 else 4 udpTxBuf 56 adcval1 2 adeval12 1000 1000 48 udpTxBuf 57 adeval12 1000 adeval12 100 100 48 udpTxBuf 58 adeval12 100 adeval12 10 10 48 udpTxBuf 59 adeval12 10 48 udpTxBuf 61 flowtick1 flowtick 1 10000 10000 48 udpTxBuf 62 flowtick 1 10000 flowtick 1 1000 1000 48 udpTxBuf 63 flowtick1 1000 flowtick1 100 100 48 udpTxBuf 64 flowtick 1 100 flowtick 1 10 10 48 udpTxBuf 65 flowtick1 10 48 udpTxBuf 6
104. lculations and Data The Excel data shown in the tables below contains the calculations for the actual uncertainties that was used to calculate the uncertainty of each part of the STCS Table F 1 Mass flow rate uncertainty information 0 275 Paddle Wheel ord 0 0459 gpm Reader Umdot 0 27880 gpm 1 gal 8 345 lbs water 0 017589 kg s 1 Ib 4536kg 76 Table 2 Thermocouple uncertainty information Temp C 0 5 0 5 0 5 0 5 0 5 0 5 Fixed BTC BTC read BTC fixed Random n student s t T avg oT om T STC random BTC total Ti Resistance 32433 32485 32478 32457 32534 32781 32528 0 11000 1 00050 1 00653 6 3 365 0 5 0 00 0 00 0 00 1 00653 G C C C C C C C Temp C 0 5 0 5 0 5 0 5 0 5 0 5 To Resistance 32081 32579 32633 32081 32096 31956 32237 67 0 11000 1 00050 1 00653 6 3 365 0 5 0 00 0 00 0 00 1 00653 Ke C C C 46 2 C 77 Table F 3 Thermistor uncertainty information Ti To Temp C Resistance Q Temp C Resistance Q 23 5 11126 23 5 11099 23 5 11126 23 2 11099 23 5 11126 23 5 11099 23 5 11126 23 5 11099 23 5 11126 23 5 11099 23 5 11126 23 5 11099 Fixed BTh 55 63000 55 49500 BTh read 33 39800 Q 33 31700 BTh fixed 64 88546 Q 64 72803 Random n 6 6 student s t 3 365 3 365 R avg 11126 Q 11099 oR 0 00 Q 0 00 om 0 00 0 00 STh random 0 00 O 0 00 BTh tota
105. ly had to be calibrated To do this the theoretical resistance values of both thermistors had to be calculated for every degree To find the resistance of a thermistor given the temperature the Steinhart Hart equation can be rearranged to give 2 1 A 71 MEE where a and 8 EJ 2 With a more accurate model for the inlet and outlet thermistors a relationship between the ADC count and the temperature can be found The thermistor resistance values from 20 C to 120 C were calculated and recorded and a resistance decade box was then used to simulate the thermistors The ADC value was recorded for each temperature allowing polynomial equations to be fit to the resulting response curve shown in Figure 7 Power Control The power output by the STCS is managed using random phase control of a triode for alternating current TRIAC that allows the power output to be varied Random phase control refers to the ability of the system to turn the power to a load on at any point in the power phase cycle One cycle of alternating current can be divided into two parts the positive voltage half and the negative voltage half The positive half in the phase cycle 13 refers to the period from 0 to 180 while the negative half is the period 180 to 360 200 180 160 140 120 100 80 60 40 20 0 ADC count 3E 08x 9E 06x 0 0006x 0 0081x 0 0657x 178 9
106. ne define 4 AppConfig MyGateway v 0 AppConfig MyGateway v 1 AppConfig MyGateway v 2 AppConfig MyGateway v 3 Primary DNS address for this node define MY DNS BYTEI define MY DNS BYTE2 define DNS BYTE3 define MY DNS BYTE4 appcfgGetc APPCFG_ DNS IPO appcfgGetc APPCFG DNS appcfgGetc APPCFG_ DNS IP2 appcfgGetc APPCFG_ DNS 1 3 define MY DNS BYTE1_SET n define MY DNS BYTE2 SET n define MY DNS SET n appcfgPutc APPCFG DNS IPO n appcfgPutc APPCFG DNS IPI appcfgPutc APPCFG DNS IP2 n 135 define MY DNS BYTE4 SET n appcfgPutc APPCFG DNS IP3 n addtogroup mod conf projdefs code define MAC SOCKETS endcode Number of available TCP sockets to be created Note that each socket consumes 34 bytes of RAM lt br gt lt b gt TCP configurations lt b gt lt br gt To minimize page update match number of sockets and HTTP connections with different page sources in a page For example if page contains reference to 3 more pages browser may try to open 4 simultaneous HTTP connections and to minimize browser delay set HTTP connections to 4 MAX SOCKETS to 4 If you are using ICMP or other applications you should keep at least one socket available for them if defined BRD_SBC44EC defined BRD_SBC45EC define MAX SOCKETS 4 elif defined BRD_SBC65EC defined BRD_SBC68EC define MAX SOCKETS 10
107. ne LATC2 define LATC3 define LATC4 define 5 define LATC6 define LATC7 define TRISC_RCO define TRISC_RC1 define TRISC_RC2 define TRISC_RC3 define TRISC_RC4 define TRISC RCS5 define TRISC RC6 define TRISC RC7 define PORTD define PORTD RDI define PORTD RD2 define PORTD RD3 define PORTD RD4 define PORTD RD5 define PORTD RD6 define PORTD RD7 define TRISD define TRISD RDI define TRISD RD2 define TRISD RD3 define TRISD RD4 define TRISD RD5 define TRISD RD6 LATBbits LATBI LATBbits LATB2 LATBbits LATB3 LATBbits LATB4 LATBbits LATBS LATBbits LATB6 LATBbits LATB7 TRISBbits TRISBO TRISBbits TRISBI TRISBbits TRISB2 TRISBbits TRISB3 TRISBbits TRISBA TRISBbits TRISB5 TRISBbits TRISB6 TRISBbits TRISB7 PORTCbits RCO PORTCbits RC1 PORTCbits RC2 PORTCbits RC3 PORTCbits RC4 PORTCbits RC5 PORTCbits RC6 PORTCbits RC7 LATCbits LATCO LATCbits LATCI LATCbits LATC2 LATCbits LATC3 LATCbits LATCA LATCbits LATC5 LATCbits LATC6 LATCbits LATC7 TRISCbits TRISCO TRISCbits TRISCI TRISCbits TRISC2 TRISCbits TRISC3 TRISCbits TRISC4 TRISCbits TRISCS TRISCbits TRISC6 TRISCbits TRISC7 PORTDbits RDO PORTDbits RDI PORTDbits RD2 PORTDbits RD3 PORTDbits RD4 PORTDbits RD5 PORTDbits RD6 PORTDbits RD7 TRISDbits TRISDO TRISDbits TRISDI TRISDbits TRISD2 TRISDbits TRISD3 TRISDbits TRISDA TRISDbits TRISDS TRISDbits TRISD6 111 define TRISD RD7 define POR
108. ng compilation define MAC USE ACCESSRAM This define must be define when using this MAC define MAC RTL8019AS EEE EEEE EEEE ak ok addtogroup mod conf projdefs b MAC For details on configuring the MAC Ethernet module ref mac conf click here NetBIOS Configuration Yk kok ok sk ale ok afe ale ale ake sk afe ale afe ale ale ale ak ak sk ale ok afe afe ale ok ok sk ok Get the requested character of our NetBIOS name If this is not defined in the projdefs h file the default name MXBOAD is used define NETBIOS NAME GETCHAR n appefgGetc APPCFG_NETBIOSO n addtogroup mod conf b NetBIOS For details on configuring the NetBIOS module ref netbios conf click here t sk ok sk ok afe afe ale ale ok ok afe ale afe Serint Configuration Yk sk sk sk sk ale ole afe ale ale ake ak ale ale ak kkk define SER RXBUF SIZE 8 Size of Rx buffer must be 8 16 32 64 128 or 256 if defined BRD_SBC44EC defined BRD_SBC45EC 125 define SER TXBUF SIZE 16 Size of TX buffer must be 8 16 32 64 128 or 256 elif
109. ng delay has been set the user then presses both buttons to save the calibration offset into memory After this calibration the STCS will accurately output the requested amount of power Safety Relays Before the power is sent to the power control circuitry it passes through two safety relays that can disconnect the power going to the load These relays are controlled by the microcontroller and the over temperature sensor If any error is recognized by the microcontroller or the temperature gets above 93 3 C the relays will open disconnecting power to the output Status LEDs The STCS has two status light emitting diodes LED on the control board to let the user know if an error has occurred or if the system is functioning normally The green LED will remain on if no error is detected and will turn off when an error does occur The red LED remains off until an error is detected at which point it turns on The status LEDs are also used in the initial set up process of the STCS to let the user know that the firing delay value has been stored in memory 15 Flow Meter Inputs The flow rate of the fluid in the STCS is important to know because it plays a large part in the calculation of both the requested power and the actual output power There are two inputs for flow meters on the STCS These inputs will accept a signal from a flow meter that has a pulse output Pulse output flow meters send a 5V pulse out when a preset amount of fluid flow
110. ng the DHCP module ref dhcp conf click here 121 ok ok afe afe ale ale ok ok ale ak ale k DNS Configuration DNS Port If not defined projdefs h file defaults to 53 define DNS_PORT 53 DNS Timeout If not defined in projdefs h file defaults to 50015 define DNS_TIMEOUT TICK TICK_SECOND TICK 2 FE TE sk addtogroup mod conf projdefs b DNS For details on configuring the DNS module ref dns conf click here ok ok afe ok sk afe ale ale ok ok afe sk sk afe ale ok ok kk ok ake ake ale k FTP Configuration afe ale ale ake sk afe ale afe ake ak ok ale afe afe ale afe ale ak ok sk ok ok sk afe ale ok sk ok ok ok define FTP COMMAND PORT 21 define FTP DATA PORT 20 define TIMEOUT TICK16 180 TICK16 TICKS PER SECOND define MAX FTP ARGS 7 define MAX FTP CMD STRING LEN 31 Configure FTP mudule to have PUT define FTP PUT
111. o quantify the accuracy of the output of the STCS the actual power was compared to the desired power using a similar metric as the one employed to quantify the repeatability test results Equation 5 is the metric that was used to find the percent difference between the expected and actual output powers The output power of the STCS was found to be 92 2 accurate Q E Qonu 0 5 Test Conclusions The results given by 4 and 5 above show that the STCS is capable of both reliably and accurately modeling the theoretical output provided by the simulation software TRNSYS Figures 13 through 17 and Figure 18 show that the output of the STCS falls within the bounds of uncertainty that were calculated for the system used in the testing procedure Based on these verifications the two goals set forth for the STCS have been met 36 1 08 0215 090 0006 1591 sye AA ur 61 911214 Du 00 2992 uonelnuuls punoq punoq Ajurej1ooun addy 5216 inoo snuiul M ub snid jnoo osle 0215 090 0006 37 APPENDICES 38 APPENDIX User s Manual This document will outline how to properly interface with set up and maintain the STCS Interfacing with the STCS requires
112. oddq ozis 0902 0904 ww aw _ 0006 5216 moo ub inoo snid m snuiu 31 SHEM ur JndinO c AA Jamod Du 00 2992 uonejnuis 666 992 228 1996 999 996 66 1996 222 1996 991 199 000 1992 228 0996 999 0996 005 099 222 0996 494 099 000 099 00 004 Orel enjoy punoq Ajurej1ooun pn 081 08 2 20 pao Nn N Ne An U a X 7 V paysadxq 518 punoq 0215 090 0904 ONNE ww aw _ 0006 5216 moo ube snid m snuiu 32 AN Jamod JELI SHEM mod 791 amg by 00 2992 uonelnuuls 666 L99 528 996 999 199 667 L99 566 1996 991 996 000 992 228 0996 999 0996 005 0996 eee 0996 494 099 000 099 00 00 Orel Orel enjoy punog Io MOT PUES AA a ogie osie aN PN ef V jndino payoodxq 5218 punoq Ayurey190un ozis 0904 0904 DOn 0006 5215 1 00 uba 5 jnoo nop A AN Jamod 33 AN Jamod OAT L sye y ut mod mdmo 9814 by 00 2992 uonelnuuls 666 992 228 199
113. on F6 combines the fixed uncertainties for the decade box and the ohmmeter with the random uncertainty of the measurements to get the uncertainty of the resistance B 285 220 26 res decade ohmmeter ADC for is 31 288 ohms 31 225 ohms for These resistance values correspond to 0 0689 C for T and 0 0692 C for The error in the reported temperature pc semp gt 18 combined with the uncertainty from the resistance used B to get the overall uncertainty for the ADC Using F7 the uncertainty for the T as reported by the ADC unit 15 0 0689 C 1 006 C for T 2 2 Banc ES Bene B res F7 Once the uncertainties for the thermistors and the ADC unit have been calculated the total uncertainty for the inlet and outlet temperatures can be found using F8 7 hasa total uncertainty of 1 0174 C and T has a total uncertainty of 1 429 C U Br Bane F8 75 Once the total uncertainties for m and have been calculated the 1 uncertainty in the output power be found using F9 Y U oou x 2 x 22 T us x ar F9 Expanding F9 a simplified equation for the total uncertainty in the output power can be found U T JU xC T E A J 7 xmC J F10 It is important to note that both F9 and F10 require the values for m T and 7 at 1 each point they are calculated Ca
114. oney saved for both simulations has been calculated the amount of time required to pay off the system can be found but first the cost of the installation has to be estimated Table E 7 has the components used in a standard two tank collector system installation and the price associated with each The total of the individual item costs was then increased by 10 to allow for any under estimation that may have been made This final total cost was then compared to available pre packaged systems available online and found to be reasonable Table E 7 Prices for solar thermal collector system installation Component Price Quantity Total Collector panels 1100 2 2200 Storage tank 1400 1 1400 Mounting hardware 500 1 500 Pump 200 1 200 Tubing 0 75 diam 10 length 25 10 250 Tube fittings 2 25 50 Tube insulation 6 2 16 32 Miscellaneous parts 100 Propylene glycol 4 gal 200 1 200 Controller 200 1 200 Sensors 100 Wiring 200 Mechanical labor 1000 Electrical labor 500 Total 6932 10 7625 If the increase in the cost of fuel tax breaks or incentives from the state and federal governments are not considered the time to pay off the system is the total cost divided by the total yearly savings from using the system If the solar thermal collector system is used to augment an existing electrical water heater the time required for the system to pay for itself is 12 73 years and the natural gas powered heater system will take 1
115. onfiguring the TCP module ref udp conf click here PORE ok ok ok sk ale ok ak ok sk ak ok ok ake File System Configuration Defines the maximum size of a file used in the file system When FSEE FILE SIZE 16MB is defined the file system can handle files with a size of up to 16 Mbytes When not defined the maximum size of a file is 64 Kbyte define FSEE FILE SIZE 16MB Specifies the maximum number of files that can be open at any one time When defined as 1 the code will be much faster and smaller This value should not be much less then the the number of HTTP Connections seeing that each HTTP connection can have a open file If most web page files are small below 2 kbytes then this is not so important if defined BRD_SBC44EC defined BRD SBCASEC define FSEE MAX FILES 2 elif defined BRD_SBC65EC defined BRD SBC68EC define FSEE MAX FILES 6 else error Board type not defined endif When this define is present the FSEE File System is used as the primary file system All functions Will be remapped to general names for example fseeOpen will be mapped to fileOpen This makes switching between different File System much simpler define FSEE IS PRIMARY FS General configu
116. ower the electronics found in the STCS A switching power supply is used to step the input voltage down to 12V which is then used to power the microcontroller current sources and relays The power supply is a commercially available part that connects to the STCS board via wiring bundles Microcontroller Board The control of the STCS hardware is handled by a Single Board Computer manufactured by Modtronix Engineering This board allows the STCS to communicate 17 with external PC and handle the various inputs and outputs required to operate the simulator A more in depth look at the code that runs the microcontroller appears in chapter four of this thesis Figure 9 shows the actual hardware that makes up the STCS Switching Power Supply mm Supply E Status LEDs Safety Relays TRIACs Figure 9 STCS hardware 18 CHAPTER FOUR Software Overview Microcontroller Board The operation of the STCS is handled by a microcontroller that interfaces with the different parts of the system and with an external PC The external PC can request the status of the STCS and control the amount of power that the STCS will output These communications take place over wiring using standard Ethernet UPD packets The microcontroller must also monitor and control the various parts of the STCS itself These operations require digital inputs and outputs as well as ADC inputs The control board must integrate all these f
117. pServerNode2 M ACA ddr v 2 0 udpServerNode2 M ACA ddr v 3 0 udpServerNode2 M ACA ddr v 4 0 udpServerNode2 M ACA ddr v 5 0 udpServerNode2 IPA ddr Val 0x6900A8COL 108 0 168 192 entered in reverse order udpSocketUserRx UDPOpen 4000 amp udpServerNode2 INVALID UDP PORT fo fo r j 0 j lt 11 j tudpRxBuf j 0 r j 0 j lt 72 j udpTxBuf j 0 k 0 static void if myUDPProc void UDPIsGetReady udpSocketUserRx 1 udpBytesReceived UDPGetArray udpRxBuf 11 UDPDiscard if udpRxBuf 0 80 amp amp udpRxBuf 6 69 80 P 69 E i if udpRxBuf 1 48 amp amp udpRxButf 1 57 amp amp udpRxBuf 2 748 amp amp udpRxBuf 2 57 amp amp udpRxBuf 3 748 amp amp udpRxBuf 3 57 amp amp udpRxBuf 4 7 48 amp amp udpRxBuf 4 57 amp amp u dpRxBuf 5 gt 48 amp amp udpRxBuf 5 lt 57 48 1000 4 48 1000 4 timertemp 1 udpRxBuff 1 48 10000 udpRxBuf 2 udpRxBuf 3 48 100 udpRxBuf 4 48 10 udpRxBuf 5 48 timertempl udpRxBuf 1 48 10000 udpRxBuf 2 H udpRxBuf 4 48 10 udpRxBuf 5 48 timertemp2 udpRxBuf 3 48 timertemp2 100 timertempl timertemp2 if timertemp 1 lt 37266 1 timertemp2 65535 timertempl 99 1 timertemp2 65535 udpRxBuf 7 udpRxBuf 8 udpRxBuf 9 udpRxBuf 10 48 else turn off all tria
118. r udpBufSize unsigned long int button ctr i unsigned short int sumadcl sumadc2 sumadc3 sumadc4 sumadc5 sumadc6 sumadc7 sumadc8 sumadc9 sumadc10 sumadc11 12 signed float mathtemp BOOL flowstatel flowstate2 pragma udata MyVars two BYTE udpRxBuf 11 BYTE udpTxBuf 72 BYTE udpBytesReceived BYTE adcread1 10 BYTE adcread2 10 BYTE adcread3 10 BYTE adcread4 10 BYTE adcread5 10 BYTE adcread6 10 BYTE adcread7 10 87 BYTE adcread8 10 BYTE adcread9 10 BYTE adcread10 10 BYTE adcread11 10 BYTE adcread12 10 pragma udata High Interrupt ISR if defined MCHP C18 pragma interrupt HighISR save section tmpdata void HighISR void elif defined HITECH C18 if defined STACK_ USE SLIP extern void MACISR void endif void interrupt HighISR void endif TMRO is used for the ticks if INTCON_TMROIF 1 TickUpdate if defined STACK USE SLIP MACISRO endif INTCON TMROIF 0 NTO zero cross detection interrupt that sets the delay value of TMR1 if INTCON_INTOIF timerval timertemp2 delayval timerhigh timerval gt gt 8 timerlow timerval timerhigh lt lt 8 TMRIH timerhigh TMRIL timerlow INTCON INTOIF 0 TICON TMRION 1 INT1 zero cross detection tinterrupt that sets the delay value of TMR3 if INTCON3 1 timerval timertemp2 delayval timerhigh timerval gt gt 8 timerlow timerval
119. ration The following code is used for general configuration addtogroup mod conf projdefs section projdefs genconf General Configuration The following section describes how to configure general parameter contained in this project addtogroup mod conf code define HAS BOOTLOADER endcode Include this define in the code to compiled the program to be uploaded to a device that has the ref tools mxbootloader installed on it By doing this this project will be compiled with the correct start of program address and interrupt vector addresses For further info in the mxbootloader click ref tools mxbootloader here lt br gt The following compiler specific modifications have to be made For HiTech compiler remove A800h option from linker For MPLAB C18 compiler configure 18f6621 Ikr file c 127 Define the start of the program and interrupt vectors This is used if this code is compiled for a bootloader ifdef HAS BOOTLOADER Bootloader that uses 0 0x7ff program memory define RSTVECTOR ADR 0x800 define HIVECTOR ADR 0x808 define LOVECTOR ADR 0x818 else define RSTVECTOR_ADR 0 Standard no bootloader define HIVECTOR ADR 0x8 Standard no bootloader define LOVECTOR ADR 0x18 Standard no bootloader endif addtogroup mod conf projdefs code define CLOCK FREQ n endcode Configure the PIC s internal clock if defined __18F452
120. red increment 16 bit counters whose values are returned to a controlling PC during a status update The only type of flow meter that is compatible with the STCS is the pulse output variety Each time a preset amount of water flows through the flow meter it outputs a 5V pulse Using the number of pulses that have accumulated over a known period of time the flow rate of the fluid can be calculated Each time the STCS reports the pulse counts for the flow meters in a status update the counts are reset to zero 24 The flow meter used in the testing of the system would output a pulse for every 0 05 gallons that flowed through it UDP Communications The UDP communications use preexisting functions that are available in the Modtronix source code to set up the UDP receive and send ports put received packets into a buffer and send packets from a buffer The microcontroller continuously checks the UDP receive buffer for an ASCII string and then verifies if the received string is a valid output power command or a request for status update If the string is a power command it reads the delay value and which elements to turn on and stores the data so it can be accessed by other functions in the code If a request for status update is received the microcontroller builds the ASCII string that contains the information about the system places it in a transmit buffer and sends the contents of the buffer to the PC that requested the status If no error is occ
121. ricity in Waco which is 0 1398 per kWh or 40 96 per MMBtu 68 Table 5 Energy and money saved for the electrical heating system MMBtu MMBtu MMBtu saved Money Month needed saved adjusted saved Jan 2 0262 1 5335 1 2779 52 34 Feb 1 8256 1 4698 1 2248 50 17 Mar 1 9238 1 7315 1 4429 59 10 Apr 1 6972 1 6246 1 3539 55 46 May 1 5577 1 5443 1 2869 52 71 Jun 1 3440 1 3417 1 1181 45 80 Jul 1 2933 1 2907 1 0756 44 06 Aug 1 2964 1 2964 1 0803 44 25 Sep 1 3525 1 3046 1 0872 44 53 Oct 1 5694 1 5030 1 2525 51 30 Nov 1 7080 1 4281 1 1901 48 75 Dec 1 9319 1 4777 1 2314 50 44 Year 19 5260 17 5436 14 6196 598 84 Table E 6 likewise has the energy gained adjusted energy gained and money saved for the collector system that augments a natural gas burning conventional water heater The cost of natural gas in Waco is 46 69 per Mcf or 45 29 per MMBtu Table E 6 Energy and money saved for the gas heating system MMBtu MMBtu MMBtu saved Money Month needed saved adjusted saved Jan 2 0262 1 5363 1 2803 57 98 Feb 1 8256 1 4670 1 2225 55 36 1 9238 1 7287 1 4406 65 24 Apr 1 6972 1 6269 1 3558 61 40 1 5577 1 5447 1 2873 58 29 1 3440 1 3417 1 1181 50 63 Jul 1 2933 1 2906 1 0755 48 71 Aug 1 2964 1 2964 1 0803 48 92 Sep 1 3525 1 3062 1 0885 49 30 Oct 1 5694 1 5026 1 2522 56 71 Nov 1 7080 1 4265 1 1888 53 84 Dec 1 9319 1 4761 1 2301 55 71 Year 19 5260 17 5628 14 6357 662 79 69 Once to amount of m
122. ring the power relays are opened the green status LED is turned off and the red status LED is turned on Ifa request for a status update is received at any point when the error flag is set to any non zero value the STCS will respond with the corresponding error code The power control code also checks if the error flag is zero before allowing the TRIACS to be turned on Once an error has been cleared in the system the error handling code will set the error flag to zero close the power relays turn on the green status LED and turn off the red status LED TRIAC Firing Delay The code responsible for changing the TRIAC firing delay monitors the firing delay adjustment buttons for a change then takes the appropriate action If only one button 15 pressed for two seconds the firing delay is increased or decreased depending on which button is depressed If both buttons are pressed simultaneously for two seconds the microcontroller checks if the current firing delay value is the same as what is saved in the EEPROM and if they are different writes the new delay value in the EEPROM so it 26 can be accessed by the microcontroller after the power to the STCS has been reset When the new value is saved the two status LEDs will blink letting the user know the process is complete External Control Program National Instruments LabVIEW was used to control the STCS during the development and verification stages of this thesis LabVIEW was chosen b
123. s through it When the STCS sees the output from the flow meter going high it increments a counter stored in memory The total count is returned to the user upon request and then the counter is reset to zero to start counting again Knowing what the amount of fluid that causes the flow meter to send a pulse the number of pulses that have accumulated and the amount of time over which the number of pulses has occurred allows a user to calculate the flow rate Auxiliary ADC Inputs The seven auxiliary user supplied inputs function similarly to the thermistors in that they are read by the ADC unit on the microcontroller Any device that has an output voltage range of to 5V can be plugged into the port The three pins on the port are the input pin ground and 5V as shown in Figure 8 If an R25 thermistor is going to be used on an auxiliary input there are jumpers next to each port that will allow it to have to same operating conditions as the five permanent thermistors With the jumper in place the input pin of the port will have the same current supply as the five thermistors in the STCS For this configuration the thermistor is connected to the input and the ground pins and the 5V pin can be ignored If the jumper is removed the attached device can use the provided 5V pin to provide a signal to output to the input pin 16 Figure 8 Auxiliary user supplied inputs Power Supply The power that is used to heat the fluid is also used to p
124. the annual savings from E5 the minimum and maximum number of years required to pay back the cost of the system can be calculated Equation E6 can be used to find the minimum and maximum payback period for both energy Sources payback E6 savings The system being designed to augment a natural gas system has a minimum payback period of 5 5 years and a maximum payback period of 11 years If the system being designed is augmenting an electrical system the minimum payback period is raised to 9 6 years and the maximum payback period to 19 2 years The allowable first cost for the system takes into account the annual savings from using the collector system and an economic factor EF that can be found in Table 1 5 in 11 The economic life of the system is planned to be 20 years with 10 interest rate and factoring in a 2 596 per year fuel price change Using these values the system will have an economic factor of 10 337 C savingsx EF ET first 65 Using E7 the allowable first cost for the system that augments the natural gas configuration will be 9868 03 and 5637 20 for the system that augments the electrical configuration Since both of these are between the minimum and maximum cost estimates of the system the system will be cost effective Feasibility Study In order to more accurately determine the feasibility of a solar thermal collector system computer simulations are used to find the energy available from a
125. the flow meter is being used in with the tests full range is 1 73745kg s so B sensor is 0 0173745kg s The flow sensor outputs a signal that has increases its frequency the faster the fluid is flowing through it The frequency output is 15 Hz for every 0 08687 kg s The sensor reader has an accuracy of 0 5 Hz so is 0 00290 kg 5 reader With these uncertainties combined the overall uncertainty associated with measuring the flow rate comes out to 0 0176kg s The other two inputs T and T were calibrated in two parts the thermistors and the ADC that reports the value corresponding to the value of the thermistor The thermistors were calibrated by measuring the temperature of water in a container with a thermocouple and measuring the resistance value of the thermistors in the water This process was done at freezing and at room temperature with six trials recorded for each The thermocouple used had a fixed uncertainty B of 0 11 C and the thermocouple tc reader used had a fixed uncertainty B of 1 0005 C The thermistors are quoted to tc read have a specified temperature accuracy of 0 5 thus their fixed uncertainty B will therm gt 73 depend on the resistance value the thermistor has for temperature For T B is 55 495 ohms and for T B is 55 63 ohms The ohmmeter that was used to measure therm of 33 317 ohms for T the resistance of the thermistors has fixed uncertainty
126. therm read and 33 398 ohms for 7 The total fixed uncertainty in calibrating 7 and 7 given by F3 is 64 885 ohms for 7 and 64 728 ohms for 7 2 2 E These resistance values correspond to temperature values if Steinhart Hart equation for the thermistor is applied Using this method B becomes 0 131 C for and therm cal 0 130 C for T Combining the two fixed uncertainties from using the thermocouple and thermocouple reader with the uncertainty of the thermistor calibration will give the overall fixed uncertainty for the thermistors Equation F4 gives the overall uncertainties of both 7 and 7 to be 1 015 C B 2 F4 therm cal JB B tc read The ADC unit was calibrated using a resistance decade box to simulate the resistance for T and T The resistance was measured with an ohmmeter and recorded along with the temperature reported back by the STCS for ten trials The decade box had a fixed uncertainty gt of half its smallest increment or 0 5 ohms The ohmmeter had a fixed uncertainty B of 31 283 ohms for and 31 214 ohms for The random ohmmeter uncertainty in the trials can be calculated using F5 74 5 S Apc dn where 7 is the Student s t value for n samples o is the standard deviation of the data and n is the number of samples taken For T 8 is 0 282 ohms and for 7 S is 0 658 ohms Equati
127. thtemp 0 00027047486 1 pow float sumadc5 3 0 mathtemp 1 34146153234 pow float sumadc5 2 0 mathtemp 2219 54777573478 5 1225301 69715049 tempsens5 signed short int mathtemp adcval6 sumadc6 adcval7 sumadc7 adcval8 sumadc8 adcval9 sumadc9 110 sumadc10 adcvalll 11 112 sumadc12 static void mySafeProc void checks if any of the temp sensors are above a max temp limit to 93 3 C if tempsens1 lt 933 amp amp tempsens2 lt 933 amp amp tempsens3 lt 933 amp amp tempsens4 lt 933 amp amp tempsens5 933 amp amp PORTB RB4 1 amp amp PORTB_RB5 0 else myerror 0 if tempsens1 gt 933 myerror 1 106 if tempsens2 gt 933 2 if tempsens3 gt 933 3 if tempsens4 gt 933 4 if tempsens5 gt 933 myerror 5 If PORTB 4 0 myerror 6 5 1 myerror 7 if myerror 0 PORTC RCO 1 PORTC RC1 1 PORTC RC2 0 else if myerror 0 PORTC RC0 0 PORTC 0 PORTC RC2 1 Elon 2 E3on E4on 0 compiler h ifndef COMPILER_H define COMPILER_H if defined HI TECH C if defined MPC define HITECH C18 else error Unknown part is selected endif else if defined _ WIN32 define MCHP C18 endif endif if defined MCHP
128. to 60 gallons The larger the tank however the greater the standby heat losses will be The two main energy sources for water heaters are electricity and natural gas Electrical heating is accomplished by running electrical current through resistive heating elements in direct contact with the water to be heated For a natural gas heater there is a burner at the bottom of the water heater tank that heats the water inside The average efficiency of electrical water heaters is between 90 and 95 while natural gas fueled heaters have an average efficiency that ranges from 60 to 65 3 The price of energy used to heat the water plays an important role in determining if a solar thermal collection system will be feasible at a location In Waco Texas the average price for electricity is 0 1398 per kWh and 46 69 per Mcf for natural gas To be able to compare these values a common unit must be used Throughout the analysis in this thesis the unit of millions of Btus MMBtu will be used so electricity is 40 96 per MMBtu and gas is 45 29 per MMBtu After the analysis in Appendix E was completed the payback period was compared to similar installations in the area Figure 3 shows the average payback period times across the state of Texas with Waco falling in the 10 to 15 year range SHW Payback Period 0 5 5 10 10 15 15 20 greater than 20 Figure 3 Payback period in terms of years 4 Based on the analysis performed in Appendix
129. to be activated At low power levels it is better to operate one element alone at say 12 power rather than all four at 3 In this manner the total output power of the STCS can be quite small and the effective power factor can be somewhat improved at low power levels Crafting algorithms to modulate the heater average power output involves inverting the formula for fractional power as a function of TRIAC phase angle This is discussed in Appendix B 52 300 200 150 voltage volts 100 50 Input voltage 208 VAC RMS triac phase angle Output voltage to load maximum allowable phase angle Figure C 1 Firing delay Table C 1 Power level command format Heat Power Level Packet Format 11 bytes PnmmmmEnnnn P mmmmm nnnn ASCII formatted capital P for Power level ASCII formatted five digit number between 00000 and 37266 corresponding to desired TRIAC phase angle Characters other than numerics will turn off all TRIACs P gt 37266 turns off all TRIACs ASCII formatted capital E for Element ASCII formatted four digit number of zeros and ones For example 0100 indicates that element 2 should operate at the specified power level but elements 1 3 and 4 should remain off Characters other than 1 will be interpreted as a 0 Peripheral Inputs output transmitted FROM unit The STCS can report the values of twelve analo
130. ue recommended in 11 for F is 0 64 xF A d E2 d Btu P 2 ft x yr Using the value for Load calculated from Table E 2 and from Table 1 3 in 11 mnual the area of the collector array is calculated to be 67 19 ft which is then rounded up to nearest square foot The storage requirements for the system are estimated using the method shown in 11 of 1 gallon on storage per ft of collector thus the initial estimation for the storage tank is 68 gallons A preliminary system cost estimate can be performed to give a basic idea of how much the collector system will cost The minimum and maximum costs for the system can be calculated by adjusting the values found in 11 for inflation from 1987 to 2008 Equation E3 shows the method used to give the upper and lower bounds of the cost estimate for the system where A is the calculated area of the collector The minimum cost for the system is 5236 and the maximum cost is 10 472 A representative 40 ft 63 collector costs around 1000 which is less than 30 of the minimum system cost thus the cost estimate is acceptable Cin 77 ft x A E3 Caa 154 ft x A The cost effectiveness of the system can be analyzed by calculating the payback period and the allowable first cost for the system The payback period involves comparing the estimated annual output of the collector system with the price of the energy that will be offset Equat
131. urring at the time of the request the output string will contain the temperatures of the five thermistors multiplied by ten the ADC count of the seven user supplied auxiliary inputs multiplied by ten and the counts of the two flow meters Ifthere is an error present in the system at the time of the request the output string will contain information about the error that is occurring For an over temperature condition the string contains which thermistor is over the limit of 93 3 C If a leak is detected or if there is no fluid present in the chambers the ASCII string will contain the corresponding error message If the received string does not contain a valid power command or status update request the string 1s discarded and no change or response is made 25 Error Handling The microcontroller code that handles errors in the STCS checks if any thermistors are reading a temperature that is above 93 3 C if there is a leak detected or if there is fluid in the chambers When no errors are detected the internal error flag in the microcontroller code is set to zero which allows the TRIACs to turn on If one of the thermistors is reporting a temperature that is greater than 93 3 C the error flag is set to a value between one and five corresponding to which thermistor reported the temperature When fluid is not present in the chambers the flag will be set to six and if a leak is detected the flag will be set to seven In the even of any error occur
132. x00 0x50 0x00 134 endcode Use these defines to define the default Primary DNS server IP address a define MY DEFAULT DNS BYTEI define MY DEFAULT DNS BYTE2 define MY DEFAULT DNS BYTE3 define MY DEFAULT DNS BYTEA MY DEFAULT GATE BYTEI MY DEFAULT GATE BYTE2 MY DEFAULT GATE BYTE3 MY DEFAULT GATE BYTE4 Mac address for this node is contained in AppConfig structure define MY MAC BYTEI define MY MAC BYTE2 define MY MAC BYTE3 define MY 4 define MAC BYTES define MY MAC AppConfig MyMACA ddr v 0 AppConfig MyMACAddr v 1 AppConfig MyMACAddr v 2 AppConfig MyMACAddr v 3 AppConfig MyMACAddr v 4 AppConfig MyMACAddr v 5 Subnet mask for this node is contained in AppConfig structure Must not be all zero s or else this node will never transmit anything define MY MASK define MY MASK 2 define MY MASK define MY MASK BYTE4 AppConfig MyMask v 0 AppConfig MyMask v 1 AppConfig MyMask v 2 AppConfig MyMask v 3 TP address of this node is contained in AppConfig structure define MY IP BYTEI MY IP BYTE2 MY IP BYTE3 MY IP BYTEA AppConfig MyIPAddr v 0 AppConfig MyIPAddr v 1 AppConfig MyIPAddr v 2 AppConfig MyIPAddr v 3 Gateway address for this node is contained in AppConfig structure define BYTEI define BYTE2 defi

Download Pdf Manuals

image

Related Search

Related Contents

  TRACTOR TRACTEUR  Philips 42PFL3604 Tv User Guide Manual Operating Instructions Pdf  HD2MPTZ20IR - IR HD Speed Dome UserManual  Progress Lighting P4008-09 Instructions / Assembly  tigerLINK Serial Server GW21W User`s Manual V1.1  照明パネル FCX31-FL(A) type 取扱説明書  Hydromist 10 & 20 User Manual French  Inst 040-508 Lagerlos  Samsung HW-J450/ZA Specification Sheet  

Copyright © All rights reserved.
Failed to retrieve file