Skip to content

Commit f16e6bf

Browse files
committed
fairly large reconstruction
1 parent 8cb383e commit f16e6bf

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ Import libraries:
3232

3333
Instantiate brical.NetworkBuilder.
3434

35-
>>>> nb=brical.NetworkBuilder()
35+
>>> nb=brical.NetworkBuilder()
3636

3737
Load JSON files:
3838

3939
In this example, you load six files from 'test/n001' directory.
4040

41-
>>>> f = open("[YOUR GIT DIRECTORY]/brical/test/n001/01InputComponent.json")
41+
>>> f = open("[YOUR GIT DIRECTORY]/brical/test/n001/01InputComponent.json")
4242
>>> nb.load_file(f)
4343
True
4444
>>> f = open("[YOUR GIT DIRECTORY]/brical/test/n001/02MainComponent.json")
@@ -76,11 +76,11 @@ BriCA modules are accessed via the module dictionary obtained with agent_builder
7676
Setting non-zero values to the input module:
7777

7878
>>> v = np.array([1, 2, 3], dtype=np.int16)
79-
>>> modules["BriCA1.InputModule"].get_component("BriCA1.InputModule").set_state("InputModulePort", v)
79+
>>> modules["BriCA1.InputModule"].set_state("InputModulePort", v)
8080

8181
Setting a map for PipeComponent (see BriCA1 tutorial for explanation):
8282

83-
>>>> modules["BriCA1.MainModule"].get_component("BriCA1.MainModule").set_map("Port1", "Port2")
83+
>>> modules["BriCA1.MainModule"].set_map("Port1", "Port2")
8484

8585
Now run the network step by step and see if values are transmitted to the ports:
8686

test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def print_network(network):
4646

4747
agent_builder = brical.AgentBuilder()
4848
agent = agent_builder.create_agent(network_builder)
49-
scheduler = brica1.VirtualTimeSyncScheduler(agent)
5049
if agent == agent_builder.INCONSISTENT:
5150
sys.stderr.write("ERROR: INCONSISTENT!\n")
5251
elif agent == agent_builder.NOT_GROUNDED:
@@ -67,7 +66,7 @@ def print_network(network):
6766
impl = v["ImplClass"]
6867
if impl == "":
6968
continue
70-
component = modules[module].get_component(module)
69+
component = modules[module]
7170
ports = v["Ports"]
7271
buffers.append([module, component, ports])
7372
if "InputModule" in module: # Setting of initial data
@@ -98,6 +97,7 @@ def print_network(network):
9897

9998
# Run
10099
print("--- Run ---")
100+
scheduler = brica1.VirtualTimeSyncScheduler(agent)
101101
for i in range(len(buffers)):
102102
print(scheduler.step())
103103
for b in buffers:

test/n001/01InputComponent.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Type" : "C",
44
"Name" : "InputComponent",
55
"Base" : "BriCA1",
6-
"Comment" : "正常系:サンプルデータが正常に動作することを確認"
6+
"Comment" : "Normal case: to confirm BriCAL works with test case n001"
77
},
88

99
"Modules" : [{

0 commit comments

Comments
 (0)