CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

JAVA for motion

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 12, 2017, 05:56
Default JAVA for motion
  #1
New Member
 
zkeng
Join Date: Mar 2017
Posts: 1
Rep Power: 0
zengke is on a distinguished road
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!
zengke is offline   Reply With Quote

Old   April 12, 2017, 22:02
Default
  #2
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
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?
me3840 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 22:04.