Skip to content
Snippets Groups Projects
Commit 673aec29 authored by Tobias's avatar Tobias
Browse files

Merge branch 'merge'

parents 5abb09a0 7ba540cb
Branches
No related tags found
No related merge requests found
...@@ -56,7 +56,7 @@ namespace ControlComponents.Core ...@@ -56,7 +56,7 @@ namespace ControlComponents.Core
operationModes = opModes.ToDictionary(o => o.OpModeName); operationModes = opModes.ToDictionary(o => o.OpModeName);
if (orderOutputs.Any(o => o.Id != ComponentName)) if (orderOutputs.Any(o => o.OwnerId != ComponentName))
{ {
throw new ArgumentException($"Output Id must be {ComponentName}"); throw new ArgumentException($"Output Id must be {ComponentName}");
} }
...@@ -65,9 +65,9 @@ namespace ControlComponents.Core ...@@ -65,9 +65,9 @@ namespace ControlComponents.Core
public void AddOrderOutput(IOrderOutput newOrderOutput) public void AddOrderOutput(IOrderOutput newOrderOutput)
{ {
if (newOrderOutput.Id != ComponentName) if (newOrderOutput.OwnerId != ComponentName)
{ {
throw new ArgumentException($"Output Id must be {ComponentName} not {newOrderOutput.Id}"); throw new ArgumentException($"Output Id must be {ComponentName} not {newOrderOutput.OwnerId}");
} }
orderOutputs.Add(newOrderOutput.Role, newOrderOutput); orderOutputs.Add(newOrderOutput.Role, newOrderOutput);
......
...@@ -7,7 +7,7 @@ namespace ControlComponents.Core ...@@ -7,7 +7,7 @@ namespace ControlComponents.Core
{ {
OrderOutputError Error { get; } OrderOutputError Error { get; }
string Role { get; } string Role { get; }
string Id { get; } string OwnerId { get; }
bool IsSet { get; } bool IsSet { get; }
bool ChangeComponent(string id); bool ChangeComponent(string id);
......
...@@ -23,7 +23,7 @@ namespace ControlComponents.Core ...@@ -23,7 +23,7 @@ namespace ControlComponents.Core
protected T controlComponent { get; private set; } protected T controlComponent { get; private set; }
public string Role { get; } public string Role { get; }
public string Id { get; } public string OwnerId { get; }
public ExecutionState EXST => controlComponent.ReadProperty<ExecutionState>(Role, nameof(EXST)); public ExecutionState EXST => controlComponent.ReadProperty<ExecutionState>(Role, nameof(EXST));
public ExecutionMode EXMODE => controlComponent.ReadProperty<ExecutionMode>(Role, nameof(EXMODE)); public ExecutionMode EXMODE => controlComponent.ReadProperty<ExecutionMode>(Role, nameof(EXMODE));
...@@ -60,7 +60,7 @@ namespace ControlComponents.Core ...@@ -60,7 +60,7 @@ namespace ControlComponents.Core
public OrderOutputTemplate(string role, string id, IControlComponentProvider provider) public OrderOutputTemplate(string role, string id, IControlComponentProvider provider)
{ {
Role = role; Role = role;
Id = id; OwnerId = id;
_provider = provider; _provider = provider;
} }
...@@ -243,7 +243,7 @@ namespace ControlComponents.Core ...@@ -243,7 +243,7 @@ namespace ControlComponents.Core
public override int GetHashCode() public override int GetHashCode()
{ {
return (Role + Id).GetHashCode(); return (Role + OwnerId).GetHashCode();
} }
public void ClearOutput(string role) public void ClearOutput(string role)
......
...@@ -4,12 +4,24 @@ using ControlComponents.Core; ...@@ -4,12 +4,24 @@ using ControlComponents.Core;
namespace ControlComponents.ML namespace ControlComponents.ML
{ {
public class MLProviderOrderOutput : OrderOutput public class MLProviderOrderOutput : OrderOutput// , IMLControlComponent
{ {
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly IMLControlComponent cc; private readonly IMLControlComponent cc;
private Task _running = Task.CompletedTask; private Task _running = Task.CompletedTask;
// public ExecutionState MLSC { get => cc.MLSC; set => cc.MLSC = value; }
// public string MLMODEL => cc.MLMODEL;
// public float[] MLOBSERVE { get => cc.MLOBSERVE; set => cc.MLOBSERVE = value; }
// public bool[][] MLENACT { get => cc.MLENACT; set => cc.MLENACT = value; }
// public float[][] MLDECIDE { get => cc.MLDECIDE; set => cc.MLDECIDE = value; }
// public float MLREWARD { get => cc.MLREWARD; set => cc.MLREWARD = value; }
// public string MLSTATS { get => cc.MLSTATS; set => cc.MLSTATS = value; }
// public MLProperties MLProperties => cc.MLProperties;
public MLProviderOrderOutput(string role, string id, IControlComponentProvider provider, IMLControlComponent cc) : base(role, id, provider, cc) public MLProviderOrderOutput(string role, string id, IControlComponentProvider provider, IMLControlComponent cc) : base(role, id, provider, cc)
{ {
this.cc = cc; this.cc = cc;
...@@ -20,7 +32,7 @@ namespace ControlComponents.ML ...@@ -20,7 +32,7 @@ namespace ControlComponents.ML
if(_running.Status == TaskStatus.WaitingForActivation) if(_running.Status == TaskStatus.WaitingForActivation)
{ {
cc.MLREWARD = reward; cc.MLREWARD = reward;
await cc.StopAndWaitForStopped(Id); await cc.StopAndWaitForStopped(OwnerId);
await cc.DeselectOperationMode(); await cc.DeselectOperationMode();
} }
else else
...@@ -47,8 +59,8 @@ namespace ControlComponents.ML ...@@ -47,8 +59,8 @@ namespace ControlComponents.ML
cc.MLOBSERVE = observations; cc.MLOBSERVE = observations;
cc.MLENACT = MLControlComponent.ConvertToMLENACT(actionMask); cc.MLENACT = MLControlComponent.ConvertToMLENACT(actionMask);
await cc.ResetAndWaitForIdle(Id); await cc.ResetAndWaitForIdle(OwnerId);
await cc.StartAndWaitForExecute(Id); await cc.StartAndWaitForExecute(OwnerId);
// TODO TIME // TODO TIME
await cc.WaitForCompleted(10000); await cc.WaitForCompleted(10000);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment