Skip to content

Commit dcf79cc

Browse files
authored
Merge pull request #110 from BlockScience/hammer
Hammer
2 parents 50c9a3c + 2eb9bc3 commit dcf79cc

File tree

8 files changed

+182
-39
lines changed

8 files changed

+182
-39
lines changed

docs/Canonical Examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Canonical Examples
3-
nav_order: 4
3+
nav_order: 6
44
layout: default
55
---
66

docs/Clients.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Clients
3+
nav_order: 5
4+
layout: default
5+
---
6+
7+
The following are the current clients which implement the block diagram protocol in different languages. They can be thought of as back ends for processing block diagrams but they also have some basic functionality for working with block diagrams in enviroments such as jupyter notebooks.
8+
9+
1. [pybdp](https://github.com/BlockScience/pybdp): The python implementation
10+
2. Typescript implementation: Will be coming out soon

docs/FrontEnds.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Front-ends
3+
nav_order: 5
4+
layout: default
5+
---
6+
7+
There are front-ends which help creating block diagrams by giving users GUIs and other interfaces to play with the block diagrams. Below are the current front-ends.
8+
9+
1. [BDP Front-end](https://github.com/BlockScience/bdp-frontend): A work-in-progress front end which utilizes react and typescript

docs/Glossary/Workbench.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,24 @@ And the children schemas are as follows below.
3333

3434
```
3535
object {
36-
ID: string (required)
37-
Name: string (required)
38-
Description: string
39-
Parent: string (required)
40-
Ports: array[string]
41-
Terminals: array[string] (required)
42-
Subsystem: object {
43-
System ID: string (required)
44-
Wires: array[string] (required)
45-
}
36+
ID: string (required)
37+
Name: string (required)
38+
Description: string
39+
Parent: string (required)
40+
Ports: array[string] (required)
41+
Terminals: array[string] (required)
42+
Subsystem: object {
43+
System ID: string (required)
44+
Port Mappings: array[object {
45+
Processor: string (required)
46+
Index: integer (required)
47+
}] (required)
48+
Terminal Mappings: array[object {
49+
Processor: string (required)
50+
Index: integer (required)
51+
}] (required)
4652
}
53+
}
4754
```
4855

4956
### Wire Schema

docs/Glossary/Workbench/Processor.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,30 @@ A processor is an instance of a block that interacts within the system based on
1313

1414
```
1515
object {
16-
ID: string (required)
17-
Name: string (required)
18-
Description: string
19-
Parent: string (required)
20-
Ports: array[string]
21-
Terminals: array[string] (required)
22-
Subsystem: object {
23-
System ID: string (required)
24-
Wires: array[string] (required)
25-
}
16+
ID: string (required)
17+
Name: string (required)
18+
Description: string
19+
Parent: string (required)
20+
Ports: array[string] (required)
21+
Terminals: array[string] (required)
22+
Subsystem: object {
23+
System ID: string (required)
24+
Port Mappings: array[object {
25+
Processor: string (required)
26+
Index: integer (required)
27+
}] (required)
28+
Terminal Mappings: array[object {
29+
Processor: string (required)
30+
Index: integer (required)
31+
}] (required)
2632
}
33+
}
2734
```
2835

2936
- Parent should reference an ID of a block which is the abstract class this processor implements
3037
- Ports and terminals should be arrays of strings which match up to IDs that spaces have
31-
- If the processor is a composite process, the system ID should be an ID of one of the systems in the toolbox and the wires attribute should be an array of strings which are IDs for different wires in the toolbox
38+
- If the processor is a composite process, the system ID should be an ID of one of the systems in the toolbox and the terminal mappings and ports mappings attribute should be an array of of processor IDs and indices which maps the sequential ports/terminals of the composite processor to where they should be passed to.
39+
- In the toy examples, there are examples in much more detail of how to build composite processors.
3240

3341
## Composite Processor
3442

docs/Schema & Glossary.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ A project is defined by two components: a toolbox which has the abstract compone
3636
- Terminals: The IDs of spaces which must match the codomain of the parent block.
3737
- Subsystem: The subsystem of the processor which is a system that the processor represents and passes its ports to and receives spaces to its terminals from.
3838
- System ID: The ID of the system that the processor is a processor for.
39-
- Wires: The IDs of the wires that connect the processor ports and terminals to the system ports and terminals.
39+
- Port Mappings: This array, which is equal in length to the number of ports on the processor, maps each port to an internal processor within the subsystem and its port index that the port should be passed on to.
40+
- Processor: The ID of the processor in the system.
41+
- Index: The index of the terminal.
42+
- Terminal Mappings: This array, which is equal in length to the number of terminals on the processor, maps terminal port to an internal processor within the subsystem and its terminal index that the outer terminal should receive output from.
43+
- Processor: The ID of the processor in the system.
44+
- Index: The index of the terminal.
4045
- Wires: A list of wires in the block diagram protocol that follow the wire schema.
4146
- ID: A unique identifier for the wire.
4247
- Parent: The ID of the space that the wire is passing.
@@ -85,11 +90,18 @@ object {
8590
Name: string (required)
8691
Description: string
8792
Parent: string (required)
88-
Ports: array[string]
93+
Ports: array[string] (required)
8994
Terminals: array[string] (required)
9095
Subsystem: object {
9196
System ID: string (required)
92-
Wires: array[string] (required)
97+
Port Mappings: array[object {
98+
Processor: string (required)
99+
Index: integer (required)
100+
}] (required)
101+
Terminal Mappings: array[object {
102+
Processor: string (required)
103+
Index: integer (required)
104+
}] (required)
93105
}
94106
}] (required)
95107
Wires: array[object {
@@ -98,11 +110,11 @@ object {
98110
Source: object {
99111
Processor: string
100112
Index: integer
101-
}
113+
} (required)
102114
Target: object {
103115
Processor: string
104116
Index: integer
105-
}
117+
} (required)
106118
}] (required)
107119
Systems: array[object {
108120
ID: string (required)

scratch/glossary.ipynb

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": 2,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -18,7 +18,7 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": 2,
21+
"execution_count": 3,
2222
"metadata": {},
2323
"outputs": [
2424
{
@@ -47,7 +47,12 @@
4747
" - Terminals: The IDs of spaces which must match the codomain of the parent block.\n",
4848
" - Subsystem: The subsystem of the processor which is a system that the processor represents and passes its ports to and receives spaces to its terminals from.\n",
4949
" - System ID: The ID of the system that the processor is a processor for.\n",
50-
" - Wires: The IDs of the wires that connect the processor ports and terminals to the system ports and terminals.\n",
50+
" - Port Mappings: This array, which is equal in length to the number of ports on the processor, maps each port to an internal processor within the subsystem and its port index that the port should be passed on to.\n",
51+
" - Processor: The ID of the processor in the system.\n",
52+
" - Index: The index of the terminal.\n",
53+
" - Terminal Mappings: This array, which is equal in length to the number of terminals on the processor, maps terminal port to an internal processor within the subsystem and its terminal index that the outer terminal should receive output from.\n",
54+
" - Processor: The ID of the processor in the system.\n",
55+
" - Index: The index of the terminal.\n",
5156
" - Wires: A list of wires in the block diagram protocol that follow the wire schema.\n",
5257
" - ID: A unique identifier for the wire.\n",
5358
" - Parent: The ID of the space that the wire is passing.\n",
@@ -83,10 +88,81 @@
8388
},
8489
{
8590
"cell_type": "code",
86-
"execution_count": null,
91+
"execution_count": 4,
8792
"metadata": {},
88-
"outputs": [],
89-
"source": []
93+
"outputs": [
94+
{
95+
"data": {
96+
"text/plain": [
97+
"{'type': 'array',\n",
98+
" 'description': 'A list of processors in the block diagram protocol that follow the processor schema.',\n",
99+
" 'title': 'Processors',\n",
100+
" 'items': {'$id': 'https://github.com/BlockScience/bdp-lib/tree/main/src/bdp_lib/schemas/processor.schema.json',\n",
101+
" '$schema': 'http://json-schema.org/draft-07/schema#',\n",
102+
" 'title': 'Processor',\n",
103+
" 'type': 'object',\n",
104+
" 'additionalProperties': False,\n",
105+
" 'description': 'A processor is an instance of a block where computation or actions would happen. When the optional parameter of subsystem is present, the processor is a composite processor and it represents a system as a processor with the systsem ID it is a processor for as well as the wires that connect the processor ports and terminals to the system ports and terminals.',\n",
106+
" 'properties': {'ID': {'type': 'string',\n",
107+
" 'title': 'ID',\n",
108+
" 'description': 'A unique identifier for the processor.'},\n",
109+
" 'Name': {'type': 'string',\n",
110+
" 'title': 'Name',\n",
111+
" 'description': 'The name of the processor.'},\n",
112+
" 'Description': {'type': 'string',\n",
113+
" 'title': 'Description',\n",
114+
" 'description': 'A description of the processor.'},\n",
115+
" 'Parent': {'type': 'string',\n",
116+
" 'title': 'Parent',\n",
117+
" 'description': 'The ID of the block that the processor is an instance of.'},\n",
118+
" 'Ports': {'type': 'array',\n",
119+
" 'title': 'Ports',\n",
120+
" 'description': 'The IDs of spaces which must match the domain of the parent block.',\n",
121+
" 'items': {'type': 'string'}},\n",
122+
" 'Terminals': {'type': 'array',\n",
123+
" 'title': 'Terminals',\n",
124+
" 'description': 'The IDs of spaces which must match the codomain of the parent block.',\n",
125+
" 'items': {'type': 'string'}},\n",
126+
" 'Subsystem': {'type': 'object',\n",
127+
" 'title': 'Subsystem',\n",
128+
" 'description': 'The subsystem of the processor which is a system that the processor represents and passes its ports to and receives spaces to its terminals from.',\n",
129+
" 'properties': {'System ID': {'type': 'string',\n",
130+
" 'title': 'System ID',\n",
131+
" 'description': 'The ID of the system that the processor is a processor for.'},\n",
132+
" 'Port Mappings': {'type': 'array',\n",
133+
" 'title': 'Port Mappings',\n",
134+
" 'description': 'This array, which is equal in length to the number of ports on the processor, maps each port to an internal processor within the subsystem and its port index that the port should be passed on to.',\n",
135+
" 'items': {'type': 'object',\n",
136+
" 'properties': {'Processor': {'type': 'string',\n",
137+
" 'title': 'Processor',\n",
138+
" 'description': 'The ID of the processor in the system.'},\n",
139+
" 'Index': {'type': 'integer',\n",
140+
" 'title': 'Index',\n",
141+
" 'description': 'The index of the terminal.'}},\n",
142+
" 'required': ['Processor', 'Index']}},\n",
143+
" 'Terminal Mappings': {'type': 'array',\n",
144+
" 'title': 'Terminal Mappings',\n",
145+
" 'description': 'This array, which is equal in length to the number of terminals on the processor, maps terminal port to an internal processor within the subsystem and its terminal index that the outer terminal should receive output from.',\n",
146+
" 'items': {'type': 'object',\n",
147+
" 'properties': {'Processor': {'type': 'string',\n",
148+
" 'title': 'Processor',\n",
149+
" 'description': 'The ID of the processor in the system.'},\n",
150+
" 'Index': {'type': 'integer',\n",
151+
" 'title': 'Index',\n",
152+
" 'description': 'The index of the terminal.'}},\n",
153+
" 'required': ['Processor', 'Index']}}},\n",
154+
" 'required': ['System ID', 'Port Mappings', 'Terminal Mappings']}},\n",
155+
" 'required': ['ID', 'Name', 'Parent', 'Ports', 'Terminals']}}"
156+
]
157+
},
158+
"execution_count": 4,
159+
"metadata": {},
160+
"output_type": "execute_result"
161+
}
162+
],
163+
"source": [
164+
"schema['properties'][\"Workbench\"][\"properties\"][\"Processors\"]"
165+
]
90166
},
91167
{
92168
"cell_type": "code",

scratch/schema.ipynb

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@
3030
" Name: string (required)\n",
3131
" Description: string\n",
3232
" Parent: string (required)\n",
33-
" Ports: array[string]\n",
33+
" Ports: array[string] (required)\n",
3434
" Terminals: array[string] (required)\n",
3535
" Subsystem: object {\n",
3636
" System ID: string (required)\n",
37-
" Wires: array[string] (required)\n",
37+
" Port Mappings: array[object {\n",
38+
" Processor: string (required)\n",
39+
" Index: integer (required)\n",
40+
" }] (required)\n",
41+
" Terminal Mappings: array[object {\n",
42+
" Processor: string (required)\n",
43+
" Index: integer (required)\n",
44+
" }] (required)\n",
3845
" }\n",
3946
" }] (required)\n",
4047
" Wires: array[object {\n",
@@ -43,11 +50,11 @@
4350
" Source: object {\n",
4451
" Processor: string\n",
4552
" Index: integer\n",
46-
" }\n",
53+
" } (required)\n",
4754
" Target: object {\n",
4855
" Processor: string\n",
4956
" Index: integer\n",
50-
" }\n",
57+
" } (required)\n",
5158
" }] (required)\n",
5259
" Systems: array[object {\n",
5360
" ID: string (required)\n",
@@ -137,7 +144,7 @@
137144
},
138145
{
139146
"cell_type": "code",
140-
"execution_count": 5,
147+
"execution_count": 3,
141148
"metadata": {},
142149
"outputs": [
143150
{
@@ -148,12 +155,26 @@
148155
" ID: string (required)\n",
149156
" Name: string (required)\n",
150157
" Description: string\n",
158+
" Parent: string (required)\n",
159+
" Ports: array[string] (required)\n",
160+
" Terminals: array[string] (required)\n",
161+
" Subsystem: object {\n",
162+
" System ID: string (required)\n",
163+
" Port Mappings: array[object {\n",
164+
" Processor: string (required)\n",
165+
" Index: integer (required)\n",
166+
" }] (required)\n",
167+
" Terminal Mappings: array[object {\n",
168+
" Processor: string (required)\n",
169+
" Index: integer (required)\n",
170+
" }] (required)\n",
171+
" }\n",
151172
"}]\n"
152173
]
153174
}
154175
],
155176
"source": [
156-
"print(format_json_schema_draft07(schema[\"properties\"][\"Toolbox\"][\"properties\"][\"Spaces\"]))"
177+
"print(format_json_schema_draft07(schema[\"properties\"][\"Workbench\"][\"properties\"][\"Processors\"]))"
157178
]
158179
},
159180
{

0 commit comments

Comments
 (0)