Ignore:
Timestamp:
11/26/13 11:56:07 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputInterfaceFactory.java

    r753 r1207  
    11package schedframe.resources.computing.profiles.energy.airthroughput; 
    22 
     3import schedframe.resources.StandardResourceType; 
    34import schedframe.resources.computing.ComputingResource; 
    45import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface; 
    56import schedframe.resources.computing.profiles.energy.airthroughput.ui.ComputingResourceAirThroughputInterface; 
     7import schedframe.resources.devices.PhysicalResource; 
     8import schedframe.resources.devices.PhysicalResourceAirThroughputInterface; 
     9import schedframe.resources.devices.coolemall.FanAirThroughputInterface; 
    610 
    711public class AirThroughputInterfaceFactory { 
    812         
    9         public static AirThroughputInterface createAirThroughputInterface(ComputingResource resource, AirThroughputProfile atp){ 
     13        public static AirThroughputInterface createAirThroughputInterface(PhysicalResource resource, AirThroughputProfile atp){ 
    1014                if(atp == null) 
    1115                        return null; 
    12                 AirThroughputInterface airThroughputInterface = new ComputingResourceAirThroughputInterface(resource, atp); 
    13  
     16                AirThroughputInterface airThroughputInterface = null; 
     17                if(resource.getType().getName().equals(StandardResourceType.CRAH.getName())) 
     18                        airThroughputInterface = new PhysicalResourceAirThroughputInterface(resource, atp); 
     19                else if(resource.getType().getName().equals(StandardResourceType.Fan.getName())) 
     20                        airThroughputInterface = new FanAirThroughputInterface(resource, atp); 
     21                else if(resource.getType().getName().equals(StandardResourceType.Inlet.getName())) 
     22                        airThroughputInterface = new FanAirThroughputInterface(resource, atp); 
     23                else if(resource.getType().getName().equals(StandardResourceType.Outlet.getName())) 
     24                        airThroughputInterface = new FanAirThroughputInterface(resource, atp); 
     25                else if(resource.getType().getName().equals(StandardResourceType.CoolingDevice.getName())) 
     26                        airThroughputInterface = new PhysicalResourceAirThroughputInterface(resource, atp); 
     27                else 
     28                        airThroughputInterface = new ComputingResourceAirThroughputInterface((ComputingResource)resource, atp); 
    1429                return airThroughputInterface; 
    1530        } 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputProfile.java

    r495 r1207  
    2828        } 
    2929         
    30         public void addToPowerUsageHistory(double airFlow) { 
     30        public void addToAirFlowHistory(double airFlow) { 
    3131 
    3232                if (airFlowHistory.size() == 0) { 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/StandardAirThroughputStateName.java

    r753 r1207  
    33public enum  StandardAirThroughputStateName implements AirThroughputStateName{ 
    44 
    5         FAN_ON, 
    6         FAN_OFF; 
     5        ON, 
     6        OFF; 
    77 
    88        public String getName() { 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/AirThroughputInterface.java

    r754 r1207  
    44 
    55import schedframe.Parameters; 
     6import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 
    67import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 
    78import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputStateName; 
     
    910public interface AirThroughputInterface { 
    1011         
    11         public AirThroughputStateName  getAirThroughputState(); 
     12        public AirThroughputStateName getAirThroughputState(); 
    1213         
    1314        public boolean setAirThroughputState(AirThroughputStateName airThroughputState); 
     
    2122        public double getPowerConsumption(AirThroughputStateName state) throws NoSuchFieldException; 
    2223         
     24        public AirFlowValue getRecentAirFlow(); 
     25         
     26        List<AirFlowValue> getAirFlowHistory(); 
     27         
    2328        public Parameters getParameters(); 
     29         
     30         
    2431} 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/ComputingResourceAirThroughputInterface.java

    r754 r1207  
    44import java.util.List; 
    55 
     6import org.joda.time.DateTimeUtils; 
     7 
    68import schedframe.Parameters; 
    79import schedframe.resources.computing.ComputingResource; 
    810import schedframe.resources.computing.profiles.energy.EnergyEvent; 
    911import schedframe.resources.computing.profiles.energy.EnergyEventType; 
     12import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 
    1013import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 
    1114import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 
     
    2225                this.resource = resource; 
    2326                this.airThroughputProfile = airThroughputProfile; 
    24                 this.currentAirThroughputState = StandardAirThroughputStateName.FAN_ON; 
     27                this.currentAirThroughputState = StandardAirThroughputStateName.ON; 
    2528        } 
    2629         
     
    3437                         
    3538                        //TO DO - notifications should be called for all resources starting form the lowest layer 
    36                         resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getName())); 
     39                        resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getFullName())); 
     40                        resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName())); 
    3741                        return true; 
    3842                } 
     
    8387        } 
    8488         
     89        public AirFlowValue getRecentAirFlow() { 
     90                AirFlowValue airFlow = null; 
     91                int lastIdx = getAirFlowHistory().size() - 1; 
     92                if(lastIdx >= 0) 
     93                        airFlow = getAirFlowHistory().get(lastIdx); 
     94                else {   
     95                        try { 
     96                                airFlow = new AirFlowValue(DateTimeUtils.currentTimeMillis(), getAirFlow(currentAirThroughputState)); 
     97                        } catch (NoSuchFieldException e) { 
     98                        } 
     99                } 
     100                return airFlow; 
     101        } 
     102         
     103        public List<AirFlowValue> getAirFlowHistory(){ 
     104                return airThroughputProfile.getAirThroughputHistory(); 
     105        } 
     106         
     107         
    85108        public Parameters getParameters() { 
    86109                return airThroughputProfile.getParameters(); 
Note: See TracChangeset for help on using the changeset viewer.