LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
jsim_reader.h File Reference

Read a JMT .jsim / .jsimg / .jsimw model into a qn::Network. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <limits>
#include <fstream>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "line/lang/lang_types.h"
#include "line/lang/qn/network_builder.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
#include "line/util/xml.h"
#include <unistd.h>
Include dependency graph for jsim_reader.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::io

Functions

template<class T>
qn::Network< T > line::io::read_jsim (const std::string &path, const std::string &name=std::string())
 Read a JSIM document into a Network.
std::string line::io::jsim_stage_stdin (const std::string &text)
 Write a piped XML model document to a temporary file and return its path.

Detailed Description

Read a JMT .jsim / .jsimg / .jsimw model into a qn::Network.

Port of matlab/src/io/JSIM2LINE.m (and jline.io.M2M.JSIM2LINE), the inverse of jmt_writer.h. It is what lets line-cli -i jsimg solve a model a user drew in JMT's GUI, which until now only the MATLAB and JAR front ends could do.

THE MODEL IS UNDER <sim> AND NOTHING ELSE IS READ. A .jsimg also carries a sibling <jmodel> block holding GUI data – station coordinates, class colours – and it repeats every <userClass name=...>. Reading the document root instead of <sim> therefore doubles every class, silently, on exactly the files a user is most likely to import.

THE SECTION ORDER IS THE INTERFACE. A JMT node is three <section> elements – input, service, output – and every parameter inside one is found by POSITION, not by name: saveGetStrategy writes the put strategy fourth because the reader counts to four. This reader therefore addresses parameters positionally where the reference does, and by name attribute where a name exists, which is what makes it survive the two JMT XML dialects (the retrial-carrying 1.2.0 form shifts the put strategy from parameter 4 to 5, and the reference tells them apart by reading parameter 3's name).

WHAT IS NOT READ IS REFUSED BY NAME rather than dropped. A .jsimg can describe blocking regions, cache sections and measures this reader does not reconstruct; importing such a file and solving the remainder would answer a question about a different model. The refusals name the section.

Definition in file jsim_reader.h.