March 28, 2018
NX CAE Integration in pSeven
While solving multidisciplinary optimization problems, it is often necessary to integrate different CAD and CAE software into the workflow. In one of our previous demo videos, we explained how to integrate CAD and CAE software in pSeven using a general approach to ensure seamless interaction of modeling, simulation and design space exploration tools. NX™ software products are no exception. In this tech tip, we describe the integration process of NX CAE (Simcenter 3D) simulations into pSeven workflow.
Workflow with integrated NX CAD and NX CAE models
pSeven offers a special block for direct integration of NX CAD models to solve design optimization and data analysis problems. Briefly, the block maps model parameters to input and output ports, so they can be changed in run-time by receiving data from other blocks. On each change of input parameters, the block starts a new NX process to rebuild the CAD model.
At the moment, NX direct integration block does not support NX CAE API, but in order to give our users the full access to NX capabilities, we prepared this step-by-step instruction describing how to achieve it using the general approach.
NX CAE distribution includes a run_journal executable that allows running solver in batch mode:
Therefore, NX CAE can be easily integrated into pSeven by using Program block.
NX CAE integration with a Program block
Journal file journal.py is written in Python and contains instructions that will be carried out successively by run_journal.exe. There are two possibilities to prepare this journal file. One can program journal.py manually from scratch by writing necessary commands. Documentation can be found here (but it’s better to use C++ reference since Python reference is incomplete). Another way is to generate this journal file automatically by using GUI of NX CAE. The main steps of this approach are summarized in the figure below, which is followed by the step-by-step guide.
Main steps for interaction with NX CAE before integrating it with pSeven (using NX CAE 11.0 as an example)
Step 1. Run NX CAE
Step 2. Setup Python language for Journal Language
2.1. Click File => Preferences => User Interface (Fig.1)
2.2. Click Tools => Journal in “User Interface Preferences” window and select Python (Fig.2)
Step 3. Add Developer panel: Click on the right mouse button and choose Developer (Fig.3)
Step 4. Start Recording: click on Record button (Fig.4) and specify path and name for journal file (Fig.5)
Step 5. Open model and do all the necessary operations, which will have to be repeated in batch mode. For example, open *.sim model, load *.prt model, update mesh, change parameters of the model, setup saving results to output files and run solver.
Note: make sure that the corresponding commands are activated:
a) “Activate Meshing” to update mesh (Fig.6);
b) “Activate Simulation” before changing parameters of simulation solver and run it for analysis (Fig.7).
Step 6. Close model
Step 7. Stop recording (Fig.8)
Step 8. Before using the generated journal.py file in batch mode, some manual modifications of this file are needed.
1) Change the absolute path to *.sim and *.prt files into the relative path, because all these files along with journal.py will be placed in the same sandbox.
2) Find section “Dialog Begin Solve” and comment the call of SolveChainOfSolutions method of object theSimSolveManager (194 row in Fig.9). Instead, add the following commands (Fig.10), which run simulation analysis in Foreground and do not allow opening various windows with solution process check.
Step 9. Run journal in cmd:
> run_journal.exe journal.py
Note: If you plan to use NX CAE along with NX CAD, be careful of that if an error occurred in CAD block and empty file was sent to directory where NX CAE is to be executed, NX CAE will run analysis with the *.prt model stored with *.sim model instead of raising an exception. Learn more about error handling functionality provided by pSeven.
By Dinara Shvarts, Application Engineer, DATADVANCE