17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 23:16:22 +01:00
Files
maszyna/tools/vehicle_graph/examples/vectron-logic.vhg

113 lines
7.8 KiB
Plaintext

// cab logic of an electric locomotive with induction motors, modelled after the Vectron .fiz.
// stage 1 of the vehicle graph: only logic and cab blocks are available, so the pantograph, the main circuit
// and the inverters are represented by timers and constants. the combined power/brake lever is split into
// a traction demand and an electrodynamic brake demand, which will drive the inverter blocks in the next stages
{
"format": "maszyna-vehicle-graph",
"version": 2,
"vehicle": { "name": "Vectron (logic test)" },
"settings": { "low_voltage_simulation": false },
"nodes": [
{ "id": "bat", "type": "cab.switch", "title": "Battery", "params": { "behaviour": "bistable", "submodel": "battery_sw:", "command": "batterytoggle" } },
{ "id": "pant_sel", "type": "cab.switch", "title": "Pantograph selector", "params": { "behaviour": "multi", "positions": 4, "min": 0, "max": 3, "default": 1, "labels": "rear;front;both;rear", "step": 30, "submodel": "pantselect_sw:" } },
{ "id": "pant_raise", "type": "cab.switch", "title": "Raise pantographs", "params": { "behaviour": "monostable", "animation": "move", "step": 4, "submodel": "pantselectedraise_bt:", "command": "pantographraiseselected" } },
{ "id": "pant_lower", "type": "cab.switch", "title": "Lower pantographs", "params": { "behaviour": "monostable", "animation": "move", "step": 4, "submodel": "pantselectedlower_bt:", "command": "pantographlowerselected" } },
{ "id": "main_sw", "type": "cab.switch", "title": "Main switch", "params": { "behaviour": "multi", "positions": 3, "min": -1, "max": 1, "default": 0, "spring": true, "labels": "off;0;on", "step": 40, "offset": -40, "submodel": "main_sw:" } },
{ "id": "reverser", "type": "cab.switch", "title": "Direction", "params": { "behaviour": "multi", "positions": 3, "min": -1, "max": 1, "default": 0, "labels": "back;0;forward", "step": 45, "offset": -45, "submodel": "dirkey:" } },
{ "id": "lever", "type": "cab.switch", "title": "Power/brake lever", "params": { "behaviour": "multi", "positions": 31, "min": -1, "max": 1, "default": 0, "step": 2, "offset": -30, "submodel": "jointctrl:" } },
{ "id": "pant_cmd", "type": "logic.sr", "title": "Pantographs commanded up" },
{ "id": "pant_cmd_on", "type": "logic.and", "title": "Raising with battery" },
{ "id": "pant_cmd_off", "type": "logic.nand", "title": "Lowering or battery off" },
{ "id": "no_lower", "type": "logic.not", "title": "Lower button released" },
{ "id": "pant_up", "type": "logic.ton", "title": "Pantograph raising", "params": { "time": 5.0 } },
{ "id": "hv_nominal", "type": "logic.const", "title": "Catenary voltage", "params": { "value": 3000 } },
{ "id": "hv", "type": "logic.math", "title": "Voltage behind the pantograph", "params": { "op": "mul" } },
{ "id": "hv_ok", "type": "logic.hyst", "title": "Voltage above minimum", "params": { "lo": 1800, "hi": 1900 } },
{ "id": "ms_on_req", "type": "logic.compare", "title": "Main switch to on", "params": { "op": "gt", "value": 0 } },
{ "id": "ms_off_req", "type": "logic.compare", "title": "Main switch to off", "params": { "op": "lt", "value": 0 } },
{ "id": "ms_init", "type": "logic.ton", "title": "Main circuit initialisation", "params": { "time": 10.0 } },
{ "id": "ms_close", "type": "logic.and", "title": "Closing allowed" },
{ "id": "ms_lost", "type": "logic.nand", "title": "Battery or voltage missing" },
{ "id": "ms_open", "type": "logic.or", "title": "Opening" },
{ "id": "ms", "type": "logic.sr", "title": "Main circuit breaker" },
{ "id": "ms_lamp_on", "type": "logic.not", "title": "Main circuit open" },
{ "id": "zero", "type": "logic.const", "title": "Zero", "params": { "value": 0 } },
{ "id": "minus_one", "type": "logic.const", "title": "Minus one", "params": { "value": -1 } },
{ "id": "lever_pos", "type": "logic.math", "title": "Traction part", "params": { "op": "max" } },
{ "id": "lever_neg", "type": "logic.math", "title": "Lever inverted", "params": { "op": "mul" } },
{ "id": "lever_brake", "type": "logic.math", "title": "Brake part", "params": { "op": "max" } },
{ "id": "dir_set", "type": "logic.compare", "title": "Direction selected", "params": { "op": "ne", "value": 0 } },
{ "id": "drive_ok", "type": "logic.and", "title": "Ready to drive" },
{ "id": "traction", "type": "logic.select", "title": "Traction demand" },
{ "id": "ed_brake", "type": "logic.select", "title": "ED brake demand" },
{ "id": "lamp_ms", "type": "fb.lamp", "title": "Main circuit lamp", "params": { "color": "red", "submodel": "i-mainbreaker:" } },
{ "id": "lamp_pant", "type": "fb.lamp", "title": "Pantograph lamp", "params": { "color": "yellow", "blink": true, "blink_period": 1.0, "submodel": "i-pantraising:" } },
{ "id": "pant_moving", "type": "logic.and", "title": "Pantograph moving" },
{ "id": "pant_not_up", "type": "logic.not", "title": "Pantograph not up yet" },
{ "id": "v_hv", "type": "fb.gauge", "title": "Catenary voltage", "params": { "min": 0, "max": 4000, "unit": "V", "angle_min": 0, "angle_max": 270, "submodel": "hvoltage:" } },
{ "id": "v_demand", "type": "fb.gauge", "title": "Traction demand", "params": { "min": 0, "max": 1, "angle_min": 0, "angle_max": 270, "submodel": "tractionforce:" } },
{ "id": "snd_base", "type": "logic.const", "title": "Idle volume", "params": { "value": 0.3 } },
{ "id": "snd_gain", "type": "logic.math", "title": "Volume rising with demand", "params": { "op": "add" } },
{ "id": "snd_inverter", "type": "fb.sound", "title": "Inverters", "params": { "file": "vectron-inverter.wav", "placement": "engine", "loop": true } }
],
"connections": [
{ "from": "pant_raise.pos", "to": "pant_cmd_on.a" },
{ "from": "bat.pos", "to": "pant_cmd_on.b" },
{ "from": "pant_lower.pos", "to": "no_lower.a" },
{ "from": "no_lower.q", "to": "pant_cmd_off.a" },
{ "from": "bat.pos", "to": "pant_cmd_off.b" },
{ "from": "pant_cmd_on.q", "to": "pant_cmd.s" },
{ "from": "pant_cmd_off.q", "to": "pant_cmd.r" },
{ "from": "pant_cmd.q", "to": "pant_up.a" },
{ "from": "hv_nominal.q", "to": "hv.a" },
{ "from": "pant_up.q", "to": "hv.b" },
{ "from": "hv.q", "to": "hv_ok.a" },
{ "from": "hv.q", "to": "v_hv.value" },
{ "from": "pant_up.q", "to": "pant_not_up.a" },
{ "from": "pant_cmd.q", "to": "pant_moving.a" },
{ "from": "pant_not_up.q", "to": "pant_moving.b" },
{ "from": "pant_moving.q", "to": "lamp_pant.on" },
{ "from": "main_sw.pos", "to": "ms_on_req.a" },
{ "from": "main_sw.pos", "to": "ms_off_req.a" },
{ "from": "hv_ok.q", "to": "ms_init.a" },
{ "from": "ms_on_req.q", "to": "ms_close.a" },
{ "from": "ms_init.q", "to": "ms_close.b" },
{ "from": "bat.pos", "to": "ms_lost.a" },
{ "from": "hv_ok.q", "to": "ms_lost.b" },
{ "from": "ms_off_req.q", "to": "ms_open.a" },
{ "from": "ms_lost.q", "to": "ms_open.b" },
{ "from": "ms_close.q", "to": "ms.s" },
{ "from": "ms_open.q", "to": "ms.r" },
{ "from": "ms.q", "to": "ms_lamp_on.a" },
{ "from": "ms_lamp_on.q", "to": "lamp_ms.on" },
{ "from": "lever.pos", "to": "lever_pos.a" },
{ "from": "zero.q", "to": "lever_pos.b" },
{ "from": "lever.pos", "to": "lever_neg.a" },
{ "from": "minus_one.q", "to": "lever_neg.b" },
{ "from": "lever_neg.q", "to": "lever_brake.a" },
{ "from": "zero.q", "to": "lever_brake.b" },
{ "from": "reverser.pos", "to": "dir_set.a" },
{ "from": "dir_set.q", "to": "drive_ok.a" },
{ "from": "ms.q", "to": "drive_ok.b" },
{ "from": "drive_ok.q", "to": "traction.sel" },
{ "from": "zero.q", "to": "traction.a" },
{ "from": "lever_pos.q", "to": "traction.b" },
{ "from": "drive_ok.q", "to": "ed_brake.sel" },
{ "from": "zero.q", "to": "ed_brake.a" },
{ "from": "lever_brake.q", "to": "ed_brake.b" },
{ "from": "traction.q", "to": "v_demand.value" },
{ "from": "ms.q", "to": "snd_inverter.play" },
{ "from": "snd_base.q", "to": "snd_gain.a" },
{ "from": "traction.q", "to": "snd_gain.b" },
{ "from": "snd_gain.q", "to": "snd_inverter.volume" }
]
}