-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
103 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package source; | ||
|
||
import util.Preferences; | ||
|
||
/** | ||
* One constant value function | ||
*/ | ||
public class Constant extends Source implements Runnable{ | ||
private double value; | ||
|
||
public Constant() { | ||
samplingTime = Preferences.samplingTime; | ||
simulationMode = Preferences.simulationMode; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
started = true; | ||
while (started){ | ||
output = value; | ||
delay(); | ||
} | ||
} | ||
|
||
public void delay(){ | ||
// The samplingTime of simulation is based in second, the sleep method is based in milliseconds | ||
try { | ||
Thread.sleep((long) ((samplingTime * simulationMode.factor)* 1000)); | ||
} catch (InterruptedException e) { | ||
started = false; | ||
} | ||
} | ||
|
||
public double getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(double value) { | ||
this.value = value; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/sources/PulseGenerator.java → src/main/java/source/PulseGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package sources; | ||
package source; | ||
|
||
/** | ||
* Function of Pulse | ||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/sources/Ramp.java → src/main/java/source/Ramp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package sources; | ||
package source; | ||
|
||
/** | ||
* Ramp Function | ||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/sources/Random.java → src/main/java/source/Random.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package sources; | ||
package source; | ||
|
||
/** | ||
* Function random | ||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/sources/SineWave.java → src/main/java/source/SineWave.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package sources; | ||
package source; | ||
|
||
/** | ||
* Created by marlon on 6/24/14. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package source; | ||
|
||
import util.Preferences; | ||
|
||
/** | ||
* Created by marlon on 6/24/14. | ||
*/ | ||
public class Source { | ||
protected double samplingTime; | ||
protected Preferences.SimulationMode simulationMode; | ||
protected double output; | ||
protected boolean started; | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/sources/Step.java → src/main/java/source/Step.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package sources; | ||
package source; | ||
|
||
/** | ||
* Step Function | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters