generated from PHOENIXCONTACT/MORYX-Template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from PHOENIXCONTACT/feature/factoryAPIs
Prepare public APIs for factory modelling
- Loading branch information
Showing
14 changed files
with
357 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// Attribute for a visual representation of the current property inside the Factory monitor UI | ||
/// </summary> | ||
public class EntryVisualizationAttribute : Attribute | ||
{ | ||
public EntryVisualizationAttribute(string unit, string icon) | ||
{ | ||
Unit = unit; | ||
Icon = icon; | ||
} | ||
|
||
/// <summary> | ||
/// Unit of the value for the current property (Ex. Kw/h) | ||
/// </summary> | ||
public string Unit { get; } | ||
|
||
/// <summary> | ||
/// Icon to display for this property inside the Factory Monitor UI | ||
/// </summary> | ||
public string Icon { get; } | ||
} | ||
} |
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,35 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System.Collections.Generic; | ||
using System.Collections.Specialized; | ||
using Moryx.AbstractionLayer.Resources; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// Location inside the factory | ||
/// </summary> | ||
public interface ILocation : IResource | ||
{ | ||
/// <summary> | ||
/// Image of the location | ||
/// </summary> | ||
string Image { get; set; } | ||
|
||
/// <summary> | ||
/// Position of the location | ||
/// </summary> | ||
Position Position { get; set; } | ||
|
||
/// <summary> | ||
/// Transport paths that are going out of this location | ||
/// </summary> | ||
IEnumerable<ITransportPath> Origins { get; } | ||
|
||
/// <summary> | ||
/// Transport paths that are coming to this location | ||
/// </summary> | ||
IEnumerable<ITransportPath> Destinations { get; } | ||
} | ||
} |
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,18 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using Moryx.AbstractionLayer.Resources; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// Group of resources inside the factory | ||
/// </summary> | ||
public interface IMachineGroup : IPublicResource | ||
{ | ||
/// <summary> | ||
/// Default icon for this resource group | ||
/// </summary> | ||
string DefaultIcon { get; set; } | ||
} | ||
} |
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,23 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using Moryx.AbstractionLayer.Resources; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// A resource/machine location inside the factory | ||
/// </summary> | ||
public interface IMachineLocation : ILocation, IPublicResource | ||
{ | ||
/// <summary> | ||
/// Resource/Machine at this location | ||
/// </summary> | ||
IPublicResource Machine { get; } | ||
|
||
/// <summary> | ||
/// Icon for the machine at this location | ||
/// </summary> | ||
string SpecificIcon { get; set; } | ||
} | ||
} |
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,18 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using Moryx.AbstractionLayer.Resources; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// A manufacturing factory interface | ||
/// </summary> | ||
public interface IManufacturingFactory : IPublicResource | ||
{ | ||
/// <summary> | ||
/// Background URL of the factory monitor | ||
/// </summary> | ||
string BackgroundUrl { get; set; } | ||
} | ||
} |
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,29 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System.Collections.Generic; | ||
using Moryx.AbstractionLayer.Resources; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// A transport path inside a factory | ||
/// </summary> | ||
public interface ITransportPath : IResource | ||
{ | ||
/// <summary> | ||
/// Origin of the transport path | ||
/// </summary> | ||
ILocation Origin { get; } | ||
|
||
/// <summary> | ||
/// Destination of the transport path | ||
/// </summary> | ||
ILocation Destination { get; } | ||
|
||
/// <summary> | ||
/// Trajectory to follow from origin to reach the destination | ||
/// </summary> | ||
List<Position> WayPoints { get; set; } | ||
} | ||
} |
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,19 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using Moryx.AbstractionLayer.Resources; | ||
using Moryx.Serialization; | ||
using System.ComponentModel; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// Class for all machine groups in manufacturing factory | ||
/// </summary> | ||
public class MachineGroup : PublicResource, IMachineGroup | ||
{ | ||
[DataMember, EntrySerialize, DefaultValue("settings")] | ||
public string DefaultIcon { get; set; } | ||
} | ||
} |
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,58 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using Moryx.AbstractionLayer.Resources; | ||
using Moryx.ControlSystem.Cells; | ||
using Moryx.Serialization; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// Class for MachineLocation in the factory | ||
/// </summary> | ||
public class MachineLocation : PublicResource, IMachineLocation | ||
{ | ||
public IPublicResource Machine => Children.OfType<ICell>().FirstOrDefault(); | ||
|
||
[DataMember, EntrySerialize] | ||
public string SpecificIcon { get; set; } | ||
|
||
[DataMember, EntrySerialize] | ||
public string Image { get; set; } | ||
|
||
/// <summary> | ||
/// X position of the location | ||
/// </summary> | ||
[DataMember, EntrySerialize, DefaultValue(10)] | ||
public double PositionX { get; set; } | ||
|
||
/// <summary> | ||
/// Y position of the location | ||
/// </summary> | ||
[DataMember, EntrySerialize, DefaultValue(10)] | ||
public double PositionY { get; set; } | ||
|
||
public Position Position | ||
{ | ||
get => new() { PositionX = PositionX, PositionY = PositionY }; | ||
set | ||
{ | ||
PositionX = value.PositionX; | ||
PositionY = value.PositionY; | ||
} | ||
} | ||
|
||
[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Source)] | ||
public IReferences<ITransportPath> Origins { get; set; } | ||
|
||
[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Target)] | ||
public IReferences<ITransportPath> Destinations { get; set; } | ||
|
||
IEnumerable<ITransportPath> ILocation.Origins => Origins; | ||
IEnumerable<ITransportPath> ILocation.Destinations => Destinations; | ||
} | ||
} |
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,17 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System.ComponentModel; | ||
using System.Runtime.Serialization; | ||
using Moryx.AbstractionLayer.Resources; | ||
|
||
using Moryx.Serialization; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
public class ManufacturingFactory : PublicResource, IManufacturingFactory | ||
{ | ||
[DataMember, EntrySerialize, DefaultValue("assets/Fabrik_Hintergrund.png"), Description("URL of the background picture of the Factory Monitor")] | ||
public string BackgroundUrl { get; set; } | ||
} | ||
} |
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,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Moryx.AbstractionLayer" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Moryx.ControlSystem\Moryx.ControlSystem.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,20 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System.Runtime.Serialization; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// Position of a resource/machine | ||
/// </summary> | ||
[DataContract] | ||
public class Position | ||
{ | ||
[DataMember] | ||
public double PositionX { get; set; } | ||
|
||
[DataMember] | ||
public double PositionY { get; set; } | ||
} | ||
} |
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,39 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
using Moryx.AbstractionLayer.Resources; | ||
using Moryx.Serialization; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// Point where the direction changes in a transport path. | ||
/// </summary> | ||
public class SwitchPoint : Resource, ILocation | ||
{ | ||
|
||
[DataMember, EntrySerialize] | ||
public double PositionX { get; set; } | ||
|
||
[DataMember, EntrySerialize] | ||
public double PositionY { get; set; } | ||
|
||
public Position Position | ||
{ | ||
get => new() { PositionX = PositionX, PositionY = PositionY }; | ||
set | ||
{ | ||
PositionX = value.PositionX; | ||
PositionY = value.PositionY; | ||
} | ||
} | ||
|
||
public IEnumerable<ITransportPath> Origins { get; set; } | ||
|
||
public IEnumerable<ITransportPath> Destinations { get; set; } | ||
|
||
public string Image { get; set; } | ||
} | ||
} |
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,26 @@ | ||
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG | ||
// Licensed under the Apache License, Version 2.0 | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
using Moryx.AbstractionLayer.Resources; | ||
using Moryx.Serialization; | ||
|
||
namespace Moryx.Factory | ||
{ | ||
/// <summary> | ||
/// Transport path in a factory | ||
/// </summary> | ||
public class TransportPath : Resource, ITransportPath | ||
{ | ||
[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Source)] | ||
public ILocation Origin { get; set; } | ||
|
||
[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Target)] | ||
public ILocation Destination { get; set; } | ||
|
||
[DataMember, EntrySerialize] | ||
public List<Position> WayPoints { get; set; } = new List<Position>(); | ||
} | ||
} |