/// <summary> /// Initializes a new instance of the SetPolicyRequest class. /// </summary> /// <param name="domainId">Node Manager Domain Id</param> /// <param name="policyEnabled">True if policy should be enabled by default</param> /// <param name="policyId">Unique Id of policy</param> /// <param name="policyType">Policy trigger target [Temp, Power, boot time]</param> /// <param name="action">Add/Remove policy</param> /// <param name="correction">Policy correction aggression</param> /// <param name="persistent">True if policy persists through Node Manager resets</param> /// <param name="exceptionAction">Action that occurs when policy gets violated</param> /// <param name="targetLimit">Depending on Policy Type, this value is Power Limt in Watts or % of throttle</param> /// <param name="correctionTime">Time in ms corrective action must be taking before exception action</param> /// <param name="triggerLimit">Depends on Policy Type. This value should be temperature in celsius or time in 1/10th of a second</param> /// <param name="statisticReporting">Reporting only. The number of seconds that the measured power will be averaged and reported. [Note: does not alter control]</param> internal SetPolicyRequest(NodeManagerDomainId domainId, bool policyEnabled, byte policyId, NodeManagerPolicyType policyType, NodeManagerPolicyAction action, NodeManagerPowerCorrection correction, bool persistent, NodeManagerPolicyExceptionAction exceptionAction, ushort targetLimit, uint correctionTime, ushort triggerLimit, ushort statisticReporting) { this.domainId = (byte)domainId; if(policyEnabled) this.domainId = (byte)(this.domainId | 0x10); this.policyId = policyId; this.policyType = (byte)policyType; // policy action. if(action == NodeManagerPolicyAction.Add) this.policyType = (byte)(this.policyType | 0x10); // correction action this.policyType = (byte)(this.policyType | (byte)correction); // persistence if(!persistent) this.policyType = (byte)(this.policyType | 0x80); // exception action if policy cannot be kept within correction time. this.exceptionAction = (byte)exceptionAction; // target limit. this.targetLimit = targetLimit; // bits 8:15 are reserved BootTimePolicy if (policyType == NodeManagerPolicyType.BootTimePolicy) this.targetLimit = (ushort)(this.targetLimit & 0xff); // set the correction time. this.correctionTime = correctionTime; // correction time override for boot time policy if (policyType == NodeManagerPolicyType.BootTimePolicy) this.correctionTime = 0; // trigger limit this.triggerLimit = triggerLimit; // trigger limit override for boot time policy if (policyType == NodeManagerPolicyType.BootTimePolicy) this.triggerLimit = 0; // statistics reporting this.statisticReporting = statisticReporting; }
/// <summary> /// Initializes a new instance of the SetPolicyRequest class. /// </summary> /// <param name="domainId">Node Manager Domain Id</param> /// <param name="policyEnabled">True if policy should be enabled by default</param> /// <param name="policyId">Unique Id of policy</param> /// <param name="policyType">Policy trigger target [Temp, Power, boot time]</param> /// <param name="action">Add/Remove policy</param> /// <param name="correction">Policy correction aggression</param> /// <param name="persistent">True if policy persists through Node Manager resets</param> /// <param name="exceptionAction">Action that occurs when policy gets violated</param> /// <param name="targetLimit">Depending on Policy Type, this value is Power Limt in Watts or % of throttle</param> /// <param name="correctionTime">Time in ms corrective action must be taking before exception action</param> /// <param name="triggerLimit">Depends on Policy Type. This value should be temperature in celsius or time in 1/10th of a second</param> /// <param name="statisticReporting">Reporting only. The number of seconds that the measured power will be averaged and reported. [Note: does not alter control]</param> internal SetPolicyRequest(NodeManagerDomainId domainId, bool policyEnabled, byte policyId, NodeManagerPolicyType policyType, NodeManagerPolicyAction action, NodeManagerPowerCorrection correction, bool persistent, NodeManagerPolicyExceptionAction exceptionAction, ushort targetLimit, uint correctionTime, ushort triggerLimit, ushort statisticReporting) { this.domainId = (byte)domainId; if (policyEnabled) { this.domainId = (byte)(this.domainId | 0x10); } this.policyId = policyId; this.policyType = (byte)policyType; // policy action. if (action == NodeManagerPolicyAction.Add) { this.policyType = (byte)(this.policyType | 0x10); } // correction action this.policyType = (byte)(this.policyType | (byte)correction); // persistence if (!persistent) { this.policyType = (byte)(this.policyType | 0x80); } // exception action if policy cannot be kept within correction time. this.exceptionAction = (byte)exceptionAction; // target limit. this.targetLimit = targetLimit; // bits 8:15 are reserved BootTimePolicy if (policyType == NodeManagerPolicyType.BootTimePolicy) { this.targetLimit = (ushort)(this.targetLimit & 0xff); } // set the correction time. this.correctionTime = correctionTime; // correction time override for boot time policy if (policyType == NodeManagerPolicyType.BootTimePolicy) { this.correctionTime = 0; } // trigger limit this.triggerLimit = triggerLimit; // trigger limit override for boot time policy if (policyType == NodeManagerPolicyType.BootTimePolicy) { this.triggerLimit = 0; } // statistics reporting this.statisticReporting = statisticReporting; }