|
[Sponsors] |
April 12, 2017, 05:56 |
JAVA for motion
|
#1 |
New Member
zkeng
Join Date: Mar 2017
Posts: 1
Rep Power: 0 |
Hello,
I am simulating the ship motion with rudder by using the DFBI. However, because of the DFBI, I can't monitor the rudder angle alone. So I need to write some java scripts. for example, some details are given as following: // STAR-CCM+ macro: tt.java // Written by STAR-CCM+ 11.04.010 package macro; import java.util.*; import star.common.*; import star.base.neo.*; public class tt extends StarMacro { public void execute() { execute0(); } private void execute0() { double Deltatime; double RudderSpeed; double RudAngle = 0.0; int i; Simulation simulation_0 = getActiveSimulation(); ImplicitUnsteadySolver implicitUnsteadySolver_0 = ((ImplicitUnsteadySolver) simulation_0.getSolverManager().getSolver(Implicit UnsteadySolver.class)); Deltatime = implicitUnsteadySolver_0.getTimeStep().getInternal Value(); for (i = 0; i < 300; i++) { ExpressionReport expressionReport_0 = (ExpressionReport) simulation_0.getReportManager().getReport("RudSpee d"); RudderSpeed = expressionReport_0.getValue(); RudderAngle = RudderAngle + RudderSpeed*Deltatime; ExpressionReport expressionReport_1 = (ExpressionReport) simulation_0.getReportManager().getReport("RudAngl e"); expressionReport_1.setDefinition("RudderAngle");//the problem is here } } } Before I write this java, I have created the report "RudSpeed" and "RudAngle". I want to use the loop with the equation (RudderAngle = RudderAngle + dt*RudderSpeed). Can you give me some suggestions? or Are there any other good ways to monitor the Rudder angle in the DFBI motion? Thank you for your help! |
|
April 12, 2017, 22:02 |
|
#2 |
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24 |
I'm confused as to what you're doing. There are reports built in that track angles of DFBI bodies.
You have a loop written in your code but it's not iterating over anything. Why do you need all this just to monitor the angle? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Java | sarahtuvia | STAR-CCM+ | 0 | March 31, 2016 11:42 |
Running salome-meca from a java script | Iche_Bins | Structural Mechanics | 0 | October 9, 2013 07:44 |
Macro to access java files in sub-directory | abraum | STAR-CCM+ | 3 | July 11, 2012 03:46 |
Getting OpenFOAM to coexist with an existing JAVA VM | nik777 | OpenFOAM Installation | 5 | February 22, 2007 08:21 |
java vs c++ | zxaar | Main CFD Forum | 10 | December 3, 2004 03:05 |