public ConfigFile(string configFileContent)
 {
     this.content      = configFileContent;
     this.maxDuration  = ConfigFileParser.GetMaximumDuration(configFileContent);
     this.refFrequency = ConfigFileParser.GetRuntimeReferenceFrequency(configFileContent);
     this.tasks        = ConfigFileParser.GetTasks(configFileContent);
     this.processors   = ConfigFileParser.GetProcessors(configFileContent);
     this.coefficients = ConfigFileParser.GetCoefficients(configFileContent);
 }
        /// <summary>
        /// Computes the energy consumed by an allocation
        /// </summary>
        /// <returns>
        /// The energy consumed by an allocation
        /// </returns>
        /// <param name="configFileContent">Content of a configuration file</param>
        /// <param name="allocation">Allocation of tasks on processors</param>
        public static float GetTotalEnergyConsumed(string configFileContent, List <List <bool> > allocation)
        {
            List <float> coefficients              = ConfigFileParser.GetCoefficients(configFileContent);
            List <float> processorFrequencies      = ConfigFileParser.GetProcessorFrequencies(configFileContent);
            List <float> taskRuntimes              = ConfigFileParser.GetTaskRuntimes(configFileContent);
            float        runtimeReferenceFrequency = ConfigFileParser.GetRuntimeReferenceFrequency(configFileContent);
            float        totalEnergyConsumed       = 0;

            if (coefficients.Count == 0 || processorFrequencies.Count == 0 || taskRuntimes.Count == 0 || allocation.Count == 0 || runtimeReferenceFrequency == -1)
            {
                return(-1);
            }
            else
            {
                // Calculate energy consumed by each task
                for (int taskId = 0; taskId < taskRuntimes.Count; taskId++)
                {
                    int processorId = 0;

                    // Find the processor that handles a given task
                    for (int allocationProcessorId = 0; allocationProcessorId < allocation.Count; allocationProcessorId++)
                    {
                        if (allocation[allocationProcessorId][taskId])
                        {
                            processorId = allocationProcessorId;
                            break;
                        }
                    }

                    float runtimeOnGivenProcessor = GetTaskRuntime(runtimeReferenceFrequency, taskRuntimes[taskId], processorFrequencies[processorId]);
                    float energyConsumedPerTask   = GetEnergyConsumedPerTask(coefficients, processorFrequencies[processorId], runtimeOnGivenProcessor);
                    totalEnergyConsumed += energyConsumedPerTask;
                }

                return(totalEnergyConsumed);
            }
        }