Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
ea1c1a05
Commit
ea1c1a05
authored
Feb 13, 2018
by
Hafiz Muhammad Wahaj Aziz
Browse files
sampling time is now converted to milliseconds
refs 3281
parent
ccd64958
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.component.ui/trunk/src/org/fortiss/af3/component/ui/generator/FMUGeneratorExecutionTarget.java
View file @
ea1c1a05
...
...
@@ -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
=
1
000.0
/
lastSelectedFrequency
;
samplingTime
=
1
/
lastSelectedFrequency
;
}
final
double
toMilliseconds
=
1000.0
;
samplingTime
=
samplingTime
*
toMilliseconds
;
return
samplingTime
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment