Simcenter STAR-CCM+ How to read values from xlsx using Apache POI and update the same in Simcenter STAR-CCM+?

2023-02-09T15:31:48.000-0500
Simcenter STAR-CCM+ Simcenter STAR-CCM+ Virtual Reality Teamcenter Share Simcenter STAR-CCM+ Viewer Simcenter STAR-CCM+ Application Specific Solutions

Summary

We may face a scenario where we may have to read certain values from excel sheet xlsx and update those in Simcenter STAR-CCM+. In this article we will be creating a macro where the coordinate values are read from xlsx and updated in Simcenter STAR-CCM+ coordinate system.


Details

Prerequisite: Apache POI libraries must be downloaded before creating this macro.
Download Apache POI libraries here

We will take an example to read three cell values from an excel sheet .xlsx and update the same in Simcenter STAR-CCM+ coordinate system.

Excel sheet values:


Update the additional library option in STAR-CCM+ so that it can read apache poi libraries:
Goto>>options>>Environment>>Expert>>User macro classpath

Step-1:
Copy all the jar files from \\poi-4.1.2\\lib
Copy all the jar files from \\poi-4.1.2\\ooxml-lib
Paste the above jar files into \\poi-4.1.2

Step-2:
The  image below shows the imports for getting file input, adding exceptions, apache libraries for reading excel cells, sheets, and STAR-CCM+ libraries. Users may need to add or remove imports based on their macro requirements.



Step-3:
To run this macro user need to specify the file path to .xlsx in the macro


Step-4:
Get row, and column values using XSSFCell class and convert them to double (so that the read value can be assigned in Simcenter STAR-CCM+)


Step-5:
Set the read values into Simcenter STAR-CCM+


Step-6:
Run the macro

Find attached excel sheet and macro file with this article for your reference.

KB Article ID# KB000045191_EN_US

Contents

SummaryDetails

Associated Components

Design Manager Electronics Cooling In-Cylinder (STAR-ICE) Job Manager Simcenter STAR-CCM+