コード例 #1
0
        private static void CalcPhysical(FrequencyMessage message, IPhysicalCalculator calc, PhysicalQuantity instance,
                                         Dictionary <int, QuantityValuePair> tempExValuePairs, Dictionary <int, decimal> shellTempDic)
        {
            for (var i = 0; i < instance.ChannelValues.Length; i++)
            {
                for (var j = 0; j < instance.ChannelValues[i].GratingValues.Length; j++)
                {
                    var current = SensorConfigManager.GetConfigBy(i + 1, j + 1);

                    if (current != null && tempExValuePairs.ContainsKey(current.SensorId))
                    {
                        instance.ChannelValues[i].GratingValues[j] = tempExValuePairs[current.SensorId];
                    }
                    else
                    {
                        instance.ChannelValues[i].GratingValues[j].Orignal =
                            QuantityValuePair.CalculateFrequency(message.Channels[i].Gratings[j]);
                        instance.ChannelValues[i].GratingValues[j].WaveLength =
                            QuantityValuePair.FrequencyToWavelength(instance.ChannelValues[i].GratingValues[j].Orignal);
                        var wave =
                            instance.ChannelValues[i].GratingValues[j].WaveLengthExtension =
                                QuantityValuePair.CalcFrequencyExtension(
                                    instance.ChannelValues[i].GratingValues[j].WaveLength, shellTempDic[i]);

                        var     extension = SensorConfigManager.GetTemperatureExtensionConfig(current);
                        decimal?exWave    = null;
                        if (extension != null && tempExValuePairs.ContainsKey(extension.SensorId))
                        {
                            exWave = tempExValuePairs[extension.SensorId].WaveLengthExtension;
                        }
                        instance.ChannelValues[i].GratingValues[j].PhysicalValue =
                            QuantityValuePair.CalcPhysicalValue(current, wave, calc, extension, exWave);
                    }
                }
            }
        }