Rancor has a web api for communicating between server and client instances. When launched as “Server” Rancor runs the simulation model and the HMI windows (unless ran as HEADLESS). When ran as Client only the HMI windows are ran and the Client communicates with a Server over the Web-API.
This document enumerates every public HTTP endpoint exposed by the Rancor Microworld Simulator (multi‑unit SMR simplified simulator). Use it as a reference when integrating dashboards, test harnesses, or automation scripts.
Element | Default | Notes |
---|---|---|
Base URL | http://<host>:7200/ |
Change the port in appsettings.json if needed. |
Content Types | application/json (REST) / application/octet-stream (MessagePack) |
|
Unit Id Format | "1" , "A" , etc. Must match the UnitNumber in the scenario files. |
Keys in RancorSim.UnitModels . |
HTTP Codes | 200 OK on success, 400 Bad Request on validation failure, 500 on server faults. |
PinCodeValidator.CheckPin(int)
enforces:
number >= 1_000_000
/api/units/...
)GET /api/units/{unitId}
Returns the live state of one unit serialized as JSON. The schema matches `` (supplied separately).
Example
curl -s http://localhost:7200/api/units/1 | jq .PowerOutputMW
POST /api/units/{unitId}/setproperty?propertyName={prop}&value={val}
DependencyProperty
name on the Unit ViewModel.Returns 200 OK
after the assignment is queued on the UI thread.
Example – start Recirc Pump A
curl -X POST "http://localhost:7200/api/units/1/setproperty?propertyName=RecircPumpA&value=true"
POST /api/units/{unitId}/executemethod?methodName={name}
Invokes an exposed public method on the Unit ViewModel.
Example – turbine SCRAM
curl -X POST "http://localhost:7200/api/units/1/executemethod?methodName=ScramTurbine"
For full list of methods see: UnitModel Reference —
/api/rancorsim/...
)POST /api/rancorsim/setstate/{state}
state — run |
freeze |
run
resumes normal time‑step progression; freeze
pauses.
POST /api/rancorsim/snap
Captures the full simulator state to Snaps/YYYY‑MM‑DD_HH‑MM‑SS.json
under the working directory. Useful for regression tests.
POST /api/rancorsim/exit/{pinCode}
On success the process calls RancorSim.Exit()
and shuts down the WPF host.
Example (assuming
1000023
is prime)curl -X POST http://localhost:7200/api/rancorsim/exit/1000023
/log/...
)POST /log/baremetal?filetype={kind}
Body: <plain‑text>
filetype — human |
event |
dynamic_view_model |
sim_api |
Proxies logging to the Server LogManager. Appends the raw body text to the corresponding logfile (paths resolved by LogManager
). No formatting is added.
/messagepack/...
) - Preferred over JSONThese mirror the REST GETs but return MessagePack‑encoded DTOs for reduced payload size.
GET /messagepack/units/{unitId}
Returns application/octet-stream
; deserialize with the provided UnitModelBaseDTO
contract.
GET /messagepack/rancorsim
Binary payload matching RancorSimBaseDTO
.
HTTP Code | Cause |
---|---|
200 | Successful operation |
400 | Invalid parameters, bad PIN, etc. |
500 | Unhandled server exception |
POST /api/rancorsim/setstate/freeze
POST /api/rancorsim/setstate/run