Class JMTIO
-
- All Implemented Interfaces:
public class JMTIOUnified I/O handler for JMT (Java Modelling Tools) files.
This class provides both read and write functionality for JMT XML format files (JSIM and JMVA) from LINE network models. It combines the functionality previously split between JMTXMLParser (write) and JMTResultParser (read).
Supported operations:
- Write: Generate JSIM/JMVA XML files from LINE models
- Read: Parse JSIM/JMVA result files and log files
JMTIO jmtio = new JMTIO(model, options); // Write String outputFile = jmtio.writeJSIM(sn, "model.jsim"); // Read JMTResult result = jmtio.parseJSIMResult("model.jsim-result.jsim");
-
-
Field Summary
Fields Modifier and Type Field Description public final Networkmodelpublic final doublesimConfIntpublic final doublesimMaxRelErrpublic final longseed
-
Method Summary
-
-
Constructor Detail
-
JMTIO
JMTIO(Network model)
Creates a new JMTIO instance with default settings.- Parameters:
model- The LINE network model
-
JMTIO
JMTIO(Network model, double simConfInt, double simMaxRelErr, long maxSamples, long maxEvents, double maxSimulatedTime, long seed)
Creates a new JMTIO instance with full parameter control.- Parameters:
model- The LINE network modelsimConfInt- Confidence interval for simulation (e.g., 0.simMaxRelErr- Maximum relative error (e.g., 0.maxSamples- Maximum number of samplesmaxEvents- Maximum number of events (-1 for unlimited)maxSimulatedTime- Maximum simulated timeseed- Random seed for reproducibility
-
-
Method Detail
-
getSimConfInt
double getSimConfInt()
-
getSimMaxRelErr
double getSimMaxRelErr()
-
getSeed
long getSeed()
-
getSaveHandlers
SaveHandlers getSaveHandlers(SolverAvgHandles avgHandles)
Gets or creates the SaveHandlers instance for XML generation.
- Parameters:
avgHandles- Performance metric handles- Returns:
SaveHandlers instance
-
updateNetworkStruct
void updateNetworkStruct(NetworkStruct sn)
Updates the network structure in the SaveHandlers.
- Parameters:
sn- The network structure
-
saveXMLHeader
ElementDocumentPair saveXMLHeader(SolverAvgHandles avgHandles, String logPath)
Generates the XML header for JMT simulation files.
- Parameters:
avgHandles- Performance metric handleslogPath- Path for simulation logs- Returns:
ElementDocumentPair containing the XML structure
-
saveClasses
ElementDocumentPair saveClasses(SolverAvgHandles avgHandles, ElementDocumentPair elementDocumentPair)
Saves class definitions to the XML document.
-
saveMetrics
ElementDocumentPair saveMetrics(SolverAvgHandles avgHandles, ElementDocumentPair elementDocumentPair)
Saves metrics configuration to the XML document.
-
saveLinks
ElementDocumentPair saveLinks(SolverAvgHandles avgHandles, ElementDocumentPair elementDocumentPair)
Saves network links to the XML document.
-
saveRegions
ElementDocumentPair saveRegions(SolverAvgHandles avgHandles, ElementDocumentPair elementDocumentPair)
Saves finite capacity regions to the XML document.
-
saveArrivalStrategy
DocumentSectionPair saveArrivalStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveBufferCapacity
DocumentSectionPair saveBufferCapacity(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveServiceStrategy
DocumentSectionPair saveServiceStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveRoutingStrategy
DocumentSectionPair saveRoutingStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveNumberOfServers
DocumentSectionPair saveNumberOfServers(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveServerVisits
DocumentSectionPair saveServerVisits(SolverAvgHandles avgHandles, DocumentSectionPair pair)
-
saveDropStrategy
DocumentSectionPair saveDropStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveGetStrategy
DocumentSectionPair saveGetStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
savePutStrategy
DocumentSectionPair savePutStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveClassSwitchStrategy
DocumentSectionPair saveClassSwitchStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveForkStrategy
DocumentSectionPair saveForkStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveJoinStrategy
DocumentSectionPair saveJoinStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveCacheStrategy
DocumentSectionPair saveCacheStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveLogTunnel
DocumentSectionPair saveLogTunnel(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveDelayOffStrategy
DocumentSectionPair saveDelayOffStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveSwitchoverStrategy
DocumentSectionPair saveSwitchoverStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
savePreemptiveStrategy
DocumentSectionPair savePreemptiveStrategy(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
savePreemptiveWeights
DocumentSectionPair savePreemptiveWeights(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
saveImpatience
DocumentSectionPair saveImpatience(SolverAvgHandles avgHandles, DocumentSectionPair pair, int ind)
-
parseLogs
Array<Array<Array<Matrix>>> parseLogs(Array<boolean> isNodeLogged, MetricType metric)
Parses JMT log files for the specified metric type.
- Parameters:
isNodeLogged- Array indicating which nodes have logging enabledmetric- The metric type to parse (e.g.- Returns:
3D array of matrices containing parsed data [nodes][classes][data]
-
parseCSVLog
List<Array<String>> parseCSVLog(String filePath)
Parses a CSV log file from JMT.
- Parameters:
filePath- Path to the CSV log file- Returns:
List of parsed rows, each as a String array
-
parseTranRespT
Array<Array<Matrix>> parseTranRespT(List<Array<String>> arvData, List<Array<String>> depData)
Parses transient response time data from arrival and departure logs.
- Parameters:
arvData- Arrival log datadepData- Departure log data- Returns:
2D array of matrices [classes][data matrices]
-
parseTranState
Array<Object> parseTranState(List<Array<String>> arvData, List<Array<String>> depData, Matrix nodePreload)
Parses transient state data from log files.
- Parameters:
arvData- Arrival log datadepData- Departure log datanodePreload- Initial state at the node- Returns:
Array containing [state matrix, event types, event classes, event jobs]
-
parseJSIMResult
JMTResult parseJSIMResult(String resultFilePath)
Parses a JSIM result XML file.
- Parameters:
resultFilePath- Path to the JSIM result file- Returns:
Parsed JMTResult, or null if parsing fails
-
parseJMVAResult
JMTResult parseJMVAResult(String resultFilePath)
Parses a JMVA result XML file.
- Parameters:
resultFilePath- Path to the JMVA result file- Returns:
Parsed JMTResult, or null if parsing fails
-
-
-
-