diff --git a/CHANGELOG.md b/CHANGELOG.md index ba304d8f..1cabd5d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `check_update` function modified - `codecov` removed from `dev-requirements.txt` - Dockerfile updated +- `Folder` parameter added to `Static_Analysis` function +- `Folder` parameter added to `Dynamic_Analysis` function +- Document modified ## [1.3] - 2021-06-30 ### Added - GitHub actions diff --git a/Documents/Amphlett.ipynb b/Documents/Amphlett.ipynb index a6d697d0..3c34fdf0 100644 --- a/Documents/Amphlett.ipynb +++ b/Documents/Amphlett.ipynb @@ -10650,13 +10650,6 @@ "data_2=Static_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=False)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" - ] - }, { "cell_type": "code", "execution_count": 21, @@ -10682,7 +10675,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "* Notice:" + "### Parameters" ] }, { @@ -10691,7 +10684,22 @@ "source": [ "1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)\n", "2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)\n", - "3. `PrintMode` : Control printing in console, (Default : `True`)" + "3. `PrintMode` : Control printing in console, (Default : `True`)\n", + "4. `Folder` : Reports folder, (Default : `os.getcwd()`)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"Folder\" , new in version 1.4" ] }, { @@ -11101,6 +11109,19 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "OPEM", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, diff --git a/Documents/Chakraborty.ipynb b/Documents/Chakraborty.ipynb index 4bbcae5c..1121455d 100644 --- a/Documents/Chakraborty.ipynb +++ b/Documents/Chakraborty.ipynb @@ -36655,7 +36655,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "* Notice:" + "### Parameters" ] }, { @@ -36664,7 +36664,15 @@ "source": [ "1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)\n", "2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)\n", - "3. `PrintMode` : Control printing in console, (Default : `True`)" + "3. `PrintMode` : Control printing in console, (Default : `True`)\n", + "4. `Folder` : Reports folder, (Default : `os.getcwd()`)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"Folder\" , new in version 1.4" ] }, { @@ -37078,6 +37086,19 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "OPEM", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, diff --git a/Documents/Chamberline_Kim.ipynb b/Documents/Chamberline_Kim.ipynb index 213894a5..0b0b6ba5 100644 --- a/Documents/Chamberline_Kim.ipynb +++ b/Documents/Chamberline_Kim.ipynb @@ -3864,13 +3864,6 @@ "data_2=Static_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=False)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" - ] - }, { "cell_type": "code", "execution_count": 10, @@ -3896,7 +3889,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "* Notice:" + "### Parameters" ] }, { @@ -3905,7 +3898,22 @@ "source": [ "1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)\n", "2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)\n", - "3. `PrintMode` : Control printing in console, (Default : `True`)" + "3. `PrintMode` : Control printing in console, (Default : `True`)\n", + "4. `Folder` : Reports folder, (Default : `os.getcwd()`)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"Folder\" , new in version 1.4" ] }, { @@ -4205,6 +4213,19 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "OPEM", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, diff --git a/Documents/Larminie_Dicks.ipynb b/Documents/Larminie_Dicks.ipynb index ccd98921..bea81cf7 100644 --- a/Documents/Larminie_Dicks.ipynb +++ b/Documents/Larminie_Dicks.ipynb @@ -8354,13 +8354,6 @@ "data_2=Static_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=False)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" - ] - }, { "cell_type": "code", "execution_count": 10, @@ -8386,7 +8379,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "* Notice:" + "### Parameters" ] }, { @@ -8395,7 +8388,22 @@ "source": [ "1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)\n", "2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)\n", - "3. `PrintMode` : Control printing in console, (Default : `True`)" + "3. `PrintMode` : Control printing in console, (Default : `True`)\n", + "4. `Folder` : Reports folder, (Default : `os.getcwd()`)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"Folder\" , new in version 1.4" ] }, { @@ -8722,6 +8730,19 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "OPEM", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, diff --git a/Documents/Padulles1.ipynb b/Documents/Padulles1.ipynb index 2c7a9ae2..65d103ee 100644 --- a/Documents/Padulles1.ipynb +++ b/Documents/Padulles1.ipynb @@ -9644,13 +9644,6 @@ "data_2=Dynamic_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=False)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" - ] - }, { "cell_type": "code", "execution_count": 14, @@ -9676,7 +9669,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "* Notice:" + "### Parameters" ] }, { @@ -9685,7 +9678,22 @@ "source": [ "1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)\n", "2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)\n", - "3. `PrintMode` : Control printing in console, (Default : `True`)" + "3. `PrintMode` : Control printing in console, (Default : `True`)\n", + "4. `Folder` : Reports folder, (Default : `os.getcwd()`)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"Folder\" , new in version 1.4" ] }, { @@ -10086,6 +10094,19 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "OPEM", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, diff --git a/Documents/Padulles2.ipynb b/Documents/Padulles2.ipynb index 123acf4c..eb6463cf 100644 --- a/Documents/Padulles2.ipynb +++ b/Documents/Padulles2.ipynb @@ -10661,13 +10661,6 @@ "data_2=Dynamic_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=False)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" - ] - }, { "cell_type": "code", "execution_count": 15, @@ -10693,7 +10686,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "* Notice:" + "### Parameters" ] }, { @@ -10702,7 +10695,22 @@ "source": [ "1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)\n", "2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)\n", - "3. `PrintMode` : Control printing in console, (Default : `True`)" + "3. `PrintMode` : Control printing in console, (Default : `True`)\n", + "4. `Folder` : Reports folder, (Default : `os.getcwd()`)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"Folder\" , new in version 1.4" ] }, { @@ -11149,6 +11157,19 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "OPEM", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, diff --git a/Documents/Padulles_Amphlett.ipynb b/Documents/Padulles_Amphlett.ipynb index 76713052..303c41b8 100644 --- a/Documents/Padulles_Amphlett.ipynb +++ b/Documents/Padulles_Amphlett.ipynb @@ -11421,13 +11421,6 @@ "data_2=Dynamic_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=False)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" - ] - }, { "cell_type": "code", "execution_count": 20, @@ -11453,7 +11446,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "* Notice:" + "### Parameters" ] }, { @@ -11462,7 +11455,22 @@ "source": [ "1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)\n", "2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)\n", - "3. `PrintMode` : Control printing in console, (Default : `True`)" + "3. `PrintMode` : Control printing in console, (Default : `True`)\n", + "4. `Folder` : Reports folder, (Default : `os.getcwd()`)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"Folder\" , new in version 1.4" ] }, { @@ -12041,6 +12049,19 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "OPEM", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, diff --git a/Documents/Padulles_Hauer.ipynb b/Documents/Padulles_Hauer.ipynb index c4d253b3..6c3318da 100644 --- a/Documents/Padulles_Hauer.ipynb +++ b/Documents/Padulles_Hauer.ipynb @@ -10698,13 +10698,6 @@ "data_2=Dynamic_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=False)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" - ] - }, { "cell_type": "code", "execution_count": 16, @@ -10730,7 +10723,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "* Notice:" + "### Parameters" ] }, { @@ -10739,7 +10732,22 @@ "source": [ "1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)\n", "2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)\n", - "3. `PrintMode` : Control printing in console, (Default : `True`)" + "3. `PrintMode` : Control printing in console, (Default : `True`)\n", + "4. `Folder` : Reports folder, (Default : `os.getcwd()`)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"PrintMode\" & \"ReportMode\" , new in version 0.5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Notice : \"Folder\" , new in version 1.4" ] }, { @@ -11221,6 +11229,19 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "OPEM", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false } }, "nbformat": 4, diff --git a/README.md b/README.md index a1dec774..58ff13ef 100644 --- a/README.md +++ b/README.md @@ -1409,11 +1409,12 @@ Modeling and simulation of proton-exchange membrane fuel cells (PEMFC) may work - For more information about this model visit here - #### Modes + #### Parameters 1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`) 2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`) 3. `PrintMode` : Control printing in console, (Default : `True`) + 4. `Folder` : Reports folder, (Default : `os.getcwd()`) #### Note diff --git a/opem/Dynamic/Chakraborty.py b/opem/Dynamic/Chakraborty.py index 7e20d3ec..75ce731a 100644 --- a/opem/Dynamic/Chakraborty.py +++ b/opem/Dynamic/Chakraborty.py @@ -187,7 +187,8 @@ def Dynamic_Analysis( InputMethod=opem.Functions.Get_Input, TestMode=False, PrintMode=True, - ReportMode=True): + ReportMode=True, + Folder=os.getcwd()): """ Run Chakraborty analysis. @@ -199,6 +200,8 @@ def Dynamic_Analysis( :type PrintMode:bool :param ReportMode : report mode control flag (True : generate report) :type ReportMode: bool + :param Folder: output folder address + :type Folder: str :return: result as dict """ OutputFile = None @@ -230,13 +233,14 @@ def Dynamic_Analysis( Name = Input_Dict["Name"] if ReportMode: OutputFile = opem.Functions.Output_Init( - Input_Dict, Simulation_Title, Name) + Input_Dict, Simulation_Title, Name, Folder) CSVFile = opem.Functions.CSV_Init( OutputParamsKeys, OutputParams, Simulation_Title, - Name) - HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name) + Name, + Folder) + HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name, Folder) IEnd = Input_Dict["i-stop"] IStep = Input_Dict["i-step"] Precision = opem.Functions.get_precision(IStep) diff --git a/opem/Dynamic/Padulles1.py b/opem/Dynamic/Padulles1.py index 40c35959..76f967f3 100644 --- a/opem/Dynamic/Padulles1.py +++ b/opem/Dynamic/Padulles1.py @@ -166,7 +166,8 @@ def Dynamic_Analysis( InputMethod=opem.Functions.Get_Input, TestMode=False, PrintMode=True, - ReportMode=True): + ReportMode=True, + Folder=os.getcwd()): """ Run Padulles I analysis. @@ -178,6 +179,8 @@ def Dynamic_Analysis( :type PrintMode:bool :param ReportMode : report mode control flag (True : generate report) :type ReportMode: bool + :param Folder: output folder address + :type Folder: str :return: result as dict """ OutputFile = None @@ -206,13 +209,14 @@ def Dynamic_Analysis( Name = Input_Dict["Name"] if ReportMode: OutputFile = opem.Functions.Output_Init( - Input_Dict, Simulation_Title, Name) + Input_Dict, Simulation_Title, Name, Folder) CSVFile = opem.Functions.CSV_Init( OutputParamsKeys, OutputParams, Simulation_Title, - Name) - HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name) + Name, + Folder) + HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name, Folder) IEnd = Input_Dict["i-stop"] IStep = Input_Dict["i-step"] Precision = opem.Functions.get_precision(IStep) diff --git a/opem/Dynamic/Padulles2.py b/opem/Dynamic/Padulles2.py index a4032392..700dc774 100644 --- a/opem/Dynamic/Padulles2.py +++ b/opem/Dynamic/Padulles2.py @@ -67,7 +67,8 @@ def Dynamic_Analysis( InputMethod=opem.Functions.Get_Input, TestMode=False, PrintMode=True, - ReportMode=True): + ReportMode=True, + Folder=os.getcwd()): """ Run Padulles II analysis. @@ -79,6 +80,8 @@ def Dynamic_Analysis( :type PrintMode:bool :param ReportMode : report mode control flag (True : generate report) :type ReportMode: bool + :param Folder: output folder address + :type Folder: str :return: result as dict """ OutputFile = None @@ -107,13 +110,14 @@ def Dynamic_Analysis( Name = Input_Dict["Name"] if ReportMode: OutputFile = opem.Functions.Output_Init( - Input_Dict, Simulation_Title, Name) + Input_Dict, Simulation_Title, Name, Folder) CSVFile = opem.Functions.CSV_Init( OutputParamsKeys, OutputParams, Simulation_Title, - Name) - HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name) + Name, + Folder) + HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name, Folder) IEnd = Input_Dict["i-stop"] IStep = Input_Dict["i-step"] Precision = opem.Functions.get_precision(IStep) diff --git a/opem/Dynamic/Padulles_Amphlett.py b/opem/Dynamic/Padulles_Amphlett.py index 5f576407..368ffe96 100644 --- a/opem/Dynamic/Padulles_Amphlett.py +++ b/opem/Dynamic/Padulles_Amphlett.py @@ -35,7 +35,8 @@ def Dynamic_Analysis( InputMethod=opem.Functions.Get_Input, TestMode=False, PrintMode=True, - ReportMode=True): + ReportMode=True, + Folder=os.getcwd()): """ Run Padulles-Amphlett analysis. @@ -47,6 +48,8 @@ def Dynamic_Analysis( :type PrintMode:bool :param ReportMode : report mode control flag (True : generate report) :type ReportMode: bool + :param Folder: output folder address + :type Folder: str :return: result as dict """ OutputFile = None @@ -78,13 +81,14 @@ def Dynamic_Analysis( Name = Input_Dict["Name"] if ReportMode: OutputFile = opem.Functions.Output_Init( - Input_Dict, Simulation_Title, Name) + Input_Dict, Simulation_Title, Name, Folder) CSVFile = opem.Functions.CSV_Init( OutputParamsKeys, OutputParams, Simulation_Title, - Name) - HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name) + Name, + Folder) + HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name, Folder) IEndMax = Input_Dict["JMax"] * Input_Dict["A"] IEnd = min(IEndMax, Input_Dict["i-stop"]) IEnd = Input_Dict["i-stop"] diff --git a/opem/Dynamic/Padulles_Hauer.py b/opem/Dynamic/Padulles_Hauer.py index a8b650c5..14b7487e 100644 --- a/opem/Dynamic/Padulles_Hauer.py +++ b/opem/Dynamic/Padulles_Hauer.py @@ -37,7 +37,8 @@ def Dynamic_Analysis( InputMethod=opem.Functions.Get_Input, TestMode=False, PrintMode=True, - ReportMode=True): + ReportMode=True, + Folder=os.getcwd()): """ Run Padulles Hauer analysis. @@ -49,6 +50,8 @@ def Dynamic_Analysis( :type PrintMode:bool :param ReportMode : report mode control flag (True : generate report) :type ReportMode: bool + :param Folder: output folder address + :type Folder: str :return: result as dict """ OutputFile = None @@ -77,13 +80,14 @@ def Dynamic_Analysis( Name = Input_Dict["Name"] if ReportMode: OutputFile = opem.Functions.Output_Init( - Input_Dict, Simulation_Title, Name) + Input_Dict, Simulation_Title, Name, Folder) CSVFile = opem.Functions.CSV_Init( OutputParamsKeys, OutputParams, Simulation_Title, - Name) - HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name) + Name, + Folder) + HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name, Folder) IEnd = Input_Dict["i-stop"] IStep = Input_Dict["i-step"] Precision = opem.Functions.get_precision(IStep) diff --git a/opem/Functions.py b/opem/Functions.py index c32b8fd7..6309edc9 100644 --- a/opem/Functions.py +++ b/opem/Functions.py @@ -287,7 +287,7 @@ def Output_Save( print("###########") -def Output_Init(InputDict, Title, Name): +def Output_Init(InputDict, Title, Name, Folder): """ Initialize output file. @@ -295,15 +295,22 @@ def Output_Init(InputDict, Title, Name): :type InputDict:dict :param Title : simulation title :type Title :str + :param Name: file name + :type Name: str + :param Folder: output folder address + :type Folder: str :return: file object """ spliter = "\n" if 'win' not in sys.platform: spliter = "\r\n" Art = text2art("Opem") - if Title not in os.listdir(os.getcwd()): - os.mkdir(Title) - opem_file = open(os.path.join(Title, Name + ".opem"), "w") + if not os.path.exists(Folder): + os.makedirs(Folder) + sim_folder = os.path.join(Folder, Title) + if not os.path.exists(sim_folder): + os.mkdir(sim_folder) + opem_file = open(os.path.join(sim_folder, Name + ".opem"), "w") opem_file.write(Art) opem_file.write("Simulation Date : " + str(datetime.datetime.now()) + spliter) @@ -318,7 +325,7 @@ def Output_Init(InputDict, Title, Name): return opem_file -def CSV_Init(OutputParamsKeys, OutputParams, Title, Name): +def CSV_Init(OutputParamsKeys, OutputParams, Title, Name, Folder): """ Initialize csv file. @@ -326,11 +333,20 @@ def CSV_Init(OutputParamsKeys, OutputParams, Title, Name): :type OutputParamsKeys : list :param OutputParams : output parameters :type OutputParams : dict + :param Title : simulation title + :type Title :str + :param Name: file name + :type Name: str + :param Folder: output folder address + :type Folder: str :return: file object """ - if Title not in os.listdir(os.getcwd()): - os.mkdir(Title) - csv_file = open(os.path.join(Title, Name + ".csv"), "w") + if not os.path.exists(Folder): + os.makedirs(Folder) + sim_folder = os.path.join(Folder, Title) + if not os.path.exists(sim_folder): + os.mkdir(sim_folder) + csv_file = open(os.path.join(sim_folder, Name + ".csv"), "w") csv_file.write("I (A),") for index, item in enumerate(OutputParamsKeys): csv_file.write(item + " (" + OutputParams[item] + ")") @@ -353,7 +369,7 @@ def None_Omit(Input_Str): return result -def HTML_Init(Title, Name): +def HTML_Init(Title, Name, Folder): """ Initialize html file. @@ -361,13 +377,18 @@ def HTML_Init(Title, Name): :type Title : str :param Name: file name :type Name : str + :param Folder: output folder address + :type Folder: str :return: HTML file as file obj """ - if Title not in os.listdir(os.getcwd()): - os.mkdir(Title) + if not os.path.exists(Folder): + os.makedirs(Folder) + sim_folder = os.path.join(Folder, Title) + if not os.path.exists(sim_folder): + os.mkdir(sim_folder) HTMLFile = io.open( os.path.join( - Title, + sim_folder, Name + ".html"), "w", diff --git a/opem/Static/Amphlett.py b/opem/Static/Amphlett.py index a8f28de1..3d497644 100644 --- a/opem/Static/Amphlett.py +++ b/opem/Static/Amphlett.py @@ -440,7 +440,8 @@ def Static_Analysis( InputMethod=opem.Functions.Get_Input, TestMode=False, PrintMode=True, - ReportMode=True): + ReportMode=True, + Folder=os.getcwd()): """ Run Amphlett static analysis. @@ -452,6 +453,8 @@ def Static_Analysis( :type PrintMode:bool :param ReportMode : report mode control flag (True : generate report) :type ReportMode: bool + :param Folder: output folder address + :type Folder: str :return: result as dict """ OutputFile = None @@ -482,13 +485,14 @@ def Static_Analysis( Name = Input_Dict["Name"] if ReportMode: OutputFile = opem.Functions.Output_Init( - Input_Dict, Simulation_Title, Name) + Input_Dict, Simulation_Title, Name, Folder) CSVFile = opem.Functions.CSV_Init( OutputParamsKeys, OutputParams, Simulation_Title, - Name) - HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name) + Name, + Folder) + HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name, Folder) IEndMax = Input_Dict["JMax"] * Input_Dict["A"] IEnd = min(IEndMax, Input_Dict["i-stop"]) IStep = Input_Dict["i-step"] diff --git a/opem/Static/Chamberline_Kim.py b/opem/Static/Chamberline_Kim.py index 6f614091..2d6e20e2 100644 --- a/opem/Static/Chamberline_Kim.py +++ b/opem/Static/Chamberline_Kim.py @@ -44,7 +44,8 @@ def Static_Analysis( InputMethod=opem.Functions.Get_Input, TestMode=False, PrintMode=True, - ReportMode=True): + ReportMode=True, + Folder=os.getcwd()): """ Run Chamberline-Kim static analysis. @@ -56,6 +57,8 @@ def Static_Analysis( :type PrintMode:bool :param ReportMode : report mode control flag (True : generate report) :type ReportMode: bool + :param Folder: output folder address + :type Folder: str :return: result as dict """ OutputFile = None @@ -86,13 +89,14 @@ def Static_Analysis( Name = Input_Dict["Name"] if ReportMode: OutputFile = opem.Functions.Output_Init( - Input_Dict, Simulation_Title, Name) + Input_Dict, Simulation_Title, Name, Folder) CSVFile = opem.Functions.CSV_Init( OutputParamsKeys, OutputParams, Simulation_Title, - Name) - HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name) + Name, + Folder) + HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name, Folder) IEnd = Input_Dict["i-stop"] IStep = Input_Dict["i-step"] Precision = opem.Functions.get_precision(IStep) diff --git a/opem/Static/Larminie_Dicks.py b/opem/Static/Larminie_Dicks.py index c46ca0ed..6d393a11 100644 --- a/opem/Static/Larminie_Dicks.py +++ b/opem/Static/Larminie_Dicks.py @@ -45,7 +45,8 @@ def Static_Analysis( InputMethod=opem.Functions.Get_Input, TestMode=False, PrintMode=True, - ReportMode=True): + ReportMode=True, + Folder=os.getcwd()): """ Run Larminie-Dicks static analysis. @@ -57,6 +58,8 @@ def Static_Analysis( :type PrintMode:bool :param ReportMode : report mode control flag (True : generate report) :type ReportMode: bool + :param Folder: output folder address + :type Folder: str :return: Result as dict """ OutputFile = None @@ -86,13 +89,14 @@ def Static_Analysis( Name = Input_Dict["Name"] if ReportMode: OutputFile = opem.Functions.Output_Init( - Input_Dict, Simulation_Title, Name) + Input_Dict, Simulation_Title, Name, Folder) CSVFile = opem.Functions.CSV_Init( OutputParamsKeys, OutputParams, Simulation_Title, - Name) - HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name) + Name, + Folder) + HTMLFile = opem.Functions.HTML_Init(Simulation_Title, Name, Folder) IEnd = Input_Dict["i-stop"] IStep = Input_Dict["i-step"] Precision = opem.Functions.get_precision(IStep) diff --git a/opem/Test/test_Amphlett.py b/opem/Test/test_Amphlett.py index 999bd544..f4f1cc64 100644 --- a/opem/Test/test_Amphlett.py +++ b/opem/Test/test_Amphlett.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- ''' +>>> import os >>> from opem.Static.Amphlett import * >>> import random >>> import shutil @@ -682,6 +683,13 @@ Report is generating ... Warning : The value of I(>0) leads to minus amount of V, please check your inputs Done! +>>> sorted(os.listdir("Amphlett")) == ['test1.csv', 'test1.html', 'test1.opem'] +True +>>> Test_Vector={"T":3432222.15,"PH2":1,"PO2":1,"i-start":5,"i-stop":0,"i-step":-2,"A":50.6,"l":0.0178,"lambda":23,"N":1,"R":0,"JMax":1.5,"Name":"test2"} +>>> Amphlett_Data=Static_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=False,Folder=os.path.join(os.getcwd(), "Folder_Test")) +>>> sorted(os.listdir(os.path.join("Folder_Test", "Amphlett"))) == ['test2.csv', 'test2.html', 'test2.opem'] +True >>> shutil.rmtree("Amphlett") +>>> shutil.rmtree("Folder_Test") ''' diff --git a/opem/Test/test_Chakraborty.py b/opem/Test/test_Chakraborty.py index b4459895..1d2837e4 100644 --- a/opem/Test/test_Chakraborty.py +++ b/opem/Test/test_Chakraborty.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- ''' >>> from opem.Dynamic.Chakraborty import * +>>> import os >>> import shutil ->>> Test_Vector=Chakraborty_Standard_Vector = {"T": 1273,"E0": 0.6,"u":0.8,"N0": 1,"R": 3.28125 * 10**(-3),"KH2O": 0.000281,"KH2": 0.000843,"KO2": 0.00252,"rho": 1.145,"i-start": 245,"i-stop": 250,"i-step": 0.1,"Name": "Test"} +>>> Test_Vector=Chakraborty_Standard_Vector = {"T": 1273,"E0": 0.6,"u":0.8,"N0": 1,"R": 3.28125 * 10**(-3),"KH2O": 0.000281,"KH2": 0.000843,"KO2": 0.00252,"rho": 1.145,"i-start": 245,"i-stop": 250,"i-step": 0.1,"Name": "test1"} >>> Chakraborty_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Chakraborty-Model Simulation @@ -673,7 +674,7 @@ 0.3778677462887989 >>> Efficiency_Calc(0.7,None,1) [Error] PEM Efficiency Calculation Failed (Vcell:0.7, u:None, N:1) ->>> Test_Vector={"T": 1273,"E0": 0.6,"u":0.8,"N0": 1,"R": 3.28125 * 10**(-3),"KH2O": 0.000281,"KH2": 0.000843,"KO2": 0.00252,"rho": 1.145,"i-start": 250,"i-stop":249 ,"i-step": -0.1,"Name": "Test"} +>>> Test_Vector={"T": 1273,"E0": 0.6,"u":0.8,"N0": 1,"R": 3.28125 * 10**(-3),"KH2O": 0.000281,"KH2": 0.000843,"KO2": 0.00252,"rho": 1.145,"i-start": 250,"i-stop":249 ,"i-step": -0.1,"Name": "test1"} >>> Chakraborty_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Chakraborty-Model Simulation @@ -801,6 +802,13 @@ ########### Report is generating ... Done! +>>> sorted(os.listdir("Chakraborty")) == ['test1.csv', 'test1.html', 'test1.opem'] +True +>>> Test_Vector={"T": 1273,"E0": 0.6,"u":0.8,"N0": 1,"R": 3.28125 * 10**(-3),"KH2O": 0.000281,"KH2": 0.000843,"KO2": 0.00252,"rho": 1.145,"i-start": 250,"i-stop":249 ,"i-step": -0.1,"Name": "test2"} +>>> Chakraborty_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True, PrintMode=False, Folder=os.path.join(os.getcwd(), "Folder_Test")) +>>> sorted(os.listdir(os.path.join("Folder_Test", "Chakraborty"))) == ['test2.csv', 'test2.html', 'test2.opem'] +True >>> shutil.rmtree("Chakraborty") +>>> shutil.rmtree("Folder_Test") ''' diff --git a/opem/Test/test_Chamberline_Kim.py b/opem/Test/test_Chamberline_Kim.py index 047a52bb..3ea45804 100644 --- a/opem/Test/test_Chamberline_Kim.py +++ b/opem/Test/test_Chamberline_Kim.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- ''' +>>> import os >>> from opem.Static.Chamberline_Kim import * >>> import shutil >>> E0=0.982 @@ -16,7 +17,7 @@ >>> Chamberline_Data=Static_Analysis(InputMethod={}, TestMode=True,PrintMode=False) >>> Chamberline_Data["Status"] False ->>> Test_Vector={"A":50.0,"E0":0.982,"b":0.0689,"R":0.328,"m":0.000125,"n":9.45,"N":1,"i-start":1,"i-stop":4,"i-step":0.1,"Name":"test2"} +>>> Test_Vector={"A":50.0,"E0":0.982,"b":0.0689,"R":0.328,"m":0.000125,"n":9.45,"N":1,"i-start":1,"i-stop":4,"i-step":0.1,"Name":"test1"} >>> Chamberline_Kim_Data=Static_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Chamberline-Kim-Model Simulation @@ -282,7 +283,7 @@ -0.0372516118425709 >>> Chamberline_Kim_Data["VE"][5] 1.2138061679542624 ->>> Test_Vector={"A":50.0,"E0":-5,"b":0.0689,"R":0.328,"m":0.000125,"n":9.45,"N":1,"i-start":5,"i-stop":1,"i-step":-1,"Name":"test2"} +>>> Test_Vector={"A":50.0,"E0":-5,"b":0.0689,"R":0.328,"m":0.000125,"n":9.45,"N":1,"i-start":5,"i-stop":1,"i-step":-1,"Name":"test1"} >>> Chamberline_Kim_Data=Static_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Chamberline-Kim-Model Simulation @@ -323,6 +324,13 @@ Report is generating ... Warning : The value of I(>1) leads to minus amount of V, please check your inputs Done! +>>> sorted(os.listdir("Chamberline-Kim")) == ['test1.csv', 'test1.html', 'test1.opem'] +True +>>> Test_Vector={"A":50.0,"E0":-5,"b":0.0689,"R":0.328,"m":0.000125,"n":9.45,"N":1,"i-start":5,"i-stop":1,"i-step":-1,"Name":"test2"} +>>> Chamberline_Kim_Data=Static_Analysis(InputMethod=Test_Vector, TestMode=True, PrintMode=False, Folder=os.path.join(os.getcwd(), "Folder_Test")) +>>> sorted(os.listdir(os.path.join("Folder_Test", "Chamberline-Kim"))) == ['test2.csv', 'test2.html', 'test2.opem'] +True >>> shutil.rmtree("Chamberline-Kim") +>>> shutil.rmtree("Folder_Test") ''' diff --git a/opem/Test/test_Functions.py b/opem/Test/test_Functions.py index 4982c4fd..d9d06334 100644 --- a/opem/Test/test_Functions.py +++ b/opem/Test/test_Functions.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- ''' +>>> import os +>>> import shutil >>> from opem.Functions import * >>> data=[i for i in range(100)] >>> integrate(data,1) @@ -72,5 +74,26 @@ New Version (1.3) Is Available! Website : http://www.ecsim.ir/opem ########### +>>> file1 = CSV_Init(OutputParamsKeys=["1","2","3"], OutputParams={"1":"1", "2":"2", "3":"3"}, Title="CSV_Test", Name="CSV_Test", Folder=os.path.join("CSV_Folder1", "CSV_Folder2")) +>>> file2 = CSV_Init(OutputParamsKeys=["1","2","3"], OutputParams={"1":"1", "2":"2", "3":"3"}, Title="CSV_Test", Name="CSV_Test2", Folder=os.path.join("CSV_Folder1", "CSV_Folder2")) +>>> file1.close() +>>> file2.close() +>>> sorted(os.listdir(os.path.join("CSV_Folder1", "CSV_Folder2", "CSV_Test"))) == ["CSV_Test.csv", "CSV_Test2.csv"] +True +>>> file1 = HTML_Init(Title="HTML_Test", Name="HTML_Test", Folder=os.path.join("HTML_Folder1", "HTML_Folder2")) +>>> file2 = HTML_Init(Title="HTML_Test", Name="HTML_Test2", Folder=os.path.join("HTML_Folder1", "HTML_Folder2")) +>>> file1.close() +>>> file2.close() +>>> sorted(os.listdir(os.path.join("HTML_Folder1", "HTML_Folder2", "HTML_Test"))) == ["HTML_Test.html", "HTML_Test2.html"] +True +>>> file1 = Output_Init(InputDict={"1":"1"}, Title="OPEM_Test", Name="OPEM_Test", Folder=os.path.join("OPEM_Folder1", "OPEM_Folder2")) +>>> file2 = Output_Init(InputDict={"1":"1"}, Title="OPEM_Test", Name="OPEM_Test2", Folder=os.path.join("OPEM_Folder1", "OPEM_Folder2")) +>>> file1.close() +>>> file2.close() +>>> sorted(os.listdir(os.path.join("OPEM_Folder1", "OPEM_Folder2", "OPEM_Test"))) == ["OPEM_Test.opem", "OPEM_Test2.opem"] +True +>>> shutil.rmtree("CSV_Folder1") +>>> shutil.rmtree("HTML_Folder1") +>>> shutil.rmtree("OPEM_Folder1") ''' diff --git a/opem/Test/test_Larminie_Dicks.py b/opem/Test/test_Larminie_Dicks.py index dc787890..20e20f60 100644 --- a/opem/Test/test_Larminie_Dicks.py +++ b/opem/Test/test_Larminie_Dicks.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- ''' +>>> import os >>> from opem.Static.Larminie_Dicks import * >>> import shutil >>> E0=1.178 @@ -17,7 +18,7 @@ >>> Larminie_Dicks_Data=Static_Analysis(InputMethod={}, TestMode=True,PrintMode=False) >>> Larminie_Dicks_Data["Status"] False ->>> Test_Vector={"A":0.06,"T":328.15,"E0":1.178,"RM":0.0018,"i_0":0.00654,"i_L":100.0,"i_n":0.23,"N":23,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test3"} +>>> Test_Vector={"A":0.06,"T":328.15,"E0":1.178,"RM":0.0018,"i_0":0.00654,"i_L":100.0,"i_n":0.23,"N":23,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test1"} >>> Larminie_Dicks_Data=Static_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Larminie-Dicks-Model Simulation @@ -355,7 +356,7 @@ -0.8163936642494803 >>> Larminie_Dicks_Data["VE"][5] 20.333975212428435 ->>> Test_Vector={"A":0.06,"E0":-1.178,"T":328.15,"RM":0.0018,"i_0":0.00654,"i_L":100.0,"i_n":0.23,"N":23,"i-start":5,"i-stop":0.1,"i-step":-2,"Name":"test3"} +>>> Test_Vector={"A":0.06,"E0":-1.178,"T":328.15,"RM":0.0018,"i_0":0.00654,"i_L":100.0,"i_n":0.23,"N":23,"i-start":5,"i-stop":0.1,"i-step":-2,"Name":"test1"} >>> Larminie_Dicks_Data=Static_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Larminie-Dicks-Model Simulation @@ -388,6 +389,13 @@ Report is generating ... Warning : The value of I(>0.1) leads to minus amount of V, please check your inputs Done! +>>> sorted(os.listdir("Larminie-Dicks")) == ['test1.csv', 'test1.html', 'test1.opem'] +True +>>> Test_Vector={"A":0.06,"E0":-1.178,"T":328.15,"RM":0.0018,"i_0":0.00654,"i_L":100.0,"i_n":0.23,"N":23,"i-start":5,"i-stop":0.1,"i-step":-2,"Name":"test2"} +>>> Larminie_Dicks_Data=Static_Analysis(InputMethod=Test_Vector, TestMode=True, PrintMode=False, Folder=os.path.join(os.getcwd(), "Folder_Test")) +>>> sorted(os.listdir(os.path.join("Folder_Test", "Larminie-Dicks"))) == ['test2.csv', 'test2.html', 'test2.opem'] +True >>> shutil.rmtree("Larminie-Dicks") +>>> shutil.rmtree("Folder_Test") ''' diff --git a/opem/Test/test_Padulles1.py b/opem/Test/test_Padulles1.py index b98c4fbc..02b4558a 100644 --- a/opem/Test/test_Padulles1.py +++ b/opem/Test/test_Padulles1.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- ''' +>>> import os >>> from opem.Dynamic.Padulles1 import * >>> import shutil ->>> Test_Vector={"T":343,"E0":0.6,"N0":88,"KO2":0.0000211,"KH2":0.0000422,"tH2":3.37,"tO2":6.74,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":0,"i-stop":4,"i-step":0.1,"Name":"test3"} +>>> Test_Vector={"T":343,"E0":0.6,"N0":88,"KO2":0.0000211,"KH2":0.0000422,"tH2":3.37,"tO2":6.74,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":0,"i-stop":4,"i-step":0.1,"Name":"test1"} >>> Padulles_I_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-I-Model Simulation @@ -409,7 +410,7 @@ [Error] Kr Calculation Failed (N0:None) >>> qO2_Calc(qH2=2,rho=0) [Error] qO2 Calculation Error (qH2:2, rho:0) ->>> Test_Vector={"T":343,"E0":-0.6,"N0":88,"KO2":0.0000211,"KH2":0.0000422,"tH2":3.37,"tO2":6.74,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":4,"i-stop":0,"i-step":-2,"Name":"test3"} +>>> Test_Vector={"T":343,"E0":-0.6,"N0":88,"KO2":0.0000211,"KH2":0.0000422,"tH2":3.37,"tO2":6.74,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":4,"i-stop":0,"i-step":-2,"Name":"test1"} >>> Padulles_I_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-I-Model Simulation @@ -440,6 +441,16 @@ Warning : The value of I(>2) leads to minus amount of V, please check your inputs Warning : There are errors in the simulations in some of I amounts; please refer to the .opem file for review. If you are confident about this parameters, ignore this warning. Done! +>>> sorted(os.listdir("Padulles-I")) == ['test1.csv', 'test1.html', 'test1.opem'] +True +>>> Test_Vector={"T":343,"E0":-0.6,"N0":88,"KO2":0.0000211,"KH2":0.0000422,"tH2":3.37,"tO2":6.74,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":4,"i-stop":0,"i-step":-2,"Name":"test2"} +>>> Padulles_I_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True, PrintMode=False, Folder=os.path.join(os.getcwd(), "Folder_Test")) +[Error] Vcell Calculation Error (Enernst:-51.31149442586593, B:0.04777, C:0.0136, I:0, Rint:0.00303) +[Error] PEM Efficiency Calculation Failed (Vcell:None, N:88) +[Error] Power Calculation Error (Vcell:None, i:0) +>>> sorted(os.listdir(os.path.join("Folder_Test", "Padulles-I"))) == ['test2.csv', 'test2.html', 'test2.opem'] +True >>> shutil.rmtree("Padulles-I") +>>> shutil.rmtree("Folder_Test") ''' diff --git a/opem/Test/test_Padulles2.py b/opem/Test/test_Padulles2.py index f9bef593..5500ee0f 100644 --- a/opem/Test/test_Padulles2.py +++ b/opem/Test/test_Padulles2.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- ''' +>>> import os >>> from opem.Dynamic.Padulles2 import * >>> import shutil ->>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test3"} +>>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test1"} >>> Padulles_II_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-II-Model Simulation @@ -429,7 +430,7 @@ >>> Padulles_II_Data=Dynamic_Analysis(InputMethod={}, TestMode=True,PrintMode=False) >>> Padulles_II_Data["Status"] False ->>> Test_Vector={"T":343,"E0":-0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":4,"i-stop":0.1,"i-step":-2,"Name":"test3"} +>>> Test_Vector={"T":343,"E0":-0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":4,"i-stop":0.1,"i-step":-2,"Name":"test1"} >>> Padulles_II_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-II-Model Simulation @@ -458,6 +459,13 @@ Report is generating ... Warning : The value of I(>0.1) leads to minus amount of V, please check your inputs Done! +>>> sorted(os.listdir("Padulles-II")) == ['test1.csv', 'test1.html', 'test1.opem'] +True +>>> Test_Vector={"T":343,"E0":-0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qH2":0.0004,"i-start":4,"i-stop":0.1,"i-step":-2,"Name":"test2"} +>>> Padulles_II_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True, PrintMode=False, Folder=os.path.join(os.getcwd(), "Folder_Test")) +>>> sorted(os.listdir(os.path.join("Folder_Test", "Padulles-II"))) == ['test2.csv', 'test2.html', 'test2.opem'] +True >>> shutil.rmtree("Padulles-II") +>>> shutil.rmtree("Folder_Test") ''' diff --git a/opem/Test/test_Padulles_Amphlett.py b/opem/Test/test_Padulles_Amphlett.py index a5f004ff..add67845 100644 --- a/opem/Test/test_Padulles_Amphlett.py +++ b/opem/Test/test_Padulles_Amphlett.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- ''' +>>> import os >>> from opem.Dynamic.Padulles_Amphlett import * >>> import shutil ->>> Test_Vector={"A":50.6,"l":0.0178,"lambda":23,"JMax":1.5,"T":343,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"Test"} +>>> Test_Vector={"A":50.6,"l":0.0178,"lambda":23,"JMax":1.5,"T":343,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test1"} >>> Padulles_Amphlett_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-Amphlett-Model Simulation @@ -587,7 +588,7 @@ 2.9 >>> Vcell_Calc(Enernst=4.5, Loss=0.4, N=None) [Error] Vcell Calculation Error (Enernst:4.5, Loss:0.4, N:None) ->>> Test_Vector={"A":50.6,"l":0.0178,"lambda":23,"JMax":1.5,"T":2,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":5,"i-stop":0.1,"i-step":-2,"Name":"Test"} +>>> Test_Vector={"A":50.6,"l":0.0178,"lambda":23,"JMax":1.5,"T":2,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":5,"i-stop":0.1,"i-step":-2,"Name":"test1"} >>> Padulles_Amphlett_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-Amphlett-Model Simulation @@ -638,6 +639,13 @@ Report is generating ... Warning : The value of I(>0.1) leads to minus amount of V, please check your inputs Done! +>>> sorted(os.listdir("Padulles-Amphlett")) == ['test1.csv', 'test1.html', 'test1.opem'] +True +>>> Test_Vector={"A":50.6,"l":0.0178,"lambda":23,"JMax":1.5,"T":2,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":5,"i-stop":0.1,"i-step":-2,"Name":"test2"} +>>> Padulles_Amphlett_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True, PrintMode=False, Folder=os.path.join(os.getcwd(), "Folder_Test")) +>>> sorted(os.listdir(os.path.join("Folder_Test", "Padulles-Amphlett"))) == ['test2.csv', 'test2.html', 'test2.opem'] +True >>> shutil.rmtree("Padulles-Amphlett") +>>> shutil.rmtree("Folder_Test") ''' diff --git a/opem/Test/test_Padulles_Hauer.py b/opem/Test/test_Padulles_Hauer.py index fb6d34fc..c1c342dc 100644 --- a/opem/Test/test_Padulles_Hauer.py +++ b/opem/Test/test_Padulles_Hauer.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- ''' +>>> import os >>> from opem.Dynamic.Padulles_Hauer import * >>> import shutil ->>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test3"} +>>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test1"} >>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-Hauer-Model Simulation @@ -429,7 +430,7 @@ False >>> qH2_Calc(qMethanol=None,CV=2,t1=2,t2=2) [Error] qH2 Calculation Failed (qMethanol:None, CV:2, t1:2, t2:2) ->>> Test_Vector={"T":2,"E0":-0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":4,"i-stop":0.1,"i-step":-2,"Name":"test3"} +>>> Test_Vector={"T":2,"E0":-0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":4,"i-stop":0.1,"i-step":-2,"Name":"test1"} >>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-Hauer-Model Simulation @@ -458,6 +459,13 @@ Report is generating ... Warning : The value of I(>0.1) leads to minus amount of V, please check your inputs Done! +>>> sorted(os.listdir("Padulles-Hauer")) == ['test1.csv', 'test1.html', 'test1.opem'] +True +>>> Test_Vector={"T":2,"E0":-0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":4,"i-stop":0.1,"i-step":-2,"Name":"test2"} +>>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True, PrintMode=False, Folder=os.path.join(os.getcwd(), "Folder_Test")) +>>> sorted(os.listdir(os.path.join("Folder_Test", "Padulles-Hauer"))) == ['test2.csv', 'test2.html', 'test2.opem'] +True >>> shutil.rmtree("Padulles-Hauer") +>>> shutil.rmtree("Folder_Test") '''