-
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
141 changed files
with
502 additions
and
516 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
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 |
---|---|---|
@@ -1,17 +1,12 @@ | ||
namespace InfrastSim; | ||
public struct NamedValue { | ||
public string Name; | ||
public double Value; | ||
public struct NamedValue(string name, int value) { | ||
public string Name = name ?? throw new ArgumentNullException(nameof(name)); | ||
public int Value = value; | ||
|
||
public NamedValue(string name, double value) { | ||
Name = name ?? throw new ArgumentNullException(nameof(name)); | ||
Value = value; | ||
} | ||
|
||
public static implicit operator NamedValue(double value) { | ||
public static implicit operator NamedValue(int value) { | ||
return new("common", value); | ||
} | ||
public static implicit operator double(NamedValue value) { | ||
public static implicit operator int(NamedValue value) { | ||
return value.Value; | ||
} | ||
} |
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,15 @@ | ||
namespace InfrastSim; | ||
internal static class TicksHelper { | ||
public const long TimeSpanTicksPerTick = 100000L; | ||
public const int TicksPerSecond = 100; | ||
public const int TicksPerMinute = TicksPerSecond * 60; | ||
public const int TicksPerHours = TicksPerMinute * 24; | ||
public const int TicksPerDrone = TicksPerMinute * 3; // 3 minute | ||
public const int TicksToProduceDrone = TicksPerMinute * 6; // 6 minute | ||
public const int TicksToProducerefresh = TicksPerHours * 12; // 12 hours | ||
|
||
public static int ToSimuTicks(this TimeSpan ts) => (int)(ts.Ticks / TimeSpanTicksPerTick); | ||
public static int TotalSeconds(this TimeSpan ts) => (int)(ts.Ticks / TimeSpan.TicksPerSecond); | ||
public static int HoursNotExceed(this TimeSpan ts, int n) => Math.Min(n, (int)(ts.Ticks / TimeSpan.TicksPerHour)); | ||
public static TimeSpan SimuTicksToTimeSpan(this int simuTicks) => TimeSpan.FromTicks(simuTicks * TimeSpanTicksPerTick); | ||
} |
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
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
Oops, something went wrong.