Speed limits and operating rules
Preview the speed envelope and explanation for a chosen locomotive and train.
Source 0.1.0 Private source package
How the calls fit together
A policy preview explains the current decision. It does not reserve authority, claim driving control or submit a speed command.
JavaScript examples
Supply your configured client. Each call awaits a decoded result; errors pass to your caller. These identifiers and values are fictional. Use selected development records and review every change before running it. Opening this page sends no API requests.
See the complete TypeScript workflow · Explore the Node starter
operatingPolicy.previewLocomotive
Previews the resolved operating policy for one layout locomotive.
const result = await client.operatingPolicy.previewLocomotive(
"account 1",
"layout 1",
"loco 1",
{
"trainFormationId": "formation 1",
"requestedSpeedPercent": 75,
"requestedDirection": "forward"
}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the locomotive.
locomotiveId· requiredRailDeckIdentifierLocomotive whose policy should be previewed.
input· requiredPreviewRailDeckLocomotiveOperatingPolicyInputRequested speed, optional direction, and optional train formation.
Returns Promise<RailDeckLocomotiveOperatingPolicyPreview>.
Example evidence: Retained SDK transport fixture.
Download all TypeScript method examples
JavaScript calls and TypeScript downloads are checked through the real SDK using local response fixtures. This verifies the calls and decoding for those fixtures.
The complete TypeScript workflow
Follow how the calls fit together, including the review and recovery steps. Supply your configured client and explicitly selected development records. Importing the download performs no requests; mutations are never retried automatically.
import type { RailDeckDirectIntegrationClient as Client } from '@raildeck/frontend-sdk/direct-integration';
/**
* Read handling evidence and preview a chosen train’s requested speed.
* @param client - Configured client; the caller owns current authority.
* @param accountId - Authorised account for this workflow.
* @param layoutId - Explicitly selected layout within the account.
* @param locomotiveId - Explicitly selected locomotive.
* @param trainId - Explicitly selected saved train.
* @param input - Reviewed input for this operation.
* @returns An explanation of the current policy, without claiming control or sending speed.
*/
export async function reviewTrainSpeedPolicy(
client: Client,
accountId: string,
layoutId: string,
locomotiveId: string,
trainId: string,
input: Omit<Parameters<Client['operatingPolicy']['previewLocomotive']>[3], 'trainFormationId'>,
) {
const handling = await client.trainFormations.getHandlingProfile(accountId, trainId);
const policy = await client.operatingPolicy.previewLocomotive(accountId, layoutId, locomotiveId, {
...input, trainFormationId: trainId,
});
return { handling, policy };
}
Download TypeScript example