74 lines
1.2 KiB
Markdown
74 lines
1.2 KiB
Markdown
---
|
|
id:
|
|
aliases: []
|
|
tags:
|
|
- topic/automation
|
|
- topic/estimating
|
|
- topic/software
|
|
- type/idea
|
|
title: Assembly Objects
|
|
dg-publish: true
|
|
---
|
|
# Assembly Objects
|
|
|
|
```cs
|
|
public class GangableReceptacle : IGangableDevice, IUtilizationEquipment
|
|
{
|
|
public int Gangs { get; }
|
|
|
|
...
|
|
}
|
|
|
|
public class GangableSwitch : IGangableDevice
|
|
...
|
|
|
|
public class DeviceBox : IOutletBox
|
|
{
|
|
private List<IGangableDevice> _contents;
|
|
|
|
public void Add(IGangableDevice device)
|
|
{
|
|
_contents.Add(device);
|
|
}
|
|
|
|
public int GetGangs()
|
|
{
|
|
int gangs = 0;
|
|
foreach (device in _contents)
|
|
{
|
|
gangs += device.Gangs
|
|
}
|
|
return gangs
|
|
}
|
|
|
|
public List<Item> Resolve()
|
|
{
|
|
// Check content types and resolve by specifications
|
|
// or raise error if not possible
|
|
// (e.g. incompatible devices)
|
|
}
|
|
}
|
|
```
|
|
|
|
```yaml
|
|
- type: switchboard
|
|
parents: 1
|
|
children: 0..
|
|
primary-rating: amperes
|
|
|
|
- type: transfer-switch
|
|
parents: 2
|
|
children: 1
|
|
primary-rating: amperes
|
|
|
|
- type: transformer
|
|
parents: 1
|
|
children: 1..
|
|
primary-rating: volt-amperes
|
|
|
|
- type: generator
|
|
parents: 0
|
|
children: 1..
|
|
primary-rating: watts
|
|
```
|