예제 #1
0
        /// <summary>
        /// initializes the form, loads up all its widgets with data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DispatchDERForm_Load(object sender, System.EventArgs e)
        {
            _log = new XMLForm();
            string DERGroupName = DERMSInterface.CIMData.operations.dispatchDER.ToString();

            DERMSInterface.CIMData.header header = _cim.DispatchDERHeader;
            this.endPointText.Text        = header.EndPoint;
            this.messageTypeText.Text     = "Dispatch DER";
            this.replyAddressText.Text    = header.ReplyAddress;
            this.userIDText.Text          = header.UserID;
            this.organizationText.Text    = header.UserOrganization;
            this.contextText.Text         = header.Context;
            this.verbText.Text            = header.Verb;
            this.ackRequiredCheck.Checked = header.AckRequired;
            this.commentText.Text         = header.Comment;

            // set to real by default. Why not?
            this.realRadio.Checked = true;
            DERMSInterface.CIMData.DERGroup group = this.group;
            DERGroupMRIDText.Text  = group.Mrid;
            realValue              = group.getWattCapacity();
            reactiveValue          = group.getVarCapacity();
            realValueText.Text     = realValue.ToString();
            reactiveValueText.Text = reactiveValue.ToString();
        }
예제 #2
0
        /// <summary>
        /// initializes the form, loads the on screen widgets with data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormLoad(object sender, System.EventArgs e)
        {
            DERMSInterface.CIMData.header header = _cim.CreateDERHeader;


            // header info
            this.endPointText.Text        = header.EndPoint;
            this.messageTypeText.Text     = "Create DER";
            this.replyAddressText.Text    = header.ReplyAddress;
            this.userIDText.Text          = header.UserID;
            this.organizationText.Text    = header.UserOrganization;
            this.contextText.Text         = header.Context;
            this.verbText.Text            = header.Verb;
            this.ackRequiredCheck.Checked = header.AckRequired;
            this.commentText.Text         = header.Comment;

            // group widgets
            DERMSInterface.CIMData.DERGroup group = _group;
            DERGroupNameText.Text     = group.GroupName;
            DERGroupMRIDText.Text     = group.Mrid;
            DERGroupRevisionText.Text = group.Revision;
            DERGroupSubText.Text      = group.Substation;
            DERGroupFeederText.Text   = group.Feeder;
            DERGroupSegmentText.Text  = group.Segment;
            // TODO : we do not set count, reactive and total power values, they are derived

            int    deviceCount   = 0;
            double realPower     = 0.0;
            double reactivePower = 0.0;

            // bind datasource to the currently selected DER group row
            bs                 = new BindingSource();
            bs.DataSource      = group.Devices;
            DERView.DataSource = bs;
            bs.ResetBindings(false);

            // we allow editing/adding to DER members
            DERView.CellValueChanged += new DataGridViewCellEventHandler(DERCellValue_Updated);
            DERView.CellValidating   += new DataGridViewCellValidatingEventHandler(DERCell_Validating);

            // first time, set the read-only sum/count vars for DERGRoup based
            // on the DER members
            group.Devices.ForEach(x =>
            {
                deviceCount++;
                realPower     += x.WattCapacity;
                reactivePower += x.VarCapacity;
            });

            // editing for DER members, no edit on derived DER Group fields
            DERView.ReadOnly = false;
            DERGroupDeviceCountText.Enabled = false;
            DERGroupRealText.Enabled        = false;
            DERGroupReactiveText.Enabled    = false;

            // intialize readonly vars
            DERGroupDeviceCountText.Text = group.Devices.Count.ToString();
            DERGroupReactiveText.Text    = group.getVarCapacity().ToString();
            DERGroupRealText.Text        = group.getWattCapacity().ToString();

            // if (_editDER == true)
            //     DERView.CellValueChanged += new DataGridViewCellEventHandler(CellValue_Changed);
        }