72 lines
2.0 KiB
JSON
72 lines
2.0 KiB
JSON
{
|
|
"version": "v0.1",
|
|
"hils": [
|
|
{
|
|
"name": "physical_io_hil",
|
|
"warmup_s": 3.0,
|
|
"init": {
|
|
"tank_level": 500,
|
|
"bottle_fill_level": 0,
|
|
"bottle_at_filler": 1,
|
|
"bottle_distance": 0,
|
|
"tank_input_valve": 0,
|
|
"tank_output_valve": 0,
|
|
"conveyor_cmd": 0
|
|
},
|
|
"params": {
|
|
"tank_max": 1000,
|
|
"bottle_max": 200,
|
|
"distance_reset": 130,
|
|
"filler_range": 30,
|
|
"inflow_rate": 18,
|
|
"outflow_rate": 6,
|
|
"fill_rate": 6,
|
|
"conveyor_speed": 4
|
|
},
|
|
"tasks": [
|
|
{
|
|
"type": "loop",
|
|
"name": "physics",
|
|
"dt_s": 0.6,
|
|
"actions": [
|
|
{
|
|
"if": "tank_input_valve > 0.5",
|
|
"then": [
|
|
{"add": ["tank_level", "inflow_rate"]}
|
|
]
|
|
},
|
|
{
|
|
"if": "tank_output_valve > 0.5",
|
|
"then": [
|
|
{"add": ["tank_level", "-outflow_rate"]},
|
|
{
|
|
"if": "bottle_at_filler > 0.5 and bottle_fill_level < bottle_max",
|
|
"then": [
|
|
{"add": ["bottle_fill_level", "fill_rate"]}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{"set": ["tank_level", "clamp(tank_level, 0, tank_max)"]},
|
|
{"set": ["bottle_fill_level", "clamp(bottle_fill_level, 0, bottle_max)"]},
|
|
{
|
|
"if": "conveyor_cmd > 0.5",
|
|
"then": [
|
|
{"add": ["bottle_distance", "-conveyor_speed"]},
|
|
{
|
|
"if": "bottle_distance < 0",
|
|
"then": [
|
|
{"set": ["bottle_distance", "distance_reset"]},
|
|
{"set": ["bottle_fill_level", "0"]}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{"set": ["bottle_at_filler", "1 if bottle_distance <= filler_range else 0"]}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|