Ejemplo n.º 1
0
        /// <summary>
        /// convenience function reads cimdata file, calls dispatch
        /// </summary>
        /// <param name="path"> filename</param>
        /// <param name="DERGroupName">DER group name</param>
        /// <param name="q">apparent or real</param>
        /// <param name="isOverride">send my own value, rather than pulling from config</param>
        /// <param name="overrideValue">value to send</param>
        /// <returns></returns>
        public static int DispatchDERGroup(String path, String DERGroupName, quantity q, ref String SOAPMessage, ref String SoapResponse, Boolean isOverride = false, double overrideValue = 0.0)
        {
            CIM c = new CIM();

            c._data = DERMSInterface.CIMData.read(path);
            int rc = c.DispatchDERGroup(DERGroupName, q, isOverride, overrideValue);

            SOAPMessage  = c.LastMessageSent;
            SoapResponse = c.LastMessageReceived;
            return(rc);
        }
Ejemplo n.º 2
0
        public static int dispatchDERGroup(
            [MarshalAs(UnmanagedType.LPTStr)] String path,
            [MarshalAs(UnmanagedType.LPTStr)] String mrid,
            [MarshalAs(UnmanagedType.LPTStr)] String q,
            [MarshalAs(UnmanagedType.LPTStr)] ref String xml,
            [MarshalAs(UnmanagedType.Bool)] bool isOverride,
            [MarshalAs(UnmanagedType.R8)] double overrideValue)
        {
            DERResult result = new DERResult();

            try
            {
                quantity qtype = (quantity)Enum.Parse(typeof(DERMSInterface.quantity), q);
                Console.WriteLine("DER file : " + path);
                Console.WriteLine("DERGroupName : " + mrid);
                Console.WriteLine("Override : " + isOverride);
                Console.WriteLine("Override value : " + overrideValue);
                String SOAPMessage  = null;
                String SOAPResponse = null;
                int    rvalue       = CIM.DispatchDERGroup(path, mrid, qtype, ref SOAPMessage, ref SOAPResponse, isOverride, overrideValue);

                result.SOAPMessage  = SOAPMessage;
                result.SOAPResponse = SOAPResponse;
                result.Returncode   = 0;
            }
            catch (Exception e)
            {
                result.Returncode   = 1;
                result.ErrorMessage = e.ToString();
                Console.WriteLine("Exception: {0}", e);
            }

            XmlSerializer ser    = new XmlSerializer(typeof(DERResult));
            StringWriter  writer = new StringWriter();

            ser.Serialize(writer, result);
            xml = writer.ToString();

            return(result.Returncode);
        }