Skip to content

Commit

Permalink
Update SysML Import
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickRitchie committed Oct 29, 2023
1 parent 0ae6419 commit 595b061
Show file tree
Hide file tree
Showing 236 changed files with 271 additions and 251 deletions.
2 changes: 2 additions & 0 deletions build/MTConnect.NET-SysML-Import/CSharp/DataItemType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class DataItemType : MTConnectDataItemType, ITemplateModel
{
public string Namespace => NamespaceHelper.GetNamespace(Id);

public string DefaultName => Type.ToCamelCase();

public string UnitsEnum => Units != null ? $"Devices.{Units}" : null;

public string MaximumVersionEnum => MTConnectVersion.GetVersionEnum(MaximumVersion);
Expand Down
37 changes: 25 additions & 12 deletions src/MTConnect.NET-Common/Agents/MTConnectAgentBroker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,19 @@ private IDeviceStreamOutput CreateDeviceStream(IDevice device, ref IObservationB
var components = device.GetComponents();
var componentStreams = new List<IComponentStreamOutput>();

// Add ComponentStream for Device
var deviceComponentStream = new ComponentStreamOutput();
deviceComponentStream.ComponentId = device.Id;
deviceComponentStream.ComponentType = device.Type;
deviceComponentStream.Component = device;
deviceComponentStream.Name = device.Name;
deviceComponentStream.Uuid = device.Uuid;
deviceComponentStream.Observations = GetObservations(device.Uuid, ref dataItemResults, device.DataItems, mtconnectVersion);
if (deviceComponentStream.Observations != null && deviceComponentStream.Observations.Length > 0)
{
componentStreams.Add(deviceComponentStream);
}

if (!components.IsNullOrEmpty())
{
foreach (var component in components)
Expand Down Expand Up @@ -1113,18 +1126,18 @@ private IDeviceStreamOutput CreateDeviceStream(IDevice device, ref IObservationB
}
}

// Add ComponentStream for Device
var deviceComponentStream = new ComponentStreamOutput();
deviceComponentStream.ComponentId = device.Id;
deviceComponentStream.ComponentType = device.Type;
deviceComponentStream.Component = device;
deviceComponentStream.Name = device.Name;
deviceComponentStream.Uuid = device.Uuid;
deviceComponentStream.Observations = GetObservations(device.Uuid, ref dataItemResults, device.DataItems, mtconnectVersion);
if (deviceComponentStream.Observations != null && deviceComponentStream.Observations.Length > 0)
{
componentStreams.Add(deviceComponentStream);
}
//// Add ComponentStream for Device
//var deviceComponentStream = new ComponentStreamOutput();
//deviceComponentStream.ComponentId = device.Id;
//deviceComponentStream.ComponentType = device.Type;
//deviceComponentStream.Component = device;
//deviceComponentStream.Name = device.Name;
//deviceComponentStream.Uuid = device.Uuid;
//deviceComponentStream.Observations = GetObservations(device.Uuid, ref dataItemResults, device.DataItems, mtconnectVersion);
//if (deviceComponentStream.Observations != null && deviceComponentStream.Observations.Length > 0)
//{
// componentStreams.Add(deviceComponentStream);
//}

if (componentStreams.Count > 0)
{
Expand Down
17 changes: 11 additions & 6 deletions src/MTConnect.NET-Common/Devices/DataItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,19 @@ public static string CreateDataItemId(string parentId, string type, string subTy

public static string CreateId(string parentId, string name, string suffix)
{
if (!string.IsNullOrEmpty(suffix))
if (!string.IsNullOrEmpty(name))
{
return $"{parentId}_{name}_{suffix}";
}
else
{
return $"{parentId}_{name}";
if (!string.IsNullOrEmpty(suffix))
{
return $"{parentId}_{name}_{suffix}";
}
else
{
return $"{parentId}_{name}";
}
}

return null;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AccelerationDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "ACCELERATION";
public const string NameId = "";
public const string NameId = "acceleration";
public const string DefaultUnits = Devices.Units.MILLIMETER_PER_SECOND_SQUARED;
public new const string DescriptionText = "Positive rate of change of velocity.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AccumulatedTimeDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "ACCUMULATED_TIME";
public const string NameId = "";
public const string NameId = "accumulatedTime";
public const string DefaultUnits = Devices.Units.SECOND;
public new const string DescriptionText = "Accumulated time for an activity or event.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ActivationCountDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ACTIVATION_COUNT";
public const string NameId = "";
public const string NameId = "activationCount";

public new const string DescriptionText = "Accumulation of the number of times a function has attempted to, or is planned to attempt to, activate or be performed.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ActiveAxesDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ACTIVE_AXES";
public const string NameId = "";
public const string NameId = "activeAxes";

public new const string DescriptionText = "Set of axes currently associated with a Path or Controller.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ActuatorDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.CONDITION;
public const string TypeId = "ACTUATOR";
public const string NameId = "";
public const string NameId = "actuator";

public new const string DescriptionText = "Indication of a fault associated with an actuator.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ActuatorStateDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ACTUATOR_STATE";
public const string NameId = "";
public const string NameId = "actuatorState";

public new const string DescriptionText = "Operational state of an apparatus for moving or controlling a mechanism or system.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AdapterSoftwareVersionDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ADAPTER_SOFTWARE_VERSION";
public const string NameId = "";
public const string NameId = "adapterSoftwareVersion";

public new const string DescriptionText = "Originator’s software version of the adapter.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AdapterUriDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ADAPTER_URI";
public const string NameId = "";
public const string NameId = "adapterUri";

public new const string DescriptionText = "URI of the adapter.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AlarmDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ALARM";
public const string NameId = "";
public const string NameId = "alarm";

public new const string DescriptionText = "**DEPRECATED:** Replaced with `CONDITION` category data items in Version 1.1.0.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AlarmLimitDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ALARM_LIMIT";
public const string NameId = "";
public const string NameId = "alarmLimit";

public new const string DescriptionText = "Set of limits used to trigger warning or alarm indicators.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AmperageACDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "AMPERAGE_AC";
public const string NameId = "";
public const string NameId = "amperageAc";
public const string DefaultUnits = Devices.Units.AMPERE;
public new const string DescriptionText = "Electrical current that reverses direction at regular short intervals.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AmperageDCDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "AMPERAGE_DC";
public const string NameId = "";
public const string NameId = "amperageDc";
public const string DefaultUnits = Devices.Units.AMPERE;
public new const string DescriptionText = "Electric current flowing in one direction only.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AmperageDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "AMPERAGE";
public const string NameId = "";
public const string NameId = "amperage";

public new const string DescriptionText = "Strength of electrical current.**DEPRECATED** in *Version 1.6*. Replaced by `AMPERAGE_AC` and `AMPERAGE_DC`.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AngleDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "ANGLE";
public const string NameId = "";
public const string NameId = "angle";
public const string DefaultUnits = Devices.Units.DEGREE;
public new const string DescriptionText = "Angular position.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AngularAccelerationDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "ANGULAR_ACCELERATION";
public const string NameId = "";
public const string NameId = "angularAcceleration";
public const string DefaultUnits = Devices.Units.DEGREE_PER_SECOND_SQUARED;
public new const string DescriptionText = "Positive rate of change of angular velocity.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AngularDecelerationDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "ANGULAR_DECELERATION";
public const string NameId = "";
public const string NameId = "angularDeceleration";
public const string DefaultUnits = Devices.Units.DEGREE_PER_SECOND_SQUARED;
public new const string DescriptionText = "Negative rate of change of angular velocity.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AngularVelocityDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "ANGULAR_VELOCITY";
public const string NameId = "";
public const string NameId = "angularVelocity";
public const string DefaultUnits = Devices.Units.DEGREE_PER_SECOND;
public new const string DescriptionText = "Rate of change of angular position.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ApplicationDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "APPLICATION";
public const string NameId = "";
public const string NameId = "application";

public new const string DescriptionText = "Application on a Component.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AssetChangedDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ASSET_CHANGED";
public const string NameId = "";
public const string NameId = "assetChanged";

public new const string DescriptionText = "AssetId of the Asset that has been added or changed.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AssetCountDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ASSET_COUNT";
public const string NameId = "";
public const string NameId = "assetCount";

public new const string DescriptionText = "Data set of the number of Asset of a given type for a Device.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AssetRemovedDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "ASSET_REMOVED";
public const string NameId = "";
public const string NameId = "assetRemoved";

public new const string DescriptionText = "AssetId of the Asset that has been removed.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AssetUpdateRateDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "ASSET_UPDATE_RATE";
public const string NameId = "";
public const string NameId = "assetUpdateRate";
public const string DefaultUnits = Devices.Units.COUNT_PER_SECOND;
public new const string DescriptionText = "Average rate of change of values for assets in the MTConnect streams. The average is computed over a rolling window defined by the implementation.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AvailabilityDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "AVAILABILITY";
public const string NameId = "";
public const string NameId = "availability";

public new const string DescriptionText = "Agent's ability to communicate with the data source.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AxisCouplingDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "AXIS_COUPLING";
public const string NameId = "";
public const string NameId = "axisCoupling";

public new const string DescriptionText = "Describes the way the axes will be associated to each other. This is used in conjunction with `COUPLED_AXES` to indicate the way they are interacting.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AxisFeedrateDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "AXIS_FEEDRATE";
public const string NameId = "";
public const string NameId = "axisFeedrate";
public const string DefaultUnits = Devices.Units.MILLIMETER_PER_SECOND;
public new const string DescriptionText = "Feedrate of a linear axis.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AxisFeedrateOverrideDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "AXIS_FEEDRATE_OVERRIDE";
public const string NameId = "";
public const string NameId = "axisFeedrateOverride";

public new const string DescriptionText = "Value of a signal or calculation issued to adjust the feedrate of an individual linear type axis.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AxisInterlockDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "AXIS_INTERLOCK";
public const string NameId = "";
public const string NameId = "axisInterlock";

public new const string DescriptionText = "State of the axis lockout function when power has been removed and the axis is allowed to move freely.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AxisStateDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "AXIS_STATE";
public const string NameId = "";
public const string NameId = "axisState";

public new const string DescriptionText = "State of a Linear or Rotary component representing an axis.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class BatteryCapacityDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "BATTERY_CAPACITY";
public const string NameId = "";
public const string NameId = "batteryCapacity";
public const string DefaultUnits = Devices.Units.COULOMB;
public new const string DescriptionText = "Maximum rated charge a battery is capable of maintaining based on the battery discharging at a specified current over a specified time period.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class BatteryChargeDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "BATTERY_CHARGE";
public const string NameId = "";
public const string NameId = "batteryCharge";
public const string DefaultUnits = Devices.Units.PERCENT;
public new const string DescriptionText = "Value of the battery's present capacity expressed as a percentage of the battery's maximum rated capacity.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class BatteryStateDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "BATTERY_STATE";
public const string NameId = "";
public const string NameId = "batteryState";

public new const string DescriptionText = "Present status of the battery.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class BlockCountDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "BLOCK_COUNT";
public const string NameId = "";
public const string NameId = "blockCount";

public new const string DescriptionText = "Total count of the number of blocks of program code that have been executed since execution started.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class BlockDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.EVENT;
public const string TypeId = "BLOCK";
public const string NameId = "";
public const string NameId = "block";

public new const string DescriptionText = "Line of code or command being executed by a Controller entity.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class CapacityFluidDataItem : DataItem
{
public const DataItemCategory CategoryId = DataItemCategory.SAMPLE;
public const string TypeId = "CAPACITY_FLUID";
public const string NameId = "";
public const string NameId = "capacityFluid";
public const string DefaultUnits = Devices.Units.MILLILITER;
public new const string DescriptionText = "Fluid capacity of an object or container.";

Expand Down
Loading

0 comments on commit 595b061

Please sign in to comment.