// 保守性の計算・評価 // ルートデバイスにのみ評価を適用する internal double EvaluateMaintainability(EA.Repository Repository, Device device) { // デバイスについている通信情報の取得 double PowerForCommunication = 0; foreach (var Connector in device.ConnectorList) { var ConnectorType = Connector.Notes.ToXDocument().Element("data").Element("通信の種類").Value; var CommunicationInfo = CommunicationTypeInfo.GetCommunicationInfo(ConnectorType); PowerForCommunication += (6 - CommunicationInfo.PowerSaving); } var ExecutionEnvironmenWhereDeviceExists = GetExecutionEnvironment(Repository, device); double EnvironmenteConfidentiality = ExecutionEnvironmenWhereDeviceExists.xdocument.Element("data").Element("環境へのアクセス性").Value.ToDouble(); double DeviceConfidentiality = device.xdocument.Element("data").Element("デバイスへのアクセス性").Value.ToDouble(); string DeviceBatteryType = device.xdocument.Element("data").Element("電源形式").Value; if (DeviceBatteryType == "主電源") { PowerForCommunication = 0; } // var BatteryAbility = BatteryAbilityDictionary[DeviceBatteryType]; var UsingPower = PowerForCommunication; var Confidentiality = (EnvironmenteConfidentiality + DeviceConfidentiality) / 2; double Maintainability = 5 - ((5 - Confidentiality) * UsingPower); return(Maintainability); }
// 通信の処理時間の計算 internal double CalculateProcessingTimeFromCommunication(XDocument Process) { double CommunicationSpeed; if (Process.Element("communication").Element("connector").Element("data").Element("通信速度").Value.Length == 0) { var CommunicationType = Process.Element("communication").Element("connector").Element("data").Element("通信の種類").Value; var CommunicationInfo = CommunicationTypeInfo.GetCommunicationInfo(CommunicationType); CommunicationSpeed = CommunicationInfo.Speed.ToKByte(); } else { CommunicationSpeed = Process.Element("communication").Element("connector").Element("data").Element("通信速度").Value.ToKByte(); } double DataAmount = Process.Element("communication").Element("component").Element("data").Element("出力データ量").Value.ToKByte(); //データ量(kb) / 通信速度(kbps)で求める return(DataAmount / CommunicationSpeed); }