Plecs Run Script
plecs_run_scriptExecutes a named simulation script in a PLECS model to trigger model-defined automation or simulation workflows via RPC.
Instructions
Run a model Simulation Script by name.
Verified on PLECS 5.0.6: the second argument is an optStruct, not a bare
string — plecs.runScript(model, {"ScriptName": name}). A successful run
returns null; the script's printed output goes to the PLECS console/Octave
log and is not captured by RPC. Use params only for a raw override.
script_name must exactly match a Script { Name "..." } block in the
.plecs file. The RPC model tree does not expose script names; use
plecs_overview(model).scripts or read the file. A wrong name lists the
available scripts in the error.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model_name": "<model_name>",
"script_name": "<script_name>"
},
"name": "plecs_run_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | No | ||
| model_name | Yes | ||
| script_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||