Commit ea1c1a05 authored by Hafiz Muhammad Wahaj Aziz's avatar Hafiz Muhammad Wahaj Aziz
Browse files

sampling time is now converted to milliseconds

refs 3281
parent ccd64958
......@@ -77,6 +77,7 @@ import org.fortiss.af3.project.extension.data.Executable;
* @author aravantinos
*/
public class FMUGeneratorExecutionTarget extends ExecutionTargetBase {
/** {@inheritDoc} */
@Override
public String getName() {
......@@ -102,7 +103,8 @@ public class FMUGeneratorExecutionTarget extends ExecutionTargetBase {
if(samplingTime == null) {
return;
}
fmuSource.setStepDuration(samplingTime);
System.out.print(samplingTime);
fmuSource.setStepDuration(samplingTime.doubleValue());
IResource targetFolder = openFolderDialog();
if(targetFolder == null) {
......@@ -168,6 +170,7 @@ public class FMUGeneratorExecutionTarget extends ExecutionTargetBase {
* Returns the sampling time from the user defined function (samplingTime) if correctly defined,
* otherwise asks from the user.
*/
@SuppressWarnings("null")
private Double getSamplingTime(DataDictionary dd) {
Shell currentShell = getWorkbench().getActiveWorkbenchWindow().getShell();
String message = "";
......@@ -197,6 +200,7 @@ public class FMUGeneratorExecutionTarget extends ExecutionTargetBase {
if(!(returnStatement.getValue() instanceof DoubleConst)) {
message += baseMsg + "return a constant value.";
} else {
// Multiplying with 1000 to convert time to milliseconds
samplingTime = ((DoubleConst)returnStatement.getValue()).getValue();
}
}
......@@ -220,8 +224,10 @@ public class FMUGeneratorExecutionTarget extends ExecutionTargetBase {
// Parsing should not throw any exception since the string went through NumberValidator
lastSelectedFrequency = Double.parseDouble(durationDlg.getValue());
// Multiplying with 1000 to convert time to milliseconds
samplingTime = 1000.0 / lastSelectedFrequency;
samplingTime = 1 / lastSelectedFrequency;
}
final double toMilliseconds = 1000.0;
samplingTime = samplingTime * toMilliseconds;
return samplingTime;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment