private void dataReadFromSimulatedData(string dataFilePath_Simulated, string dataFilePath_Mode)
        {
            Txt_Handle txt_Handle = new Txt_Handle();

            string[] dataRead_Simulated = txt_Handle.dataRead(dataFilePath_Simulated);
            string[] dataRead_Mode = txt_Handle.dataRead(dataFilePath_Mode);

            charge_HA.Text = dataRead_Simulated[0];

            double h_HA_Double = Convert.ToDouble(dataRead_Simulated[1]);
            h_HA.Value = Convert.ToDecimal(System.Math.Abs(h_HA_Double));
            savedH_HA.Value = Convert.ToDecimal(dataRead_Simulated[2]);

            charge_EA.Text = dataRead_Simulated[3];
            duration_EA.Value = Convert.ToDecimal(dataRead_Simulated[4]);
            speed_EA.Value = Convert.ToDecimal(dataRead_Simulated[5]);
            savedE_EA.Value = Convert.ToDecimal(dataRead_Simulated[6]);

            gear_Boiler.Value = Convert.ToDecimal(dataRead_Simulated[7]);
            duration_Boiler.Value = Convert.ToDecimal(dataRead_Simulated[8]);

            envrmtdata_lout_Heat.Value = Convert.ToDecimal(dataRead_Simulated[9]);
            duration_Heat.Value = Convert.ToDecimal(dataRead_Simulated[10]);

            envrmtdata_lout_Electricity.Value = Convert.ToDecimal(dataRead_Simulated[11]);
            duration_Electricity.Value = Convert.ToDecimal(dataRead_Simulated[12]);

            gear_UE.Value = Convert.ToDecimal(dataRead_Simulated[13]);
            duration_UE.Value = Convert.ToDecimal(dataRead_Simulated[14]);

            price_E.Value = Convert.ToDecimal(dataRead_Simulated[15]);
            price_H.Value = Convert.ToDecimal(dataRead_Simulated[16]);
            price_G.Value = Convert.ToDecimal(dataRead_Simulated[17]);

            switch (dataRead_Mode[0])
            {
                case "1":
                    Mode.Text = "经济";
                    break;
                case "2":
                    Mode.Text = "节能";
                    break;
                case "4":
                    Mode.Text = "经济+节能";
                    break;
            }
        }
Example #2
0
 private void needWriteToFile(string needFilePath)
 {
     Txt_Handle txt_Handle = new Txt_Handle();
     string[] dataToWrite = new string[3];
     dataToWrite[0] = need_E.Content.ToString();
     dataToWrite[1] = need_H.Content.ToString();
     dataToWrite[2] = "0";
     txt_Handle.dataWrite(needFilePath, dataToWrite);
 }
Example #3
0
        private void needReadFromFile(string needFilePath)
        {
            Txt_Handle txt_Handle = new Txt_Handle();
            string[] dataRead_EnergyNeed = txt_Handle.dataRead(needFilePath);

            need_E.Content = dataRead_EnergyNeed[0];
            need_H.Content = dataRead_EnergyNeed[1];
        }
Example #4
0
        private List<string>[] equStateReadFromFile(string equipmentFilePath, string stateFilePath)
        {
            Txt_Handle txt_Handle = new Txt_Handle();

            string[] strEqu = txt_Handle.dataRead(equipmentFilePath);
            string[] strState = txt_Handle.dataRead(stateFilePath);

            List<string> lsEqu = new List<string>(strEqu);
            List<string> lsState = new List<string>(strState);

            List<string>[] arrList = new List<string>[2];
            arrList[0] = lsEqu;
            arrList[1] = lsState;
            return arrList;
        }
Example #5
0
        private void equStateWriteToFile(string equipmentFilePath, List<string> lsEqu, string stateFilePath, List<string> lsState)
        {
            Txt_Handle txt_Handle = new Txt_Handle();

            string[] strEqu = lsEqu.ToArray();
            string[] strState = lsState.ToArray();

            txt_Handle.dataWrite(equipmentFilePath, strEqu);
            txt_Handle.dataWrite(stateFilePath, strState);
        }
        private void city_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //所选地区能源数据存储
            string path_NeedE_Winter = "";
            string path_NeedH_Winter = "";

            string path_NeedE_Summer = "";
            string path_NeedH_Summer = "";

            string path_NeedE_SA = "";

            switch (city.Text)
            {
                case "北京":
                    path_NeedE_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedE_W_Beijing.txt";
                    path_NeedH_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedH_W_Beijing.txt";

                    path_NeedE_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedE_S_Beijing.txt";
                    path_NeedH_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedH_S_Beijing.txt";

                    path_NeedE_SA = @"..\..\Local Storage\EnergyNeedFile\NeedE_SA_Beijing.txt";

                    break;
                case "上海":
                    path_NeedE_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedE_W_Shanghai.txt";
                    path_NeedH_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedH_W_Shanghai.txt";

                    path_NeedE_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedE_S_Shanghai.txt";
                    path_NeedH_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedH_S_Shanghai.txt";

                    path_NeedE_SA = @"..\..\Local Storage\EnergyNeedFile\NeedE_SA_Shanghai.txt";

                    break;

                case "广州":
                    path_NeedE_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedE_W_Guangzhou.txt";
                    path_NeedH_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedH_W_Guangzhou.txt";

                    path_NeedE_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedE_S_Guangzhou.txt";
                    path_NeedH_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedH_S_Guangzhou.txt";

                    path_NeedE_SA = @"..\..\Local Storage\EnergyNeedFile\NeedE_SA_Guangzhou.txt";

                    break;
                case "沈阳":
                    path_NeedE_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedE_W_Shenyang.txt";
                    path_NeedH_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedH_W_Shenyang.txt";

                    path_NeedE_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedE_S_Shenyang.txt";
                    path_NeedH_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedH_S_Shenyang.txt";

                    path_NeedE_SA = @"..\..\Local Storage\EnergyNeedFile\NeedE_SA_Shenyang.txt";

                    break;
                case "武汉":
                    path_NeedE_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedE_W_Wuhan.txt";
                    path_NeedH_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedH_W_Wuhan.txt";

                    path_NeedE_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedE_S_Wuhan.txt";
                    path_NeedH_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedH_S_Wuhan.txt";

                    path_NeedE_SA = @"..\..\Local Storage\EnergyNeedFile\NeedE_SA_Wuhan.txt";

                    break;
                case "重庆":
                    path_NeedE_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedE_W_Chongqing.txt";
                    path_NeedH_Winter = @"..\..\Local Storage\EnergyNeedFile\NeedH_W_Chongqing.txt";

                    path_NeedE_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedE_S_Chongqing.txt";
                    path_NeedH_Summer = @"..\..\Local Storage\EnergyNeedFile\NeedH_S_Chongqing.txt";

                    path_NeedE_SA = @"..\..\Local Storage\EnergyNeedFile\NeedE_SA_Chongqing.txt";

                    break;
            }

            Txt_Handle txt_Handle = new Txt_Handle();

            //读取所选地区能源数据
            string[] needE_Winter = txt_Handle.dataRead(path_NeedE_Winter);
            string[] needH_Winter = txt_Handle.dataRead(path_NeedH_Winter);

            string[] needE_Summer = txt_Handle.dataRead(path_NeedE_Summer);
            string[] needH_Summer = txt_Handle.dataRead(path_NeedH_Summer);

            string[] needE_SA = txt_Handle.dataRead(path_NeedE_SA);
            string[] needH_SA = new string[24];

            for (int i = 0; i < 24; i++)
            {
                needH_SA[i] = "0";
            }

            //要写入的文件
            string pathToWrite_NeedE_Winter = @"..\..\Local Storage\NeedE_W.txt";
            string pathToWrite_NeedH_Winter = @"..\..\Local Storage\NeedH_W.txt";

            string pathToWrite_NeedE_Summer = @"..\..\Local Storage\NeedE_S.txt";
            string pathToWrite_NeedH_Summer = @"..\..\Local Storage\NeedH_S.txt";

            string pathToWrite_NeedE_SA = @"..\..\Local Storage\NeedE_SA.txt";
            string pathToWrite_NeedH_SA = @"..\..\Local Storage\NeedH_SA.txt";

            //写入数据
            txt_Handle.dataWrite(pathToWrite_NeedE_Winter, needE_Winter);
            txt_Handle.dataWrite(pathToWrite_NeedH_Winter, needH_Winter);

            txt_Handle.dataWrite(pathToWrite_NeedE_Summer, needE_Summer);
            txt_Handle.dataWrite(pathToWrite_NeedH_Summer, needH_Summer);

            txt_Handle.dataWrite(pathToWrite_NeedE_SA, needE_SA);
            txt_Handle.dataWrite(pathToWrite_NeedH_SA, needH_SA);
        }
        private void dataWriteToSimulatedData(string dataFilePath_Simulated, string dataFilePath_Mode)
        {
            Txt_Handle txt_Handle = new Txt_Handle();

            PropertyInfo[] pis = typeof(SimulatedData).GetProperties();
            int length = pis.Length;

            string[] dataWrite_Simulated = new string[length];

            dataWrite_Simulated[0] = charge_HA.Text.ToString();
            dataWrite_Simulated[1] = h_HA.Value.ToString();
            dataWrite_Simulated[2] = savedH_HA.Value.ToString();

            dataWrite_Simulated[3] = charge_EA.Text.ToString();
            dataWrite_Simulated[4] = duration_EA.Value.ToString();
            dataWrite_Simulated[5] = speed_EA.Value.ToString();
            dataWrite_Simulated[6] = savedE_EA.Value.ToString();

            dataWrite_Simulated[7] = gear_Boiler.Value.ToString();
            dataWrite_Simulated[8] = duration_Boiler.Value.ToString();

            dataWrite_Simulated[9] = envrmtdata_lout_Heat.Value.ToString();
            dataWrite_Simulated[10] = duration_Heat.Value.ToString();

            dataWrite_Simulated[11] = envrmtdata_lout_Electricity.Value.ToString();
            dataWrite_Simulated[12] = duration_Electricity.Value.ToString();

            dataWrite_Simulated[13] = gear_UE.Value.ToString();
            dataWrite_Simulated[14] = duration_UE.Value.ToString();

            dataWrite_Simulated[15] = price_E.Value.ToString();
            dataWrite_Simulated[16] = price_H.Value.ToString();
            dataWrite_Simulated[17] = price_G.Value.ToString();

            txt_Handle.dataWrite(dataFilePath_Simulated, dataWrite_Simulated);

            string[] dataWrite_Mode = new string[1];

            switch (Mode.Text)
            {
                case "经济":
                    dataWrite_Mode[0] = "1";
                    break;
                case "节能":
                    dataWrite_Mode[0] = "2";
                    break;
                case "经济+节能":
                    dataWrite_Mode[0] = "4";
                    break;
            }

            txt_Handle.dataWrite(dataFilePath_Mode, dataWrite_Mode);
        }
        private void RB_Manual_Checked(object sender, RoutedEventArgs e)
        {
            Txt_Handle txt_Handle = new Txt_Handle();

            dataReadFromNeedE(path_NeedH_Manual);
            dataReadFromNeedH(path_NeedH_Manual);

            string[] mode_Season = new string[1];
            mode_Season[0] = "M";
            txt_Handle.dataWrite(path_mode_Season, mode_Season);
        }
        private void dataWriteToNeedH(string dataFilePath)
        {
            Txt_Handle txt_Handle = new Txt_Handle();

            string[] dataWrite = new string[24];

            for (int i = 0; i < 24; i++)
            {
                TAlex.WPF.Controls.NumericUpDown numbericUpDown = need.FindName("needH_" + i.ToString()) as TAlex.WPF.Controls.NumericUpDown;

                dataWrite[i] = numbericUpDown.Value.ToString();
            }

            txt_Handle.dataWrite(dataFilePath, dataWrite);
        }
        private void dataReadFromNeedH(string dataFilePath)
        {
            Txt_Handle txt_Handle = new Txt_Handle();

            string[] dataRead = txt_Handle.dataRead(dataFilePath);

            for (int i = 0; i < 24; i++)
            {
                TAlex.WPF.Controls.NumericUpDown numbericUpDown = need.FindName("needH_" + i.ToString()) as TAlex.WPF.Controls.NumericUpDown;
                numbericUpDown.Value = Convert.ToDecimal(dataRead[i]);
            }
        }