workshop simulation assistant simulation assistant
play

Workshop: Simulation Assistant Simulation Assistant: Workshop Content - PowerPoint PPT Presentation

Workshop: Simulation Assistant Simulation Assistant: Workshop Content Java macros: simple demonstration Wizards: high-end Java Simulation Assistants as an end user: two examples Internal Flow Muffler aero-acoustics


  1. Workshop: Simulation Assistant

  2. Simulation Assistant: Workshop Content • Java macros: simple demonstration • Wizards: high-end Java • Simulation Assistants as an end user: two examples – Internal Flow – Muffler aero-acoustics • Simulation Assistants in detail • Edit and enhance an existing Simulation Assistant – Netbeans – Add a new scene to a Task

  3. What is a Simulation Assistant? • The Simulation Assistant – A tool to help guide users through STAR-CCM+ setup processes • Exposed as a side panel • Leverages the power of Java – A framework for Authors to replicate best practices and simulation workflows • The Simulation Assistant – Enhances user experience – Ensures repeatability of a process – Enforces consistency of results – Speeds up learning curve – Shortens time to productivity for • Users new to STAR-CCM+ or to CFD • Sophisticated and industry specific analysis workflows

  4. Why Simulation Assistant? • Simulation Assistant provide a visual workflow within STAR-CCM+ – A flexible approach allowing a scalable level of sophistication • Users – Designed to be a simple way of executing simulation steps without • Knowing STAR-CCM+ UI • Mastering the physics to analyse • Authors – Designed to be a simple way of executing simulation tasks without high levels of Java knowledge • Different to macros which are inherently procedural • Use event driven programming

  5. The Simulation Assistant • The Simulation Assistant appears in a new frame on the right hand side of the STAR-CCM+ window • The workflow is divided up into different steps – Each step may have a number of actions – Actions are used to execute operations within STAR-CCM+ • Single operation – e.g. change a value • Complex operations – e.g. setup a continuum • Swing operations – e.g. pop-up a new panel

  6. Where can I learn about …? • Examples – Three example Simulation Assistants are available for users • Documentation - Help – A dedicated section in the Help coves using and developing a Simulation Assistant – A tutorial is available showing the route to building the Internal Flow Assistant

  7. Launching a Simulation Assistant • The Simulation Assistant is loaded from the File menu – Java files that contain the structure of the Simulation Assistant – May be .java or compiled .jar files

  8. Main Components Tasks: • The major stages in your workflow • May be expanded or collapsed Steps: • Operations within a task • Typically presented as bullet points Sub-Tasks • May be expanded or collapsed within a task Actions: • Hyperlinks that execute a function

  9. Task Layout Information Tags • Clickable icons that expand • May be used to Pre & Post-Conditions: provide additional • Optional automatic information/ enabling/ disabling of instructions tasks • Ensures required actions are completed before moving forward Images • May be embedded in text • Can be used to execute actions

  10. Authoring a Simulation Assistant

  11. How do I Write an Assistant • The Simulation Assistant framework provides – A structure to execute actions in a logical and consistent manner • It can be thought of as executing a series of STAR-CCM+ java macros one by one – A documented API and consistent coding style • Provided with STAR-CCM+ are – Tutorial – Documentation – Example Assistants – Javadocs – NetBeans template

  12. The Structure of a Simulation Assistant Compiled Assistant Compiled bundles all project files project .jar in a single file that can be easily distributed The top level assistant Assistant is a placeholder for .java subsequent tasks Each task may contain Task .java a number of actions as well as sub-tasks If xhtml files are used, Text defined by XHTML, Text/Layout Stylesheet .css the style of text may be may be embedded in .xhtml defined by a stylesheet task or separate file

  13. Step 1 – Setting up an IDE • It is recommended to use the NetBeans IDE for developing Simulation Assistants – It can be downloaded from https://netbeans.org/ – The same IDE helps in writing STAR-CCM+ macros • Once downloaded install the STAR-CCM+ Simulation Assistant template – Go to Tools > Plugins > Downloaded > Add plugins – Point the plugin manager to nbm file available to download through the Steve portal – Accept the license terms and usage and continue

  14. Step 2 – Creating a Project • Each Simulation Assistant should be a separate NetBeans project – Go to file > New Project. The STAR-CCM+ template should be seen with the Simulation Assistant Project • Next choose the title, name, location and package/class details of your project

  15. Step 3 – Adding STAR-CCM+ Libraries • The final step in creating the Simulation Assistant project is adding the STAR-CCM+ libraries – If not already present, create a new library by choosing Manage Libraries… • Use Add JAR/Folder to add all the files in the lib, core, core\locale, modules, modules\ext & modules\locale sub-directories – These can be found in the STAR-CCM+ installation directory under lib/java/platorm • Important Note: – On Windows it’s recommended to install STAR-CCM+ in the top level of your hard drive or move the Java libraries from STAR-CCM+ into a separate location – If STAR-CCM+ is installed to the default location you project may not compile due to a bug in NetBeans

  16. Structure of the Top Level Assistant • When a simulation assistant project is created, the top level task is automatically created • The top level assistant.java simply references each of the subsequent tasks – The tasks are added to an ArrayList Name of the assistant displayed in STAR-CCM+ @StarAssistant(display =“Assistant Name") public final class AssistantClass extends SimulationAssistant { public AssistantClass () { List<Task> tasks = new ArrayList<Task>(); tasks.add(new Task1name ()); tasks.add(new Task2name ()); Assistant Tasks tasks.add(new Task3name ()); tasks.add(new Task4name ()); setOutline(tasks); } }

  17. Creating a Task • To create a new task, right click on the assistant package and choose “New > Simulation Assistant Task” • Choose the name and location of the task • Before creating the task you can also choose whether the xhtml is embedded in the task or an external file

  18. Structure of a Task • The main function of the task is to provide actions for the user – The actions themselves, generally take the form of snippets of java code used to perform STAR-CCM+ tasks i.e. sections of java macro – One task may contain many actions – Actions are exposed via XHTML Reference to the action, Name of the task displayed as a link displayed in STAR-CCM+ @StarAssistantTask(display = “ Task Name ", xhtml fragment contentFragment = "<ul><li><a href=\"staraction: action \"> action name </a></li></ul>", displayed in STAR-CCM+ controller = NewTask.NewTaskController.class) public class TaskName extends Task { Task class public class NewTaskController extends FunctionTaskController { referenced in the top level public void action () { java file Individual notifyUser("Example TaskController function."); action } containing code snippet } }

  19. Subtasks • May be created and are shown nested in another task – Each subtask is a new java file Task Expanded subtask Collapsed subtask • Added to a tasks by creating an ArrayList List<Task> subTasks = new ArrayList<Task>(); subTasks.add(new Task1A ()); subTasks.add(new Task1B ()); subTasks.add(new Task1C ()); setSubtasks(subTasks);

  20. Using Lookups • In many instances a client-server object (cso) such as a may be needed across multiple tasks – e.g. I choose a boundary in task 1 and then want to modify it in task 2 – To keep track of these hierarchical lookups are used • To add an object to the lookup list – addToTaskLookup(cso) • To retrieve objects – lookupObject(class) - returns the first object of that class from list – lookupObjects(class) – returns all objects of that class from list – getLookup() – returns the entire list – removeFromTaskLookup(cso) – removes a cso from the list – clearTaskLookup() – clears the entire list

  21. Expanding Nodes • To highlight the area where an action is working on or where the user should input values, it is possible to expand nodes in the tree • Two methods are available – selectAndExpandNode(ClientServerObject[] csos) • Selects the associated nodes in the tree and expands when not visible – selectNodeExclusive(ClientServerObject[] csos) • Selects the associated nodes in the tree and collapses all other branches

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend