Esempio n. 1
0
        /// <summary>
        /// Collect and set up the parameter sets of all circuit entities.
        /// </summary>
        /// <remarks>
        /// The parameter sets are cloned during set up to avoid issues when running multiple
        /// simulations in parallel.
        /// </remarks>
        /// <param name="entities">The entities for which parameter sets need to be collected.</param>
        /// <exception cref="ArgumentNullException">entities</exception>
        private void SetupParameters(IEnumerable <Entity> entities)
        {
            entities.ThrowIfNull(nameof(entities));

            // Register all parameters
            foreach (var entity in entities)
            {
                foreach (var p in entity.ParameterSets.Values)
                {
                    var parameterset = _cloneParameters ? p.Clone() : p;
                    parameterset.CalculateDefaults();
                    EntityParameters.Add(entity.Name, parameterset);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Collect and set up the parameter sets of all circuit entities.
        /// </summary>
        /// <remarks>
        /// The parameter sets are cloned during set up to avoid issues when running multiple
        /// simulations in parallel.
        /// </remarks>
        /// <param name="entities">The entities for which parameter sets need to be collected.</param>
        /// <exception cref="ArgumentNullException">entities</exception>
        private void SetupParameters(IEnumerable <Entity> entities)
        {
            if (entities == null)
            {
                throw new ArgumentNullException(nameof(entities));
            }

            // Register all parameters
            foreach (var entity in entities)
            {
                foreach (var p in entity.ParameterSets.Values)
                {
                    p.CalculateDefaults();
                    EntityParameters.Add(entity.Name, _cloneParameters ? p.DeepClone() : p);
                }
            }
        }