Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare public APIs for factory modelling #41

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions MoryxFactory.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29215.179
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.ControlSystem", "src\Moryx.ControlSystem\Moryx.ControlSystem.csproj", "{DF4730D4-5DB2-46A5-9F2B-C7B22E61268B}"
EndProject
Expand All @@ -28,6 +28,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.ProcessData", "src\Mo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.ProcessData.Tests", "src\Tests\Moryx.ProcessData.Tests\Moryx.ProcessData.Tests.csproj", "{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.Factory", "src\Moryx.Factory\Moryx.Factory.csproj", "{4B1C8062-EF37-4880-AFDF-2C3CCEE3A848}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.Simulation", "src\Moryx.Simulation\Moryx.Simulation.csproj", "{23B4A0C7-6F13-4FBB-998C-CD56DCF6D775}"
EndProject
Global
Expand Down Expand Up @@ -60,6 +62,10 @@ Global
{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}.Release|Any CPU.Build.0 = Release|Any CPU
{4B1C8062-EF37-4880-AFDF-2C3CCEE3A848}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B1C8062-EF37-4880-AFDF-2C3CCEE3A848}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B1C8062-EF37-4880-AFDF-2C3CCEE3A848}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B1C8062-EF37-4880-AFDF-2C3CCEE3A848}.Release|Any CPU.Build.0 = Release|Any CPU
{23B4A0C7-6F13-4FBB-998C-CD56DCF6D775}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23B4A0C7-6F13-4FBB-998C-CD56DCF6D775}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23B4A0C7-6F13-4FBB-998C-CD56DCF6D775}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
31 changes: 31 additions & 0 deletions src/Moryx.Factory/EntryVisualizationAttribute.cs
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; }
}
}
35 changes: 35 additions & 0 deletions src/Moryx.Factory/ILocation.cs
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; }
}
}
18 changes: 18 additions & 0 deletions src/Moryx.Factory/IMachineGroup.cs
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; }
}
}
23 changes: 23 additions & 0 deletions src/Moryx.Factory/IMachineLocation.cs
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; }
}
}
18 changes: 18 additions & 0 deletions src/Moryx.Factory/IManufacturingFactory.cs
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; }
}
}
29 changes: 29 additions & 0 deletions src/Moryx.Factory/ITransportPath.cs
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; }
}
}
19 changes: 19 additions & 0 deletions src/Moryx.Factory/MachineGroup.cs
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; }

Check warning on line 17 in src/Moryx.Factory/MachineGroup.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'DefaultIcon' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
}
58 changes: 58 additions & 0 deletions src/Moryx.Factory/MachineLocation.cs
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; }

Check warning on line 22 in src/Moryx.Factory/MachineLocation.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'SpecificIcon' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[DataMember, EntrySerialize]
public string Image { get; set; }

Check warning on line 25 in src/Moryx.Factory/MachineLocation.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'Image' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <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;
}
}
17 changes: 17 additions & 0 deletions src/Moryx.Factory/ManufacturingFactory.cs
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; }

Check warning on line 15 in src/Moryx.Factory/ManufacturingFactory.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'BackgroundUrl' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
}
16 changes: 16 additions & 0 deletions src/Moryx.Factory/Moryx.Factory.csproj
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>
20 changes: 20 additions & 0 deletions src/Moryx.Factory/Position.cs
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; }
}
}
39 changes: 39 additions & 0 deletions src/Moryx.Factory/SwitchPoint.cs
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; }

Check warning on line 33 in src/Moryx.Factory/SwitchPoint.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'Origins' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public IEnumerable<ITransportPath> Destinations { get; set; }

Check warning on line 35 in src/Moryx.Factory/SwitchPoint.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'Destinations' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public string Image { get; set; }

Check warning on line 37 in src/Moryx.Factory/SwitchPoint.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'Image' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
}
26 changes: 26 additions & 0 deletions src/Moryx.Factory/TransportPath.cs
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; }

Check warning on line 18 in src/Moryx.Factory/TransportPath.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'Origin' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Target)]
public ILocation Destination { get; set; }

Check warning on line 21 in src/Moryx.Factory/TransportPath.cs

View workflow job for this annotation

GitHub Actions / Build / Build

Non-nullable property 'Destination' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[DataMember, EntrySerialize]
public List<Position> WayPoints { get; set; } = new List<Position>();
}
}
Loading