public SolarPanel(Guid deviceId, string deviceName, float capacity, SolarUnit parentUnit) { DeviceId = deviceId; DeviceName = deviceName; Capacity = capacity; ParentUnit = parentUnit; }
public static void Main() { var smallUnit = new SolarUnit(Guid.NewGuid(), "SU001"); List <SolarPanel> panels = new List <SolarPanel> { new SolarPanel(Guid.NewGuid(), "P01", 100, smallUnit), new SolarPanel(Guid.NewGuid(), "P02", 93, smallUnit) }; panels.ForEach(panel => smallUnit.AddPanels(panel)); var anotherUnit = new SolarUnit(Guid.NewGuid(), "SU002"); List <SolarPanel> anotherPanels = new List <SolarPanel> { new SolarPanel(Guid.NewGuid(), "P04", 60, anotherUnit), new SolarPanel(Guid.NewGuid(), "P05", 67, anotherUnit) }; anotherPanels.ForEach(panel => anotherUnit.AddPanels(panel)); smallUnit.AddUnits(anotherUnit); Console.WriteLine(smallUnit.PowerGenerationCapacity()); }
public void AddUnits(SolarUnit unit) { units.Add(unit); }