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
This guide explains how to control the position of individual control rods in Rancor 3.0 using the existing Unit property API. You first switch rod control to manual mode and then set each rod’s position independently.
RodCtrlMode
to 0
to enable manual rod control.Rod1
, Rod2
, Rod3
, and Rod4
independently.100
= fully inserted (all the way down; as when scrammed)0
= fully withdrawn (all the way out)POST /api/units/{unitId}/setproperty?propertyName={prop}&value={val}
Replace {unitId}
with the target unit’s ID (for example, 1
, A
, etc.).
POST /api/rancorsim/setstate/freeze
RodCtrlMode = 0
).Rod1
–Rod4
. Move in increments of 5POST /api/rancorsim/setstate/run
Enable manual rod control:
curl -X POST "http://localhost:7200/api/units/1/setproperty?propertyName=RodCtrlMode&value=0"
Set individual rod positions (example values):
curl -X POST "http://localhost:7200/api/units/1/setproperty?propertyName=Rod1&value=95"
curl -X POST "http://localhost:7200/api/units/1/setproperty?propertyName=Rod2&value=95"
curl -X POST "http://localhost:7200/api/units/1/setproperty?propertyName=Rod3&value=95"
curl -X POST "http://localhost:7200/api/units/1/setproperty?propertyName=Rod4&value=95"
Note: In PowerShell, curl
is an alias for Invoke-WebRequest
and does not support -X
. Use Invoke-WebRequest
directly:
Enable manual rod control:
Invoke-WebRequest -Uri "http://localhost:7200/api/units/1/setproperty?propertyName=RodCtrlMode&value=0" -Method POST
Set individual rod positions:
Invoke-WebRequest -Uri "http://localhost:7200/api/units/1/setproperty?propertyName=Rod1&value=95" -Method POST
Invoke-WebRequest -Uri "http://localhost:7200/api/units/1/setproperty?propertyName=Rod2&value=95" -Method POST
Invoke-WebRequest -Uri "http://localhost:7200/api/units/1/setproperty?propertyName=Rod3&value=95" -Method POST
Invoke-WebRequest -Uri "http://localhost:7200/api/units/1/setproperty?propertyName=Rod4&value=95" -Method POST
http://<host>:7200/
(configurable in appsettings.json
).0
to 100
inclusive (0 = out, 100 = in).unitId
if you are controlling a different unit.