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

Merge branch 'merge'

parents 5abb09a0 7ba540cb
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,7 @@ namespace ControlComponents.Core
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}");
}
......@@ -65,9 +65,9 @@ namespace ControlComponents.Core
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);
......
......@@ -7,7 +7,7 @@ namespace ControlComponents.Core
{
OrderOutputError Error { get; }
string Role { get; }
string Id { get; }
string OwnerId { get; }
bool IsSet { get; }
bool ChangeComponent(string id);
......
......@@ -23,7 +23,7 @@ namespace ControlComponents.Core
protected T controlComponent { get; private set; }
public string Role { get; }
public string Id { get; }
public string OwnerId { get; }
public ExecutionState EXST => controlComponent.ReadProperty<ExecutionState>(Role, nameof(EXST));
public ExecutionMode EXMODE => controlComponent.ReadProperty<ExecutionMode>(Role, nameof(EXMODE));
......@@ -60,7 +60,7 @@ namespace ControlComponents.Core
public OrderOutputTemplate(string role, string id, IControlComponentProvider provider)
{
Role = role;
Id = id;
OwnerId = id;
_provider = provider;
}
......@@ -243,7 +243,7 @@ namespace ControlComponents.Core
public override int GetHashCode()
{
return (Role + Id).GetHashCode();
return (Role + OwnerId).GetHashCode();
}
public void ClearOutput(string role)
......
......@@ -4,12 +4,24 @@ using ControlComponents.Core;
namespace ControlComponents.ML
{
public class MLProviderOrderOutput : OrderOutput
public class MLProviderOrderOutput : OrderOutput// , IMLControlComponent
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly IMLControlComponent cc;
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)
{
this.cc = cc;
......@@ -20,7 +32,7 @@ namespace ControlComponents.ML
if(_running.Status == TaskStatus.WaitingForActivation)
{
cc.MLREWARD = reward;
await cc.StopAndWaitForStopped(Id);
await cc.StopAndWaitForStopped(OwnerId);
await cc.DeselectOperationMode();
}
else
......@@ -47,8 +59,8 @@ namespace ControlComponents.ML
cc.MLOBSERVE = observations;
cc.MLENACT = MLControlComponent.ConvertToMLENACT(actionMask);
await cc.ResetAndWaitForIdle(Id);
await cc.StartAndWaitForExecute(Id);
await cc.ResetAndWaitForIdle(OwnerId);
await cc.StartAndWaitForExecute(OwnerId);
// TODO TIME
await cc.WaitForCompleted(10000);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment