18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 22:44:59 +01:00
Files
maszyna/McZapkie/MOVER.h
maj00r e6fa206e47 Split stack 3-5c into master (switch blades, 3D sleepers, editor core, SRK stations, tutorial) (#289)
* feat(track): the rail code split by concern, the blades of the switches with the key frogs shaped from their templates

The rails are laid by code of their own instead of inside Track.cpp: gauge lines (GaugeLine), knot lines (Knots.h), crossings and check rails (RailCrossings), rail materials (RailMaterials), measuring the rail profile (RailProfile), planning the cuts (RailPlan), the carving scan (RailCarve) and laying the geometry (RailLayer).

A switch with the key frogs draws its blades from the tip where their planed nose ends to the heel, bent as they're thrown, and the rail behind them from the heel on, where they were laid from the start of the switch before; on a switch of the catalogue they start at the cut tip of the tables, 1.248 m from the joint at R 190, 1.5 m at R 300 (track_features::blades). The frogs cut from the rails, the wing and the check rails are built but switched off (track_features::crossings), the rails laid whole as before. The switches without the key keep the blades they had.

A switch path can be a chain of pieces: pieces1 and pieces2 keep the parts of each path after the classic bezier, which stays as the approximation older versions read. A path with its radius given is a curve however gently it bends, a plain track a straight only where both of its control vectors lie along it. A vehicle trailing through a switch with a movable nose set the other way runs off the rails at it (TRAILED_SWITCH).

* feat(render): the shared treads of the rails and their cut faces drawn, the cut faces in the matte variants of the rail materials

Both renderers draw the treads a track shares with the rails it crosses, in the pick pass too, and a pass of their own for the faces where the rails are cut, the ends of the blades among them, in the matte variants of the rail materials, so the cut faces don't shine like the head the wheels polish.

* feat(vehicle): an axle on a switch keeps to the path it came on, and coming from the frog end trails the switch through where the wheels reach the blades

The switch thrown under an axle no longer moves it over onto the other path; it runs on along the one it entered. Coming from the frog end, where the blades are shaped or the frog has a movable nose, the switch set the other way is trailed through (rozprucie) only where the wheels get to the blades or to the nose, not as the axle enters the track; the other switches are trailed through as it enters, as before.

* fix(track): the tracks drawn straight before, which their second control vector bends now, written to the log

The simulator told a straight by the first control vector of a path alone, so a track whose second control vector bent it was drawn straight; now it's a curve. Such a track is named in the log as it loads, so a scenery made counting on the straight can be found: 25 tracks of lk357. Paths with both control vectors along them bend a centimetre or so at most and aren't named.

* feat(track): 3D sleepers and switch timbers laid where the simulator makes the ballast, switched off in the build

The sleepers of a track running alone are laid square to it, the timbers of the switches and crossings across the tracks running over them, shared by them, of the models set with sleepers3d and sleepers3dplain in eu07.ini; sleepers3dbed tells whether the ballast is laid under them too, lowered so they stick out of it. The layout of a cluster of tracks is worked out once and kept till a track of it changes, in a thread of its own while the simulation runs. timbermodel of a track, read and written back before, takes the place of the model of sleepers3d there. All of it is off whatever eu07.ini sets (track_features::sleepers), the tracks keeping their ballast and their sleeper models.

* feat(render): the 3D sleepers and switch timbers drawn in instanced batches

Render_Timbers lays the beams of the tracks in range where they're out of date and draws those of a run of tracks of a cell gathered by the model and its part or its level of detail, in as few instanced batches as they fit in; in the shadow pass only those near the camera. A track with them leaves its old sleeper model out. OpenGL 3.3 renderer only.

* fix(track): the counts of what's wrong with the sleepers kept safe from the thread laying them, and that thread stopped before what it works with goes

The counts of the beams clipped, dropped and off the plane, of the slowest and the biggest cluster, are counted by the thread working out the layouts in the background as well as by the simulation laying a cluster itself, and were plain values written by both; they're atomic now. What the thread keeps the clusters in, their version and the counts were made after the worker, as it first asked for them, and so destroyed before it at the exit while its thread could still be laying a cluster; they're made first now, the worker stopping and joining its thread before they go. The tracks go with the paths of the simulation, made before the worker.

* revert(track): a tributary and a track of an unknown type load as before

They came in with the rail code from the guards of the editor against crashing, and don't belong with the blades: a track of an unknown type loaded as a normal track of the railway could be joined to it and run on, and a tributary loaded as a river with its first path lost the second one when the editor saved the scenery. Both load as on master again; the place where the editor crashed on them is to be guarded where it is.

* fix(track): the tracks drawn straight before named in the log once, as they load, and the paths of the switches with no radius told a straight as before in one term

The log of the tracks the second control vector bends now was written each time the segments of a track were made again, as a track with its unevenness loads and as the editor changes or drags a track; it's written only the first time, as the track loads. The paths of a switch or a crossing with no radius keep the rule of master, a straight told by the first control vector alone, its two terms being the same length; they're one term now, with the comment saying so.

* fix(track): the thread laying the sleepers stopped as the application exits, and loading no models itself

The thread reads the scenery, which the application deletes as it exits well before the statics go: it's stopped and joined first thing in exit() now, the worker destroyed with the statics only where the application exits some other way, and not started again after. The models the beams are made of were loaded by the thread where it didn't find them, through the renderer, out of the thread of the renderer, into a map read by the simulation meanwhile: they're found under a lock now and loaded only by the threads other than it, again for all the tracks whenever a track changed since, before a layout is asked of it. With the 3D sleepers off in the build their settings aren't exported, and a track changed doesn't look for the tracks around to lay their beams again.

* feat(track): the 3D sleepers turned on with sleepers3d in eu07.ini, no longer switched off in the build

track_features::sleepers is gone: sleepers3d <model> in eu07.ini lays them, none (the default) lays nothing and the
tracks keep their ballast, as before. The sleepers3d settings are written back with the others.

The editor changes the tracks, so while it's open their sleepers are worked out on the main thread as they're needed,
not in the background.

* fix(render): only the part of a timber model drawn, not what else the model holds

A timber model of parts may hold more than its begin, main and end, as the kits with the fastenings of the rails do. Those
were drawn with each part of each timber, in the middle of the track; they aren't laid, so they're skipped now.

* fix(track): the 3D sleepers laid only for a renderer which draws them

Only the OpenGL 3.3 renderer draws the beams. With another one a track set to them lost its ballast to them, lowered or
not laid at all with sleepers3dbed no, and nothing was drawn in its place. Draws_Timbers() of the renderer tells now,
and where it's false the tracks keep their ballast, as with sleepers3d none.

* fix(render): the submodels of a timber model left as they were after its parts are drawn

They were all made visible after a part was drawn, the ones the model hides itself too, like Light_On, while the same
model may stand in the scenery. The submodels of the top level besides the parts are listed as the model is loaded,
hidden while a part is drawn and given back their own visibility after. The parts have to be at the top level of the
model for that; a model with them deeper is logged and drawn whole.

Render_Timbers no longer looks the model up under the lock for every run of tracks, the name set is enough there.

* fix(render): a vertex whose faces give its texture no direction gets a tangent across its normal, not a NaN one

The cut ends of the rails have one spot of the texture on all their corners, so their tangent came out of normalize() as NaN. The normal-mapped shaders then shaded them with a NaN normal: about half of the vertices of the cuts and frogs, and the end faces of the rails.

* feat(track): the frogs cut from the rails turned on with frogs in eu07.ini, no longer switched off in the build

frogs yes cuts the rails of the plain tracks and of the switches with the key frogs where they cross other rails, into frogs, wing rails and check rails. It's off by default: the rails are laid whole as before, the blades of the switches with the key are shaped still.

* refactor(editor): the track mode file split into the files of its tools, the code as it was

A pure move, so that the commits after it show what changes in each tool rather than a 4800-line file rewritten.
The member functions of editor_mode go to the file the editor of this branch has them in: route, straights, lay,
switchplace, switchdrive, switchtool, trackgizmo, and the rest stays in editormodetrack.cpp. The helpers of its
anonymous namespace go to editormodetrackshared.h, as they were but inline, in namespace track_mode, which the files
use. No line of code changes; the files add only their license, includes and the using line.

* feat(editor): the groundwork the tools of the editor share

- The tool interface (editortool.h), the gestures of the mouse (editorgestures.h) and what the modes share
  (editormodeshared.h); the projection, viewport, selection and texture picking taking them up.
- Scripted input (scriptedinput): the input of a selftest script fed to the editor as if typed and clicked, the real
  mouse and keyboard ignored meanwhile; EU07_EDITOR_SELFTEST_HIDDEN draws into a window never shown nor focused.
- The ui layers and panels of the editor, its settings, icons and the info of the includes; the layers of the scenery
  and their saving; the launcher mode.
- utilities: user_cache_path (the cache folder of the system for the user) and the helpers of the translations.
- stb_image: the gif loader takes the frame two back from the frames it decoded, not from before its buffer.
- tools/editor: the scripts making the headers of the drives, the turntables, the editor and its usage.
- Unit tests: test_area and the stubs of the editor the tests link.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the tracks laid along an alignment, to the PKP PLK norms, with their grade line and the ground

- The alignment of the laying (editorAlignment, editorAlignmentStore): straights, transition curves and arcs with the
  cant of the norms for the speed, the radius below the minimum for it a warning; the lay, route and straights tools
  build on it, the route plan reading the curves going on from the tracks adjoining.
- The grade line (editorProfile, the profile and gradeline tools): fitted to the terrain model or edited by hand, the
  tracks fitted marked in the scenery (//$f), the shared grade lines of nearly parallel tracks (//$n).
- The ground under the tracks (editorGroundFollow, trackbed): the terrain drawn to the tracks and restored, the tracks
  put onto the terrain.
- Connections between tracks (editorConnections, the connection and connection curve tools), the track presets, the
  shape of a track (editorTrackShape), digitizing tracks from the orthophoto, the properties sheet of the tracks
  (trackprops) and the track ux.
- Unit tests: alignment, ground fit, heights, with the data of two fits.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the switches placed, slid and designed from their templates

- The switch templates (editorSwitchStore, the template tool): the catalogue switches and the user's own, kept with
  the settings; the designer (editorSwitchDesign) with a drawing of the dimensions, a and b typed in with the shape
  making up the rest, a switch clicked off the orthophoto.
- The curve of a switch laid into a curve (editorSwitchCurve), placement on a straight or into a curve, slide along
  it, crossovers and double slips (switchplace, switchslide), the drives of the switches (switchdrive) and the records
  of the switches placed (records).
- Unit tests: test_switch_curve.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the tools of the infrastructure beside the tracks

The gauge, speed, joints, lineside, parallel tracks, vehicles, signals, turntables, sweep and road tools with headers
of their own; the kilometrage of the lines (editorKilometrage, the km tool); the infrastructure, roads and speeds
behind them (editorInfra, editorRoad, editorSpeed).

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the terrain model of geoportal.gov.pl and the orthophoto downloaded for the editor

- editorNmt: the squares of the terrain model at 1 m (NMT GRID1, the WCS service of geoportal.gov.pl) fetched by two
  workers, kept in editor/cache/nmt/grid1 of the game folder, the heights of the scenery taken from them; the nmt
  mode loads it along the tracks or around the camera.
- editorHttp: the HTTP client of both, WinHTTP on Windows, libcurl elsewhere where it's built with it; without it the
  caches only.
- The orthophoto: its cache moved to the cache folder of the system for the user, the download area a polygon on the
  topo map (//$a) filled in the background, the 4K imagery, the tiles waiting outlined on the ground.
- editorGeoMap: the topo map of the top view; heightmapterrain and the terrain streamer grow the terrain made from the
  model around the camera.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(launcher): the scenery wizard picks the place of a new scenery on the topo map the editor shares

The wizard drops its own map download and decoding for the topo map widget of the editor (editorGeoMap). The place
clicked becomes the geographic reference of the new scenery (//$g PUWG1992), and the scenery starts with the
orthophoto of the editor on (//$o), lying under it in place.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the tools wired into the editor mode and the build

editor_mode takes the tools of the commits before: its header declares them, editormode.cpp and the track mode drive
them, and the renderers draw their overlays (opengl33 and legacy). CMakeLists lists the new sources and adds
WITH_EDITOR_SELFTESTS (off by default); the unit tests build the new test files.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the selftests of the editor split by what they test

The scripts of EU07_EDITOR_SELFTEST run the commands of editormodeselftest*.cpp: scene, track, rails, join, switch,
signal, sleepers, sweep, terrain, monkey. The code is in every build; only with WITH_EDITOR_SELFTESTS=ON does the
editor read the variables and run a script. The selftests of master now need the option too.

The tree builds again with this commit.

* feat(editor): the Polish texts of the editor, all of them in one update of editor_pl.po

* fix(editor): the marks of the editor moved off the letters the starters read, and its lines told by their words

The starters read some letters in a scenery file: the Starter the title //$n, the attachments //$f and the old scenery //$a,
StarterNG and the launcher of the game the attachments //$f and the title //$n. The editor wrote its download area,
shared grade lines and fitted tracks under them, and took every line of those marks as its own: saved, a scenery lost
its title and attachments, and the starters showed the lines of the editor as them.

- The download area is //$z, the shared grade lines //$w, the fitted tracks //$t.
- Their lines and those of //$o are told by their first words, as //$h, //$r and //$k were: //$o only as "on 0" or
  "on 1", the origin or the settings of older builds after it, so a trainset described as "on ..." isn't taken.
- The lines older builds wrote under //$a, //$n and //$f are read only by the words the editor wrote in them, or by
  its own comment line before them, under the new mark. Each save writes them again with it, also when the editor
  didn't change them; the lines of the starters stay.

* fix(editor): a square of the terrain model cut short isn't read, and the squares are kept in the user's cache

The service puts the directory of its GeoTIFF before the pixels, so a file cut short by a write or a fetch broken off
was read whole, the pixels missing coming out as heights of 0 m, for good.

- The reader (editorGeoTiff.hpp, with unit tests) wants all the strips the rows need, each within the file.
- A square is written under a name of its own and renamed.
- The squares are kept in the user's cache folder (nmt/grid1), as the orthophoto, since the game folder may not be
  writable; without one, in the game folder as before. The ones older builds kept there are moved over as each is
  asked for, a damaged one deleted.
- Capabilities that didn't come aren't kept as the fallback name for the session: the next square asks again.

* chore(editor): the http client said to serve the terrain model and the topo map too, the gif fix of stb_image marked local

- CMake names the orthophoto, the terrain model and the topo map as what goes without libcurl.
- The fix of the gif frame two back in stb_image is ours, not upstream's (v2.30 still has the old line): a comment at
  the line says so, for an update of stb_image to keep it.

* fix(editor): the lines moved off the letters of the starters in a merged layer written once, not again with each save

A merged layer's text goes into the file of its target on save, and the target is read again; the marked lines of the
merged layer were dropped only for the marks the editor had changed. The lines moved to the new letters stayed with
their old places, and the next save of the session wrote them into the target once more.

- After a save, the marked lines of every merged layer are dropped; those of its target are read again from its file.
- The lines of a dead layer aren't written again.
- The selftest layermerge merges the layer of one file into another's, as the layers panel does.

* feat(editor): the station as the signalling sees it, found from a switch of it, and its schematic

editorStation: the switches joined by plain track no longer than 1.5 km, the tracks between them and the lines leading
out, 400 m of each beyond the outermost switch; laid out as a schematic along the main track through the station. The
track circuits, the signals and their lights, the lengths of the station tracks and the lines to the next stations are
worked out from it for the signalling tool.

Nothing uses it yet: the signalling tool, wired in the next commit, does. It builds on its own.

* feat(editor): the signalling of a station in the Signalling tab, laid out from a switch of it as on the lines of PKP PLK

LMB on a switch in the Signalling tab opens its station: the schematic in a window of its own, the name, the code, the
line and the km of the station, and the steps of its signalling, each one step of undo:

- the switches numbered along the station after its code, bpd_1, the parts of a slip bpd_15a..d; the drives and the
  objects naming a switch follow it, events written by hand keep the old names;
- the tracks cut at the joints of the track circuits, Ie-4, and the circuits named, bpd_iz1, bpd_it1;
- the entry, exit and shunting signals placed and named, A, F1, Tm1, from the templates chosen;
- the signals of the lines out: the automatic block of three or four aspects, the block sections no shorter than the
  braking distance, or the semi-automatic one with a warning disc; block boundaries drawn by hand;
- the lights each signal needs for its routes, Ie-1 and Ie-4 § 8, its template fitted to them;
- the SHP track resonators the signals lack, rezonator.inc;
- the lengths of the station tracks as a table, and what the station and its lines still lack, with Repair.

The stations described are kept as //$s lines in the files of their layers.

* fix(editor): the signals of a station and of its lines not placed with no template for a kind, no track cut for them first

- Set the signals and Set the line signals cut the tracks first, and only then found no template for a kind. They
  stopped there, but the cuts stayed as a step of undo. Now they ask for the templates first, by the lookup
  signal_batch() uses (signal_template_for(), behind editor_signals::signal_templates_missing()). Without one
  nothing is cut.
- Set the signals and Set the track circuits again under Track lengths had the ids of the buttons of the steps
  above them. ImGui flagged them when hovered. Each now has an id of its own.

* fix(utilities): win1250_to_utf8 turns the polish letters into utf-8, not into themselves

utilities.cpp starts with a byte order mark, so the compiler reads it as utf-8. The game's targets don't get
/utf-8, though: set_target_properties(... COMPILE_OPTIONS ...) in the MSVC block of CMakeLists.txt replaces the
options add_compile_options gave them. So the string literals went into the program in the code page of the
system, windows-1250 on a polish one, and the map of win1250_to_utf8 turned each letter into itself.

What read windows-1250 through it got no utf-8: the names, descriptions and categories of the sceneries and the
names of the textures in the launcher, and the descriptions of the templates in the editor. The editor writes
such a description back through utf8_to_win1250, which makes a question mark of each byte that doesn't start
a utf-8 sequence, so the letters it had read unchanged didn't come back.

The utf-8 sequences are written as bytes now, the way utf8_to_win1250 has them, so they don't depend on the
options. The options stay as they are: with /utf-8 other literals of the files with a byte order mark would
change, the "±" of the table of Bezogonkow would take two bytes and move the letters after it.

The unit tests check the letters and that the text given is valid utf-8.

(cherry picked from commit 9ffed96ec1)

* fix(editor): the switches renamed only after the events by their old names are shown, the station records in windows-1250 and in the file the scenery had

Number the switches renames the switches and what the editor writes along with them, but not the events written
by hand: a switch event aiming at a switch, or <name>:event0 and the others named after it, would keep the old
name and lose its switch. Now the first click lists them in the status, up to six and how many more, and renames
nothing. A second click with the same renames goes ahead.

The name of a station is written in windows-1250, like the rest of the scenery file. A name read that isn't
valid utf-8 is taken for windows-1250; the utf-8 the earlier builds wrote is read as it is. utf8_to_win1250
moves from editorIncludeInfo.cpp to the utilities, beside win1250_to_utf8, and the unit tests check both ways.

The record of a station that had none goes beside the records of the other stations, in the file marked with
them, so a scenery saved under another name keeps them in one file. output_layer takes, after
<scenery>_<part>.scm, an included file of the part of another name, the one of the scenery it was copied from,
before it makes a new one.

The comments: the joints of the track circuits stand 4.2 m beyond the fouling points, where the axes are 3.5 m
apart, as joints() counts them; the regulation of the lengths is cited with its date and title.

* fix(editor): a scenery saved under another name keeps one file of the keys by the movable noses, not the old one beside its own

The editor writes the keys by the movable noses on each save to <scenery>_dzioby.scm and includes it. A copy of
a scenery, saved under another name, still included the file of the scenery it came from, and its save wrote a
file of its own and included it too, so each key stood twice.

Now the save leaves out of the scenery the other files of such keys it includes, told by the line the editor
writes at their start. Their files stay on the disk, for the scenery they were made for. A file made by hand,
without that line, stays included. The turntable controls had the same, fixed the same way on their own.

* fix(editor): a file of the scenery named like a part of a tool isn't taken for the one the tool made

output_layer took, after <scenery>_<part>.scm, any included file named *_<part>.scm, so that a scenery saved under
another name goes on with the file of the scenery it was copied from. A file of the scenery named alike, written by
hand, such as rejon_teren.scm, got the terrain directive, the hectometre posts or the new signals too.

The files output_layer makes start with a line of their own now, "// scenery layer created in the editor for its
<part> part", and a file of another name is taken only with that line. A layer gets it through the new parameter
of scene::node_layers::create(); the others start with the general line as before. <scenery>_<part>.scm of the
scenery itself is taken without the line, as it was. A file made for a part by an earlier build has only the
general line, so a copy saved from it gets a file of its own.

* feat(editor): a player of GIF clips for the windows of the editor

editor_clips::clip plays a GIF in an ImGui window, looped, from the time given. stb_image decodes the whole
file on a thread of its own, so the window isn't held up; until then the clip says it's loading. The frames are
kept as stb_image decoded them, and the one shown is a texture of the ImGui renderer (Create_Image), made again
only when the frame changes. A file that isn't there is told missing at once, with no thread started.

Nothing uses it yet; the tutorial of the next commit shows its clips with it.

* feat(editor): Help > Tutorial, fifteen short lessons of the editor

The lessons: looking around, laying track, curves, the radius of the curves at the bends, correcting a curve,
joining tracks, switches, switch templates, signals and posts, selecting and fixing, editing with the gizmo, the
grade line, terrain from the terrain model, sceneries made before, saving and driving.

Each lesson has:
- in eight lessons, a looping clip from lang/editor_tutorial/<lesson>.gif, played from the start on a click;
  in six others, a moving drawing (the radius at a bend, a switch template clicked, the signals, the grade
  line, the terrain, a trainset);
- the mouse buttons and keys drawn as pictures beside what they do;
- ticks that fill in as the user does it, told by the tools through editor_guide::first_step_done();
- a button that turns the tool of the lesson on;
- Back / Next and a dot per lesson, green when the lesson is done.

The window follows the work: when the tool in use changes, it turns to the first lesson of that tool not done
yet, and a page turned by hand stays until then. In a lesson of laying it warns when there's no ground under
the cursor.

Where it opens:
- by itself when an editor session starts, until "Show when the editor opens" is unticked (first_steps in the
  editor's settings);
- from the Help menu;
- from a Tutorial button beside Lay a track in the hint of an empty scenery, which isn't drawn while the
  tutorial is open;
- at its lesson, from a "?" by the radius at the bends in the lay panel.

A lesson whose clip isn't there is shown without it; the clips aren't in this commit.

editor_guide is a new role of the editor, given to the hekto-post and trainset tools. Selftest command
tutorial <page>: opens the tutorial at a lesson, from 0; -1 closes it.

* fix(editor): the lessons of the tutorial say what the editor does

The lesson texts checked one by one against the tools; the ones that told otherwise:
- Switches: a connection isn't chosen at the top of the panel, its kind comes from where the drag is let go (a
  crossover onto the other track, over a crossover the other way a double one, or scissors where they overlap).
- Switches: a ladder leads onto the parallel tracks it's dragged across, let go on the farthest, with the
  straights up to where they start; it lays no missing tracks.
- Terrain: there is no step 3. Step 1 is Location, step 2 is Load around the camera while there are no tracks
  and Tracks and terrain with its three ways once there are. The rows had the step numbers in the keys column,
  and 1, 2 and 3 switch the edit modes in the Terrain field. Now the steps show the mouse, the terrain under
  some tracks only is a row of F3 (the line the terrain panel shows), and the rows that only tell what the
  fit does have no key.
- Sceneries made before: a plain include can be changed; the row lists what can't: an include template (.inc),
  the binary terrain cache, a file included twice or with parameters, a locked or hidden layer.
- Laying: the second Esc drops the points only within 3 s.
- The radius at the bends: two transition curves from 6000 m down to 2000 m while they're long enough for the
  speed, then an arc; a label turns orange where the curve breaks the norms, not because it came out smaller;
  two transitions meeting read 2xL and R; the labels of each transition curve are on laid tracks, close up.
- Signals and posts: the W17 markers go by the selected switch, around the camera or the whole scenery, not
  along a line.
- Selecting and fixing: E lengthens the track, the control vectors bend it.
- The gizmo: at a point Q moves the point alone, W turns the whole track about it.

The tooltip of Help > Tutorial no longer speaks of clips: the tutorial goes without them. lang/editor_pl.po
has the new texts.

* fix(editor): the lessons of the tutorial in plain words

Every row, goal and warning of the tutorial is said again for someone
who has never laid a track, in English and in Polish:
- the words of the railway and of the editor are said in everyday ones,
  or explained where they come: the radius (how big the curve is), the
  transition curve (the easing into it), the cant (the outer rail
  raised), the gizmo (handles on the track), the control vectors (points
  that bend it), the grade line (how the line goes up and down), the
  terrain model (the real ground), the orthophoto (the aerial photo),
  the hectometre posts (every 100 m), W17 (how far a wagon may stand);
- what only a designer needs is left out: the 6000 and 2000 m of the
  radius ladder, the compound curve, the hump, the kinds of include that
  can't be changed;
- the buttons are named as the panels name them: Apply to the scenery,
  Template editor..., the tiles of the switch tool;
- the Polish names of three lessons say what they are about ("Uchwyty na
  torze (gizmo)", "Wzniesienia i spadki", "Prawdziwy teren"). Their
  English titles stay, the lessons are found by them;
- the warning of no ground under the cursor tells what happens to the
  track;
- two captions of the drawings say what they show (the tracks inside a
  box, posts every 100 m), and in Polish the button of the top view is
  "Widok z góry (O)", without "ortogonalny".

What each row tells of is the same as before. The msgid of the length
typed while laying stays, the window of the keys (F1) uses it.

* feat(editor): the semaphores and the warning discs chosen by what their descriptions say they show

The descriptions of the signal templates can now say what a semaphore shows and what a disc
repeats, and the editor reads it:

- signal: {arms: 2, aspects: {Sr1: ..., Sr2: ..., Sr3: ..., Sz: ...}, repeats: {stop: ...,
  vmax: ..., "40": ...}} is kept with the template, the events named for each aspect
- the palette shows a template with arms as a semaphore of its arms, with 1 arm / 2 arms and
  Sz picking the template of the same tile that has them
- the signals of SRK take a semaphore whose aspects cover what the signal needs (Sr3 where a
  speed is reduced, Sz on the main signals), the fewest arms that do it, and say which one
  does when the placed one hasn't them or has more than it needs
- the warning disc before a semaphore is one whose repeats cover stop, the highest speed and
  40 km/h when the semaphore shows Sr3; SRK writes no events of the routes, so this only
  chooses and checks the disc
- the linked signal (parameter 7) is read for the role link as well as text
- signal_headers.py keeps the keys written by hand in a description (arms, aspects, repeats,
  the description and the parameters from 6 on) when it writes the guessed ones again
- signaltemplates of the self test lists what the templates say and the heads made of them

* feat(editor): the shaped discs swapped and set by hand, the warning discs checked by what they repeat

The shaped shunting and stop discs (mk1, tzm, z1) are known to the signalling, but it doesn't
place them by itself:

- a shaped disc chosen in the palette for the shunting or the stop signals is placed by hand
  only; the signalling of a station takes the light template of the kind there, and says so
  when there is none
- the template of a shunting or a stop signal standing can be swapped for a light or a shaped
  one of another mount as well (dwarf and mast, not gantry)
- a signal whose description lists its aspects shows a button for each under its card: it sets
  the signal to that aspect in the editor, by the animations, the lights and the submodels its
  event sets off, the time standing still; nothing of it is saved. TAnimContainer::Finish takes
  an animation to its end at once, giving the submodel its angles, multi_event::branches tells
  the events set off when the condition isn't met

From the review of the descriptions:

- a shaped warning disc standing before a semaphore described is checked by the events it
  repeats: stop, the highest speed and 40 km/h of a second arm told apart; one which doesn't is
  offered the disc which does, and Fit swaps it
- the disc offered is of the mount of the disc chosen, taken from the template even when it
  isn't described
- 1 arm / 2 arms / Sz of the palette pick the template leaning as the chosen one and most like
  it by its name
- a semaphore described with its arms but not its aspects has Sr1, Sr2 and with a second arm
  Sr3
- Fit leaves a semaphore having what it needs with its arms, for the events written by hand to
  the aspects of a second one; the messages of the fitting speak of what the signals need, not
  of their lights
- signal_headers.py warns of a signal map written as a block, whose keys it can't keep

* fix(editor): an aspect shown by hand doesn't name a vehicle that may be gone

The Show button runs the events of the aspect outside the queue. run() writes
the vehicle that set the event off last into the log, and nothing clears that
pointer, so a train deleted since would have been read after it was freed. The
queue sets the activator anew each time, so it is cleared before the run.

* fix(editor): a disc not described is only offered the one that tells, a light stand-in of the mount of the shaped one

- A shaped warning disc whose template doesn't say what it repeats may tell
  all its semaphore shows as well. It is no longer marked as not fitting:
  the disc described is offered as a hint, and Fit leaves it be. A disc whose
  template isn't among the scanned, its mount not known, is offered nothing
  rather than discs of any mount.
- A shaped disc chosen for shunting or stop is stood in for by a light
  template of its own mount first, a dwarf for a dwarf.
- The tooltip of the aspect buttons says the trains read the signal as its
  events set it last, in a run started from the editor too.
- The Polish texts of the fitting speak of signals, not semaphores, since it
  takes the discs too.

* refactor: the Sonar remarks on the switch blades taken care of

- the big functions of the rails split into helpers with one job each:
  the carving, the laying and the planning of the rails, their
  crossings, the blades, the lofted spans of a segment, the profile of
  a rail measured piece by piece, the joining of the switches
- the floating-point loop counters are while loops doing the same
  additions, so the samples come out where they did
- C arrays are std::array, the two sides of the paths path_sides; the
  ends of a cut are two parts of one struct, ending and starting
- the rail laid by a course of its own, not eleven parameters
- the globals kept in functions, the nested ternaries taken apart, one
  declaration per statement, explicit captures, ranges algorithms,
  std::format, std::numbers, emplace_back, structured bindings
- the region finds the sections around a point into a list the caller
  gives, so the search for the rails around a track shares no list with
  another thread
- check_rails and create_track_rail_profile are const, the pool of the
  reused chunks can't be copied

The geometry of every chunk of lk357 and td_fog, with the frogs on and
off, comes out the same as before.

* refactor: the Sonar remarks on the 3D sleepers taken care of

- the big functions of the sleepers split into helpers with one job
  each: the clusters and the lines of timbers, the gaps under the rails,
  the models and their parts, the check of the layout, the drawing of
  the timbers in instanced batches
- the tracks near a track found into a list of their own, the region
  searched into a list the caller keeps, not the one the region shares
  with the main thread; the callbacks are templates, not std::function
- the layout of a cluster takes a span of its tracks
- the globals kept in functions, the parts of a beam int constants,
  beam_overhang no longer hidden by a field of the same name
- scoped_lock, jthread, contains, ranges algorithms, std::format,
  emplace_back, structured bindings, explicit captures, upper-case
  literal suffixes, one declaration per statement
- the uniform buffer takes a span of bytes

* fix(editor): the editor core builds with GCC again

- kCrossoverStraights is constexpr, so the connection curve can take it into
  a constant expression; GCC refused a double that was only const there.
- the track_hover alias inside editor_mode dropped: declared after
  hovered_track had already used the name, it changed what the name meant in
  the class (-Wchanges-meaning); the definitions name the shared track_hover.
- <cstring> included where the rail self-test uses std::memcpy, which MSVC
  reached through other headers.

* refactor: the second round of Sonar remarks on the switch blades

- the carve of a throwable part takes the cut before it only where there
  is one, as only that cut makes it throwable
- the splitting of a grooved profile by the floor of its groove moved out
  of the rail layer into a class of its own, which is given the profile,
  the size of the rail, the texture of the plates and the side
- the rail drawing is made by a const function
- the triangles of an ear-clipped outline go in as the arrays they are,
  the search for a corner within an ear is an any_of, the loop pruning
  thin corners keeps the count it started with, as it stops at the first
- the bytes of the blocks of a texture are taken off the file through
  its buffer, with no cast of their storage
- the log of a carved part takes the tracks around it as a span
- the joint length of a switch, a constant, isn't captured, and the
  directions at the ends of a crossroads are tested in one condition each

* refactor: the Sonar remarks on the tutorial

- the window of the tutorial in smaller pieces: the steps reached, the
  lesson followed and its clip, the clip or the sketch of a lesson, its
  keys and steps, the button under it and the buttons of the pages; the
  lessons are a table of their own, the button of each kind of lesson
  picked from a switch
- a clip whose delays add up to nothing shows no frame instead of
  dividing by them
- the frames of a clip are decoded by a function of their own, on a
  thread kept with them and joined once it's done, or as the editor
  closes, instead of a detached one
- the sleepers of the signal sketch counted by a whole number, the texts
  of the sketches made by std::format, their points kept in std::array,
  the whole numbers turned into floats where it's meant

* fix: the bugs and vulnerabilities Sonar found in the editor core

- the loops stepping along a track, a curve or the view count their
  steps by a whole number and take the station as so many steps from
  the first, instead of adding a fraction up, which drifts
- the self-test of the guard rails keeps the plan of the rails of the
  track against while it goes through them: the range of the loop was
  in a plan made for it and gone before the loop began
- the generators of the self-tests and of a unit test are seeded on
  purpose, so a run can be repeated: marked for Sonar as such
- the tool writing the descriptions of the templates takes the names
  out of its tables only where they stay in the data folder

* fix: the loops of the signalling stepping by a whole number

the places of the block signals along a line and the marks of the
chainage under the plan of a station are counted by a whole number and
taken as so many steps from the first, instead of adding a fraction up,
which drifts; Sonar took the counters of floats for bugs

* refactor: the checks of the signal heads and the signal sheet in smaller pieces

the remarks Sonar made on the signal descriptions: the warning about
a disc on the mount of a signal is worked out by a function of its own,
the fit and the aspects of a head, the swap of a template and its
aspects in the sheet of a signal are drawn by members of their own, the
walk over the events of a signal is a free function instead of a
std::function held by a lambda, and the description of an include is
read a part at a time; the names of the kinds are kept in a std::array
and looked up by the algorithms of ranges, a name is taken as a
std::string_view where it is only compared, and the locals named event,
which hid the enumerator, are renamed

* style: a space after a comma in the join self-test

* style: a space after the question mark in the terrain sketch

* style: a space after the question mark in the status of the fitting

* refactor: the last Sonar remarks on the small fixes

the opening of a scenario catches the exception the scenery throws when
it can't be read, not any runtime error; the vehicle moved between
trainsets keeps its source by a reference to const; the messages of a
track of an unknown type and of a tributary are raw string literals;
the parser opens a file by a std::filesystem::path, and the log of a
file it can't open still names its folder and its name

* refactor: the crossings of a track found without casting its const away

the radius of a node can be read off a const one: radius_() is const
across the nodes, the ones of the tracks and the models marked override,
and a const radius() gives the radius worked out already, or works it
out anew without keeping it; the helpers finding the crossings of a
track only read it and take it const, its own run of rails typed apart
from the ones of the tracks it crosses, which the crossings found name;
the triangles of a filled outline are pushed as named corners

* refactor: the paths around a track sampled without casting its const away

the sampling of the paths and the clusters of tracks laid together only
read the tracks, so they take and keep them const: the path sampled
points at a const track, the tracks near one are found from a const one
by its const radius, and a cluster holds const tracks; the shared zones
of the timbers no longer cast the const of their track away

* fix(editor): the Sonar blocker remarks on the stack, no side effects in the operands of && and ||, no local named final (S912, S1669)

Counting the leftover signals, the pieces of a station walk, the places with nothing beside a run and the joints and fouling points
logged by the self-tests no longer counts inside a condition; the last span of a straight is named tail. The counts and what they
log are the same.

* revert(vehicle): an axle on a switch follows the switch as it is set, as before the stack

The axle kept to the path it came on, so a switch thrown under a moving train no longer sent the rest of it onto the other
branch, and coming from the frog end it trailed shaped blades only where the wheels reached them. That changed the running of
every switch in every scenery, and the AI still scans its route by the switch as set. TrkFoll is as on master again, and the
trailing point of the blades it used is gone.

* revert(track): a path is told a straight by its first control vector alone again, as the sceneries are made for

A plain track was drawn bent where its second control vector was off the chord though the first lay along it, and a path with a
radius given was never straightened. Tracks of existing sceneries drawn straight before would have been drawn bent, with their
length, cant and the models along them. TTrack::straightened is the rule of master, for plain tracks and the paths of switches.

The editor keeps a bend dragged with the second control vector, or set by joining the tangents, by moving the first one 2.5 cm
off the chord to the side of the bend, past the tolerance, so the track is drawn, saved and read back bent, by older builds too;
the second one dragged back along the chord takes the first one back onto it.

* feat(track): the switches joined directly to other switches at load told in the log

A switch right after another one is joined to it as the sceneries load, where its end was left open before and vehicles came off
the track there. Each switch joined so is logged with its place and the number of ends, and the whole number once, so a scenery
can be checked for places that run differently now.

* fix(editor): a bend kept by lengthening the first control vector, not turning it

keep_bent moved the first control vector 2.5 cm sideways, which turned the
start tangent: a kink of 0.29 deg on a 15 m track, flagged by the joints
check, and against the fixed direction at a switch or a locked track.

Now the vector keeps its direction and gets 2.5 cm longer than a third of
the chord, which the simulator no longer takes for a straight. It is also
applied after an end is moved or snapped, since a new chord or a snap onto
a neighbour could bring the vector back within the tolerance. With the
second vector back on the chord, the first goes back to a third of it.

* fix(track): each switch joined directly to another one logged with both names

join_switches counted ends, while one join links both switches, and only
the first switch of a pair was named. It now returns the switches joined
to, and the log names both of each joint and gives the number of joints.

* fix(editor): a path drawn bent is kept bent through every edit, one drawn straight is left as it is

The first control vector is made longer past the 2 cm tolerance only where the path was drawn bent before the edit, or where
the edit itself sets the second vector: the end of the path moved, its first vector, its second one, a neighbour followed or
its grade taken, the controls aligned at a joint, an end snapped. A path drawn straight keeps being straight when its ends
move, and the paths of a track that the edit doesn't bend aren't changed. Moving the second vector back along the chord takes
the first one back to a third of the chord where it was made longer here.

* fix(app): a scenery that can't be opened takes the game back to the launcher whatever the file system throws

Catches std::runtime_error again, as master did: invalid_scenery_exception is one of them, and so is what the file system
throws while the scenery is opened.

* fix(track): the beams worked out in the background don't read the ends a switch is set to

The ballast a switch trackbed takes is asked of the tracks joined to its main path, as the trackbed is made at the load,
not of the ends the switch is set to now, which change as it's thrown while the thread runs. What the thread reads with no
lock against the main thread is written down where it runs, with the two things driving can change: a switch thrown and a
turntable turned.

* perf(render): the cut faces of a track drawn with nothing put on the heap, a track with none passed over at once

* chore(track): the switch drawing the cut faces in the unrolled material read only in the builds with the self-tests

* docs(track): the blades flag said to be switched on, and what frogs in eu07.ini changes of it

* fix(editor): a response over 64 MB is refused, curl kept to http and https, the address read as UTF-8

The body of a map or of a service the user typed is read into memory up to 64 MB and fails above that, with WinHTTP and
with curl. curl follows at most 10 redirects and only to http or https. WinHTTP gets the address widened from UTF-8, so a
pasted one with letters past ASCII isn't turned into garbage.

* fix(editor): only the orthophoto an older editor kept is deleted from the settings folder, not all its cache

The geoportal folder of the old cache is removed, and the cache folder itself only where nothing else is left in it.

* fix(editor): the square metre of the outlined area written as its UTF-8 bytes, shown right where /utf-8 doesn't reach

* docs(track): why the velocity read for a switch is put back after its segments are made

* fix(track): the blade tips and the open ends of a track take the dark of the rail, not the colour of a worn tread

No wheel runs over them, so their cut faces aren't drawn as worn: the beige the matte material gives a worn face is left
to the cut faces of the frogs.

* fix(editor): a neighbour followed or given its grade is bent only where its second vector really changed

follow() and follow_grade() write the second vector of a track joined at its end back as it was when the joint didn't
turn or keep its grade; a track the simulator draws straight with that vector off the chord was made bent then, though
the edit never touched it. Its first vector is lengthened now only where the path was drawn bent or the second vector
took another direction or grade.

* fix(track): the open ends of a track laid with cuts take the dark of the rail too

The rails a frog or a crossing cuts are laid piece by piece; the caps of their pieces at the open ends of the track were
drawn worn with the cuts of the frogs. They aren't worn now, as the open ends of the other tracks.

* fix(editor): a neighbour drawn straight is bent only where the edit took its second vector off the chord

follow_grade() sets the height of the second vector anew on every graded joint, a fraction of a millimetre off the height
the scenery has, so a change of the vector bent a track whose second vector stood off the chord sideways already, though
the simulator draws it straight. follow() and follow_grade() keep a path drawn straight bent now only where its second
vector lay along the chord before the edit and stands off it after; a path drawn bent is kept bent as before. How far the
vector stands off the chord is measured in one place, keep_bent() uses it too.

* docs(editor): the comment of keep_bent above keep_bent again, not above the measure of the chord

* Editor: signal reads kept by the signal, level crossing discs, signals out of the gauge, indicators, the signalling tools split (#307)

* fix(editor): the read of a signal stays by it as its track is split, on a switch and when it is moved, and a level crossing disc is placed

The trains find a signal by its read, a passive event in a list of the track, and measure the way to the cell it reads along three
tracks further at most. The editor let the read drift away from the signal, or put it where trains of another path read it.

- A track split in two: a read the trains scan for (a passive event) goes to the piece by the point it reads, whatever its list;
  before, those of the runs towards the end stayed on the first piece. Five splits left the reads of A, B, C and J on the first
  piece while the signals stood on the sixth, out of the reach of the trains. The reads of signals placed since the scenery was
  opened, not bound to an event yet, go to the piece by their signal the same way.
- A signal moved off its track jumped back to that track's end once the track was changed: the track had taken it up as its
  object and measured it again along itself. A moved signal is let go by the track it stood by, and an object of a single point
  moved off the side of its track no longer follows it.
- A switch reads its events to the trains of both its paths. A signal past the frog of a path, where the axes are a gauge apart,
  is passed by the trains of that path only, so its read goes to the track joined to the far end of the path, in the list of
  the trains running from the switch onto it or the other way. Before the frog it stays on the switch. Moving the signal across
  the frog takes the read between the two.
- A signal by a switch on the side of its other path stood on that path, in the way of its trains (0.45 m from its axis); it
  is refused there, placed or moved, with the reason.
- The kind crossing of the descriptions (tsosp, tsospn) is known: the level crossing disc is listed in the palette and placed
  with its read.

Checked in the editor on a hidden desktop: five splits of a track with bound and fresh reads, a signal moved to another track
and the old one raised, signals placed before and past the frog of a switch on both paths, turned and moved across the frog,
saved and opened again with the reads bound, the tracks raised, shifted and bent with the signals following. Unit tests pass.

* fix(editor): a split keeps reads far off the path and bound objects up to 30 m by their pieces

A read the trains scan for moves to the piece by the point it reads only from event1 and event2, only
when it isn't ignored and only when that point is within 50 m of one of the pieces; a read at the
station building stays in its list. An object bound by hand keeps its binding as its path moves up to
30 m from it, an adopted one up to 12 m as before.

* feat(editor): the tracks that read a signal are drawn and can be picked, flipped or dropped

The selected signal shows each read of its _sem_info as a thick band over the reading track, arrows
in the way the read is scanned, a line from the foot of the signal and a plate with the list and the
track; the hovered one shows them thinner and placing or moving a signal shows where it will be read.
The panel lists the reads: each can be turned the other way or removed, "Pick the path" takes a
click on a track (with Shift one read more or less) and "By the path it stands by" puts back the
read the signal gets when it is placed. Each change is one step of the undo.

The self-test gets signalread, signalreadflip, signalreaddrop and signalreaddefault, and the probe
lists every read of a signal.

* fix(editor): a moved or turned signal keeps the reads picked by hand, and a read set again isn't an undo step

Moving a signal, taking it across the track or turning it put back only the read by the track it
stands by and dropped the others: those stay on their tracks now, on the other list when the signal
is turned. Setting the reads the signal has already says so and adds no step to the undo. Picking a
reading track disarms the template, so a click after Esc doesn't place a signal, and the signals
are listed again after any change of the history, also once it is full.

* feat(editor): a signal is placed out of the gauge of the tracks around it

As a signal is placed, moved, taken across or turned, its models are measured against the gauge
chosen in the Gauge window along every path near it. One that enters it is taken sideways, away
from the axis of the track whose gauge it enters, as deep as it went in and 3 cm more, in the same
step of the undo; between two tracks too close for it, it stays where it was put and the status
tells which gauge it enters and how deep. A gantry is only measured.

The panel of the selected signal tells when it stands in the gauge, with a button to move it out,
and the view marks the deepest place. The gauge tool measures any models against the paths around
them for it. The self-test places a signal at a given offset and its probe tells the gauge.

* fix(editor): a moved signal leaves only the read of the track it stood by, and the gauge is checked on its level

The reads a moved signal keeps were all but the first one listed, which is the first track of the
scenery having it, not the one the signal stood by: a read picked by hand could go and the track
it left could keep it. It is the read of the track it stood by that goes with it now, and turned,
eventall1 and eventall2 swap as well. A track more than 2 m above or below the foot doesn't push
the signal aside, the status tells the real distance it went, the gauge is measured again when the
signal follows a dragged track, and the marker in the view shows only what is up to date.

* feat(editor): indicators put on a signal from the panel, they move and go with it

The indicators of scenery/pkp/wskazniki described as "category: indicator"
are offered under the selected signal, grouped by their sign. One is put
in as an include named after the signal, on the srk layer:

- a lit one (place: head) under the lowest lamp of the signal, 0.73 m
  below it and 5 cm ahead of the mast, each next one 0.45 m lower; a dwarf
  signal is refused, it has no mast for one;
- a plate (place: foot) at the foot of the signal, its model has its place
  by the mast built in.

The panel lists the indicators standing by the signal with a Remove
button. They are found as the includes whose first parameter is the
signal's name, within 1 m of it in plan. When the signal is flipped,
turned or moved, they keep their place in its frame, in the same undo
step; deleting the signal deletes them too. If the signal and the
indicator both define an event, the status says so, since the scenery
keeps only one of them.

The self-test gets signalindicator and signalindicatordrop, and its
signalprobe gives each indicator's height and the height of the lowest
lamp.

* feat(tools): indicator descriptions and the indicators taken out of the signal templates

indicator_headers.py writes //$e descriptions into the LED indicators of
scenery/pkp/wskazniki (W19, W20, W21, W24, W26) with the events each
shows. It also makes the indicators that were so far only built into the
signal templates:

- W1 of the warning discs, new, old and with the light strip;
- W1 and W18 (new and old) of the block signals;
- the I, II and III plates of the repeaters.

The plates fixed flat to the mast are moved 4 cm ahead. Their back is
5 cm from the mast's axis, while the mast is 6.1 cm thick and its clamp
under them 8.3 cm, so the mast went through the plate, in the templates
too.

* fix(editor): a signal turned or moved by the gizmo is read and kept out of the gauge, its indicators go with it everywhere

The gizmo of an include only rewrote the numbers of a signal. Its read stayed on the event it had, even when the signal was turned
to the trains of the other direction. Its indicators stayed behind, its height could be dragged off the ground, and the gauge
wasn't checked. Now:

- the gizmo moves a signal in the plan only, at the height it has;
- while it is dragged, its indicators keep their place by it;
- once it is let go, the drag is made again as a move of the signal tool, one step of the history: the read goes to the event of
  the trains it faces on the path it stands by, and it is taken out of the gauge;
- dropped away from every track, it goes back where it stood.

The indicators of a signal are found in the scenery now, not in the list the signal tool keeps up only while it is open:

- deleted from another tab, the signal takes them with it;
- a signal renamed in the node properties gives its new name to them in the same step of the history;
- in the station and line batches, a renamed signal renames them, and a removed one removes them;
- the binding of objects to tracks puts them on the path reading their signal, not on the one nearest to them, and a signal moved
  by hand lets go of them too.

Also:

- a signal on a gantry takes no indicator from the list;
- an indicator a signal has already isn't put on it twice;
- the signals and their indicators are found in one pass over the includes, the indicators by the name of their signal;
- a step of the history with tracks is always one of their edit, so they are taken back with the includes.

The self-test gets signalgizmo, which turns and moves a signal as the gizmo does.

* fix(tools): indicator_headers.py keeps the files it replaces, writes beside the data on request

- An indicator it made, found changed, is put into a tar in editor_backup before it's written again.
- --sidecar writes the descriptions of the lit indicators into editor/templates, as the other header scripts do, the files of
  the game left alone.
- The indicators it makes are copies: the signal templates keep their own, and the docstring and the files say so.

* fix(editor): a signal moved by the gizmo by another track is read by it, the templates known without the signal tool

- At the end of a gizmo move the nearest track takes the signal when it is nearer than its own by more than 0.5 m; a track it
  was dropped onto, within 1.2 m of its axis, doesn't, so a signal only turned between two tracks or dropped onto one in a
  switch keeps its own.
- The signal templates and indicators are looked for when a signal is renamed or its gizmo shown, so its indicators follow
  without the signal tool opened first.
- A drop refused puts the gizmo and the node properties back where the signal stands.
- The indicators follow only once the gizmo made its step, and the ones not changed are left alone: grabbed and let go it
  changes nothing.

* fix(editor): a signal dropped by the gizmo onto a track keeps its own, the gizmo doesn't wait for the template scan

- When the nearest path to the drop is within 1.2 m of its axis, the signal keeps its own track, instead of only that path
  being left out: dropped onto a middle track it no longer goes to the track beyond it.
- The gizmo starts the signal template scan without waiting for it, so a rescan with a signal selected doesn't stop the
  editor; renaming a signal still waits.

* feat(editor): the signalling split into Signals, Station, Station signals and Line block

The one Signalling tool held the signals placed by hand, the whole wizard of a station and its checks; each is now a tool of its
own in the toolbar:
- Signals (I): the palette, a signal placed by a track, dragged along it, selected; a click on a switch no longer opens a station.
- Station: LMB on a switch lays the station out; its name, code, line, km, speed and braking distance, the numbers of the
  switches, the track circuits, the number of the selected track, the list of the switches.
- Station signals: the signals of the whole station placed at once, the template of each of their kinds (main, shunt) chosen in
  a table, and below what the signalling lacks: the repairs, the SHP resonators, the track lengths, the signal heads.
- Line block: the block of each line, the block boundaries drawn by hand, the line signals, the templates of the block signals
  and warning discs.
The station tools share the open station and its schematic; Station signals and Line block show what the Station tool set for
it, the line and the km in red where the line block needs them. The template table replaces the palette in the station
tools, so choosing a template there no longer arms placing. Two icons drawn for the new tools, in editor_icons.py too; the
png is drawn by the same shapes, Pillow wasn't at hand. The tracktab self-test takes a tool by its name, and srkopen shows the
Station tool.

* feat(editor): a signal shows its distance from the track axis and to the switch ahead, and goes to 50, 100 m... from it

- editor/editorTrackTrace: the track followed the way a train runs, shared by the W17 markers and the signals. The fouling
  point of a switch (where the axes of its tracks are 3.5 m apart) moved here from the lineside tool, and danger_ahead
  finds where a train first comes to a switch: the start of one it runs onto from its start, or the fouling point of one it
  runs onto from behind, which may lie behind the point (a signal in the fouling zone).
- The card of the selected signal: its distance from the axis of its track, and along it to the start or the fouling
  point of the switch ahead, in red when it stands inside the fouling zone. The overlay draws the same as a dimension line
  beside the track on the side of the signal, with the distance at the place.
- Placed, dragged along or moved with the gizmo, a signal goes to a round distance to the switch ahead (50 m steps) when
  within 2.5 m of one; Alt keeps it where it is. The drag of a new one is measured from where it was pressed.
- The fixes of the review of the split: the click label of the station tools in their own branch and a plain select in
  Signals, the card of a signal picked from the check lists shown in Station signals, and the help texts naming the
  Templates table and the Signals tool.
- Self-tests: signalprobe logs the distance from the axis and to the switch ahead, signal snap=1 snaps as placing does.

* feat(editor): the fouling point widened in the curves under 250 m, as the standard of the gauge says

Standardy techniczne PKP PLK, tom II (from 2025-07-17), 6.5-6.6: the W17 marker stands where the axes of the tracks are
nominally 3.50 m apart; where one of the tracks lies there in a curve under 250 m that spacing grows by the widening of the
gauge from its radius (annex 1, table 1), the widenings of both summed when both lie in curves.

- editor/editorFouling: the fouling point found along the axes of the main track and the branch, standing on its own: at
  each point of the branch the spacing wanted is the nominal one plus, for each track, the widening on the side of the
  other track from its radius there (taken over 5 m each way): 50000/R - 185 mm towards the centre of the curve,
  60000/R - 225 mm away from it, none from 250 m up.
- gauge::curve_widening gives table 1 of the gauge the editor checks already.
- The W17 tool and the distance of a signal to the switch ahead both use it; the card of a signal shows how far apart the
  axes are at the fouling point, the help of the W17 tool says where the figures come from.
- Unit tests: a straight branch at 1:9, a branch in a curve of 300 m (no widening) and of 200 m (outer widening), both
  tracks in curves (both widenings summed) and a straight branch off a curving track.

* feat(editor): the cant leans the cars into the fouling point, and the fixes of the review of the metre

- The fouling point takes the cant in, as Ie-1 wants it placed "with the gauge, the cant and the widening in the curves":
  the cars of a track on a cant lean towards the inside of its curve by D Hi / 1500 (bD of table 1 of the standard of the
  gauge), so when the other track lies on that side the spacing wanted grows by it, taken at 3.05 m over the rail top, the
  top of the widest part of GPL-1. The cant of each point comes from the roll of its path as the gauge tool takes it. At any
  radius, as the table has it; the track leaning away adds nothing.
- Below 150 m, where table 1 ends, the widening from the radius is that of 150 m rather than the formula run on.
- A switch run onto from behind has its fouling point looked for once its own path is walked too, so one lying on that
  path is found rather than skipped for a farther switch.
- A point behind a signal lies on the track of the farther end of its segment, so a signal snapped back over a joint lands
  at the round distance rather than at the joint.
- Alt keeping a signal off the round distances reads the key from ImGui, which Global.altState misses while ImGui holds the
  keyboard. The gizmo doesn't snap a signal: a1d10bb0 says it does, it's placing and dragging with the tool only.
- The help of the distance on the card stays on the distance, the spacing of the axes under it. The unused
  track_trace::nearest_on is gone.
- Unit tests: the cant leaning towards the other track in a curve and at 300 m, nothing when leaning away, and the table
  ending at 150 m.

* fix(editor): the cars lean the way the cant of their track tips them, taken 3.25 m up

- The cant along the trace keeps its sign: a roll above 0 lowers the left rail of the path (as the editor lifts its
  terrain by it), turned to the way the track is walked. A track adds the leaning of its cars to the spacing wanted at the
  fouling point when the other track lies on the side its lower rail is, whichever way it curves: a branch on a cant
  against its own curve leans towards the main track on its outer side, which d70f189c missed, and a cant on the straight
  counts too.
- The leaning is taken 3.25 m over the rail top, the top of the widest part of the cars, rather than 3.05 m of GPL-1.
- Unit tests: a cant against the curve, a cant on the straight, and the leaning away still adding nothing.

* fix(editor): the station tools tell by the mouse what a button came to, and the fields of a station read as empty

What a button of the Station, Station signals and Line block tools came to was written at the foot of the panel, under the
lists, scrolled away: a click which refused for want of the code of the station looked as if nothing happened. It's told now by
the mouse which clicked, a refusal in red as the other tools do, and in the status bar. The fields of a station still empty
show their examples as such, "e.g. BPd", not as values typed in; the Station tool says above its steps that the code is to be
typed first, Station signals that the code and the track circuits are wanted, the code marked there as needed.

The check of a warning disc and of a block section went by the braking distance of the station, while Set the line signals
places them by the one of their line: on lk357 a disc placed 700 m before Z, the line run at 100 km/h, was marked as standing
nearer than the 1000 m of the station. A signal of a line out is checked by the braking distance of its line now.

* feat(editor): the joints of the track circuits put, moved and taken away by hand, kept by the station

The Station tool gets Edit the joints by hand: LMB on a plain track of the
station puts a joint there, LMB on a joint takes it, then on a track moves
it, on it again takes it away. The circuits are set again at once, one step
of undo each. The joints so changed are kept in the //$s record of the
station (joints +x/y/z for one put, -x/y/z for a planned one taken away),
so Set the track circuits keeps them; As planned forgets them. The undo
step carries the hand joints of the station with the tracks.

srkjoint drives it in the self-tests.

* feat(editor): the indicators under the lights reordered, a signal set from the axis and raised, standing on the ground by default

The indicators under the lights of the selected signal get arrows up and
down: one changes places with the indicator above or below it, a plate at
the foot keeps its own. One step of undo each.

The distance of the selected signal from the axis of its track is typed in
the panel, it moves across as far along the track as it stands, the gauge
pushing it out again where it comes too near. Its height is set the same
way, raised over where it stands by default, over the rail heads on a
gantry.

A signal is put on the ground by default, the zero of its model 0.38 m
under the rail heads: the ground lies 0.35 m under them as Ie-102 draws it
(Lx), the foot of the mast stands on the foundation 3 cm over it in the
models of pctga, and the sceneries made by hand (Wrzosy, Baltyk) stand
their signals 0.20 m under the rail foot so. It stood on the rail heads.

signalindicatorswap and signalacross drive it in the self-tests.

* fix(editor): the hand joints of a station without a record, of its ends and of another station; a dragged signal keeps its place across and its height

- Edit the joints by hand on a station not described yet read the record
  of index -1: the hand joints are shown only for a station with one.
- The joint between the station and a line out of it can't be taken: taken
  away, the circuit of the switch ran on over the tracks of the line.
- A joint held is let go when another station opens, a move by less than
  half a metre lets it go, and a change no step of the history takes is
  undone, so the undo knows every change of the joints.
- A signal dragged or snapped along its track keeps its distance from the
  axis and its height over the default, set by hand or standing so before.

* fix(editor): a dragged signal carries what it had by its own track; As planned forgets the hand joints that change nothing

The distance from the axis and the height of a dragged signal were taken
against the track it was dropped onto: dropped on the next piece of its
line, on a grade or by a parallel track it came out too far, in the gauge
or off the ground. They are taken as it stood by its own track at the
start of the drag. As planned clears the hand joints even where the
circuits come out the same.

* fix(editor): a signal stands as high over the rail heads as its include gives, lowered only where its bottom would hang over the ground

The default height of a signal was 0.38 m under the rail heads for every model. It is now read from the
description of its include, `//$e signal: {..., height: <m>, depth: <m>}`: height is where the zero of the
model stands over the rail heads (by Ie-117 § 15 the top of the foundation of a mast 0.10 m under them, of
a dwarf 0.20 m), depth how far the model reaches under its zero. With a depth, a signal whose bottom would
hang over the ground, down an embankment, goes down onto it, by at most 3 m (more is taken for a bridge).
Without a height the zero stands at the rail heads.

"Raised" in the panel, a signal moved across or dragged, all count from that default height.

* fix(editor): a signal flipped, given another template or its variant for the other side stays as raised as it was

The default height now depends on the template and on the ground under the signal, so keeping the height
as it was no longer keeps the raise. Flipped to the other side of the track, the signal is raised over the
default there as it was over the default on its own side. Given another template (Swap), or the variant of
its template for the other side when moved or placed, it goes up or down by how much the default height of
the new template differs from the old one.

* fix(editor): As planned forgetting hand joints that change nothing is a step of undo of its own

With nothing in the circuits to change no step of the history took the forgotten joints, so they went with no undo for it: Ctrl+Z took back the step before. The anchor of the station as it is now carries them in a step of their own. The signalmove selftest gets its carry indented with the block it is in.

* feat(editor): an indicator under the lights goes in its place by Ie-117, from the top W21, W24, W20, W19, W26

Put on a signal, an indicator under its lights was put below the ones there. It now goes in its place by Ie-117 section 12.1 among them, under the last one it doesn't go above, the others (W18 and the rest) below these; the ones under it move a place down, in the same step of undo.

* fix(editor): the signal card and the move of a signal keep no pointer across a refresh of the signals

- The card of the selected signal went on after "To the other side" or
  "Turn around" with found pointing into the list of the signals
  standing, which their refresh had just replaced: the indicators and
  the gauge of the card read freed memory. It now ends that frame there.
- signal_move_to read the mount of the template after the refresh,
  which may scan the templates again; it is taken before it.
  signal_place takes a copy of the template given for the same reason.
- The fouling test counts its metres with an int, and the search of the
  middle point of the radius is a while loop (no floating loop counter).

* fix(editor): the dimension line to the danger point counts its metres with an int (Sonar S2193)

The line drawn by the track from a signal to the switch or fouling point
ahead stepped a double by 1 m. It now counts the whole metres with an
int from the same first one: the points are the same, since adding 1 to
a whole double and adding a whole int to it give the same values.

---------

Co-authored-by: maj00r <maj00r@host>

* feat(editor): ride the camera along the tracks, and a minimap with stations by their W4 (#317)

* feat(editor): the camera rides along the tracks, over the joints and switches and over to the tracks alongside

Y puts the camera onto the track under the cursor (or the nearest one), looking along it 3 m over the rails.
W/S drive it ahead and back the way the camera looks, Shift and Ctrl faster (20, 60, 250 m/s); A/D take
it over to the track alongside, a click to any track; E/Q and the wheel raise and lower it; the mouse looks
around as when flying. At a switch entered from its blades it goes straight on, Z picks the turnout for the
camera alone: no switch is thrown, no track learns of the ride. The bar over the view shows the track, the
km, the speed, the height and the switch ahead. Y or Esc ends it. Self-test commands ride, ridewalk,
ridejump, rideahead, rideprobe and rideleave.

* feat(editor): a minimap of the tracks with the camera on them, and the stations found by the names of their W4

View / Minimap and stations (W4), Ctrl+M: a window with the rail tracks seen from above, the camera as
a triangle the way it looks, the track ridden along in orange and the stops of passenger trains as dots
with the names of their stations. It follows the camera, or is dragged and zoomed apart from it; a
click takes the camera there, riding along the track onto the track there. Above it the stations the
PassengerStopPoint memory cells and events name, searched by a part of the name with or without the
polish letters; a click (or Enter for the first found) flies the camera over to the stop looking along
the track, riding it rides on from there, each click to the next W4 of the station. Self-test commands
minimap, stations, station and minimapclick.

* fix(editor): the ride and the minimap after the review, with fewer words on the screen

- Ctrl+S, Ctrl+Z and the other shortcuts reach the editor while riding; Esc closes
  an open popup first
- no key stays held when a window takes the keyboard, the place is kept within
  a path that got shorter, a release of the mouse goes where its press went
- the minimap keeps under the vertex limit of a draw list, Enter in the search
  goes round the stops of the station, the marked station stays marked
- the bar of the ride is one line: the track, km, speed and height; the switch
  ahead under it, the keys only while standing
- the minimap in the Map menu, opening over the view, with short texts; the
  context menu of a track rides along it

* feat(editor): the ride drives with the right button held, as the camera flies, and the editor works on along it

- W/S, A/D and Q/E drive the ride only with the right button held; without it
  they're the editor's keys again (Q/W/E the gizmo)
- the left button and Esc go to the tools while riding: tracks and objects are
  laid and selected from where the ride took the camera; Y leaves, a flight of
  the camera to a framing leaves too
- after the review: the help names Ctrl+W/Ctrl+Down as the much faster drive,
  the stops of the minimap stay within the vertex limit, the search field lets
  the keys go after Enter

* fix(editor): the tools keep their wheel and the menu of a track its click while riding, a pan or the view from above ends the ride

---------

Co-authored-by: maj00r <maj00r@host>

* feat(editor): signals placed by the editor get a name plate drawn by python (#316)

* feat: Elf emergency brake position in the master controller (eu07/maszyna#413)

The Elf's master controller (EIMCtrlType 2) gets an optional emergency
brake position below its position 0, turned on by the new .fiz key
EIMCtrlMainEmergency=Yes in Cntrl (default No, no change without it).
With it the old positions move up by one (MCPN 5, neutral at 4): the
emergency position brakes fully at once and vents the brake pipe, like
the alarm chain or the Impuls's EIMCtrlEmergency. The loader raises a
too small MCPN to 5 and logs it. The Elf code with hard-coded positions
(CheckEIMIC, the MED full braking, the AI) takes the shift into account.

SVN data to change afterwards (dynamic/pkp/elf_v1, needs this exe):
- every .fiz with EIMCtrlType=2: EIMCtrlMainEmergency=Yes, MCPN=5,
  DirChangeMaxPos=4 where present;
- the cab .mmd mainctrl entries: offset one notch lower (-0.06 -> -0.09),
  sounds shifted one index up, new sound0 with
  26284_elf_nastawnik_nagle_*.wav.

Issue: (eu07/maszyna#413)

* fix: Elf emergency brake position vents the pipe only from the driven vehicle, coupled units agree on the controller position

The emergency position of the master controller vented the brake pipe from
every vehicle whose controller stood there, and "MainCtrl" reached the coupled
vehicles raw, so an Elf with EIMCtrlMainEmergency and one without it disagreed
by one notch (the full braking of one was the emergency brake of the other,
neutral of one a power position of the other). The pipe is now vented only
from the vehicle driven from (IsCabMaster()), and the position goes to the
coupled vehicles in the positions without the key (MainCtrlPosForCoupled(),
the emergency one as the full braking), each adding its own shift on receiving
it (MainCtrlPosFromCoupled()).

The loader's fix-up for the old MCPN=4 raises DirChangeMaxPos by the same
shift, so the reverser keeps working at the new neutral.

* feat(editor): the signals the editor places get a plate with their name, drawn by python

A signal placed with the signal tool used to get the plate texture of
textures/tabl named like it, or none at all. Now, unless a texture is
picked, its plate is made by python/local/signal_plate.py:
"make:signal_plate?name=<name>", a light plate with a dark edge, four
screws and the name in black, the way the plates of textures/tabl look.
Renaming the signal in its properties renames a drawn plate with it; a
picked texture stays.

The templates put the plate after a folder, "tabl/(p6)", so
material_data::assign() takes the folder off a skin which names a
texture made by a script.

* fix(editor): a drawn signal plate keeps following a cleared name, and isn't made for a name it can't carry

Clearing the name of a signal in its properties made its plate the drawn
plate of no name, which then never followed the name again. A drawn
plate now follows any rename to a name, and keeps the last one while the
name is cleared.

A name with '|', '&' or '?', or one longer than 64 characters, gets no
plate (0_nothing) instead of a broken one: '|' splits the skin, '&' and
'?' the query of the script, and a very long name made a path too long
for the file system when the skin was looked for on the disk.

* fix(editor): a signal plate keeps its last name through a name it can't carry, and a plate named by hand stays

Renaming a signal to a name its plate can't carry turned the drawn plate
into 0_nothing, and it stopped following the name for good. Such a name
now leaves the plate with the last usable one, like a cleared name does,
and the plate follows again once a usable name is typed.

A drawn plate whose name was given by hand, different from the name of
the signal, is no longer replaced on a rename: only the drawn plate of
the signal's own name follows it.

* feat(editor): the drawn signal plates come in three looks, plain, toned and aged

The plate drawn by python/local/signal_plate.py looked too clean. It now
takes a look in its query, "make:signal_plate?look=toned&name=Tm12":
plain is the bright plate it was, toned a greyish field with a little
grain and dust towards the bottom and the sides, a thinner edge, smaller
screws and graphite letters, aged a darker, grainier and dustier one.
Toned is drawn when no look is given.

The signal tool picks the look under the plate, kept in the settings of
the editor. A rename of the signal in its properties keeps the look of
its plate.

* perf(editor): the grain and the dust of a drawn signal plate are made on whole images

The toned and aged plates shaded their field a pixel at a time in
python, about 34 ms a plate with the interpreter held, so a station of
a hundred signals in view kept the python queue, and the screens of the
cabs, waiting for seconds. The dust is now made once per look, and the
grain from random bytes of the name, both put on the field with
ImageChops: about 2 ms a plate. The mean colour of the plates stays the
same; only the grain falls differently.

* fix(editor): the station signalling draws the plates of its signals as their schematic names them

The plates the station signalling places and renames say what its
schematic shows (Tm3, F1, ToA, a block signal without the stem), and a
template swapped in for a signal without a plate draws that text too
rather than the small letters of the name. A signal left for removal
gets a plate of no text again, not one saying "_old".

No plate, 0_nothing, or the texture named like the signal, what the
editor gave before the plates were drawn, become the drawn plate when
the signal is renamed, in the properties panel as by the station
signalling, in the look set in the editor.

* fix(editor): a plate of a scenery named like the end of the name of its signal stays through a rename in the properties

A texture pzs_a was given by its scenery as a, its real plate: a rename in the properties panel keeps it. Only the station signalling, which looked its plates up that way, takes such a one for its own.

* feat(editor): the drawn signal plates are 256 pixels across, sharp up close

The edge, the screws and the blur are drawn bigger by as much as the plate is, and the grain is as coarse as before, so the three looks stay as they were. The smallest letters tried grow with the plate too.

* feat(editor): a drawn signal plate takes a speed index and the m of shunting signals, typed in the signal tool

signal_plate.py draws the speed index after the name, one digit up at
its right or two as a fraction across the height of the letters (index=4,
index=12 for 1/2), and with m=1 an "m" on a strip of its own under the
name, as Ie-1 marks a semaphore giving shunting signals and as the
textures/tabl a-12m plates show it.

The signal tool has a field for the index and a box for the m under the
look of the plate; the hint of the plate names them (B 1/2 m). The
style of a drawn plate, its look with the index and the m, stays with
it through a rename, in the properties panel and by the station
signalling, which sets neither. The signal selftest takes index= and m=.

* fix(editor): the speed index of a plate takes only digits as they are typed

The decimal field let in signs and dots, which stayed shown while the index held only the digits, and filled the two places before a second digit could go in.

* fix(sonar): the remarks on the drawn signal plates, to pass the quality gate

The new code of the plates was 5.2% technical debt against the 5% of the
gate. Fixed the small remarks; the big functions stay as they are:
- the speed index field and the plate looks are std::arrays, the index is
  copied without snprintf, the combo of the looks has a function of its own
- ranges algorithms, a string_view for signal_plate_drawn, emplace_back
- signal_plate.py: dict literals, a cache of fonts not named like FONTS,
  no unused local, the name and the m drawn by methods of their own; the
  plates drawn are byte for byte the same as before

---------

Co-authored-by: jerrrrycho <jurek.pakula@gmail.com>
Co-authored-by: maj00r <maj00r@host>

* fix(editor): the tutorial and the hints tell of the kilometrage, and the first lesson takes O either way

The kilometrage (X) was in no hint, no shortcut list and no lesson, though the hectometre posts and the block signals are numbered after it. The row of the track tools now reads L T G N U I X B P V J, the turntable with it, and F1 lists I / X / B. The lesson of the signals and the posts says what X does and where the posts take their numbers from, the km of the line or the km typed in their panel for the place clicked, and it opens with the kilometrage tool too. The first lesson asked to switch to the view from above, which a scenery made in the wizard opens in already: O either way does it now.

* fix(editor): master's road lifting texts translated, and the panning by the wheel told of in 3D too

The merge of master left the status and the label of the lifting of the road points in English: both go through the translations now. Master pans the 3D view by the wheel as well, so the lesson, the hint row and its line say it works in both views. <cstring>, dropped from the road tool before, came back in the merge and is gone again.

* fix(editor): the tools of a plain line in sight, the km of a line set once, a lesson of a whole line and of the ride along a track

What a layman building a line with signals and posts couldn't find:
- The Signals, Kilometrage and Posts tools are in the main row of Tracks, after the tools of laying; the stations, their signals, the line block, the turntable, the trainset and the checks stay behind More.
- "Objects" was where the hectometre posts are: the tool is Posts now (Słupki), its hints say the line the posts go along.
- The km of a line could be typed in three places that didn't lead to each other. The panel of the posts and the one of a station, where the line has no km set, say the typed km is theirs alone and have Set the km of the line (X), opening the Kilometrage tool; that tool says first that one known point serves the posts, the stations and the block signals.
- The hint of the Signals tool says to pick a signal in the list, then click beside a track; with no templates the panel says so in plain words.
- A new lesson, A whole line, step by step: the tracks and switches, the km, the station, its signals, the line block, the posts and the drive, with a button to the station tool, and opened with the station tools.
- The first lesson shows the ride of the camera along a track (Y, then W S A D and Z) and has it as a step to try.
- lang/editor_pl.po: "Restore the terrain" and "Drag an end" were there twice, the second copies are gone.

Checked: MSVC build, unit tests 459/459; editor run on a small scenery, screenshots of the toolbar, the new lesson, the first lesson with the ride ticked after Y, the panels of the posts, the kilometrage and the signals. The station panel with no km of the line wasn't seen, the scenery had no station.

* fix(editor): the posts open expanded from the trainset, and the Polish of the whole-line lesson reads right

B or the Posts button pressed while the trainset tab is shown opens the hectometre posts with their panel expanded.
The Tracks area tooltip names the kilometrage and the posts.
The station step names the shunting signals, the station button says Narzędzie Stacja, and the ride rows and the lesson list read smoother in Polish.

* fix(editor): a bent model is lengthened along the tracks joined to its own, laid along another track after the bending, and set by fewer settings

The ends of a bent model have handles in the view: dragged, the model goes on along the tracks joined there, at a switch the way it's dragged to.
Its length, a drag of the whole model and a drag of an end all follow the joined tracks; before, they went on straight past the end of the track under the model.
The panel of a bent model picks its track: another one picked, the model stays where it stands, a platform turns its edge to the new track and keeps its length.
On top stay the track, the length, the offset and the height, bent or repeated, and the platform edge; the reference point, the position along, turned, mirrored, the cant and the gauge widening went under More settings.
The buttons of the model's own length and of the whole track are gone: the length field and the handles do it.
The links of a model to its tracks are counted anew when its pieces change, undo and redo included.

* fix(editor): the bends of straights laid from the end of a curve begin with a straight, not a compound curve

In the mode of straights the curve of a plain track's free end no longer goes on into the curve of the first bend as a compound curve.
The line comes out of the end's curve by a transition onto a straight, and each bend gets a curve of its own.
Only a curve traced in the mode of a curve goes on from the curve of the end, as it already did at a switch.

* fix(editor): the bent model keeps its links and its line to what it reaches, and drags without rebuilding at each track

- the links of a bent model are matched anew whenever any of its pieces change, not only the first
- the line is lengthened by the plan lengths of the joined tracks and built once a round; a drag reuses the line made at its start while it doesn't grow
- the tracks of one name are told apart in the track lists, and a deleted track leaves them
- the tracks at the ends the copies no longer reach are left out of the line after an edit or a drag

* fix(editor): a click on a bent model's handles changes nothing, and the track picked stays picked

- the line is trimmed on a drag's release only when the drag changed the model, and an edit that trimming undoes makes no undo step
- the track picked for the bending is kept by the track, not its place in the list, when the list is gathered anew

* fix(lang): a stray line taken out of editor_pl.po

A single "r" between two entries, left by an edit of the switch texts: msgfmt refuses the file with it.

* feat(launcher): the range of the aerial photos of a new real scenery given on the map, changed later in the editor (#328)

* feat(launcher): the new real scenery gets the range of its aerial photos on the map, changed later in the editor

The wizard of a new scenery asked only for the centre; the editor then
downloaded the photos around the camera wherever it went, and a scenery
had no range of them until one was drawn in the orthophoto settings.

The realistic scenery is made in three steps: the name, the place (a
click on the map or the place typed, degrees or PUWG 1992), and the
range of the aerial photos: a square of 1, 2, 5 or 10 km around the
centre, or an area of the user's, its corners clicked on the map. The
range is drawn on the map with its size and the number of the tiles,
and it's written to the scenery as the download area (//$z), so the
editor downloads the photos and the terrain model inside it only.

What a beginner gets wrong is told before the scenery is made: the
button stays off with the reason under it (no name, the name taken, no
centre, the centre outside Poland, an area being drawn or crossing
itself), and a warning comes with the centre outside the area, a large
area and a centre clicked on the map of the whole country (the map
zooms to the place after the first click).

In the editor the download area says in plain words what it does, a
square around the camera replaces it in one click, and with the camera
outside it a note at the bottom of the view says there are no photos
there, with the way to the range.

* fix(launcher): the range of the photos asked for after the centre, the drawing given up as with Cancel, the square named by its sides

The review of the range of the aerial photos found:
- with My own area chosen before the centre, the clicks meant for the
  centre went to the corners of the area: step 3 waits for the centre;
- switching to Fictional while drawing dropped the area there was
  before, and an unfinished one of three corners counted as done: it's
  given up as with Cancel now, also with Esc; Enter ends it, Backspace
  takes the last corner back, as in the editor;
- the error of a place mistyped stayed after a click on the map;
- the largest square was told to be large or not by the rounding: the
  warning comes from 50 sq km on;
- "2 km" read as a radius: the squares say "2 x 2 km", the tooltip how
  far each edge is;
- a place typed with an area of the user's fitted the map to the area,
  not to the place.

In the editor the note of the camera outside the range says the terrain
model isn't there either, its button says it opens the settings, it
stands above the strip of the profile and the keys of the tools, and it
can be closed until the camera is back inside. The squares around the
camera want the place of the scenery on the map, and replace an area
there is, or start one of 10 x 10 km, only with a yes.

* fix(editor): one note of the empty scenery in the middle of the view, the warnings of an area told once it's drawn

A new scenery opened in the editor showed two notes of the same over
each other in the middle of the view: the panel of the track tools
("The scenery has no tracks yet") and the line of the terrain ("This
scenery is still empty"). The line gives way to the panel now.

In the wizard the centre outside the area and the crossing edges were
told while the area was still being drawn; they're told once it's done.

* fix(editor): the note of the camera outside the range of the photos hidden while the camera rides a track

Its lines at the bottom of the view are where the camera riding a track writes the next switch and its keys.

---------

Co-authored-by: maj00r <maj00r@host>

---------

Co-authored-by: maj00r <maj00r@host>
Co-authored-by: Hirek193 <polomarket73@gmail.com>
Co-authored-by: jerrrrycho <jurek.pakula@gmail.com>
2026-11-11 21:34:39 +01:00

2824 lines
129 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
//---------------------------------------------------------------------------
// Q: 20160805 - odlaczenie pliku fizyki .pas od kompilacji
#include <array>
#include <map>
#include <optional>
#include "hamulce.h"
#include "couplerphysics.h"
#include "scripting/ladderlogic.h"
#include "vehicle/odometerreading.h"
class cParser;
/*
MaSzyna EU07 locomotive simulator
Copyright (C) 2001-2004 Maciej Czapkiewicz and others
*/
/*
(C) McZapkie v.2004.02
Co brakuje:
6. brak pantografow itp 'Nie do konca, juz czesc zrobiona - Winger
7. brak efektu grzania oporow rozruchowych, silnika, osi
9. ulepszyc sprzeg sztywny oraz automatyczny
10. klopoty z EN57
...
n. Inne lokomotywy oprocz elektrowozu pradu stalego
*/
/*
Zrobione:
1. model szeregowego silnika elektrycznego sterowanego reostatem
2. fizyka ruchu - sily oporu, nachylenia, przyspieszenia styczne i normalne,
przyczepnosc/poslizg przy hamowaniu i rozruchu
3. docisk klockow hamulcowych -hamulec reczny oraz pomocniczy hamulec pneumatyczny
4. ubytki cisnienia wskutek hamowania, kompresor - ladowanie zbiornika
5. niektore uszkodzenia i awarie - logika rozmyta
a) silnik elektryczny - za duzy prad, napiecie, obroty
b) sprzegi - zerwanie gdy zbyt duze sily
6. flagi niektorych dzwiekow
7. hamulec zasadniczy - elektropneumatyczny (impulsowanie), pneumatyczny - zmiany cisnienia
zwiekszenie nacisku przy duzych predkosciach w hamulcach Oerlikona
8. sprzegi - sila, tlumiennosc
9. lok. el. - wylacznik glowny, odlacznik uszkodzonych silnikow
10. parametry trakcji
11. opoznienia w zalaczaniu stycznikow
12. trakcja wielokrotna
13. informacja na temat zrodla mocy dla silnikow trakcyjnych, ogrzewania, oswietlenia
14. dumb - uproszczony model lokomotywy (tylko dla AI)
15. ladunki - ilosc, typ, szybkosc na- i rozladunku, funkcje przetestowac!
16. ulepszony model fizyczny silnika elektrycznego (hamowanie silnikiem, ujemne napiecia)
17. poprawione hamulce - parametry cylindrow itp
18. ulepszone hamulce - napelnianie uderzeniowe, stopnie hamowania
19. poprawione hamulce - wyszczegolnenie cisnienia dla stopni hamowania
20. poprawione hamulce elektropneumatyczne
21. poprawione hamowanie przeciwposlizgowe i odluzniacz
22. dodany model mechanicznego napedu recznego (drezyna)
23. poprawiona szybkosc hamowania pomocniczego i przeciwposlizgowego, odlaczanie silnikow, odlaczanie bocznikow
24. wprowadzone systemy zabezpieczenia: SHP, Czuwak, sygnalizacja kabinowa (nie dzialaja w DebugMode).
25. poprawiona predkosc propagacji fali cisnienia (normalizacja przez kwadrat dlugosci) //to jest zdeka liniowe
26. uwzgledniona masa ladunku, przesuniecie w/m toru ruchu
27. lampy/sygnaly przednie/tylne
28. wprowadzona pozycja odciecia hamulca (yB: tja, ale oerlikona....)
29. rozne poprawki: slizganie, wykolejanie itp
30. model silnika spalinowego z przekladnia mechaniczna
31. otwieranie drzwi, sprezarka, przetwornica
32. wylaczanie obliczen dla nieruchomych wagonow
33. Zbudowany model rozdzielacza powietrza roznych systemow
34. Poprawiona pozycja napelniania uderzeniowego i hamulec EP
35. Dodane baterie akumulatorow (KURS90)
36. Hamowanie elektrodynamiczne w ET42 i poprawione w EP09
37. jednokierunkowosc walu kulakowego w EZT (nie do konca)
38. wal kulakowy w ET40
39. poprawiona blokada nastawnika w ET40
...
*/
/// <summary>Global counter incremented when a string-to-numeric conversion fails during config parsing.</summary>
extern int ConversionError;
/// <summary>Static friction coefficient for steel-on-steel contact (used for adhesion at standstill).</summary>
const double Steel2Steel_friction = 0.15; // tarcie statyczne
/// <summary>Earth gravitational acceleration [m/s^2].</summary>
const double g = 9.81; // przyspieszenie ziemskie
/// <summary>Sand consumption rate when sanding is active [kg/s].</summary>
const double SandSpeed = 0.1; // ile kg/s}
/// <summary>2*pi shortcut.</summary>
const double Pirazy2 = 6.2831853071794f;
//-- var, const, procedure ---------------------------------------------------
/// <summary>Truthy alias used by CheckLocomotiveParameters() to ignore a check failure.</summary>
static bool const Go = true;
/// <summary>Falsy alias used by CheckLocomotiveParameters() to abort on a check failure.</summary>
static bool const Hold = false; /*dla CheckLocomotiveParameters*/
/// <summary>Maximum number of resistor / scheme entries for electric motor traction.</summary>
static int const ResArraySize = 64; /*dla silnikow elektrycznych*/
/// <summary>Maximum number of motor-parameter table entries (gear stages).</summary>
static int const MotorParametersArraySize = 10;
/// <summary>Maximum number of pantograph current collectors per vehicle.</summary>
static int const maxcc = 4; /*max. ilosc odbierakow pradu*/
// static int const LocalBrakePosNo = 10; /*ilosc nastaw hamulca pomocniczego*/
// static int const MainBrakeMaxPos = 10; /*max. ilosc nastaw hamulca zasadniczego*/
/// <summary>Number of positions on the manual (parking) brake handle.</summary>
static int const ManualBrakePosNo = 20; /*ilosc nastaw hamulca recznego*/
/// <summary>Number of positions on the lights selector switch.</summary>
static int const LightsSwitchPosNo = 16;
/// <summary>Maximum number of positions of the universal (auxiliary) controller.</summary>
static int const UniversalCtrlArraySize = 32; /*max liczba pozycji uniwersalnego nastawnika*/
/*uszkodzenia toru*/
/// <summary>Track damage flag: rail wear.</summary>
static int const dtrack_railwear = 2;
/// <summary>Track damage flag: free / loose rail.</summary>
static int const dtrack_freerail = 4;
/// <summary>Track damage flag: thin (worn-out) rail.</summary>
static int const dtrack_thinrail = 8;
/// <summary>Track damage flag: bent rail.</summary>
static int const dtrack_railbend = 16;
/// <summary>Track damage flag: vegetation overgrowth.</summary>
static int const dtrack_plants = 32;
/// <summary>Track damage flag: track impassable for movement.</summary>
static int const dtrack_nomove = 64;
/// <summary>Track damage flag: rails missing entirely.</summary>
static int const dtrack_norail = 128;
/*uszkodzenia taboru*/
/// <summary>Vehicle damage flag: thin wheel (locomotives).</summary>
static int const dtrain_thinwheel = 1; /*dla lokomotyw*/
/// <summary>Vehicle damage flag: shifted load (wagons).</summary>
static int const dtrain_loadshift = 1; /*dla wagonow*/
/// <summary>Vehicle damage flag: wheel wear.</summary>
static int const dtrain_wheelwear = 2;
/// <summary>Vehicle damage flag: bearing failure.</summary>
static int const dtrain_bearing = 4;
/// <summary>Vehicle damage flag: coupling damage.</summary>
static int const dtrain_coupling = 8;
/// <summary>Vehicle damage flag: ventilator failure (electric locomotive).</summary>
static int const dtrain_ventilator = 16; /*dla lokomotywy el.*/
/// <summary>Vehicle damage flag: load damage (wagons).</summary>
static int const dtrain_loaddamage = 16; /*dla wagonow*/
/// <summary>Vehicle damage flag: engine failure (locomotives).</summary>
static int const dtrain_engine = 32; /*dla lokomotyw*/
/// <summary>Vehicle damage flag: load destroyed (wagons).</summary>
static int const dtrain_loaddestroyed = 32; /*dla wagonow*/
/// <summary>Vehicle damage flag: axle damage.</summary>
static int const dtrain_axle = 64;
/// <summary>Vehicle damage flag: derailment.</summary>
static int const dtrain_out = 128; /*wykolejenie*/
/// <summary>Vehicle damage flag: broken pantograph.</summary>
static int const dtrain_pantograph = 256; /*polamanie pantografu*/
/// <summary>Reason for a derailment event.</summary>
enum DerailReason
{
/// <summary>No derailment.</summary>
NONE = 0,
/// <summary>End of track reached.</summary>
END_OF_TRACK = 1, // Ra: powód wykolejenia: brak szyn
/// <summary>Speed too high for curve (overturn).</summary>
TOO_HIGH_SPEED = 2, // Ra: powód wykolejenia: przewrócony na łuku
/// <summary>Track gauge does not match wheelset gauge.</summary>
GAUGE_MISMATCH = 3, // Ra: powód wykolejenia: za szeroki tor
/// <summary>Track type incompatible with this vehicle.</summary>
WRONG_TRACK_TYPE = 4, // Ra: powód wykolejenia: nieodpowiednia trajektoria
/// <summary>Collision with another vehicle.</summary>
COLLISION = 5, // powód wykolejenia: zderzenie z innym pojazdem
/// <summary>Trailing through a switch with a movable nose set the other way.</summary>
TRAILED_SWITCH = 6, // powód wykolejenia: rozprucie rozjazdu z ruchomym dziobem
};
/*wagi prawdopodobienstwa dla funkcji FuzzyLogic*/
/// <summary>Fuzzy-logic probability weight: electric engine general problem.</summary>
#define p_elengproblem (1e-02)
/// <summary>Fuzzy-logic probability weight: electric engine damage.</summary>
#define p_elengdamage (1e-01)
/// <summary>Fuzzy-logic probability weight: coupler damage.</summary>
#define p_coupldmg (2e-03)
/// <summary>Fuzzy-logic probability weight: derailment.</summary>
#define p_derail (1e-03)
/// <summary>Fuzzy-logic probability weight: acceleration-related event.</summary>
#define p_accn (1e-01)
/// <summary>Fuzzy-logic probability weight: damage caused by wheel slip.</summary>
#define p_slippdmg (1e-03)
/*typ sprzegu*/
/// <summary>Coupling type: virtual — vehicles share a track and are aware of each other.</summary>
static int const ctrain_virtual = 0; // gdy pojazdy na tym samym torze się widzą wzajemnie
/// <summary>Coupling type: physical coupler.</summary>
static int const ctrain_coupler = 1; // sprzeg fizyczny
/// <summary>Coupling type: pneumatic brake hose.</summary>
static int const ctrain_pneumatic = 2; // przewody hamulcowe
/// <summary>Coupling type: control cable (multiple-unit).</summary>
static int const ctrain_controll = 4; // przewody sterujące (ukrotnienie)
/// <summary>Coupling type: high-voltage power cable.</summary>
static int const ctrain_power = 8; // przewody zasilające (WN)
/// <summary>Coupling type: passenger gangway.</summary>
static int const ctrain_passenger = 16; // mostek przejściowy
/// <summary>Coupling type: secondary 8 atm pneumatic line (yellow, main air).</summary>
static int const ctrain_scndpneumatic = 32; // przewody 8 atm (żółte; zasilanie powietrzem)
/// <summary>Coupling type: high-voltage train heating cable.</summary>
static int const ctrain_heating = 64; // przewody ogrzewania WN
/// <summary>Coupling type: permanent (inter-section) — not separable during ordinary shunting; encoded as negative in config files.</summary>
static int const ctrain_depot = 128; // nie rozłączalny podczas zwykłych manewrów (międzyczłonowy), we wpisie wartość ujemna
/// <summary>Vehicle ends — front or rear (mutually exclusive).</summary>
enum end
{
/// <summary>Front end.</summary>
front = 0,
/// <summary>Rear end.</summary>
rear = 1
};
/// <summary>Vehicle sides — right or left (mutually exclusive).</summary>
enum side
{
/// <summary>Right side.</summary>
right = 0,
/// <summary>Left side.</summary>
left = 1
};
/// <summary>Bit flags representing the kind of physical/logical connections in a coupling. Combinable.</summary>
enum coupling
{
/// <summary>No coupling (virtual / not connected).</summary>
faux = 0x0,
/// <summary>Mechanical coupler.</summary>
coupler = 0x1,
/// <summary>Pneumatic brake hose (PG).</summary>
brakehose = 0x2,
/// <summary>Control cable (multiple-unit).</summary>
control = 0x4,
/// <summary>High-voltage cable (traction supply).</summary>
highvoltage = 0x8,
/// <summary>Passenger gangway.</summary>
gangway = 0x10,
/// <summary>Main air (8 atm) line — secondary pneumatic supply.</summary>
mainhose = 0x20,
/// <summary>Train heating cable.</summary>
heating = 0x40,
/// <summary>Permanent (non-separable) coupling.</summary>
permanent = 0x80,
/// <summary>24 V auxiliary power cable.</summary>
power24v = 0x100,
/// <summary>110 V auxiliary power cable.</summary>
power110v = 0x200,
/// <summary>3-phase 400 V auxiliary power cable.</summary>
power3x400v = 0x400,
// uic = 0x1000,
};
/// <summary>Range of effect for a control command (mutually exclusive).</summary>
enum class range_t
{
/// <summary>Affects only this vehicle.</summary>
local,
/// <summary>Affects this multiple-unit (vehicles permanently coupled into a unit).</summary>
unit,
/// <summary>Affects the entire consist.</summary>
consist
};
/// <summary>State of the door closure signalling (SOD) of a vehicle or a consist, ordered from the least to the most
/// severe: the state of a consist is the most severe state of its vehicles.</summary>
enum class door_closure_t
{
/// <summary>No doors worked by the crew: the vehicle doesn't take part in the signalling.</summary>
none,
/// <summary>All doors closed and locked: they can't be opened.</summary>
locked,
/// <summary>All doors closed, but released: a permit is given, or no lock holds them shut.</summary>
released,
/// <summary>A door is open, or not fully closed yet.</summary>
open
};
/// <summary>Whether the door closure signalling lamp is lit: steadily for locked doors, in the lit phase of the
/// blinking for released ones, never with a door open or with no doors signalled.</summary>
bool door_closure_lamp(door_closure_t const State, bool const BlinkLit);
/// <summary>Possible settings for an enable/disable input pair (mutually exclusive).</summary>
enum class operation_t
{
/// <summary>No input.</summary>
none = 0,
/// <summary>Enable input held active.</summary>
enable,
/// <summary>Disable input held active.</summary>
disable,
/// <summary>Enable button press transition (rising edge).</summary>
enable_on,
/// <summary>Enable button release transition.</summary>
enable_off,
/// <summary>Disable button press transition.</summary>
disable_on,
/// <summary>Disable button release transition.</summary>
disable_off,
};
/// <summary>Auto-start method for ancillary devices (mutually exclusive).</summary>
enum class start_t
{
/// <summary>Device cannot be started.</summary>
disabled,
/// <summary>Manual start only.</summary>
manual,
/// <summary>Starts automatically.</summary>
automatic,
/// <summary>Manual start with automatic fallback.</summary>
manualwithautofallback,
/// <summary>Driven by the converter state.</summary>
converter,
/// <summary>Driven by the battery state.</summary>
battery,
/// <summary>Driven by direction selector state.</summary>
direction
};
/// <summary>Bit flags representing vehicle external lights (positions and types). Combinable.</summary>
enum light
{
/// <summary>Headlight, left.</summary>
headlight_left = 1 << 0,
/// <summary>Red marker, left.</summary>
redmarker_left = 1 << 1,
/// <summary>Headlight, upper centre.</summary>
headlight_upper = 1 << 2,
// TBD, TODO: redmarker_upper support?
/// <summary>Headlight, right.</summary>
headlight_right = 1 << 4,
/// <summary>Red marker, right.</summary>
redmarker_right = 1 << 5,
/// <summary>Rear-end markers (combined).</summary>
rearendsignals = 1 << 6,
/// <summary>Auxiliary light, left (e.g. ditch light).</summary>
auxiliary_left = 1 << 7,
/// <summary>Auxiliary light, right.</summary>
auxiliary_right = 1 << 8,
/// <summary>High-beam headlight, left.</summary>
highbeamlight_left = 1 << 9,
/// <summary>High-beam headlight, right.</summary>
highbeamlight_right = 1 << 10
};
/// <summary>The cab interior light a position of the light preset selector sets (eu07/maszyna#529).</summary>
struct lights_preset_cablight
{
/// <summary>Bits of the optional third column of a LightsList row.</summary>
enum flag
{
/// <summary>The cab light is on.</summary>
light_on = 1 << 0,
/// <summary>The cab light is dimmed.</summary>
light_dimmed = 1 << 1
};
bool light{false};
bool dim{false};
};
/// <summary>Door operation method (who controls them and how) — mutually exclusive.</summary>
enum control_t
{
/// <summary>Local; passengers operate manually, doors open/close for the duration of loading.</summary>
passenger, // local, opened/closed for duration of loading
/// <summary>Remote; driver-operated.</summary>
driver, // remote, operated by the driver
/// <summary>Local autonomous; close when the vehicle moves and/or after a timeout.</summary>
autonomous, // local, closed when vehicle moves and/or after timeout
/// <summary>Remote; conductor-operated.</summary>
conductor, // remote, operated by the conductor
/// <summary>Primarily manual but also responds to remote control.</summary>
mixed // primary manual but answers also to remote control
};
/*typ hamulca elektrodynamicznego*/
/// <summary>Electrodynamic-brake type: no ED brake.</summary>
static int const dbrake_none = 0;
/// <summary>Electrodynamic-brake type: passive (always on while moving).</summary>
static int const dbrake_passive = 1;
/// <summary>Electrodynamic-brake type: switchable (driver toggles).</summary>
static int const dbrake_switch = 2;
/// <summary>Electrodynamic-brake type: reversal (engaged via reverser).</summary>
static int const dbrake_reversal = 4;
/// <summary>Electrodynamic-brake type: automatic (engages from main brake).</summary>
static int const dbrake_automatic = 8;
/*dzwieki*/
/// <summary>Bit flags identifying sound events emitted by a vehicle. Combinable.</summary>
enum sound
{
/// <summary>No sound event.</summary>
none,
/// <summary>Generic "loud" event flag (e.g. impact / forced action).</summary>
loud = 1 << 0,
/// <summary>Coupler stretching to its limit.</summary>
couplerstretch = 1 << 1,
/// <summary>Buffer clash (vehicles colliding).</summary>
bufferclash = 1 << 2,
/// <summary>Contactor / relay clicking.</summary>
relay = 1 << 3,
/// <summary>Series-parallel switch operating.</summary>
parallel = 1 << 4,
/// <summary>Field-shunt contactor operating.</summary>
shuntfield = 1 << 5,
/// <summary>Generic pneumatic event.</summary>
pneumatic = 1 << 6,
/// <summary>Coupling detached.</summary>
detach = 1 << 7,
/// <summary>Mechanical coupler attached.</summary>
attachcoupler = 1 << 8,
/// <summary>Brake hose attached.</summary>
attachbrakehose = 1 << 9,
/// <summary>Main air hose attached.</summary>
attachmainhose = 1 << 10,
/// <summary>Control cable attached.</summary>
attachcontrol = 1 << 11,
/// <summary>Gangway attached.</summary>
attachgangway = 1 << 12,
/// <summary>Heating cable attached.</summary>
attachheating = 1 << 13,
/// <summary>Adapter piece attached to coupler.</summary>
attachadapter = 1 << 14,
/// <summary>Adapter piece removed from coupler.</summary>
removeadapter = 1 << 15,
/// <summary>Door-open permission signalling.</summary>
doorpermit = 1 << 16,
};
/// <summary>Bit flags for the customizable reset button — which protective relay it resets. Combinable.</summary>
enum relay_t
{
/// <summary>Main circuit ground-fault relay.</summary>
maincircuitground = 1 << 0,
/// <summary>Auxiliary circuit ground-fault relay.</summary>
auxiliarycircuitground = 1 << 1,
/// <summary>Traction motor overload relay.</summary>
tractionnmotoroverload = 1 << 2,
/// <summary>Primary converter overload relay.</summary>
primaryconverteroverload = 1 << 3,
/// <summary>Secondary converter overload relay.</summary>
secondaryconverteroverload = 1 << 4,
/// <summary>Ventilator overload relay.</summary>
ventillatoroverload = 1 << 5,
/// <summary>Heating overload relay.</summary>
heatingoverload = 1 << 6,
/// <summary>Electrodynamic-brake overload relay.</summary>
electrodynamicbrakesoverload = 1 << 7,
};
/// <summary>Bit flags for actions triggered on cab activation / deactivation. Combinable.</summary>
enum activation
{
/// <summary>Engage the emergency brake.</summary>
emergencybrake = 1 << 0,
/// <summary>Operate cab mirrors.</summary>
mirrors = 1 << 1,
/// <summary>Raise the pantographs.</summary>
pantographsup = 1 << 2,
/// <summary>Switch on red end-of-train markers.</summary>
redmarkers = 1 << 3,
/// <summary>Set door-open permit.</summary>
doorpermition = 1 << 4,
/// <summary>Engage the spring brake.</summary>
springbrakeon = 1 << 5,
/// <summary>Release the spring brake.</summary>
springbrakeoff = 1 << 6,
/// <summary>Place the reverser in neutral.</summary>
neutraldirection = 1 << 7,
};
// szczególne typy pojazdów (inna obsługa) dla zmiennej TrainType
// zamienione na flagi bitowe, aby szybko wybierać grupę (np. EZT+SZT)
// TODO: convert to enums, they're used as specific checks anyway
/// <summary>Vehicle type flag: default (no special handling).</summary>
static int const dt_Default = 0;
/// <summary>Vehicle type flag: EZT (electric multiple unit).</summary>
static int const dt_EZT = 1;
/// <summary>Vehicle type flag: ET41 locomotive.</summary>
static int const dt_ET41 = 2;
/// <summary>Vehicle type flag: ET42 locomotive.</summary>
static int const dt_ET42 = 4;
/// <summary>Vehicle type flag: pseudo-diesel (electric drivetrain with diesel input model).</summary>
static int const dt_PseudoDiesel = 8;
/// <summary>Vehicle type flag: ET22 locomotive (added in Megapack).</summary>
static int const dt_ET22 = 0x10; // używane od Megapacka
/// <summary>Vehicle type flag: SN61 (set from CHK only, not used in conditions).</summary>
static int const dt_SN61 = 0x20; // nie używane w warunkach, ale ustawiane z CHK
/// <summary>Vehicle type flag: EP05 locomotive.</summary>
static int const dt_EP05 = 0x40;
/// <summary>Vehicle type flag: ET40 locomotive.</summary>
static int const dt_ET40 = 0x80;
/// <summary>Vehicle type flag: ŠKODA 181 locomotive.</summary>
static int const dt_181 = 0x100;
/// <summary>Vehicle type flag: DMU (diesel multiple unit).</summary>
static int const dt_DMU = 0x200;
// stałe dla asynchronów
/// <summary>EIM config index: dfic — frequency rise rate at start.</summary>
static int const eimc_s_dfic = 0;
/// <summary>EIM config index: dfmax — maximum frequency rate of change.</summary>
static int const eimc_s_dfmax = 1;
/// <summary>EIM config index: p — number of pole pairs.</summary>
static int const eimc_s_p = 2;
/// <summary>EIM config index: cfu — voltage / frequency conversion coefficient.</summary>
static int const eimc_s_cfu = 3;
/// <summary>EIM config index: cim — current / current conversion coefficient.</summary>
static int const eimc_s_cim = 4;
/// <summary>EIM config index: icif — magnetisation current ratio.</summary>
static int const eimc_s_icif = 5;
/// <summary>EIM config index: Uzmax — maximum DC link voltage.</summary>
static int const eimc_f_Uzmax = 7;
/// <summary>EIM config index: Uzh — DC link voltage at field-weakening transition.</summary>
static int const eimc_f_Uzh = 8;
/// <summary>EIM config index: DU — voltage drop at the converter.</summary>
static int const eimc_f_DU = 9;
/// <summary>EIM config index: I0 — no-load magnetising current.</summary>
static int const eimc_f_I0 = 10;
/// <summary>EIM config index: cfu — V/f gain in normal mode.</summary>
static int const eimc_f_cfu = 11;
/// <summary>EIM config index: cfuH — V/f gain in field-weakening region.</summary>
static int const eimc_f_cfuH = 12;
/// <summary>EIM config index: F0 — starting force at zero speed.</summary>
static int const eimc_p_F0 = 13;
/// <summary>EIM config index: a1 — force-frequency slope coefficient.</summary>
static int const eimc_p_a1 = 14;
/// <summary>EIM config index: Pmax — maximum power.</summary>
static int const eimc_p_Pmax = 15;
/// <summary>EIM config index: Fh — force at field-weakening point.</summary>
static int const eimc_p_Fh = 16;
/// <summary>EIM config index: Ph — power at field-weakening point.</summary>
static int const eimc_p_Ph = 17;
/// <summary>EIM config index: Vh0 — speed where field weakening begins.</summary>
static int const eimc_p_Vh0 = 18;
/// <summary>EIM config index: Vh1 — speed of full field weakening.</summary>
static int const eimc_p_Vh1 = 19;
/// <summary>EIM config index: Imax — maximum motor current.</summary>
static int const eimc_p_Imax = 20;
/// <summary>EIM config index: abed — anti-skid set point.</summary>
static int const eimc_p_abed = 21;
/// <summary>EIM config index: eped — EP brake intensity bias.</summary>
static int const eimc_p_eped = 22;
// zmienne dla asynchronów
/// <summary>EIM variable index: FMAXMAX — absolute maximum allowable force.</summary>
static int const eimv_FMAXMAX = 0;
/// <summary>EIM variable index: Fmax — current force limit.</summary>
static int const eimv_Fmax = 1;
/// <summary>EIM variable index: ks — slip coefficient.</summary>
static int const eimv_ks = 2;
/// <summary>EIM variable index: df — frequency offset.</summary>
static int const eimv_df = 3;
/// <summary>EIM variable index: fp — base frequency.</summary>
static int const eimv_fp = 4;
/// <summary>EIM variable index: U — applied voltage.</summary>
static int const eimv_U = 5;
/// <summary>EIM variable index: pole — pole-pair indicator.</summary>
static int const eimv_pole = 6;
/// <summary>EIM variable index: Ic — control current.</summary>
static int const eimv_Ic = 7;
/// <summary>EIM variable index: If — field current.</summary>
static int const eimv_If = 8;
/// <summary>EIM variable index: M — torque.</summary>
static int const eimv_M = 9;
/// <summary>EIM variable index: Fr — actual force.</summary>
static int const eimv_Fr = 10;
/// <summary>EIM variable index: Ipoj — line current.</summary>
static int const eimv_Ipoj = 11;
/// <summary>EIM variable index: Pm — mechanical power.</summary>
static int const eimv_Pm = 12;
/// <summary>EIM variable index: Pe — electrical power.</summary>
static int const eimv_Pe = 13;
/// <summary>EIM variable index: eta — efficiency.</summary>
static int const eimv_eta = 14;
/// <summary>EIM variable index: fkr — critical frequency.</summary>
static int const eimv_fkr = 15;
/// <summary>EIM variable index: Uzsmax — maximum measured DC link voltage.</summary>
static int const eimv_Uzsmax = 16;
/// <summary>EIM variable index: Pmax — instantaneous power limit.</summary>
static int const eimv_Pmax = 17;
/// <summary>EIM variable index: Fzad — set-point force.</summary>
static int const eimv_Fzad = 18;
/// <summary>EIM variable index: Imax — maximum allowed current.</summary>
static int const eimv_Imax = 19;
/// <summary>EIM variable index: Fful — full force.</summary>
static int const eimv_Fful = 20;
/// <summary>Brake-of-mode flag: PS (pneumatic, primary).</summary>
static int const bom_PS = 1;
/// <summary>Brake-of-mode flag: PN (pneumatic, no electrodynamic).</summary>
static int const bom_PN = 2;
/// <summary>Brake-of-mode flag: EP (electro-pneumatic).</summary>
static int const bom_EP = 4;
/// <summary>Brake-of-mode flag: MED (mixed pneumatic+ED).</summary>
static int const bom_MED = 8;
/// <summary>Bit flags reporting vehicle problems that prevent driving.</summary>
enum TProblem // lista problemów taboru, które uniemożliwiają jazdę
{ // flagi bitowe
/// <summary>The vehicle has the brake applied or seized axles.</summary>
pr_Hamuje = 1, // pojazd ma załączony hamulec lub zatarte osie
/// <summary>The vehicle requires pantographs to be inflated/raised.</summary>
pr_Pantografy = 2, // pojazd wymaga napompowania pantografów
/// <summary>Reserved sentinel — last bit flag.</summary>
pr_Ostatni = 0x80000000 // ostatnia flaga bitowa
};
/// <summary>Compressor parameter list — indices into the compressor programmer table.</summary>
enum TCompressorList // lista parametrów w programatorze sprężarek
{ // pozycje kolejne
/// <summary>Compressor enable permission (0/1).</summary>
cl_Allow = 0, // zezwolenie na pracę sprężarek
/// <summary>Compressor output multiplier.</summary>
cl_SpeedFactor = 1, // mnożnik wydajności
/// <summary>Pressure-switch lower threshold multiplier.</summary>
cl_MinFactor = 2, // mnożnik progu załącznika ciśnieniowego
/// <summary>Pressure-switch upper threshold multiplier.</summary>
cl_MaxFactor = 3 // mnożnik progu wyłącznika ciśnieniowego
};
/// <summary>3-D position in world coordinates [m].</summary>
struct TLocation
{
/// <summary>X coordinate.</summary>
double X;
/// <summary>Y coordinate (vertical).</summary>
double Y;
/// <summary>Z coordinate.</summary>
double Z;
};
/// <summary>Euler-angle rotation (radians) around X / Y / Z axes.</summary>
struct TRotation
{
/// <summary>Rotation around X axis.</summary>
double Rx;
/// <summary>Rotation around Y axis.</summary>
double Ry;
/// <summary>Rotation around Z axis.</summary>
double Rz;
};
/// <summary>Vehicle bounding box (width × length × height [m]).</summary>
struct TDimension
{
/// <summary>Width.</summary>
double W = 0.0;
/// <summary>Length.</summary>
double L = 0.0;
/// <summary>Height.</summary>
double H = 0.0;
};
/// <summary>A pending command queued for the vehicle, with its arguments and propagation rules.</summary>
struct TCommand
{
/// <summary>Command name.</summary>
std::string Command; /*komenda*/
/// <summary>First numeric argument.</summary>
double Value1 = 0.0; /*argumenty komendy*/
/// <summary>Second numeric argument.</summary>
double Value2 = 0.0;
/// <summary>Coupling flag controlling how the command propagates between vehicles.</summary>
int Coupling{coupling::control}; // coupler flag used to determine command propagation
/// <summary>World-space location associated with the command.</summary>
TLocation Location;
};
/*tory*/
/// <summary>Geometric shape of a track segment under the vehicle.</summary>
struct TTrackShape
{ /*ksztalt odcinka*/
/// <summary>Curvature radius [m]; 0 means straight track.</summary>
double R = 0.0; // promien
/// <summary>Segment length [m].</summary>
double Len = 0.0; // dlugosc
/// <summary>Track gradient (rise/run).</summary>
double dHtrack = 0.0; // nachylenie
/// <summary>Track cant / superelevation.</summary>
double dHrail = 0.0; // przechylka
};
/// <summary>Per-segment track parameters: gauge, friction, category, load capacity, damage.</summary>
struct TTrackParam
{ /*parametry odcinka - szerokosc, tarcie statyczne, kategoria, obciazalnosc w t/os, uszkodzenia*/
/// <summary>Track gauge / width [m].</summary>
double Width = 0.0;
/// <summary>Static friction coefficient on this segment.</summary>
double friction = 0.0;
/// <summary>Track category bit flags.</summary>
int CategoryFlag = 0;
/// <summary>Track-quality bit flags.</summary>
int QualityFlag = 0;
/// <summary>Track-damage bit flags (dtrack_*).</summary>
int DamageFlag = 0;
/// <summary>Maximum allowed velocity on this segment (used by AI driver).</summary>
double Velmax; /*dla uzytku maszynisty w ai_driver*/
};
/// <summary>Traction-supply parameters at the vehicle's current location.</summary>
struct TTractionParam
{
/// <summary>Catenary voltage [V].</summary>
double TractionVoltage = 0.0; /*napiecie*/
/// <summary>Catenary frequency [Hz] (0 for DC).</summary>
double TractionFreq = 0.0; /*czestotliwosc*/
/// <summary>Maximum current capacity [A].</summary>
double TractionMaxCurrent = 0.0; /*obciazalnosc*/
/// <summary>Pantograph-catenary contact resistance [Ω].</summary>
double TractionResistivity = 0.0; /*rezystancja styku*/
};
/*powyzsze parametry zwiazane sa z torem po ktorym aktualnie pojazd jedzie*/
// what a horn needs to sound: air from the main reservoir, or the low voltage
enum class horn_supply
{
air,
electric
};
/// <summary>High-level brake-system family.</summary>
enum class TBrakeSystem
{
/// <summary>Individual (vehicle-only) brake.</summary>
Individual,
/// <summary>Pneumatic brake (Westinghouse-style).</summary>
Pneumatic,
/// <summary>Electro-pneumatic brake.</summary>
ElectroPneumatic
};
/// <summary>Brake-system subtype identifying the manufacturer's distributor family.</summary>
enum class TBrakeSubSystem
{
ss_None,
ss_W,
ss_K,
ss_KK,
ss_Hik,
ss_ESt,
ss_KE,
ss_LSt,
ss_MT,
ss_Dako
};
/// <summary>Specific brake-distributor (valve) model.</summary>
enum class TBrakeValve
{
NoValve,
W,
W_Lu_VI,
W_Lu_L,
W_Lu_XR,
K,
Kg,
Kp,
Kss,
Kkg,
Kkp,
Kks,
Hikg1,
Hikss,
Hikp1,
KE,
SW,
EStED,
NESt3,
ESt3,
LSt,
ESt4,
ESt3AL2,
EP1,
EP2,
M483,
CV1_L_TR,
CV1,
CV1_R,
Other
};
/// <summary>Specific driver's brake-handle model (cab valve).</summary>
enum class TBrakeHandle
{
NoHandle,
West,
FV4a,
M394,
M254,
FVE408,
FVel6,
D2,
Knorr,
FD1,
BS2,
testH,
St113,
MHZ_P,
MHZ_T,
MHZ_EN57,
MHZ_K5P,
MHZ_K8P,
MHZ_6P
};
/// <summary>Type of the auxiliary (independent) brake.</summary>
enum class TLocalBrake
{
NoBrake,
ManualBrake,
PneumaticBrake,
HydraulicBrake
};
/// <summary>Brake delay parameter table (apply/release for passenger and freight).</summary>
using TBrakeDelayTable = double[4];
/// <summary>One row of the brake pressure / pipe pressure / flow-speed table for a brake handle position.</summary>
struct TBrakePressure
{
/// <summary>Brake pipe pressure target [bar].</summary>
double PipePressureVal = 0.0;
/// <summary>Brake cylinder pressure target [bar].</summary>
double BrakePressureVal = 0.0;
/// <summary>Flow speed (orifice scaling).</summary>
double FlowSpeedVal = 0.0;
/// <summary>Brake system this entry applies to.</summary>
TBrakeSystem BrakeType = TBrakeSystem::Pneumatic;
};
/// <summary>Brake pressure table indexed by handle position.</summary>
using TBrakePressureTable = std::map<int, TBrakePressure>;
/// <summary>Engine / drive type.</summary>
enum class TEngineType
{
None,
Dumb,
WheelsDriven,
ElectricSeriesMotor,
ElectricInductionMotor,
DieselEngine,
SteamEngine,
DieselElectric,
Main
};
/// <summary>Form of energy supplied by the power source.</summary>
enum class TPowerType
{
NoPower,
BioPower,
MechPower,
ElectricPower,
SteamPower
};
/// <summary>Fuel type for combustion engines.</summary>
enum class TFuelType
{
Undefined,
Coal,
Oil
};
/// <summary>Steam-locomotive grate parameters.</summary>
struct TGrateType
{
/// <summary>Fuel type burned on this grate.</summary>
TFuelType FuelType;
/// <summary>Grate surface area [m²].</summary>
double GrateSurface;
/// <summary>Fuel transport speed (stoker rate).</summary>
double FuelTransportSpeed;
/// <summary>Fuel ignition temperature [°C].</summary>
double IgnitionTemperature;
/// <summary>Maximum allowable grate temperature [°C].</summary>
double MaxTemperature;
// inline TGrateType() {
// FuelType = Undefined;
// GrateSurface = 0.0;
// FuelTransportSpeed = 0.0;
// IgnitionTemperature = 0.0;
// MaxTemperature = 0.0;
// }
};
/// <summary>Steam-locomotive boiler parameters.</summary>
struct TBoilerType
{
/// <summary>Boiler internal volume [m³].</summary>
double BoilerVolume;
/// <summary>Heat exchange surface of the boiler [m²].</summary>
double BoilerHeatSurface;
/// <summary>Superheater surface [m²].</summary>
double SuperHeaterSurface;
/// <summary>Maximum water volume [m³].</summary>
double MaxWaterVolume;
/// <summary>Minimum (safety) water volume [m³].</summary>
double MinWaterVolume;
/// <summary>Maximum boiler pressure [bar].</summary>
double MaxPressure;
// inline TBoilerType() {
// BoilerVolume = 0.0;
// BoilerHeatSurface = 0.0;
// SuperHeaterSurface = 0.0;
// MaxWaterVolume = 0.0;
// MinWaterVolume = 0.0;
// MaxPressure = 0.0;
// }
};
/// <summary>Pantograph (current collector) model identifier.</summary>
enum TPantType
{
/// <summary>AKP-4E pantograph (PKP single-arm).</summary>
AKP_4E,
/// <summary>DSA-series pantograph (Stemmann).</summary>
DSAx,
/// <summary>EC160/EC200 pantograph.</summary>
EC160_200,
/// <summary>WBL85 pantograph.</summary>
WBL85
};
/// <summary>Current-collector (pantograph) configuration block.</summary>
struct TCurrentCollector
{
/// <summary>Number of pantographs of this type.</summary>
long CollectorsNo; // musi być tu, bo inaczej się kopie
/// <summary>Minimum pantograph height [m] (currently unused).</summary>
double MinH;
/// <summary>Maximum pantograph height [m] (currently unused).</summary>
double MaxH;
/// <summary>Working width of the contact strip [m].</summary>
double CSW; // szerokość części roboczej (styku) ślizgacza
/// <summary>Minimum acceptable contact-line voltage [V].</summary>
double MinV;
/// <summary>Maximum acceptable contact-line voltage [V].</summary>
double MaxV;
/// <summary>True if an over-voltage protection relay is fitted.</summary>
bool OVP; // czy jest przekaznik nadnapieciowy
/// <summary>Minimum voltage required to engage the main switch [V].</summary>
double InsetV; // minimalne napięcie wymagane do załączenia
/// <summary>Minimum air pressure required to operate [bar].</summary>
double MinPress; // minimalne ciśnienie do załączenia WS
/// <summary>Maximum air pressure after the reductor [bar].</summary>
double MaxPress; // maksymalne ciśnienie za reduktorem
/// <summary>True if power output is faked (e.g. for AI vehicles without a model).</summary>
bool FakePower;
/// <summary>Physical layout id (orientation / side).</summary>
int PhysicalLayout;
/// <summary>Pantograph type (model).</summary>
TPantType PantographType;
// inline TCurrentCollector() {
// CollectorsNo = 0;
// MinH, MaxH, CSW, MinV, MaxV = 0.0;
// OVP, InsetV, MinPress, MaxPress = 0.0;
// }
};
/// <summary>Power-source kind (where the vehicle gets electrical or mechanical energy from).</summary>
enum class TPowerSource
{
NotDefined,
InternalSource,
Transducer,
Generator,
Accumulator,
CurrentCollector,
PowerCable,
Heater,
Main
};
/// <summary>Diesel engine driven generator parameters and outputs.</summary>
struct engine_generator
{
// ld inputs
/// <summary>Pointer to the prime-mover revolutions [rev/s].</summary>
double *engine_revolutions; // revs per second of the prime mover
// config
/// <summary>Minimum working rev rate [rev/s].</summary>
double revolutions_min; // min working revolutions rate, in revs per second
/// <summary>Maximum working rev rate [rev/s].</summary>
double revolutions_max; // max working revolutions rate, in revs per second
/// <summary>Voltage generated at <c>revolutions_min</c> [V].</summary>
double voltage_min; // voltage generated at min working revolutions
/// <summary>Voltage generated at <c>revolutions_max</c> [V].</summary>
double voltage_max; // voltage generated at max working revolutions
// ld outputs
/// <summary>Current rev rate [rev/s].</summary>
double revolutions;
/// <summary>Current generated voltage [V].</summary>
double voltage;
};
/// <summary>Battery / accumulator power source.</summary>
struct TAccumulator
{
/// <summary>Maximum capacity [Ah].</summary>
double MaxCapacity;
/// <summary>Source used to recharge the battery.</summary>
TPowerSource RechargeSource;
// inline _mover__1() {
// MaxCapacity = 0.0;
// RechargeSource = NotDefined;
// }
};
/// <summary>Permanent power cable (e.g. to a heater) carrying a specific power form.</summary>
struct TPowerCable
{
/// <summary>Type of power transmitted.</summary>
TPowerType PowerTrans;
/// <summary>Steam pressure (when SteamPower is transmitted) [bar].</summary>
double SteamPressure;
// inline _mover__2() {
// SteamPressure = 0.0;
// PowerTrans = NoPower;
// }
};
/// <summary>Steam locomotive boiler-and-grate combo.</summary>
struct THeater
{
/// <summary>Grate parameters.</summary>
TGrateType Grate;
/// <summary>Boiler parameters.</summary>
TBoilerType Boiler;
};
/// <summary>Transducer (DC-DC / converter) parameters.</summary>
struct TTransducer
{
// ld inputs
/// <summary>Input voltage [V].</summary>
double InputVoltage;
};
/// <summary>
/// Generic power-source parameters. The trailing union holds source-specific
/// configuration depending on <c>SourceType</c>.
/// </summary>
struct TPowerParameters
{
/// <summary>Maximum source voltage [V].</summary>
double MaxVoltage{0.0};
/// <summary>Maximum source current [A].</summary>
double MaxCurrent{0.0};
/// <summary>Internal resistance [Ω].</summary>
double IntR{0.001};
/// <summary>Type of source (selects which union member is meaningful).</summary>
TPowerSource SourceType;
union
{
struct
{
THeater RHeater;
};
struct
{
TPowerCable RPowerCable;
};
struct
{
TCurrentCollector CollectorParameters;
};
struct
{
TAccumulator RAccumulator;
};
struct
{
engine_generator EngineGenerator;
};
struct
{
TTransducer Transducer;
};
struct
{
TPowerType PowerType;
};
};
inline TPowerParameters()
{
SourceType = TPowerSource::NotDefined;
PowerType = TPowerType::NoPower;
RPowerCable.PowerTrans = TPowerType::NoPower;
}
};
/*dla lokomotyw elektrycznych:*/
struct TScheme
{
int Relay = 0; /*numer pozycji rozruchu samoczynnego*/
double R = 0.0; /*opornik rozruchowy*/ /*dla dizla napelnienie*/
int Bn = 0;
int Mn = 0; /*ilosc galezi i silnikow w galezi*/ /*dla dizla Mn: czy luz czy nie*/
bool AutoSwitch = false; /*czy dana pozycja nastawniana jest recznie czy autom.*/
int ScndAct = 0; /*jesli ma bocznik w nastawniku, to ktory bocznik na ktorej pozycji*/
};
using TSchemeTable = TScheme[ResArraySize + 1]; /*tablica rezystorow rozr.*/
struct TDEScheme
{
double RPM = 0.0; /*obroty diesla*/
double GenPower = 0.0; /*moc maksymalna*/
double Umax = 0.0; /*napiecie maksymalne*/
double Imax = 0.0; /*prad maksymalny*/
};
using TDESchemeTable = TDEScheme[33]; /*tablica WWList dla silnikow spalinowych*/
struct TFFScheme
{
double v = 0.0; // parametr wejsciowy
double freq = 0.0; // wyjscie: czestotliwosc falownika
};
using TFFSchemeTable = TFFScheme[33];
struct TWiperScheme
{
uint8_t byteSum = 0; // suma bitowa pracujacych wycieraczek
double WiperSpeed = 0.0; // predkosc wycieraczki
double interval = 0.0; // interwal pracy wycieraczki
double outBackDelay = 0.0; // czas po jakim wycieraczka zacznie wracac z konca do poczatku
};
using TWiperSchemeTable = TWiperScheme[16];
struct TShuntScheme
{
double Umin = 0.0;
double Umax = 0.0;
double Pmin = 0.0;
double Pmax = 0.0;
};
using TShuntSchemeTable = TShuntScheme[33];
struct TMPTRelay
{ /*lista przekaznikow bocznikowania*/
double Iup = 0.0;
double Idown = 0.0;
};
using TMPTRelayTable = TMPTRelay[MotorParametersArraySize + 1]; // indexed like MotorParam
struct TMotorParameters
{
double mfi{0.0};
double mIsat{0.0};
double mfi0{0.0}; // aproksymacja M(I) silnika} {dla dizla mIsat=przekladnia biegu
double fi{0.0};
double Isat{0.0};
double fi0{0.0}; // aproksymacja E(n)=fi*n} {dla dizla fi, mfi: predkosci przelozenia biegu <->
bool AutoSwitch{false};
};
struct TUniversalCtrl
{
int mode = 0; /*tryb pracy zadajnika - pomocnicze*/
double MinCtrlVal = 0.0; /*minimalna wartosc nastawy*/
double MaxCtrlVal = 0.0; /*maksymalna wartosc nastawy*/
double SetCtrlVal = 0.0; /*docelowa wartosc nastawy*/
double SpeedUp = 0.0; /*szybkosc zwiekszania nastawy*/
double SpeedDown = 0.0; /*szybkosc zmniejszania nastawy*/
int ReturnPosition = 0; /*pozycja na ktora odskakuje zadajnik*/
int NextPosFastInc = 0; /*nastepna duza pozycja przy przechodzeniu szybkim*/
int PrevPosFastDec = 0; /*poprzednia duza pozycja przy przechodzeniu szybkim*/
};
using TUniversalCtrlTable = std::array<TUniversalCtrl, UniversalCtrlArraySize + 1>;
class TSecuritySystem
{
bool vigilance_enabled = false;
bool cabsignal_enabled = false;
bool radiostop_enabled = false;
bool cabsignal_active = false;
bool pressed = false;
bool enabled = false;
bool is_sifa = false; // Sifa-like pedal device, with inverted input for convenient keyboard usage
bool separate_acknowledge = false; // cabsignal reset button is separate from vigilance
bool cabsignal_lock = false;
bool vigilance_suspended = false; // the vigilance device switched off by the shunt mode of the vehicle, see AwareOffInShuntMode
double vigilance_timer = 0.0;
double alert_timer = 0.0;
double press_timer = 0.0;
double velocity = 0.0;
bool power = false;
int cabactive = 0;
double AwareDelay = 30.0;
double AwareMinSpeed = 0.0;
double SoundSignalDelay = 5.0;
double EmergencyBrakeDelay = 5.0;
double MaxHoldTime = 1.5;
bool CabDependent = false;
bool AwareOffInShuntMode = false; // the shunt mode of the vehicle switches the vigilance device off, as on the SM42
public:
void set_enabled(bool e);
void acknowledge_press();
void acknowledge_release();
void cabsignal_reset();
void update(double dt, double Vel, bool pwr, int cab);
void set_cabsignal();
void set_cabsignal_lock(bool);
void set_shunt_mode(bool State);
bool is_blinking() const;
bool is_vigilance_blinking() const;
bool is_cabsignal_blinking() const;
bool is_beeping() const;
bool is_cabsignal_beeping() const;
bool is_braking() const;
bool is_engine_blocked() const;
bool radiostop_available() const;
bool has_separate_acknowledge() const;
void load(std::string const &line, double Vmax);
double MagnetLocation = 0.0;
};
struct TTransmision
{ // liczba zebow przekladni
int NToothM = 0;
int NToothW = 0;
double Ratio = 1.0;
double Efficiency = 1.0;
};
enum class TCouplerType
{
NoCoupler,
Articulated,
Bare,
Chain,
Screw,
Automatic
};
struct power_coupling
{
double current{0.0};
double voltage{0.0};
bool is_local{false}; // whether the power comes from external or onboard source
bool is_live{false}; // whether the coupling with next vehicle is live
};
struct TCoupling
{
/*parametry*/
double SpringKB = 1.0; /*stala sprezystosci zderzaka/sprzegu, %tlumiennosci */
double DmaxB = 0.1; /*tolerancja scisku/rozciagania, sila rozerwania*/
double FmaxB = 1000.0;
double SpringKC = 1.0;
double DmaxC = 0.1;
double FmaxC = 1000.0;
double beta = 0.0;
TCouplerType CouplerType = TCouplerType::NoCoupler; /*typ sprzegu*/
int AutomaticCouplingFlag = coupling::coupler;
int AllowedFlag = coupling::coupler | coupling::brakehose; // Ra: maska dostępnych
int PowerFlag = coupling::power110v | coupling::power24v;
int PowerCoupling = coupling::permanent; // type of coupling required for power transfer
/*zmienne*/
bool AutomaticCouplingAllowed{true}; // whether automatic coupling can be currently performed
int CouplingFlag = 0; /*0 - wirtualnie, 1 - sprzegi, 2 - pneumatycznie, 4 - sterowanie, 8 - kabel mocy*/
class TMoverParameters *Connected = nullptr; /*co jest podlaczone*/
int ConnectedNr = 0; // Ra: od której strony podłączony do (Connected): 0=przód, 1=tył
double CForce = 0.0; /*sila z jaka dzialal*/
double Dist = 0.0; /*strzalka ugiecia zderzaków*/
bool CheckCollision = false; /*czy sprawdzac sile czy pedy*/
float stretch_duration{0.f}; // seconds, elapsed time with excessive force applied to the coupler
bool broken{false}; // the coupler broke (damage_coupler()), until it's repaired (repair_coupler())
// optional adapter piece
double adapter_length{0.0}; // meters, value added on the given end to standard vehicle (half)length
double adapter_height{0.0}; // meters, distance from rail level
TCouplerType adapter_type = TCouplerType::NoCoupler; // CouplerType override if other than NoCoupler
power_coupling power_high;
power_coupling power_110v;
power_coupling power_24v;
// the physical model of the coupling (couplerphysics in eu07.ini), see couplerphysics.h: the parameters of this end,
// and the state of the coupling with the vehicle at this end, which that vehicle keeps alike on its own end
coupler_physics::end_parameters physics;
coupler_physics::pair_state physics_state;
int sounds{0}; // sounds emitted by the coupling devices
bool Render = false; /*ABu: czy rysowac jak zaczepiony sprzeg*/
std::string control_type; // abstraction of control coupling interface and communication standard
inline bool has_adapter() const
{
return adapter_type != TCouplerType::NoCoupler;
}
inline TCouplerType type() const
{
return adapter_type == TCouplerType::NoCoupler ? CouplerType : adapter_type;
}
};
class TDynamicObject;
struct neighbour_data
{
TDynamicObject *vehicle{nullptr}; // detected obstacle
int vehicle_end{-1}; // facing end of the obstacle
float distance{10000.f}; // distance to the obstacle // NOTE: legacy value. TBD, TODO: use standard -1 instead?
};
struct speed_control
{
bool IsActive = false;
bool Start = false;
bool ManualStateOverride = true;
bool BrakeIntervention = false;
bool BrakeInterventionBraking = false;
bool BrakeInterventionUnbraking = false;
bool Standby = false;
bool Parking = false;
double InitialPower = 1.0;
double FullPowerVelocity = -1;
double StartVelocity = -1;
double VelocityStep = 5;
double PowerStep = 0.1;
double MinPower = 0.0;
double MaxPower = 1.0;
double MinVelocity = 0;
double MaxVelocity = 120;
double DesiredVelocity = 0;
double DesiredPower = 1.0;
double Offset = -0.5;
double FactorPpos = 0.5;
double FactorPneg = 0.5;
double FactorIpos = 0.0;
double FactorIneg = 0.0;
double BrakeInterventionVel = 30.0;
double PowerUpSpeed = 1000;
double PowerDownSpeed = 1000;
};
struct inverter
{
double Freal = 0.0;
double Request = 0.0;
bool IsActive = true;
bool Activate = true;
bool Error = false;
bool Failure_Drive = false;
bool Failure_Const = false;
};
class TMoverParameters
{ // Ra: wrapper na kod pascalowy, przejmujący jego funkcje Q: 20160824 - juz nie wrapper a klasa bazowa :)
private:
// types
/* TODO: implement
// communication cable, exchanging control signals with adjacent vehicle
struct jumper_cable {
// types
using flag_pair = std::pair<bool, bool>;
// members
// booleans
// std::array<bool, 1> flags {};
// boolean pairs, exchanged data is swapped when connected to a matching end (front to front or back to back)
// TBD, TODO: convert to regular bool array for efficiency once it's working?
std::array<flag_pair, 1> flag_pairs {};
// integers
// std::array<int, 1> values {};
};
*/
// basic approximation of a generic device
// TBD: inheritance or composition?
struct basic_device
{
// config
start_t start_type{start_t::manual};
// ld inputs
bool is_enabled{false}; // device is allowed/requested to operate
bool is_disabled{false}; // device is requested to stop
// TODO: add remaining inputs; start conditions and potential breakers
// ld outputs
bool is_active{false}; // device is working
};
struct basic_light : public basic_device
{
// config
float dimming{1.0f}; // light strength multiplier
// ld outputs
float intensity{0.0f}; // current light strength
};
struct cooling_fan : public basic_device
{
// config
float speed{0.f}; // cooling fan rpm; either fraction of parent rpm, or absolute value if negative
float sustain_time{0.f}; // time of sustaining work of cooling fans after stop
float min_start_velocity{-1.f}; // minimal velocity of vehicle, when cooling fans activate
// ld outputs
float revolutions{0.f}; // current fan rpm
float stop_timer{0.f}; // current time, when shut off condition is active
};
// basic approximation of a fuel pump
struct fuel_pump : public basic_device
{
// TODO: fuel consumption, optional automatic engine start after activation
};
// basic approximation of an oil pump
struct oil_pump : public basic_device
{
// config
float pressure_minimum{0.f}; // lowest acceptable working pressure
float pressure_maximum{0.65f}; // oil pressure at maximum engine revolutions
// ld inputs
float resource_amount{1.f}; // amount of affected resource, compared to nominal value
// internal data
float pressure_target{0.f};
// ld outputs
float pressure{0.f}; // current pressure
};
// basic approximation of a water pump
struct water_pump : public basic_device
{
// ld inputs
// TODO: move to breaker list in the basic device once implemented
bool breaker{false}; // device is allowed to operate
};
// basic approximation of a solenoid valve
struct basic_valve : basic_device
{
// config
bool solenoid{true}; // requires electric power to operate
bool spring{true}; // spring return or double acting actuator
};
// basic approximation of a pantograph
struct basic_pantograph
{
// ld inputs
basic_valve valve; // associated pneumatic valve
// ld outputs
bool is_active{false}; // device is working
bool sound_event{false}; // indicates last state which generated sound event
double voltage{0.0};
};
// basic approximation of doors
struct basic_door
{
// config
// ld inputs
bool open_permit{false}; // door can be opened
bool local_open{false}; // local attempt to open the door
bool local_close{false}; // local attempt to close the door
bool remote_open{false}; // received remote signal to open the door
bool remote_close{false}; // received remote signal to close the door
// internal data
float auto_timer{-1.f}; // delay between activation of open state and closing state for automatic doors
float close_delay{0.f}; // delay between activation of closing state and actual closing
float open_delay{0.f}; // delay between activation of opening state and actual opening
float position{0.f}; // current shift of the door from the closed position
float step_position{0.f}; // current shift of the movable step from the retracted position
// ld outputs
bool is_closed{true}; // the door is fully closed
bool is_door_closed{true}; // the door is fully closed, step doesn't matter
bool is_closing{false}; // the door is currently closing
bool is_opening{false}; // the door is currently opening
bool is_open{false}; // the door is fully open
bool step_folding{false}; // the doorstep is currently closing
bool step_unfolding{false}; // the doorstep is currently opening
};
struct door_data
{
// config
control_t open_control{control_t::passenger};
float open_rate{1.f};
float open_delay{0.f};
control_t close_control{control_t::passenger};
float close_rate{1.f};
float close_delay{0.f};
int type{2};
float range{0.f}; // extent of primary move/rotation
float range_out{0.f}; // extent of shift outward, applicable for plug doors
int step_type{2};
float step_rate{0.5f};
float step_range{0.f};
bool has_lock{false};
bool has_warning{false};
bool has_autowarning{false};
float auto_duration{-1.f}; // automatic door closure delay period
float auto_velocity{-1.f}; // automatic door closure velocity threshold
bool auto_include_remote{false}; // automatic door closure applies also to remote control
bool permit_needed{false};
bool closure_signal{false}; // the door closure lamp (SOD) of the cab signals the doors of the whole consist in three states
std::vector<int> permit_presets; // permit presets selectable with preset switch
float voltage{0.f}; // power type required for door movement
// ld inputs
bool lock_enabled{true};
bool step_enabled{true};
bool remote_only{false}; // door ignores local control signals
// internal data
int permit_preset{-1}; // curent position of preset selection switch
// vehicle parts
std::array<basic_door, 2> instances; // door on the right and left side of the vehicle
// ld outputs
bool is_locked{false};
double doorLockSpeed = 10.0; // predkosc przy ktorej wyzwalana jest blokada drzwi
};
struct water_heater
{
// config
struct heater_config_t
{
float temp_min{-1}; // lowest accepted temperature
float temp_max{-1}; // highest accepted temperature
};
heater_config_t config;
// ld inputs
bool breaker{false}; // device is allowed to operate
bool is_enabled{false}; // device is requested to operate
// ld outputs
bool is_active{false}; // device is working
bool is_damaged{false}; // device is damaged
};
struct heat_data
{
// input, state of relevant devices
bool cooling{false}; // TODO: user controlled device, implement
// bool okienko { true }; // window in the engine compartment
// system configuration
bool auxiliary_water_circuit{false}; // cooling system has an extra water circuit
double fan_speed{0.075}; // cooling fan rpm; either fraction of engine rpm, or absolute value if negative
// heat exchange factors
double kw{0.35};
double kv{0.6};
double kfe{1.0};
double kfs{80.0};
double kfo{25.0};
double kfo2{25.0};
// system parts
struct fluid_circuit_t
{
struct circuit_config_t
{
float temp_min{-1}; // lowest accepted temperature
float temp_max{-1}; // highest accepted temperature
float temp_cooling{-1}; // active cooling activation point
float temp_flow{-1}; // fluid flow activation point
bool shutters{false}; // the radiator has shutters to assist the cooling
};
circuit_config_t config;
bool is_cold{false}; // fluid is too cold
bool is_warm{false}; // fluid is too hot
bool is_hot{false}; // fluid temperature crossed cooling threshold
bool is_flowing{false}; // fluid is being pushed through the circuit
};
fluid_circuit_t water;
fluid_circuit_t water_aux;
fluid_circuit_t oil;
fluid_circuit_t engine;
// output, state of affected devices
bool PA{false}; // malfunction flag
float rpmw{0.0}; // current main circuit fan revolutions
float rpmwz{0.0}; // desired main circuit fan revolutions
bool zaluzje1{false};
float rpmw2{0.0}; // current auxiliary circuit fan revolutions
float rpmwz2{0.0}; // desired auxiliary circuit fan revolutions
bool zaluzje2{false};
// output, temperatures
float Te{15.0}; // ambient temperature TODO: get it from environment data
// NOTE: by default the engine is initialized in warm, startup-ready state
float Ts{50.0}; // engine temperature
float To{45.0}; // oil temperature
float Tsr{50.0}; // main circuit radiator temperature (?)
float Twy{50.0}; // main circuit water temperature
float Tsr2{40.0}; // secondary circuit radiator temperature (?)
float Twy2{40.0}; // secondary circuit water temperature
float temperatura1{50.0};
float temperatura2{40.0};
float powerfactor{1.0}; // coefficient of heat generation for engines other than su45
// engine overheat threshold
float engine_max_temp{-1}; // maximum acceptable engine temperature, triggers overheat lamp when exceeded
bool engine_is_hot{false}; // engine temperature crossed cooling threshold
};
struct spring_brake
{
std::shared_ptr<TReservoir> Cylinder;
bool Activate{false}; // Input: switching brake on/off in exploitation - main valve/switch
bool ShuttOff{true}; // Input: shutting brake off during failure - valve in pneumatic container
bool Release{false}; // Input: emergency releasing rod
bool IsReady{false}; // Output: readyness to braking - cylinder is armed, spring is tentioned
bool IsActive{false}; // Output: brake is working
double SBP{0.0}; // Output: pressure in spring brake cylinder
bool PNBrakeConnection{false}; // Conf: connection to pneumatic brake cylinders
double MaxSetPressure{0.0}; // Conf: Maximal pressure for switched off brake
double ResetPressure{0.0}; // Conf: Pressure for arming brake cylinder
double MinForcePressure{0.1}; // Conf: Minimal pressure for zero force
double MaxBrakeForce{0.0}; // Conf: Maximal tension for brake pads/shoes
double PressureOn{-2.0}; // Conf: Pressure changing ActiveFlag to "On"
double PressureOff{-1.0}; // Conf: Pressure changing ActiveFlag to "Off"
double ValveOffArea{0.0}; // Conf: Area of filling valve
double ValveOnArea{0.0}; // Conf: Area of dumping valve
double ValvePNBrakeArea{0.0}; // Conf: Area of bypass to brake cylinders
int MultiTractionCoupler{127}; // Conf: Coupling flag necessary for transmitting the command
};
public:
std::string chkPath;
bool reload_FIZ();
double dMoveLen = 0.0;
/*---opis lokomotywy, wagonu itp*/
/*--opis serii--*/
int CategoryFlag = 1; /*1 - pociag, 2 - samochod, 4 - statek, 8 - samolot*/
/*--sekcja stalych typowych parametrow*/
std::string TypeName; /*nazwa serii/typu*/
int TrainType = 0; /*typ: EZT/elektrowoz - Winger 040304 Ra: powinno być szybciej niż string*/
TEngineType EngineType = TEngineType::None; /*typ napedu*/
TPowerParameters EnginePowerSource; /*zrodlo mocy dla silnikow*/
TPowerParameters SystemPowerSource; /*zrodlo mocy dla systemow sterowania/przetwornic/sprezarek*/
TPowerParameters HeatingPowerSource; /*zrodlo mocy dla ogrzewania*/
TPowerParameters AlterHeatPowerSource; /*alternatywne zrodlo mocy dla ogrzewania*/
TPowerParameters LightPowerSource; /*zrodlo mocy dla oswietlenia*/
TPowerParameters AlterLightPowerSource; /*alternatywne mocy dla oswietlenia*/
double Vmax = -1.0;
double Mass = 0.0;
double Power = 0.0; /*max. predkosc kontrukcyjna, masa wlasna, moc*/
double Mred = 0.0; /*Ra: zredukowane masy wirujące; potrzebne do obliczeń hamowania*/
double TotalMass = 0.0; /*wyliczane przez ComputeMass*/
double HeatingPower = 0.0;
double EngineHeatingRPM{0.0}; // guaranteed engine revolutions with heating enabled
double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/
double BatteryVoltage = 0.0; /*Winger - baterie w elektrykach*/
bool Battery = false; /*Czy sa zalaczone baterie*/
start_t BatteryStart = start_t::manual;
bool EpFuse = true; /*Czy jest wlaczony hamulec EP*/
double EpForce = 0.0; /*Poziom zadanej sily EP*/
bool Signalling = false; /*Czy jest zalaczona sygnalizacja hamowania ostatniego wagonu*/
bool Radio = false; /*Czy jest zalaczony radiotelefon*/
// the cut-off in the radio's power supply: a fuse in the cabinet, a lever on the desk or the switch on the radio's power
// supply (eu07/maszyna#438). Closed unless the driver opens it, so vehicles without such a switch work as before
bool RadioFuse = true;
float NominalBatteryVoltage = 0.f; /*Winger - baterie w elektrykach*/
TDimension Dim; /*wymiary*/
double Cx = 0.0; /*wsp. op. aerodyn.*/
float Floor = 0.96f; // poziom podłogi dla ładunków
float WheelDiameter = 1.f; /*srednica kol napednych*/
float WheelDiameterL = 0.9f; // Ra: srednica kol tocznych przednich
float WheelDiameterT = 0.9f; // Ra: srednica kol tocznych tylnych
float TrackW = 1.435f; /*nominalna szerokosc toru [m]*/
double AxleInertialMoment = 0.0; /*moment bezwladnosci zestawu kolowego*/
std::string AxleArangement; /*uklad osi np. Bo'Bo' albo 1'C*/
int NPoweredAxles = 0; /*ilosc osi napednych liczona z powyzszego*/
int NAxles = 0; /*ilosc wszystkich osi j.w.*/
int BearingType = 1; /*lozyska: 0 - slizgowe, 1 - toczne*/
double ADist = 0.0;
double BDist = 0.0; /*odlegosc osi oraz czopow skretu*/
/*hamulce:*/
int NBpA = 0; /*ilosc el. ciernych na os: 0 1 2 lub 4*/
int SandCapacity = 0; /*zasobnik piasku [kg]*/
TBrakeSystem BrakeSystem = TBrakeSystem::Individual; /*rodzaj hamulca zespolonego*/
TBrakeSubSystem BrakeSubsystem = TBrakeSubSystem::ss_None;
TBrakeValve BrakeValve = TBrakeValve::NoValve;
TBrakeHandle BrakeHandle = TBrakeHandle::NoHandle;
TBrakeHandle BrakeLocHandle = TBrakeHandle::NoHandle;
bool LocHandleTimeTraxx = false; /*hamulec dodatkowy typu traxx*/
double MBPM = 1.0; /*masa najwiekszego cisnienia*/
int wiperSwitchPos = 0; // pozycja przelacznika wycieraczek
double WiperAngle = {45.0}; // kat pracy wycieraczek
std::shared_ptr<TBrake> Hamulec;
std::shared_ptr<TDriverHandle> Handle;
std::shared_ptr<TDriverHandle> LocHandle;
std::shared_ptr<TReservoir> Pipe;
std::shared_ptr<TReservoir> Pipe2;
spring_brake SpringBrake;
TLocalBrake LocalBrake = TLocalBrake::NoBrake; /*rodzaj hamulca indywidualnego*/
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
TBrakePressure BrakePressureActual; // wartości ważone dla aktualnej pozycji kranu
int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/
int UniversalBrakeButtonFlag[3] = {0, 0, 0}; /* mozliwe działania przycisków hamulcowych */
int UniversalResetButtonFlag[3] = {0, 0, 0}; // customizable reset buttons assignments
int TurboTest = 0;
bool batterySwAlreadyFired = false; // czy przycisk baterii juz zostal wcisniety
bool isBatteryButtonImpulse = false; // czy przelacznik baterii traktowac jako pojedynczy przycisk
bool shouldHoldBatteryButton = false; // czy nalezy przytrzymac przycisk baterii aby wlaczyc/wylaczyc baterie
float BatteryButtonHoldTime = 1.f; // minimalny czas przytrzymania przycisku baterii
double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/
double MaxBrakePress[5]; // pomocniczy, proz, sred, lad, pp
double P2FTrans = 0.0;
double TrackBrakeForce = 0.0; /*sila nacisku hamulca szynowego*/
int BrakeMethod = 0; /*flaga rodzaju hamulca*/
bool Handle_AutomaticOverload = false; // automatyczna asymilacja na pozycji napelniania
bool Handle_ManualOverload = false; // reczna asymilacja na guzik
double Handle_GenericDoubleParameter1 = 0.0;
double Handle_GenericDoubleParameter2 = 0.0;
double Handle_OverloadMaxPressure = 1.0; // maksymalne zwiekszenie cisnienia przy asymilacji
double Handle_OverloadPressureDecrease = 0.002; // predkosc spadku cisnienia przy asymilacji
/*max. cisnienie w cyl. ham., stala proporcjonalnosci p-K*/
double HighPipePress = 0.0;
double LowPipePress = 0.0;
double DeltaPipePress = 0.0;
/*max. i min. robocze cisnienie w przewodzie glownym oraz roznica miedzy nimi*/
double CntrlPipePress = 0.0; // ciśnienie z zbiorniku sterującym
double BrakeVolume = 0.0;
double BrakeVVolume = 0.0;
double VeselVolume = 0.0;
/*pojemnosc powietrza w ukladzie hamulcowym, w ukladzie glownej sprezarki [m^3] */
int BrakeCylNo = 0; /*ilosc cylindrow ham.*/
double BrakeCylRadius = 0.0;
double BrakeCylDist = 0.0;
double BrakeCylMult[3];
int LoadFlag = 0;
/*promien cylindra, skok cylindra, przekladnia hamulcowa*/
double BrakeCylSpring = 0.0; /*suma nacisku sprezyn powrotnych, kN*/
double BrakeSlckAdj = 0.0; /*opor nastawiacza skoku tloka, kN*/
double BrakeRigEff = 0.0; /*sprawnosc przekladni dzwigniowej*/
double RapidMult = 1.0; /*przelozenie rapidu*/
double RapidVel = 55.0; /*szybkosc przelaczania rapidu*/
int BrakeValveSize = 0;
std::string BrakeValveParams;
double Spg = 0.0;
double MinCompressor = 0.0;
double MaxCompressor = 0.0;
double MinCompressor_cabA = 0.0;
double MaxCompressor_cabA = 0.0;
double MinCompressor_cabB = 0.0;
double MaxCompressor_cabB = 0.0;
bool CabDependentCompressor = false;
double CompressorSpeed = 0.0;
int CompressorList[4][9]; // pozycje świateł, przód - tył, 1 .. 16
double EmergencyValveOn = 0.0;
double EmergencyValveOff = 0.0;
bool EmergencyValveOpen = false;
double EmergencyValveArea = 0.0;
double LockPipeOn = -1.0;
double LockPipeOff = -1.0;
double HandleUnlock = -3.0;
bool EmergencyCutsOffHandle = false;
int CompressorListPosNo = 0;
int CompressorListDefPos = 1;
bool CompressorListWrap = false;
/*cisnienie wlaczania, zalaczania sprezarki, wydajnosc sprezarki*/
TBrakeDelayTable BrakeDelay; /*opoznienie hamowania/odhamowania t/o*/
double AirLeakRate{0.01}; // base rate of air leak from brake system components ( 0.001 = 1 l/sec )
int BrakeCtrlPosNo = 0; /*ilosc pozycji hamulca*/
/*nastawniki:*/
int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/
int ScndCtrlPosNo = 0;
int LightsPosNo = 0;
int LightsDefPos = 1;
bool LightsWrap = false;
int Lights[2][18]; // pozycje świateł, przód - tył, 1 .. 16 (17 do lightsset)
// the cab interior light each light preset sets, from the optional third column of LightsList (bits of
// lights_preset_cablight::flag); -1: the preset leaves the cab light as it is (eu07/maszyna#529)
std::array<int, 18> LightsCabLight{[] {
std::array<int, 18> positions;
positions.fill(-1);
return positions;
}()};
int ScndInMain{0}; /*zaleznosc bocznika od nastawnika*/
bool MBrake = false; /*Czy jest hamulec reczny*/
double maxTachoSpeed = {0.0}; // maksymalna predkosc na tarczce predkosciomierza analogowego
double StopBrakeDecc = 0.0;
bool ReleaseParkingBySpringBrake{false};
bool ReleaseParkingBySpringBrakeWhenDoorIsOpen{false};
bool SpringBrakeCutsOffDrive{true};
double SpringBrakeDriveEmergencyVel{-1};
bool HideDirStatusWhenMoving{false}; // Czy gasic lampki kierunku powyzej predkosci zdefiniowanej przez HideDirStatusSpeed
int HideDirStatusSpeed{1}; // Predkosc od ktorej lampki kierunku sa wylaczane
bool isDoubleClickForMeasureNeeded = {false}; // czy rozpoczecie pomiaru odleglosci odbywa sie po podwojnym wcisnienciu przycisku?
float DistanceCounterDoublePressPeriod = {1.f}; // czas w jakim nalezy podwojnie wcisnac przycisk, aby rozpoczac pomiar odleglosci
TSecuritySystem SecuritySystem;
int EmergencyBrakeWarningSignal{0}; // combined with basic WarningSignal when manual emergency brake is active
horn_supply HornSupply{horn_supply::air}; // of the low and high tone horns (WarningSignal 1 and 2)
horn_supply Horn3Supply{horn_supply::air}; // of the third horn (WarningSignal 4)
// main reservoir pressure [bar, as MinCP and MaxCP] below which a pneumatic horn stays silent
static constexpr double HornMinPressure{2.0};
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/
int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/
bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/
bool UniCtrlIntegratedBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie*/
bool UniCtrlIntegratedLocalBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie hamulcem pomocniczym*/
int UniCtrlNoPowerPos{0}; // cached highesr position not generating traction force
// UCList CtrlValStep: the universal controller (EIMCtrlType 3) changes its setting in steps of this size (e.g. 0.05 for the
// 5% steps of the 6Dg), one at once when moved to a raising or lowering position, then one each time its SpeedUp / SpeedDown
// covers a step; 0 (the default) changes it continuously
double UniCtrlValStep{0.0};
std::pair<std::string, std::array<int, 2>> PantsPreset{"0132", {0, 0}}; // pantograph preset switches; .first holds possible setups as chars, .second holds currently selected preset in each cab
/*-sekcja parametrow dla lokomotywy elektrycznej*/
TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/
int RlistSize = 0;
TMotorParameters MotorParam[MotorParametersArraySize + 1];
/*rozne parametry silnika przy bocznikowaniach*/
/*dla lokomotywy spalinowej z przekladnia mechaniczna: przelozenia biegow*/
// bounds-safe read access to MotorParam
TMotorParameters const &motor_param(int const Position) const
{
if (Position < 0)
return MotorParam[0];
if (Position > MotorParametersArraySize)
return MotorParam[MotorParametersArraySize];
return MotorParam[Position];
}
TTransmision Transmision;
// record {liczba zebow przekladni}
// NToothM, NToothW : byte;
// Ratio: real; {NToothW/NToothM}
// end;
double NominalVoltage = 0.0; /*nominalne napiecie silnika*/
double WindingRes = 0.0;
double u = 0.0; // wspolczynnik tarcia yB wywalic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
double CircuitRes = 0.0; /*rezystancje silnika i obwodu*/
int IminLo = 0;
int IminHi = 0; /*prady przelacznika automatycznego rozruchu, uzywane tez przez ai_driver*/
int ImaxLo = 0; // maksymalny prad niskiego rozruchu
int ImaxHi = 0; // maksymalny prad wysokiego rozruchu
bool MotorOverloadRelayHighThreshold{false};
double nmax = 0.0; /*maksymalna dop. ilosc obrotow /s*/
double InitialCtrlDelay = 0.0;
double CtrlDelay = 0.0; /* -//- -//- miedzy kolejnymi poz.*/
double CtrlDownDelay = 0.0; /* -//- -//- przy schodzeniu z poz.*/ /*hunter-101012*/
int FastSerialCircuit = 0; /*0 - po kolei zamyka styczniki az do osiagniecia szeregowej, 1 - natychmiastowe wejscie na szeregowa*/ /*hunter-111012*/
int BackwardsBranchesAllowed = 1;
int AutoRelayType = 0; /*0 -brak, 1 - jest, 2 - opcja*/
bool CoupledCtrl = false; /*czy mainctrl i scndctrl sa sprzezone*/
bool HasCamshaft{false};
int DynamicBrakeType = 0; /*patrz dbrake_**/
int DynamicBrakeAmpmeters = 2; /*liczba amperomierzy przy hamowaniu ED*/
bool SplitEDPneumaticBrake = false; /*czy hamulec ED i pneumatyczny pomocniczy są rozdzielone na osobne nastawniki*/
int DynamicBrakeCtrlPosNo = 10; /*ilosc pozycji nastawnika hamulca ED (DBPN, domyslnie 10)*/
double DynamicBrakeRes = 5.8; /*rezystancja oporników przy hamowaniu ED*/
double DynamicBrakeRes1 = 5.8; /*rezystancja oporników przy hamowaniu ED - 1 tryb*/
double DynamicBrakeRes2 = 5.8; /*rezystancja oporników przy hamowaniu ED - 2 tryb*/
double TUHEX_Sum = 750; /*nastawa sterownika hamowania ED - aktualna*/
double TUHEX_Diff = 10; /*histereza działania sterownika hamowania ED*/
double TUHEX_MinIw = 60; /*minimalny prąd wzbudzenia przy hamowaniu ED - wynika z chk silnika*/
double TUHEX_MaxIw = 400; /*maksymalny prąd wzbudzenia przy hamowaniu ED - ograniczenie max siły*/
double TUHEX_Sum1 = 750; /*nastawa1 sterownika hamowania ED*/
double TUHEX_Sum2 = 750; /*nastawa2 sterownika hamowania ED*/
double TUHEX_Sum3 = 750; /*nastawa3 sterownika hamowania ED*/
int TUHEX_Stages = 0; /*liczba stopni hamowania ED*/
// TODO: wrap resistor fans variables and state into a device
int RVentType = 0; /*0 - brak, 1 - jest, 2 - automatycznie wlaczany*/
double RVentnmax = 1.0; /*maks. obroty wentylatorow oporow rozruchowych*/
double RVentCutOff = 0.0; /*rezystancja wylaczania wentylatorow dla RVentType=2*/
double RVentSpeed{0.5}; // rozpedzanie sie wentylatora obr/s^2}
double RVentMinI{50.0}; // przy jakim pradzie sie wylaczaja}
bool RVentForceOn{false}; // forced activation switch
int CompressorPower = 1; // 0: main circuit, 1: z przetwornicy, reczne, 2: w przetwornicy, stale, 3: diesel engine, 4: converter of unit in front, 5: converter of unit behind
int SmallCompressorPower = 0; /*Winger ZROBIC*/
bool Trafo = false; /*pojazd wyposażony w transformator*/
/*-sekcja parametrow dla lokomotywy spalinowej z przekladnia mechaniczna*/
double dizel_Mmax = 1.0;
double dizel_nMmax = 1.0;
double dizel_Mnmax = 2.0;
double dizel_nmax = 2.0;
double dizel_nominalfill = 0.0;
std::map<double, double> dizel_Momentum_Table;
std::map<double, double> dizel_vel2nmax_Table;
/*parametry aproksymacji silnika spalinowego*/
double dizel_Mstand = 0.0; /*moment oporow ruchu silnika dla enrot=0*/
/* dizel_auto_min, dizel_auto_max: real; {predkosc obrotowa przelaczania automatycznej skrzyni biegow*/
double dizel_nmax_cutoff = 0.0; /*predkosc obrotowa zadzialania ogranicznika predkosci*/
double dizel_nmin = 0.0; /*najmniejsza dopuszczalna predkosc obrotowa*/
double dizel_nmin_hdrive = 0.0; /*najmniejsza dopuszczalna predkosc obrotowa w czasie jazdy na hydro */
double dizel_nmin_hdrive_factor = 0.0; /*wspolczynnik wzrostu obrotow minimalnych hydro zaleznosci od zadanego procentu*/
double dizel_nmin_retarder = 0.0; /*obroty pracy podczas hamowania retarderem*/
double dizel_nreg_acc = 999.0; /*tempo zwiększania prędkości przez regulator dizla */
double dizel_minVelfullengage = 0.0; /*najmniejsza predkosc przy jezdzie ze sprzeglem bez poslizgu*/
double dizel_maxVelANS = 3.0; /*predkosc progowa rozlaczenia przetwornika momentu*/
double dizel_AIM = 1.0; /*moment bezwladnosci walu itp*/
double dizel_RevolutionsDecreaseRate{2.0};
double dizel_NominalFuelConsumptionRate = 250.0; /*jednostkowe zużycie paliwa przy mocy nominalnej, wczytywane z fiz, g/kWh*/
double dizel_FuelConsumption = 0.0; /*współczynnik zużycia paliwa przeliczony do jednostek maszynowych, l/obrót*/
double dizel_FuelConsumptionActual = 0.0; /*chwilowe spalanie paliwa w l/h*/
double dizel_FuelConsumptedTotal = 0.0; /*ilość paliwa zużyta od początku symulacji, l*/
double dizel_engageDia = 0.5;
double dizel_engageMaxForce = 6000.0;
double dizel_engagefriction = 0.5; /*parametry sprzegla*/
double engagedownspeed = 0.9;
double engageupspeed = 0.5;
/*parametry przetwornika momentu*/
bool hydro_TC = false; /*obecnosc hydraulicznego przetwornika momentu*/
double hydro_TC_TMMax = 2.0; /*maksymalne wzmocnienie momentu*/
double hydro_TC_CouplingPoint = 0.85; /*wzgledna predkosc zasprzeglenia*/
double hydro_TC_LockupTorque = 3000.0; /*moment graniczny sprzegla blokujacego*/
double hydro_TC_LockupRate = 1.0; /*szybkosc zalaczania sprzegla blokujacego*/
double hydro_TC_UnlockRate = 1.0; /*szybkosc rozlaczania sprzegla blokujacego*/
double hydro_TC_FillRateInc = 1.0; /*szybkosc napelniania sprzegla*/
double hydro_TC_FillRateDec = 1.0; /*szybkosc oprozniania sprzegla*/
double hydro_TC_TorqueInIn = 4.5; /*stala momentu proporcjonalnego do kwadratu obrotow wejsciowych*/
double hydro_TC_TorqueInOut = 0.0; /*stala momentu proporcjonalnego do roznica obrotow wejsciowych i wyjsciowych*/
double hydro_TC_TorqueOutOut = 0.0; /*stala momentu proporcjonalnego do kwadratu obrotow wyjsciowych*/
double hydro_TC_LockupSpeed = 1.0; /*prog predkosci zalaczania sprzegla blokujacego*/
double hydro_TC_UnlockSpeed = 1.0; /*prog predkosci rozlaczania sprzegla blokujacego*/
std::map<double, double> hydro_TC_Table; /*tablica przetwornika momentu*/
/*parametry retardera*/
bool hydro_R = false; /*obecnosc retardera*/
int hydro_R_Placement = 0; /*umiejscowienie retardera: 0 - za skrzynia biegow, 1 - miedzy przetwornikiem a biegami, 2 - przed skrzynia biegow */
double hydro_R_TorqueInIn = 1.0; /*stala momentu proporcjonalnego do kwadratu obrotow wejsciowych*/
double hydro_R_MaxTorque = 1.0; /*maksymalny moment retardera*/
double hydro_R_MaxPower = 1.0; /*maksymalna moc retardera - ogranicza moment*/
double hydro_R_FillRateInc = 1.0; /*szybkosc napelniania sprzegla*/
double hydro_R_FillRateDec = 1.0; /*szybkosc oprozniania sprzegla*/
double hydro_R_MinVel = 1.0; /*minimalna predkosc, przy ktorej retarder dziala*/
double hydro_R_EngageVel = 1.0; /*minimalna predkosc hamowania, przy ktorej sprzeglo jest wciaz wlaczone*/
bool hydro_R_Clutch = false; /*czy retarder ma rozłączalne sprzęgło*/
double hydro_R_ClutchSpeed = 10.0; /*szybkość narastania obrotów po włączeniu sprzęgła retardera*/
bool hydro_R_WithIndividual = false; /*czy dla autobusów jest to łączone*/
/*- dla lokomotyw spalinowo-elektrycznych -*/
double AnPos = 0.0; // pozycja sterowania dokladnego (analogowego)
bool AnalogCtrl = false; //
bool AnMainCtrl = false; //
bool ShuntModeAllow = false;
bool ShuntMode = false;
bool Flat = false;
double Vhyp = 1.0;
TDESchemeTable DElist;
TFFSchemeTable FFlist;
int FFListSize = 0;
TFFSchemeTable FFEDlist;
int FFEDListSize = 0;
TWiperSchemeTable WiperList;
int WiperListSize;
int WiperDefaultPos{0};
int modernWpierListSize;
double Vadd = 1.0;
TMPTRelayTable MPTRelay;
int RelayType = 0;
TShuntSchemeTable SST;
double PowerCorRatio = 1.0; // Wspolczynnik korekcyjny
/*- dla uproszczonego modelu silnika (dumb) oraz dla drezyny*/
double Ftmax = 0.0;
/*- dla lokomotyw z silnikami indukcyjnymi -*/
double eimc[26];
bool EIMCLogForce = false; //
static std::vector<std::string> const eimc_labels;
double InverterFrequency{0.0}; // current frequency of power inverters
int InvertersNo = 0; // number of inverters
double InvertersRatio = 0.0;
std::vector<inverter> Inverters; // all inverters
int InverterControlCouplerFlag = 4; // which coupling flag is necessary to controll inverters
int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie
int BRVto = 0; // Czas jaki wentylatory jeszcze dodatkowo schladzaja rezystor
double BRVtimer = 0; // Timer dla podtrzymania wentylatora
std::map<double, double> EIM_Pmax_Table; /*tablica mocy maksymalnej od predkosci*/
/* -dla pojazdów z blendingiem EP/ED (MED) */
double MED_Vmax = 0; // predkosc maksymalna dla obliczen chwilowej sily hamowania EP w MED
double MED_Vmin = 0; // predkosc minimalna dla obliczen chwilowej sily hamowania EP w MED
double MED_Vref = 0; // predkosc referencyjna dla obliczen dostepnej sily hamowania EP w MED
double MED_amax{9.81}; // maksymalne opoznienie hamowania sluzbowego MED
bool MED_EPVC = false; // czy korekcja sily hamowania EP, gdy nie ma dostepnego ED
double MED_EPVC_Time = 7; // czas korekcji sily hamowania EP, gdy nie ma dostepnego ED
bool MED_Ncor = false; // czy korekcja sily hamowania z uwzglednieniem nacisku
double MED_MinBrakeReqED = 0; // minimalne zadanie sily hamowania uruchamiajace ED - ponizej tylko EP
double MED_FrED_factor = 1; // mnoznik sily hamowania ED do korekty blendingu
double MED_ED_Delay1 = 0; // opoznienie wdrazania hamowania ED (pierwszy raz)
double MED_ED_Delay2 = 0; // opoznienie zwiekszania sily hamowania ED (kolejne razy)
int DCEMUED_CC{0}; // na którym sprzęgu sprawdzać działanie ED
double DCEMUED_EP_max_Vel{0.0}; // maksymalna prędkość, przy której działa EP przy włączonym ED w jednostce (dla tocznych)
double DCEMUED_EP_min_Im{0.0}; // minimalny prąd, przy którym EP nie działa przy włączonym ED w członie (dla silnikowych)
double DCEMUED_EP_delay{0.0}; // opóźnienie włączenia hamulca EP przy hamowaniu ED - zwłoka wstępna
/*-dla wagonow*/
struct load_attributes
{
std::string name; // name of the cargo
float offset_min{0.f}; // offset applied to cargo model when load amount is 0
load_attributes() = default;
load_attributes(std::string const &Name, float const Offsetmin) : name(Name), offset_min(Offsetmin) {}
};
std::vector<load_attributes> LoadAttributes;
float MaxLoad = 0.f; /*masa w T lub ilosc w sztukach - ladownosc*/
double OverLoadFactor = 0.0; /*ile razy moze byc przekroczona ladownosc*/
float LoadSpeed = 0.f;
float UnLoadSpeed = 0.f; /*szybkosc na- i rozladunku jednostki/s*/
#ifdef EU07_USEOLDDOORCODE
int DoorOpenCtrl = 0;
int DoorCloseCtrl = 0; /*0: przez pasazera, 1: przez maszyniste, 2: samoczynne (zamykanie)*/
double DoorStayOpen = 0.0; /*jak dlugo otwarte w przypadku DoorCloseCtrl=2*/
bool DoorClosureWarning = false; /*czy jest ostrzeganie przed zamknieciem*/
bool DoorClosureWarningAuto = false; // departure signal plays automatically while door closing button is held down
double DoorOpenSpeed = 1.0;
double DoorCloseSpeed = 1.0; /*predkosc otwierania i zamykania w j.u. */
double DoorMaxShiftL = 0.5;
double DoorMaxShiftR = 0.5;
double DoorMaxPlugShift = 0.1; /*szerokosc otwarcia lub kat*/
int DoorOpenMethod = 2; /*sposob otwarcia - 1: przesuwne, 2: obrotowe, 3: trójelementowe*/
float DoorCloseDelay{0.f}; // delay (in seconds) before the door begin closing, once conditions to close are met
double PlatformSpeed = 0.5; /*szybkosc stopnia*/
double PlatformMaxShift{0.0}; /*wysuniecie stopnia*/
int PlatformOpenMethod{2}; /*sposob animacji stopnia*/
#endif
double MirrorMaxShift{90.0};
double MirrorVelClose{5.0};
bool MirrorForbidden{false}; /*czy jest pozwolenie na otworzenie lusterek (przycisk)*/
bool ScndS = false; /*Czy jest bocznikowanie na szeregowej*/
bool ScndCtrlResistiveLock{false}; // the shunt controller can't be moved, up or down, while the master controller is at zero or on a resistive position, and drops to 0 when the master controller gets there (ScndCtrlResistiveLock=Yes in Cntrl.)
bool SpeedCtrl = false; /*czy jest tempomat*/
speed_control SpeedCtrlUnit; /*parametry tempomatu*/
double SpeedCtrlButtons[10]{30, 40, 50, 60, 70, 80, 90, 100, 110, 120}; /*przyciski prędkości*/
double SpeedCtrlDelay = 2; /*opoznienie dzialania tempomatu z wybieralna predkoscia*/
double SpeedCtrlValue = 0; /*wybrana predkosc jazdy na tempomacie*/
/*--sekcja zmiennych*/
/*--opis konkretnego egzemplarza taboru*/
TLocation Loc{0.0, 0.0, 0.0}; // pozycja pojazdów do wyznaczenia odległości pomiędzy sprzęgami
TRotation Rot{0.0, 0.0, 0.0};
glm::vec3 Front{};
std::string Name; /*nazwa wlasna*/
TCoupling Couplers[2]; // urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
// the physical coupler model covers the vehicle: it's in the player's train or in one the player's train closes in on
// (vehicle_table::update_coupler_physics()); with couplerphysics all in eu07.ini every vehicle is covered
bool CouplerPhysics{false};
std::array<neighbour_data, 2> Neighbours; // potential collision sources
bool Power110vIsAvailable = false; // cached availability of 110v power
bool Power24vIsAvailable = false; // cached availability of 110v power
double Power24vVoltage{0.0}; // cached battery voltage
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
int SoundFlag = 0; /*!o patrz stale sound_ */
int AIFlag{0}; // HACK: events of interest for consist owner
double DistCounter = 0.0; /*! licznik kilometrow */
odometer::reading Odometer; // total distance run, kept between the sessions (eu07/maszyna#72)
std::pair<double, double> EnergyMeter; // energy <drawn, returned> from grid [kWh]
double V = 0.0; // predkosc w [m/s] względem sprzęgów (dodania gdy jedzie w stronę 0)
double Vel = 0.0; // moduł prędkości w [km/h], używany przez AI
double AccS = 0.0; // efektywne przyspieszenie styczne w [m/s^2] (wszystkie siły)
double AccSVBased{}; // tangential acceleration calculated from velocity change
double AccN = 0.0; // przyspieszenie normalne w [m/s^2]
double AccVert = 0.0; // vertical acceleration
double nrot = 0.0; // predkosc obrotowa kol (obrotow na sekunde)
double nrot_eps = 0.0; // przyspieszenie kątowe kół (bez kierunku)
double WheelFlat = 0.0;
bool TruckHunting{true}; // enable/disable truck hunting calculation
/*! rotacja kol [obr/s]*/
double EnginePower = 0.0; /*! chwilowa moc silnikow*/
double dL = 0.0;
double Fb = 0.0;
double Ff = 0.0; /*przesuniecie, sila hamowania i tarcia*/
double FTrain = 0.0;
double FStand = 0.0; /*! sila pociagowa i oporow ruchu*/
double FTotal = 0.0; /*! calkowita sila dzialajaca na pojazd*/
double UnitBrakeForce = 0.0; /*!s siła hamowania przypadająca na jeden element*/
double Ntotal = 0.0; /*!s siła nacisku klockow*/
bool SlippingWheels = false;
bool SandDose = false; /*! poslizg kol, sypanie piasku*/
bool SandDoseManual = false; /*piaskowanie reczne*/
bool SandDoseAuto = false; /*piaskowanie automatyczne*/
bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/
double Sand = 0.0; /*ilosc piasku*/
double BrakeSlippingTimer = 0.0; /*pomocnicza zmienna do wylaczania przeciwposlizgu*/
double dpBrake = 0.0;
double dpPipe = 0.0;
double dpMainValve = 0.0;
double dpLocalValve = 0.0;
double EmergencyValveFlow = 0.0; // air flow through alerter valve during last simulation step
/*! przyrosty cisnienia w kroku czasowym*/
double ScndPipePress = 0.0; /*cisnienie w przewodzie zasilajacym*/
double BrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych*/
double LocBrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych z pomocniczego*/
double PipeBrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych z przewodu*/
double PipePress = 0.0; /*!o cisnienie w przewodzie glownym*/
double EqvtPipePress = 0.0; /*!o cisnienie w przewodzie glownym skladu*/
double Volume = 0.0; /*objetosc spr. powietrza w zbiorniku hamulca*/
double CompressedVolume = 0.0; /*objetosc spr. powietrza w ukl. zasilania*/
double PantVolume = 0.48; /*objetosc spr. powietrza w ukl. pantografu*/ // aby podniesione pantografy opadły w krótkim czasie przy wyłączonej sprężarce
double Compressor = 0.0; /*! cisnienie w ukladzie zasilajacym*/
bool CompressorFlag = false; /*!o czy wlaczona sprezarka*/
bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/
bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/
bool CompressorAllowLocal{true}; // local device state override (most units don't have this fitted so it's set to true not to intefere)
bool CompressorGovernorLock{false}; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure
double CompressorStartDelay{0.0}; // time [s] the compressor waits after getting its power before it can start, after the engine starts say
double CompressorPowerTime{0.0}; // time [s] since the compressor got its power
bool CompressorTankValve{false}; // indicates excessive pressure is vented from compressor tank directly and instantly
start_t CompressorStart{start_t::manual}; // whether the compressor is started manually, or another way
start_t PantographCompressorStart{start_t::manual};
basic_valve PantsValve;
std::array<basic_pantograph, 2> Pantographs;
bool PantAllDown{false};
double PantFrontVolt = 0.0; // pantograf pod napieciem? 'Winger 160404
double PantRearVolt = 0.0;
// TODO converter parameters, for when we start cleaning up mover parameters
start_t ConverterStart{start_t::manual}; // whether converter is started manually, or by other means
float ConverterStartDelay{0.0f}; // delay (in seconds) before the converter is started, once its activation conditions are met
double ConverterStartDelayTimer{0.0}; // helper, for tracking whether converter start delay passed
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/
bool ConverterAllowLocal{true}; // local device state override (most units don't have this fitted so it's set to true not to intefere)
bool ConverterFlag = false; /*! czy wlaczona przetwornica NBMX*/
bool BRVentilators = false; /* Czy rezystor hamowania pracuje */
start_t ConverterOverloadRelayStart{start_t::manual}; // whether overload relay reset responds to dedicated button
bool ConverterOverloadRelayOffWhenMainIsOff{false};
fuel_pump FuelPump;
oil_pump OilPump;
water_pump WaterPump;
water_heater WaterHeater;
bool WaterCircuitsLink{false}; // optional connection between water circuits
heat_data dizel_heat;
std::array<cooling_fan, 2> MotorBlowers;
door_data Doors;
float DoorsOpenWithPermitAfter{-1.f}; // remote open if permit button is held for specified time. NOTE: separate from door data as its cab control thing
int DoorsPermitLightBlinking{0}; // when the doors permit signal light is blinking
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/
double BrakeCtrlPos2 = 0.0; /*nastawa hamulca zespolonego - kapturek dla FV4a*/
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/
double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/
double DynamicBrakeCtrlPos = 0.0; /*nastawa nastawnika hamulca elektrodynamicznego (0..1) - aktywne tylko gdy SplitEDPneumaticBrake*/
bool UniversalBrakeButtonActive[3] = {false, false, false}; /* brake button pressed */
/*
int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R
*/
bool AlarmChainFlag = false; // manual emergency brake
bool RadioStopFlag = false; /*hamowanie nagle*/
bool LockPipe = false; /*locking brake pipe in emergency state*/
bool UnlockPipe = false; /*unlockig brake pipe button pressed*/
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
// the AI wagon inspector cut the brake out (b_dmg) and puts it back when the train no longer needs it
// cut out (brake_setting::apply). Anyone else cutting it out or putting it back takes it over
bool BrakeCutOutByInspector = false;
int BrakeOpModeFlag = 0; /*nastawa trybu pracy PS/PN/EP/MED 1/2/4/8*/
int BrakeOpModes = 0; /*nastawy mozliwe do uzyskania*/
bool DynamicBrakeFlag = false; /*czy wlaczony hamulec elektrodymiczny*/
bool DynamicBrakeEMUStatus = true; /*czy hamulec ED dziala w ezt*/
int TUHEX_StageActual = 0; /*aktualny stopien tuhexa*/
bool TUHEX_ResChange = false; /*czy zmiana rezystancji hamowania ED - odwzbudzanie*/
bool TUHEX_Active = false; /*czy hamowanie ED wywołane z zewnątrz*/
// NapUdWsp: integer;
double LimPipePress = 0.0; /*stabilizator cisnienia*/
double ActFlowSpeed = 0.0; /*szybkosc stabilizatora*/
int DamageFlag = 0; // kombinacja bitowa stalych dtrain_* }
int EngDmgFlag = 0; // kombinacja bitowa stalych usterek}
// EndSignalsFlag: byte; {ABu 060205: zmiany - koncowki: 1/16 - swiatla prz/tyl, 2/31 - blachy prz/tyl}
// HeadSignalsFlag: byte; {ABu 060205: zmiany - swiatla: 1/2/4 - przod, 16/32/63 - tyl}
TCommand CommandIn;
/*komenda przekazywana przez PutCommand*/
/*i wykonywana przez RunInternalCommand*/
std::string CommandOut; /*komenda przekazywana przez ExternalCommand*/
std::string CommandLast; // Ra: ostatnio wykonana komenda do podglądu
double ValueOut = 0.0; /*argument komendy która ma byc przekazana na zewnatrz*/
TTrackShape RunningShape; /*geometria toru po ktorym jedzie pojazd*/
TTrackParam RunningTrack; /*parametry toru po ktorym jedzie pojazd*/
double OffsetTrackH = 0.0;
double OffsetTrackV = 0.0; /*przesuniecie poz. i pion. w/m osi toru*/
/*-zmienne dla lokomotyw*/
bool Mains = false; /*polozenie glownego wylacznika*/
double MainsInitTime{0.0}; // config, initialization time (in seconds) of the main circuit after it receives power, before it can be closed
double MainsInitTimeCountdown{0.0}; // current state of main circuit initialization, remaining time (in seconds) until it's ready
start_t MainsStart{start_t::manual};
// config, Engine:JointEngineStart. whether the cab's line breaker / engine start switch works the vehicles in multiple
// too; when it doesn't, the cab has separate switches for them (mainb_*, mainc_*)
bool JointEngineStart{true};
bool LineBreakerClosesOnlyAtNoPowerPos{false};
bool ControlPressureSwitch{false}; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels
bool HasControlPressureSwitch{true};
bool ReleaserEnabledOnlyAtNoPowerPos{false};
int MainCtrlPos = 0; /*polozenie glownego nastawnika*/
int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/
int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/
int CompressorListPos = 0; /*polozenie przelacznika wielopozycyjnego sprezarek*/
int DirActive = 0; // czy lok. jest wlaczona i w ktorym kierunku: względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona
int DirAbsolute = 0; // zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1)
int MainCtrlMaxDirChangePos{0}; // can't change reverser state with master controller set above this position
int CabActive = 0; // numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad
int CabOccupied = 0; // numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
bool CabMaster = false; // czy pojazd jest nadrzędny w składzie
inline bool IsCabMaster() const
{
return CabActive == CabOccupied && CabMaster;
} // czy aktualna kabina jest na pewno tą, z której można sterować
bool AutomaticCabActivation = true; // czy zmostkowany rozrzad przelacza sie sam przy zmianie kabiny
int InactiveCabFlag = 0; // co sie dzieje przy dezaktywacji kabiny
bool InactiveCabPantsCheck = false; // niech DynamicObject sprawdzi pantografy
double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/
int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi
bool DepartureSignal = false; /*sygnal odjazdu*/
bool InsideConsist = false;
/*-zmienne dla lokomotywy elektrycznej*/
TTractionParam RunningTraction; /*parametry sieci trakcyjnej najblizej lokomotywy*/
double enrot = 0.0; // ilosc obrotow silnika
double Im = 0.0; // prad silnika
/*
// currently not used
double IHeating = 0.0;
double ITraction = 0.0;
*/
double Itot = 0.0; // prad calkowity
double TotalCurrent = 0.0;
// momenty
double Mm = 0.0;
double Mw = 0.0;
// sily napedne
double Fw = 0.0;
double Ft = 0.0;
// Ra: Im jest ujemny, jeśli lok jedzie w stronę sprzęgu 1
// a ujemne powinien być przy odwróconej polaryzacji sieci...
// w wielu miejscach jest używane abs(Im)
int Imin = 0;
int Imax = 0; /*prad przelaczania automatycznego rozruchu, prad bezpiecznika*/
double EngineVoltage = 0.0; // voltage supplied to engine
int MainCtrlActualPos = 0; /*wskaznik RList*/
int ScndCtrlActualPos = 0; /*wskaznik MotorParam*/
bool DelayCtrlFlag = false; // czy czekanie na 1. pozycji na załączenie?
double LastRelayTime = 0.0; /*czas ostatniego przelaczania stycznikow*/
bool AutoRelayFlag = false; /*mozna zmieniac jesli AutoRelayType=2*/
bool FuseFlag = false; /*!o bezpiecznik nadmiarowy*/
bool ConvOvldFlag = false; /*! nadmiarowy przetwornicy i ogrzewania*/
bool GroundRelay{true}; // switches off to protect against damage from earths
start_t GroundRelayStart{start_t::manual}; // relay activation method
bool StLinFlag = false; /*!o styczniki liniowe*/
bool StLinSwitchOff{false}; // state of the button forcing motor connectors open
bool ResistorsFlag = false; /*!o jazda rezystorowa*/
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
double PantographVoltage{0.0}; // voltage supplied to pantographs
double PantPress = 0.0; /*Cisnienie w zbiornikach pantografow*/
bool PantPressSwitchActive{false}; // state of the pantograph pressure switch. gets primed at defined pressure level in pantograph air system
bool PantPressLockActive{false}; // pwr system state flag. fires when pressure switch activates by pantograph pressure dropping below defined level
bool NoVoltRelay{true}; // switches off if the power level drops below threshold
bool OvervoltageRelay{true}; // switches off if the power level goes above threshold
bool s_CAtestebrake = false; // hunter-091012: zmienna dla testu ca
std::array<std::pair<double, double>, 4> PowerCircuits; // 24v, 110v, 3x400v and 3000v power circuits, voltage from local sources and current draw pairs
/*-zmienne dla lokomotywy spalinowej z przekladnia mechaniczna*/
double dizel_fill = 0.0; /*napelnienie*/
double dizel_engagestate = 0.0; /*sprzeglo skrzyni biegow: 0 - luz, 1 - wlaczone, 0.5 - wlaczone 50% (z poslizgiem)*/
double dizel_engage = 0.0; /*sprzeglo skrzyni biegow: aktualny docisk*/
double dizel_automaticgearstatus = 0.0; /*0 - bez zmiany, -1 zmiana na nizszy +1 zmiana na wyzszy*/
bool dizel_startup{false}; // engine startup procedure request indicator
bool dizel_ignition{false}; // engine ignition request indicator
bool dizel_spinup{false}; // engine spin up to idle speed flag
// the starter turns the engine a while before it fires: smoke comes out only after SmokeDelay (the Engine section of the vehicle's
// .fiz, seconds from the start of the spin up) has passed. 0, the default, lets it out as soon as the starter turns, as before eu07/maszyna#523
double dizel_SmokeDelay{0.0};
double dizel_FiringCountdown{0.0}; // seconds left until the engine being started fires, 0 once it runs on its own
double dizel_engagedeltaomega = 0.0; /*roznica predkosci katowych tarcz sprzegla*/
double dizel_n_old = 0.0; /*poredkosc na potrzeby obliczen sprzegiel*/
double dizel_Torque = 0.0; /*aktualny moment obrotowy silnika spalinowego*/
double dizel_Power = 0.0; /*aktualna moc silnika spalinowego*/
double dizel_nreg_min = 0.0; /*predkosc regulatora minimalna, zmienna w hydro*/
double dizel_nreg_max = 0.0; /*predkosc regulatora maksymalna, zmienna w hydro*/
/* - zmienne dla przetowrnika momentu */
double hydro_TC_Fill = 0.0; /*napelnienie*/
bool hydro_TC_Lockup = false; /*zapiecie sprzegla*/
double hydro_TC_TorqueIn = 0.0; /*moment*/
double hydro_TC_TorqueOut = 0.0; /*moment*/
double hydro_TC_TMRatio = 1.0; /*aktualne przelozenie momentu*/
double hydro_TC_Request = 0.0; /*zadanie sily*/
double hydro_TC_nIn = 0.0; /*predkosc obrotowa walu wejsciowego*/
double hydro_TC_nOut = 0.0; /*predkosc obrotowa walu wyjsciowego*/
/* - zmienne dla przetowrnika momentu */
double hydro_R_Fill = 0.0; /*napelnienie*/
double hydro_R_Torque = 0.0; /*moment*/
double hydro_R_Request = 0.0; /*zadanie sily hamowania*/
double hydro_R_n = 0.0; /*predkosc obrotowa retardera*/
bool hydro_R_ClutchActive = false; /*czy retarder jest napędzany*/
/*- zmienne dla lokomotyw z silnikami indukcyjnymi -*/
double eimic = 0; /*aktualna pozycja zintegrowanego sterowania jazda i hamowaniem*/
double eimic_analog = 0; /*pozycja zadajnika analogowa*/
double eimic_real = 0; /*faktycznie uzywana pozycja zintegrowanego sterowania jazda i hamowaniem*/
double eimic_step_progress{0.0}; // the part of the next UniCtrlValStep the controller has covered so far
double eim_localbrake = 0; /*nastawa hamowania dodatkowego pneumatycznego lokomotywy*/
int EIMCtrlType = 0; /*rodzaj wariantu zadajnika jazdy*/
bool SpeedCtrlTypeTime = false; /*czy tempomat sterowany czasowo*/
int SpeedCtrlAutoTurnOffFlag = 0; /*czy tempomat sam się wyłącza*/
bool EIMCtrlAdditionalZeros = false; /*czy ma dodatkowe zero jazdy i zero hamowania */
bool EIMCtrlEmergency = false; /*czy ma dodatkowe zero jazdy i zero hamowania */
bool EIMCtrlMainEmergency = false; /*czy zadajnik typu 2 (Elf) ma pozycje hamowania naglego ponizej swojej pozycji 0*/
double eimv_pr = 0; /*realizowany procent dostepnej sily rozruchu/hamowania*/
double eimv[21];
static std::vector<std::string> const eimv_labels;
double SpeedCtrlTimer = 0; /*zegar dzialania tempomatu z wybieralna predkoscia*/
double eimicSpeedCtrl = 1; /*pozycja sugerowana przez tempomat*/
double eimicSpeedCtrlIntegral = 0; /*calkowany blad ustawienia predkosci*/
double NewSpeed = 0; /*nowa predkosc do zadania*/
double MED_EPVC_CurrentTime = 0; /*aktualny czas licznika czasu korekcji siły EP*/
double MED_ED_DelayTimer = 0; /*aktualny czas licznika opoznienia hamowania ED*/
/*-zmienne dla drezyny*/
double PulseForce = 0.0; /*przylozona sila*/
double PulseForceTimer = 0.0;
int PulseForceCount = 0;
/*dla drezyny, silnika spalinowego i parowego*/
double eAngle = M_PI * 0.5;
/*-dla wagonow*/
float LoadAmount = 0.f; /*masa w T lub ilosc w sztukach - zaladowane*/
load_attributes LoadType;
std::string LoadQuantity; // jednostki miary
int LoadStatus = 0; //+1=trwa rozladunek,+2=trwa zaladunek,+4=zakończono,0=zaktualizowany model
bool LoadTypeChange{false}; // indicates load type was changed
double LastLoadChangeTime = 0.0; // raz (roz)ładowania
#ifdef EU07_USEOLDDOORCODE
bool DoorBlocked = false; // Czy jest blokada drzwi
bool DoorLockEnabled{true};
bool DoorLeftOpened = false; // stan drzwi
double DoorLeftOpenTimer{-1.0}; // left door closing timer for automatic door type
bool DoorRightOpened = false;
double DoorRightOpenTimer{-1.0}; // right door closing timer for automatic door type
#endif
// TODO: move these switch types where they belong, cabin definition
std::string PantSwitchType;
std::string ConvSwitchType;
bool HeatingSwitchImpulse{false}; // the train heating switch springs back to its middle position
std::string StLinSwitchType;
bool Heating = false; // ogrzewanie 'Winger 020304
bool HeatingAllow{false}; // heating switch // TODO: wrap heating in a basic device
int DoubleTr = 1; // trakcja ukrotniona - przedni pojazd 'Winger 160304
basic_light CompartmentLights;
bool PhysicActivation = true;
/*ABu: stale dla wyznaczania sil (i nie tylko) po optymalizacji*/
double FrictConst1 = 0.0;
double FrictConst2s = 0.0;
double FrictConst2d = 0.0;
double TotalMassxg = 0.0; /*TotalMass*g*/
double fBrakeCtrlPos = -2.0; // płynna nastawa hamulca zespolonego
bool bPantKurek3 = true; // kurek trójdrogowy (pantografu): true=połączenie z ZG, false=połączenie z małą sprężarką // domyślnie zbiornik pantografu połączony jest ze zbiornikiem głównym
bool PantAutoValve{false}; // type of installed pantograph compressor valve
int iProblem = 0; // flagi problemów z taborem, aby AI nie musiało porównywać; 0=może jechać
int iLights[2]; // bity zapalonych świateł tutaj, żeby dało się liczyć pobór prądu
// Status nowszego hebelka od przyciemniania swiatel/swiatel dlugich
// 0 - swiatla wylaczone (opcja dziala tylko gdy w fiz zdefiniowano OffState w sekcji Switches; w przeciwnym wypadku pstryk startuje z wartoscia == 1
// 1 - swiatla normalne przyciemnione
// 2 - swiatla normalne
// 3 - swiatla dlugie przyciemnione
// 4 - swiatla dlugie normalne
struct dimPosition
{
bool isOff = false;
bool isDimmed = false;
bool isHighBeam = false;
};
// default positions
std::vector<dimPosition> dimPositions = {{false, false, false}, // 0 - Not dimmed
{false, true, false}}; // 1 - Dimmed
int modernDimmerPosition{0};
int modernDimmerDefaultPosition{0};
// bool modernContainOffPos{true};
bool enableModernDimmer{false};
bool modernDimmerCanCycle{false};
// the given dimmer position brought into the DimmerList, to its first or last entry; 0 for an empty list
int clampDimmerPosition(int Position) const;
// the entry of the current dimmer position, or a plain one (not off, not dimmed, no high beam) when the
// position is outside the DimmerList: the .fiz can give a short or an empty list, or a DefaultPos past its end
dimPosition currentDimPosition() const;
// moves the dimmer by Step positions within the DimmerList, around to its other end when it can cycle;
// a position outside the list is brought into it first. false when the dimmer doesn't move
bool stepDimmerPosition(int Step);
// Barwa reflektora
int refR{255}; // Czerwony
int refG{255}; // Zielony
int refB{255}; // Niebieski
double dimMultiplier{0.6f}; // mnoznik swiatel przyciemnionych
double normMultiplier{1.0f}; // mnoznik swiatel zwyklych
double highDimMultiplier{2.5f}; // mnoznik dlugich przyciemnionych
double highMultiplier{2.8f}; // mnoznik dlugich
plc::basic_controller m_plc;
int AIHintPantstate{0}; // suggested pantograph setup
// suggested pantograph setup in shunting (AI: ShuntPantstate=, eu07/maszyna#461), the bits as in Pantstate: 1 front,
// 2 rear, 3 both; 0 (the default) shunts with the pantographs handled as in train mode
int AIHintShuntPantstate{0};
bool AIHintPantUpIfIdle{true}; // whether raise both pantographs if idling for a while
double AIHintLocalBrakeAccFactor{1.05}; // suggested acceleration weight for local brake operation
TMoverParameters(double VelInitial, std::string const &TypeNameInit, std::string const &NameInit, int Cab);
// obsługa sprzęgów
static double CouplerDist(TMoverParameters const *Left, TMoverParameters const *Right);
static double Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1, const TDimension &Dim2);
bool Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Enforce = false, bool Audible = true);
int DettachStatus(int ConnectNo);
bool Dettach(int ConnectNo);
void damage_coupler(int const End);
// repairs the broken coupler of the end, and the one of the vehicle it was coupled with, so they can be coupled
// again; the vehicles clear their coupler damage once neither of their couplers is broken. returns: whether there
// was a broken coupler to repair
bool repair_coupler(int const End);
void Derail(DerailReason Reason);
bool DirectionForward();
bool DirectionBackward(void); /*! kierunek ruchu*/
bool EIMDirectionChangeAllow(void) const;
inline double IsVehicleEIMBrakingFactor() const
{
return DynamicBrakeFlag && ResistorsFlag ? 0.0 : eimv[eimv_Ipoj] < 0 ? -1.0 : 1.0;
}
void BrakeLevelSet(double b);
bool BrakeLevelAdd(double b);
bool IncBrakeLevel(); // wersja na użytek AI
bool DecBrakeLevel();
bool ChangeCab(int direction);
bool CurrentSwitch(bool const State);
bool IsMotorOverloadRelayHighThresholdOn() const;
void UpdateBatteryVoltage(double dt);
double ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam const &Track, TTractionParam const &ElectricTraction, TLocation const &NewLoc,
TRotation const &NewRot); // oblicza przesuniecie pojazdu
double FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, TLocation const &NewLoc, TRotation const &NewRot); // oblicza przesuniecie pojazdu - wersja zoptymalizowana
void compute_movement_(double const Deltatime);
double ShowEngineRotation(int VehN) const;
// Q *******************************************************************************************
double GetTrainsetVoltage(int const Coupling = coupling::heating | coupling::highvoltage) const;
double GetTrainsetHighVoltage() const;
bool switch_physics(bool const State);
double LocalBrakeRatio(void) const;
double ManualBrakeRatio(void) const;
double PipeRatio(void) const; /*ile napelniac*/
double RealPipeRatio(void) const; /*jak szybko*/
double BrakeVP(void) const;
double EngineRPMRatio() const; // returns current engine revolutions as percentage of max engine revolutions, in range 0-1
double EngineIdleRPM() const;
double EngineMaxRPM() const;
/*! przesylanie komend sterujacych*/
bool SendCtrlToNext(std::string const &CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = coupling::control);
bool SetInternalCommand(std::string const &NewCommand, double NewValue1, double NewValue2, int const Couplertype = coupling::control);
double GetExternalCommand(std::string &Command) const;
bool RunCommand(std::string const &Command, double CValue1, double CValue2, int const Couplertype = coupling::control);
bool RunInternalCommand();
void PutCommand(std::string const &NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
bool CabActivisation(bool const Enforce = false);
bool CabDeactivisation(bool const Enforce = false);
bool CabActivisationAuto(bool const Enforce = false);
bool CabDeactivisationAuto(bool const Enforce = false);
/*! funkcje zwiekszajace/zmniejszajace nastawniki*/
/*! glowny nastawnik:*/
bool IncMainCtrl(int CtrlSpeed);
bool DecMainCtrl(int CtrlSpeed);
bool IsMainCtrlActualNoPowerPos() const; // whether the master controller is actually set to position which won't generate any extra power
bool IsMainCtrlNoPowerPos() const; // whether the master controller is set to position which won't generate any extra power
bool IsMainCtrlMaxPowerPos() const;
int MainCtrlNoPowerPos() const; // highest setting of master controller which won't cause engine to generate extra power
int MainCtrlActualPowerPos() const; // current actual setting of master controller, relative to the highest setting not generating extra power
int MainCtrlPowerPos() const; // current setting of master controller, relative to the highest setting not generating extra power
// positions the master controller of the EIMCtrlType 2 (Elf) has below its own position 0, the emergency brake (0 or 1)
int EIMCtrlEmergencyPositions() const;
// whether the master controller is in its emergency brake position (EIMCtrlType 2 with EIMCtrlMainEmergency)
bool IsMainCtrlEmergencyPos() const;
// the master controller position sent to the coupled vehicles ("MainCtrl"), the same with and without
// EIMCtrlMainEmergency: the Elf's positions without the emergency brake one, which goes as the full braking
int MainCtrlPosForCoupled() const;
// the master controller position of this vehicle for one received from a coupled vehicle ("MainCtrl")
int MainCtrlPosFromCoupled(int Position) const;
/*! pomocniczy nastawnik:*/
bool IncScndCtrl(int CtrlSpeed);
bool DecScndCtrl(int CtrlSpeed);
int GetVirtualScndPos() const;
// whether ScndCtrlResistiveLock keeps the shunt controller from being moved at the current master controller position
bool IsScndCtrlLockedByMainCtrl() const;
// ScndCtrlResistiveLock: the shunt controller drops to 0 once the master controller is at zero or on a resistive position, so it
// can't stay engaged there, locked in place (eu07/maszyna#402)
void ScndCtrlResistiveLockCheck();
bool IsScndCtrlNoPowerPos() const;
bool IsScndCtrlMaxPowerPos() const;
bool AddPulseForce(int Multipler); /*dla drezyny*/
bool SandboxManual(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza reczne sypanie piasku*/
bool SandboxAuto(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza automatyczne sypanie piasku*/
bool Sandbox(bool const State, range_t const Notify = range_t::consist); /*wlacza/wylacza sypanie piasku*/
bool SandboxAutoAllow(bool const State); /*wlacza/wylacza zezwolenie na automatyczne sypanie piasku*/
/*! zbijanie czuwaka/SHP*/
void SecuritySystemReset(void);
void SecuritySystemCheck(double dt);
bool BatterySwitch(bool State, range_t const Notify = range_t::consist);
bool EpFuseSwitch(bool State);
bool SpringBrakeActivate(bool State);
bool SpringBrakeShutOff(bool State);
bool SpringBrakeRelease();
/*! stopnie hamowania - hamulec zasadniczy*/
bool IncBrakeLevelOld(void);
bool DecBrakeLevelOld(void);
bool IncLocalBrakeLevel(float const CtrlSpeed);
bool DecLocalBrakeLevel(float const CtrlSpeed);
/*! ABu 010205: - skrajne polozenia ham. pomocniczego*/
bool IncManualBrakeLevel(int CtrlSpeed);
bool DecManualBrakeLevel(int CtrlSpeed);
/*! oddzielny nastawnik hamulca elektrodynamicznego (gdy SplitEDPneumaticBrake)*/
bool IncDynamicBrakeLevel(float const CtrlSpeed);
bool DecDynamicBrakeLevel(float const CtrlSpeed);
bool DynamicBrakeLevelSet(double Position);
double DynamicBrakeRatio(void) const;
bool DynamicBrakeAvailable(void) const; /*czy ED dostepny w aktualnym oknie predkosci Vh0..Vh1*/
bool DynamicBrakeSwitch(bool Switch);
bool RadiostopSwitch(bool Switch);
bool AlarmChainSwitch(bool const State);
bool AntiSlippingBrake(void);
bool BrakeReleaser(int state);
bool UniversalBrakeButton(int button, int state); /*uniwersalny przycisk hamulca*/
bool SwitchEPBrake(int state);
// whether the EP brake control of the cab has power: battery, the reverser out of neutral and the EP fuse on
bool EPBrakeControlPowered() const;
bool AntiSlippingButton(void); /*! reczny wlacznik urzadzen antyposlizgowych*/
/*funkcje dla ukladow pneumatycznych*/
bool IncBrakePress(double &brake, double PressLimit, double dp);
bool DecBrakePress(double &brake, double PressLimit, double dp);
bool BrakeDelaySwitch(int BDS); /*! przelaczanie nastawy opoznienia*/
bool IncBrakeMult(void); /*przelaczanie prozny/ladowny*/
bool DecBrakeMult(void);
/*pomocnicze funkcje dla ukladow pneumatycznych*/
void UpdateBrakePressure(double dt);
void UpdatePipePressure(double dt);
void CompressorCheck(double dt); /*wlacza, wylacza kompresor, laduje zbiornik*/
void UpdatePantVolume(double dt); // Ra
void UpdateScndPipePressure(double dt);
void UpdateSpringBrake(double dt);
double GetDVc(double dt);
/*funkcje obliczajace sily*/
void ComputeConstans(void); // ABu: wczesniejsze wyznaczenie stalych dla liczenia sil
void ComputeMass(void);
void ComputeTotalForce(double dt);
double Adhesive(double staticfriction) const;
double TractionForce(double dt);
double FrictionForce() const;
double BrakeForceR(double ratio, double velocity) const;
double BrakeForceP(double press, double velocity) const;
double BrakeForce(const TTrackParam &Track);
double CouplerForce(int const End, double dt);
// whether the coupling at the end is computed by the physical model: couplerphysics set in eu07.ini, and this
// vehicle or the one at the end covered by it (CouplerPhysics), or every vehicle with couplerphysics all
bool coupler_physics_at(int const End) const;
// the force of the coupling at the end by the physical model (couplerphysics in eu07.ini), see couplerphysics.h
double coupler_force_physical(int const End, double const dt);
// with the physical model: whether the vehicles at the end hit the stop of their springs at the last update and
// still close in on it, so that they collide; a hit hard enough breaks the coupling or crushes the buffers
bool coupler_stop_hit(int const End, TMoverParameters &Other, int const OtherEnd);
// couples the automatic couplers of the end and of the other vehicle pressed against each other, unless the hit
// is too fast for them to catch
void automatic_coupling(int const End, TMoverParameters &Other, int const OtherEnd);
void CollisionDetect(int const End, double const dt);
// closing speed of a collision [km/h] above which the vehicles involved may derail, adjusted for their mass ratio
static constexpr double SafeCollisionVelocity{15.0};
// closing speed [km/h] of the End of this vehicle and the OtherEnd of the other vehicle it touches, along the coupler
// axis: the sum of the speeds in a head-on collision, the difference in a rear-end one, negative when they part
double CollisionVelocity(int const End, TMoverParameters const &Other, int const OtherEnd) const;
// velocity [m/s] of this vehicle relative to the other vehicle it touches with its End and the OtherEnd of the
// other one, along this vehicle's axis
double CouplerVelocityDifference(int const End, TMoverParameters const &Other, int const OtherEnd) const;
// whether the automatic couplers at the End of this vehicle and the OtherEnd of the other one can catch each other on
// contact, rather than the vehicles colliding (with crash damage enabled, only at a closing speed which doesn't derail them)
bool AutomaticCouplingSafe(int const End, TMoverParameters const &Other, int const OtherEnd) const;
// whether the control coupling (multiple-unit control) can join the End of this vehicle and the OtherEnd of the other
// one: not between an electric and a diesel traction vehicle, unless both couplers name the same control system
// (ControlType). Vehicles without own traction (cars, control trailers) take any. Global.control_coupling_engine_check
// off allows it always (eu07/maszyna#520)
bool ControlCouplingAllowed(int const End, TMoverParameters const &Other, int const OtherEnd) const;
// the CouplingType to join the End of this vehicle and the OtherEnd of the other one with, without the control coupling
// when ControlCouplingAllowed() rules it out. a permanent coupling (of the vehicles of one unit) is kept whole
int CompatibleCoupling(int const End, TMoverParameters const &Other, int const OtherEnd, int const CouplingType) const;
// the horns of the Signal (WarningSignal bits) which have the air or the voltage they need to sound
int SoundingHorns(int const Signal) const;
// whether the signal lamps of the main circuit (line contactors, ground relay, motor overload relays) can light:
// the pressure switch, when fitted, cuts the start off and puts them out, otherwise they go out once the brakes are applied
bool MainCircuitLampsEnabled() const
{
return false == ControlPressureSwitch && (HasControlPressureSwitch || BrakePress < 1.0);
}
// whether the lamp of the open line contactors is lit. on the electric locomotives it tells the start can be made, so
// it goes out with the start cut off; on the diesel-electric ones (the SU45 and SU46 family) it just tells the
// contactors are open, whatever opened them: the master controller at 0, or the pressure switch (eu07/maszyna#263)
bool LineContactorsLampLit() const
{
if (EngineType == TEngineType::DieselElectric)
{
return false == StLinFlag;
}
return false == StLinFlag && MainCircuitLampsEnabled();
}
// the vehicles the line breaker / engine start switch of this vehicle works, and its engine stopping on its own
// stops: the whole consist, or with JointEngineStart=No this vehicle alone (eu07/maszyna#80)
range_t MainSwitchRange() const
{
return JointEngineStart ? range_t::consist : range_t::local;
}
// whether the vehicle has a driver's cab: it has the driver's brake valve (BrakeHandle in the Cntrl. section of the
// .fiz), which the wagons and most cars of the units without a cab don't (a few copy the Cntrl. section of the cab
// car, as the EN57 s car does). it's the vehicle type's, unlike the cab the scenario puts a driver in
bool HasDriverCab() const
{
return BrakeHandle != TBrakeHandle::NoHandle;
}
// whether the cab command opening the main circuit opens it where the only cab switch of the circuit is the button
// closing it: on a diesel that's the starter button, and the command is the one way to stop an engine whose fuel pump
// starts on its own (eu07/maszyna#427). the other vehicles with such a button keep ignoring the command
bool MainCircuitOpensWithStarterOnly() const
{
return EngineType == TEngineType::DieselEngine || EngineType == TEngineType::DieselElectric;
}
// whether the pumps a joint oil and fuel pump switch works, those not started automatically, are all switched on
bool OilFuelPumpsEnabled() const
{
auto const fuelmanual{FuelPump.start_type != start_t::automatic};
auto const oilmanual{OilPump.start_type != start_t::automatic};
return (fuelmanual || oilmanual) && (false == fuelmanual || FuelPump.is_enabled) && (false == oilmanual || OilPump.is_enabled);
}
// whether the radio is switched on, its power supply isn't cut off and it has the low voltage to work
bool RadioPowered() const
{
return Radio && RadioFuse && (Power24vIsAvailable || Power110vIsAvailable);
}
/*obrot kol uwzgledniajacy poslizg*/
double ComputeRotatingWheel(double WForce, double dt, double n) const;
/*--funkcje dla lokomotyw*/
bool WaterPumpBreakerSwitch(bool State, range_t const Notify = range_t::consist); // water pump breaker state toggle
bool WaterPumpSwitch(bool State, range_t const Notify = range_t::consist); // water pump state toggle
bool WaterPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // water pump state toggle
bool WaterHeaterBreakerSwitch(bool State, range_t const Notify = range_t::consist); // water heater breaker state toggle
bool WaterHeaterSwitch(bool State, range_t const Notify = range_t::consist); // water heater state toggle
bool WaterCircuitsLinkSwitch(bool State, range_t const Notify = range_t::consist); // water circuits link state toggle
bool FuelPumpSwitch(bool State, range_t const Notify = range_t::consist); // fuel pump state toggle
bool FuelPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // fuel pump state toggle
bool OilPumpSwitch(bool State, range_t const Notify = range_t::consist); // oil pump state toggle
bool OilPumpSwitchOff(bool State, range_t const Notify = range_t::consist); // oil pump state toggle
bool MotorBlowersSwitch(bool State, end const Side, range_t const Notify = range_t::consist); // traction motor fan state toggle
bool MotorBlowersSwitchOff(bool State, end const Side, range_t const Notify = range_t::consist); // traction motor fan state toggle
bool CompartmentLightsSwitch(bool State, range_t const Notify = range_t::consist); // compartment lights state toggle
bool CompartmentLightsSwitchOff(bool State, range_t const Notify = range_t::consist); // compartment lights state toggle
bool MainSwitch(bool const State, range_t const Notify = range_t::consist); /*! wylacznik glowny*/
void MainSwitch_(bool const State);
bool MainSwitchCheck() const; // checks conditions for closing the line breaker
bool ConverterSwitch(bool State, range_t const Notify = range_t::consist); /*! wl/wyl przetwornicy*/
bool CompressorSwitch(bool State, range_t const Notify = range_t::consist); /*! wl/wyl sprezarki*/
bool ChangeCompressorPreset(int const Change, range_t const Notify = range_t::consist);
bool HeatingSwitch(bool const State, range_t const Notify = range_t::consist);
void HeatingSwitch_(bool const State);
double EnginePowerSourceVoltage() const; // returns voltage of defined main engine power source
/*-funkcje typowe dla lokomotywy elektrycznej*/
void LowVoltagePowerCheck(double const Deltatime);
void MainsCheck(double const Deltatime);
void PowerCouplersCheck(double const Deltatime, coupling const Coupling);
void ConverterCheck(double const Timestep); // przetwornica
void HeatingCheck(double const Timestep);
void WaterPumpCheck(double const Timestep);
void WaterHeaterCheck(double const Timestep);
void FuelPumpCheck(double const Timestep);
void OilPumpCheck(double const Timestep);
void MotorBlowersCheck(double const Timestep);
void PantographsCheck(double const Timestep);
void LightsCheck(double const Timestep);
bool FuseOn(range_t const Notify = range_t::consist); // bezpiecznik nadamiary
bool FuseFlagCheck(void) const; // sprawdzanie flagi nadmiarowego
void FuseOff(void); // wylaczenie nadmiarowego
bool UniversalResetButton(int const Button, range_t const Notify = range_t::consist);
bool RelayReset(int const Relays, range_t const Notify = range_t::consist); // resets specified relays
double ShowCurrent(int AmpN) const; // pokazuje bezwgl. wartosc pradu na wybranym amperomierzu
double ShowCurrentP(int AmpN) const; // pokazuje bezwgl. wartosc pradu w wybranym pojezdzie //Q 20160722
/*!o pokazuje bezwgl. wartosc obrotow na obrotomierzu jednego z 3 pojazdow*/
/*function ShowEngineRotation(VehN:int): integer; //Ra 2014-06: przeniesione do C++*/
/*funkcje uzalezniajace sile pociagowa od predkosci: v2n, n2r, current, momentum*/
double v2n(void);
double Current(double n, double U);
double Momentum(double I) const;
double MomentumF(double I, double Iw, int SCP) const;
bool CutOffEngine(void); // odlaczenie udszkodzonych silnikow
/*funkcje automatycznego rozruchu np EN57*/
bool MaxCurrentSwitch(bool State, range_t const Notify = range_t::consist); // przelacznik pradu wysokiego rozruchu
bool MinCurrentSwitch(bool State); // przelacznik pradu automatycznego rozruchu
bool AutoRelaySwitch(bool State); // przelacznik automatycznego rozruchu
bool AutoRelayCheck(); // symulacja automatycznego rozruchu
bool MotorConnectorsCheck();
bool ResistorsFlagCheck(void) const; // sprawdzenie kontrolki oporow rozruchowych NBMX
bool OperatePantographsValve(operation_t const State, range_t const Notify = range_t::consist);
bool OperatePantographValve(end const End, operation_t const State, range_t const Notify = range_t::consist);
bool DropAllPantographs(bool const State, range_t const Notify = range_t::consist);
void CheckEIMIC(double dt); // sprawdzenie i zmiana nastawy zintegrowanego nastawnika jazdy/hamowania
void CheckSpeedCtrl(double dt);
void SpeedCtrlButton(int button);
void SpeedCtrlInc();
void SpeedCtrlDec();
bool SpeedCtrlPowerInc();
bool SpeedCtrlPowerDec();
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
bool dizel_EngageSwitch(double state);
bool dizel_EngageChange(double dt);
bool dizel_AutoGearCheck(void);
double dizel_fillcheck(int mcp, double dt);
double dizel_Momentum(double dizel_fill, double n, double dt);
double dizel_MomentumRetarder(double n, double dt); // moment hamowania retardera
void dizel_HeatSet(float const Value);
void dizel_Heat(double const dt);
bool dizel_StartupCheck();
bool dizel_Update(double dt);
/* funckje dla wagonow*/
bool AssignLoad(std::string const &Name, float const Amount = 0.f);
bool LoadingDone(double LSpeed, std::string_view Loadname);
bool PermitDoors(side const Door, bool const State = true, range_t const Notify = range_t::consist);
void PermitDoors_(side const Door, bool const State = true);
bool ChangeDoorPermitPreset(int const Change, range_t const Notify = range_t::consist);
bool PermitDoorStep(bool const State, range_t const Notify = range_t::consist);
bool ChangeDoorControlMode(bool const State, range_t const Notify = range_t::consist);
bool OperateDoors(side const Door, bool const State, range_t const Notify = range_t::consist);
bool LockDoors(bool const State, range_t const Notify = range_t::consist);
bool signal_departure(bool const State, range_t const Notify = range_t::consist); // toggles departure warning
void update_doors(double const Deltatime); // door controller update
door_closure_t door_closure() const; // state of the door closure signalling of this vehicle
// whether the door closure lamp in the cab of this vehicle is lit: with DoorClosureSignal, for the given state of the
// consist; without it, for the lock of the vehicle's own doors, as the lamp always worked
bool door_closure_lamp_lit(door_closure_t const Consist, bool const BlinkLit) const;
/* funkcje dla samochodow*/
bool ChangeOffsetH(double DeltaOffset);
/*funkcje ladujace pliki opisujace pojazd*/
bool LoadFIZ(std::string const &chkpath); // Q 20160717 bool LoadChkFile(std::string chkpath);
bool LoadFIZ_Text(std::string const &Text); // the same, from text in the .fiz format
bool CheckLocomotiveParameters(bool ReadyFlag, int Dir);
std::string EngineDescription(int what) const;
// the cab interior light the light preset at given position (1-based, as LightsPos) sets, if it sets one
std::optional<lights_preset_cablight> LightsPresetCabLight(int Position) const;
private:
bool LoadFIZ_Parse(cParser &Parser); // reads the definition from either of the above
void LoadFIZ_Param(std::string const &line);
void LoadFIZ_Load(std::string const &line);
void LoadFIZ_Dimensions(std::string const &line);
void LoadFIZ_Wheels(std::string const &line);
void LoadFIZ_Brake(std::string const &line);
void LoadFIZ_Doors(std::string const &line);
void LoadFIZ_BuffCoupl(std::string const &line, int const Index);
void LoadFIZ_TurboPos(std::string const &line);
void LoadFIZ_Cntrl(std::string const &line);
void LoadFIZ_Blending(std::string const &line);
void LoadFIZ_DCEMUED(std::string const &line);
void LoadFIZ_SpringBrake(std::string const &line);
void LoadFIZ_Light(std::string const &line);
void LoadFIZ_Headlights(std::string const &Line);
void LoadFIZ_Clima(std::string const &line);
void LoadFIZ_Power(std::string const &Line);
void LoadFIZ_SpeedControl(std::string const &Line);
void LoadFIZ_Engine(std::string const &Input);
void LoadFIZ_Switches(std::string const &Input);
void LoadFIZ_MotorParamTable(std::string const &Input);
void LoadFIZ_Circuit(std::string const &Input);
void LoadFIZ_AI(std::string const &Input);
void LoadFIZ_RList(std::string const &Input);
void LoadFIZ_UCList(std::string const &Input);
void LoadFIZ_DList(std::string const &Input);
void LoadFIZ_FFList(std::string const &Input);
void LoadFIZ_FFEDList(std::string const &Input);
void LoadFIZ_WiperList(std::string const &Input);
void LoadFIZ_LightsList(std::string const &Input);
void LoadFIZ_DimmerList(std::string const &Input);
void LoadFIZ_CompressorList(std::string const &Input);
void LoadFIZ_PowerParamsDecode(TPowerParameters &Powerparameters, std::string const &Prefix, std::string const &Input);
TPowerType LoadFIZ_PowerDecode(std::string const &Power) const;
TPowerSource LoadFIZ_SourceDecode(std::string const &Source) const;
TEngineType LoadFIZ_EngineDecode(std::string const &Engine) const;
bool readMPT0(std::string const &line);
bool readMPT(std::string const &line); // Q 20160717
bool readMPTElectricSeries(std::string const &line);
bool readMPTDieselElectric(std::string const &line);
bool readMPTDieselEngine(std::string const &line);
bool readBPT(/*int const ln,*/ std::string const &line); // Q 20160721
bool readRList(std::string const &Input);
bool readUCList(std::string const &Input);
bool readDList(std::string const &line);
bool readDMList(std::string const &line);
bool readV2NMAXList(std::string const &line);
bool readHTCList(std::string const &line);
bool readPmaxList(std::string const &line);
bool readFFList(std::string const &line);
bool readFFEDList(std::string const &line);
bool readWWList(std::string const &line);
bool readWiperList(std::string const &line);
bool readDimmerList(std::string const &line);
bool readLightsList(std::string const &Input);
bool readCompressorList(std::string const &Input);
void BrakeValveDecode(std::string const &s); // Q 20160719
void BrakeSubsystemDecode(); // Q 20160719
};
// double Distance(TLocation Loc1, TLocation Loc2, TDimension Dim1, TDimension Dim2);
namespace simulation
{
using weights_table = std::unordered_map<std::string, float>;
extern weights_table Weights;
} // namespace simulation