From ad30e68a0d190b18287d025004978f5d2b33c024 Mon Sep 17 00:00:00 2001 From: chrpetre <108675940+chrpetre@users.noreply.github.com> Date: Fri, 23 Dec 2022 11:58:36 +0100 Subject: [PATCH] DOC: Minor changes (#51) --- doc/source/getting_started/index.rst | 2 +- doc/source/index.rst | 2 +- examples/evaluate/00-coupledClutches.py | 4 ++-- examples/evaluate/01-electricRange.py | 25 +++++++++++++------------ examples/evaluate/02-heatExchangerRS.py | 1 + examples/evaluate/03-scalarDROM.py | 3 +-- examples/evaluate/README.txt | 4 ++-- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/doc/source/getting_started/index.rst b/doc/source/getting_started/index.rst index 303aa05e..dcf83181 100644 --- a/doc/source/getting_started/index.rst +++ b/doc/source/getting_started/index.rst @@ -20,7 +20,7 @@ following environment variable that specifies the location of your Ansys License Twin Runtimes dependencies -------------------------- -The ``pytwin`` package allows users to easily execute deployment workflows based on ``.twin`` files generated by `Ansys Twin Builder `_, which are generally constituted based on several types of different models (system level models, ROMs, 3rd party FMUs,...). Each of these models may have specific runtime dependencies (e.g. Modelica models cross-compiled with Ansys Twin Deployer on Ubuntu 20.04 have a dependency on libgfortran5). When executing the Twin Runtimes through ``pytwin`` on a specific environment, it is therefore important that all the dependencies of the Twin Runtimes, including the ones of their constitutive models, are properly installed and made available in that environment. +The ``pytwin`` package allows users to easily execute deployment workflows based on ``.twin`` files generated by `Ansys Twin Builder `_, which are generally made up of several types of models (system level models, ROMs, 3rd party FMUs,...). Each of these models may have specific runtime dependencies (e.g. Modelica models cross-compiled with Ansys Twin Deployer on Ubuntu 20.04 have a dependency on libgfortran5). When executing the Twin Runtimes through ``pytwin`` on a specific environment, it is therefore important that all the dependencies of the Twin Runtimes, including the ones of their constitutive models, are properly installed and made available in that environment. Install the package ------------------- diff --git a/doc/source/index.rst b/doc/source/index.rst index 623f3787..3c781c2d 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -42,7 +42,7 @@ to programmatically interact with, and control the execution of Twin Runtimes. Features -------- -Some of the many features in the PyTwin package,, ``pytwin``, +Some of the many features in the PyTwin package, ``pytwin``, allow you to: - Use the Twin Runtimes Core SDK to build your own consumption workflows based on atomic API calls, see :ref:`ref_index_api_sdk` diff --git a/examples/evaluate/00-coupledClutches.py b/examples/evaluate/00-coupledClutches.py index d8df1ceb..d92168b8 100644 --- a/examples/evaluate/00-coupledClutches.py +++ b/examples/evaluate/00-coupledClutches.py @@ -131,9 +131,9 @@ def plot_result_comparison(step_by_step_results: pd.DataFrame, batch_results: pd data_index += 1 results_step_pd = pd.DataFrame(sim_output_list_step, columns=["Time"] + list(twin_model.outputs), dtype=float) -# ############################################################################## +############################################################################### # Batch simulation mode -# ~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Resetting/re-initializing the Twin and running it in batch mode (i.e. passing # all the input data, simulating all the data points, and collecting all # the outputs at once) diff --git a/examples/evaluate/01-electricRange.py b/examples/evaluate/01-electricRange.py index f6bd9a11..a2cb3661 100644 --- a/examples/evaluate/01-electricRange.py +++ b/examples/evaluate/01-electricRange.py @@ -31,18 +31,6 @@ twin_file = download_file("ElectricRange_23R1_other.twin", "twin_files") -############################################################################### -# User inputs -# ~~~~~~~~~~~~~~~~~~~~~~~~ -# Defining user inputs and simulation settings - -time_step = 1.0 -time_end = 24000.0 # simulating the model for 400 minutes -dp1 = {"ElectricRange_powerLoad": 2000.0, "ElectricRange_vehicleMass": 2000.0} -dp2 = {"ElectricRange_powerLoad": 3000.0, "ElectricRange_vehicleMass": 2000.0} -dp3 = {"ElectricRange_powerLoad": 2000.0, "ElectricRange_vehicleMass": 1500.0} -sweep = [dp1, dp2, dp3] - ############################################################################### # Auxiliary functions definition # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -108,6 +96,19 @@ def plot_result_comparison(results: list[pd.DataFrame], sweep: list[dict]): print("Loading model: {}".format(twin_file)) twin_model = TwinModel(twin_file) +############################################################################### +# User inputs +# ~~~~~~~~~~~~~~~~~~~~~~~~ +# Defining user inputs and simulation settings + +time_step = 1.0 +time_end = 24000.0 # simulating the model for 400 minutes +print("Twin parameters : {}".format(twin_model.parameters)) +dp1 = {"ElectricRange_powerLoad": 2000.0, "ElectricRange_vehicleMass": 2000.0} +dp2 = {"ElectricRange_powerLoad": 3000.0, "ElectricRange_vehicleMass": 2000.0} +dp3 = {"ElectricRange_powerLoad": 2000.0, "ElectricRange_vehicleMass": 1500.0} +sweep = [dp1, dp2, dp3] + ############################################################################### # Parametric sweep over the different design points # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/examples/evaluate/02-heatExchangerRS.py b/examples/evaluate/02-heatExchangerRS.py index 8a82a106..c318c3d0 100644 --- a/examples/evaluate/02-heatExchangerRS.py +++ b/examples/evaluate/02-heatExchangerRS.py @@ -97,6 +97,7 @@ def plot_result_comparison(results: pd.DataFrame): # Evaluating the Twin with different input values and collecting the corresponding outputs # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Since the Twin is based on a static model, 2 different options can be considered : +# # - setting the initial input value to evaluate and run the initialization function (current approach) # - create an input dataframe considering all the input values to evaluate and run the evaluate batch function # (in that case, a time dimension needs to be defined arbitrarily to execute the transient simulation) diff --git a/examples/evaluate/03-scalarDROM.py b/examples/evaluate/03-scalarDROM.py index 39a6c7c2..f9f587f7 100644 --- a/examples/evaluate/03-scalarDROM.py +++ b/examples/evaluate/03-scalarDROM.py @@ -146,8 +146,7 @@ def plot_result_comparison(step_by_step_results: pd.DataFrame, what_if: pd.DataF for column in twin_model_input_df.columns[1::]: inputs[column] = ( twin_model_input_df[column][data_index] * 0.9 - ) # the second Twin will be evaluated using same - # inputs reduced by 10% + ) # the second Twin will be evaluated using same inputs reduced by 10% twin_model_what_if.evaluate_step_by_step(step_size=step, inputs=inputs) outputs = [twin_model_what_if.evaluation_time] for item in twin_model_what_if.outputs: diff --git a/examples/evaluate/README.txt b/examples/evaluate/README.txt index b24791a7..752de044 100644 --- a/examples/evaluate/README.txt +++ b/examples/evaluate/README.txt @@ -6,5 +6,5 @@ These examples show how to use the evaluation workflow given a twin file. This i - parametric sweep of dynamic model, - parametric response surface ROM evaluation, - scalar dynamic ROM simulation with state saving and loading, -- field ROM evaluation and results visualization, -- field ROM evaluation and transfer of results as inputs for FEA calculation \ No newline at end of file +- field ROM evaluation and results visualization from the runtime and post processed in Fluent, +- field ROM evaluation and transfer of results as inputs for Mechanical stress analysis \ No newline at end of file