Research Article
The Design and Comparison of Central and Distributed Light Sensored Smart LED Lighting Systems
Pseudocode 2
Pseudocode of the control algorithm for the distributed sensor smart lighting system.
#define Default_Room_Reference_Light | Room_Reference_Light=User_Preference | Light1=Light_From_ADC_Lightsensor1 | Light2=Light_From_ADC_Lightsensor2 | Presence_Sensor=Presence_From_Timer | if presence =1 | smart_lightingt=1; | else | smart_lighting=0; | end if | while smart_lighting=1 do | Measure_Light1 | Measure_Light2 | error1=Room_Reference_Light-Measure_Light1 | error2=Room_Reference_Light-Measure_Light2 | if error1>hysteresis then | PWM1=PWM1-I; | else | PWM1=PWM1+I; | end if | if error2>hysteresis then | PWM2=PWM2-I; | else | PWM2=PWM2+I; | end if | end while |
|