Example #1
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 #2
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);
        }