Class SaveHandlers
This class is responsible for converting LINE network models into JMT XML format for discrete-event simulation. It provides comprehensive support for translating various network components including nodes, routing strategies, service disciplines, and performance metrics.
The class supports both JSIMg (JMT Simulation Graph) and JSIM (JMT Simulation) XML formats, with JSIMg being the default format that includes additional simulation parameters such as confidence intervals, maximum relative error, and stopping criteria.
Key Features:
- Conversion of LINE Network models to JMT XML format
- Support for complex routing strategies and class switching
- Handling of various node types (Sources, Queues, Delays, Sinks, etc.)
- Translation of service disciplines and scheduling strategies
- Cache modeling with different replacement strategies
- Fork-join synchronization patterns
- Performance metric collection and measurement configuration
Supported Node Types:
- Sources with various arrival processes
- Queues with different scheduling disciplines
- Delay stations for pure delays
- Sinks for job termination
- Routers for probabilistic routing
- Forks and Joins for synchronization
- Caches with replacement strategies
- Transitions for Petri net models
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classServer pools and job parallelism of a node, as the JMT Server section needs them. -
Constructor Summary
ConstructorsConstructorDescriptionSaveHandlers(Network simModel) Constructs a SaveHandlers instance with default simulation parameters.SaveHandlers(Network simModel, double simMaxRelErr, double simConfInt, SolverAvgHandles avgHandles, long seed, String simFileName, long maxEvents, long maxSamples, double maxSimulatedTime) Constructs a SaveHandlers instance with full simulation parameter control. -
Method Summary
Modifier and TypeMethodDescriptionboolean[]Returns a boolean array indicating which classes should be exported to JMT.booleanisHeterogeneousStation(int stationIdx) Checks if a station has heterogeneous server configuration.static booleanjmtCapIsUnbounded(NetworkStruct sn, int ist) Is the buffer at stationistUNBOUNDED, as the JSIM writer reads it?static doublejmtReachablePopulation(NetworkStruct sn, int ist) jmtReachablePopulation(int)against an explicit struct, so that SolverJMT.jmtMethodRefusal can apply the writer's own BINDING test without building a writer.static StringjmtStationCapRefusal(NetworkStruct sn, int ist) jmtStationCapAssert(int)as a SENTENCE rather than an exception, against an explicit struct; empty when the buffer atistis exportable.saveArrivalStrategy(DocumentSectionPair documentSectionPair, int ind) saveBufferCapacity(DocumentSectionPair documentSectionPair, int ind) Saves buffer capacity for JMT XML.saveCache(ElementDocumentPair elementDocumentPair) saveCacheStrategy(DocumentSectionPair documentSectionPair, int ind) saveClasses(ElementDocumentPair elementDocumentPair) saveClassParallelism(DocumentSectionPair documentSectionPair, int ind) Saves the per-class job parallelism to JMT XML.saveClassSwitchStrategy(DocumentSectionPair documentSectionPair, int ind) saveDelayOffStrategy(DocumentSectionPair documentSectionPair, int ind) Saves delay-off and setup time strategies for Queue nodes.saveDropRule(DocumentSectionPair documentSectionPair, int ind) saveDropStrategy(DocumentSectionPair documentSectionPair, int ind) saveEnablingConditions(DocumentSectionPair documentSectionPair, int ind) saveFCRMetrics(ElementDocumentPair elementDocumentPair) Saves performance metrics for Finite Capacity Regions (blocking regions).saveFiringOutcomes(DocumentSectionPair documentSectionPair, int ind) saveFiringPriorities(DocumentSectionPair documentSectionPair, int ind) saveFiringWeights(DocumentSectionPair documentSectionPair, int ind) saveForkStrategy(DocumentSectionPair documentSectionPair, int ind) saveGetStrategy(DocumentSectionPair documentSectionPair) saveGetStrategy(DocumentSectionPair documentSectionPair, int ind) saveHeterogeneousServerConfig(DocumentSectionPair documentSectionPair, int ind) Saves all heterogeneous server configuration to JMT XML.saveHeteroSchedPolicy(DocumentSectionPair documentSectionPair, int ind) Saves heterogeneous scheduling policy to JMT XML.saveImpatience(DocumentSectionPair documentSectionPair, int ind) saveInhibitingConditions(DocumentSectionPair documentSectionPair, int ind) saveJoinStrategy(DocumentSectionPair documentSectionPair, int ind) saveLinks(ElementDocumentPair elementDocumentPair) saveLogTunnel(DocumentSectionPair documentSectionPair, int ind) saveMetric(ElementDocumentPair elementDocumentPair, AvgHandle handles) saveMetrics(ElementDocumentPair elementDocumentPair) saveModeNames(DocumentSectionPair documentSectionPair, int ind) saveNumberOfServers(DocumentSectionPair documentSectionPair, int ind) saveNumbersOfServers(DocumentSectionPair documentSectionPair, int ind) savePlaceCapacities(DocumentSectionPair documentSectionPair, int ind) savePreemptiveStrategy(DocumentSectionPair documentSectionPair, int ind) savePreemptiveWeights(DocumentSectionPair documentSectionPair, int ind) savePutStrategies(DocumentSectionPair documentSectionPair, int ind) savePutStrategy(DocumentSectionPair documentSectionPair, int ind) saveRegions(ElementDocumentPair elementDocumentPair) saveRetrialDistributions(DocumentSectionPair documentSectionPair, int ind) saveRoutingStrategy(DocumentSectionPair documentSectionPair, int ind) saveServerCompatibilities(DocumentSectionPair documentSectionPair, int ind) Saves server-class compatibility matrix to JMT XML.saveServersPerType(DocumentSectionPair documentSectionPair, int ind) Saves the number of servers per server type to JMT XML.saveServerTypeNames(DocumentSectionPair documentSectionPair, int ind) Saves heterogeneous server type names to JMT XML.saveServerVisits(DocumentSectionPair documentSectionPair) saveServiceStrategy(DocumentSectionPair documentSectionPair, int ind) saveSwitchoverStrategy(DocumentSectionPair documentSectionPair, int ind) saveTimingStrategies(DocumentSectionPair documentSectionPair, int ind) saveTotalCapacity(DocumentSectionPair documentSectionPair, int ind) saveXMLHeader(String logPath) serverPools(int ind) Builds the server pools of nodeind, or null when the station declares neither server types nor job parallelism.setPollingServerClassName(DocumentSectionPair documentSectionPair, int ind) voidUpdates the internal network structure used for model conversion.voidwarnHeteroRates(int ind) Warns that per-server-type service rates cannot reach the JMT engine.
-
Constructor Details
-
SaveHandlers
public SaveHandlers(Network simModel, double simMaxRelErr, double simConfInt, SolverAvgHandles avgHandles, long seed, String simFileName, long maxEvents, long maxSamples, double maxSimulatedTime) Constructs a SaveHandlers instance with full simulation parameter control.This constructor allows complete customization of all simulation parameters for JMT model generation. It is typically used when specific simulation configuration is required beyond the default settings.
- Parameters:
simModel- The LINE network model to be converted to JMT formatsimMaxRelErr- Maximum relative error for simulation stopping criterion (e.g., 0.03 for 3%)simConfInt- Confidence interval for simulation results (e.g., 0.99 for 99%)avgHandles- Collection of performance metric handlers to be included in the simulationseed- Random number generator seed for reproducible simulation resultssimFileName- Output filename for the simulation model (empty string for default naming)maxEvents- Maximum number of events to simulate (0 for unlimited)maxSamples- Maximum number of samples to collect for each metricmaxSimulatedTime- Maximum simulation time (use GlobalConstants.Inf for unlimited)
-
SaveHandlers
Constructs a SaveHandlers instance with default simulation parameters.This convenience constructor uses SolverJMT default values for all simulation parameters, making it suitable for most standard simulation scenarios. The default configuration provides reasonable accuracy and performance for typical queueing network analysis.
Default Parameters:
- Maximum relative error: 3%
- Confidence interval: 99%
- Random seed: 23000
- Maximum samples: 10,000
- Maximum events: unlimited
- Maximum simulation time: unlimited
- Parameters:
simModel- The LINE network model to be converted to JMT format
-
-
Method Details
-
updateNetworkStruct
Updates the internal network structure used for model conversion.This method allows updating the network structure after the SaveHandlers instance has been created. This is useful when the network model has been modified or when working with multiple network configurations.
- Parameters:
sn- The new network structure to use for subsequent conversions
-
getExportableClasses
public boolean[] getExportableClasses()Returns a boolean array indicating which classes should be exported to JMT. Classes with 0 customers are normally skipped unless they are used as cache hit/miss classes (since jobs will switch into them) or can receive jobs via class-switching from another class in the same chain.- Returns:
- boolean array of length nclasses, true for classes to export
-
saveArrivalStrategy
-
saveBufferCapacity
Saves buffer capacity for JMT XML. LINE uses Kendall notation where cap = K = total system capacity (queue + in-service). JMT's "size" parameter also represents total capacity K. -
jmtReachablePopulation
jmtReachablePopulation(int)against an explicit struct, so that SolverJMT.jmtMethodRefusal can apply the writer's own BINDING test without building a writer. sn.cap is DERIVED for a station the user never capped, so "the cap is finite" is not the question -- "the cap is below what can reach the station" is.- Parameters:
sn- the model structist- station index- Returns:
- the reachable population, possibly infinite
-
jmtCapIsUnbounded
Is the buffer at stationistUNBOUNDED, as the JSIM writer reads it?THIS PORT DOES NOT CARRY Inf ON sn.cap FOR AN UNBOUNDED STATION, and that is what makes the question worth a named predicate.
Station.capis anint, so it cannot hold Inf: its "no bound" value isInteger.MAX_VALUE(Station.hasFiniteCap()is the predicate for the declared one). refreshCapacity then derives a station's capacity asmin(sum(chaincap row), sum(classcap row)), and it SUMS that sentinel across the classes served there -- so an unbounded MIXED station comes out as 2147483647 + 2 = 2147483649 for one open and one closed class, and a Source serving two open classes as 2 x 2147483647 = 4294967294.Utils.isInf(double)recognises the sentinel EXACTLY and so does not see a sum of them.>= Integer.MAX_VALUEis refreshCapacity's own idiom for the same question (chainCap >= Integer.MAX_VALUE,station.getCap() >= Integer.MAX_VALUE), and it is safe because setCapacity takes anint: no capacity a caller can declare is larger. MATLAB, native python and C++ all carry a genuine Inf here, so this narrowing is the JAR's alone.saveBufferCapacity used to ask the question by NARROWING to int first, which saturates the sum back onto Integer.MAX_VALUE and made Utils.isInf answer correctly by accident. Naming it here is what lets the gate ask the same question as the writer instead of reading the raw double and concluding that every mixed model has a binding buffer.
- Parameters:
sn- the model structist- station index- Returns:
- true when the station has no bound a job can reach
-
jmtStationCapRefusal
jmtStationCapAssert(int)as a SENTENCE rather than an exception, against an explicit struct; empty when the buffer atistis exportable.ONE PREDICATE, TWO CALLERS. saveBufferCapacity raises it while writing the JSIM document, and SolverJMT.jmtMethodRefusal returns it so that findSolver and SolverAUTO never offer jmt.jsim on a model the writer will refuse. It used to be reachable only from inside the writer, which is why the gate could not see it.
- Parameters:
sn- the model structist- station index- Returns:
- empty string when exportable, otherwise the refusal
-
saveCache
-
saveCacheStrategy
-
saveClassSwitchStrategy
public DocumentSectionPair saveClassSwitchStrategy(DocumentSectionPair documentSectionPair, int ind) -
saveClasses
-
saveDropRule
-
saveDropStrategy
-
saveEnablingConditions
-
saveFiringOutcomes
-
saveFiringPriorities
-
saveFiringWeights
-
saveForkStrategy
-
saveGetStrategy
-
saveGetStrategy
-
setPollingServerClassName
public DocumentSectionPair setPollingServerClassName(DocumentSectionPair documentSectionPair, int ind) -
saveSwitchoverStrategy
-
saveDelayOffStrategy
Saves delay-off and setup time strategies for Queue nodes. This exports the switchoverStrategies, delayOffTime and setUpTime parameters to JMT XML format when the queue has delay-off times enabled.JMT's Server constructor expects parameters in order: switchoverStrategies, delayOffStrategies, setUpStrategies
- Parameters:
documentSectionPair- the document/section pair to append toind- the node index- Returns:
- updated document/section pair
-
saveInhibitingConditions
public DocumentSectionPair saveInhibitingConditions(DocumentSectionPair documentSectionPair, int ind) -
saveJoinStrategy
-
saveLinks
-
saveLogTunnel
-
saveMetric
-
saveMetrics
-
saveFCRMetrics
Saves performance metrics for Finite Capacity Regions (blocking regions). Requests QLen, RespT, ResidT, and Tput metrics for each FCR. -
saveModeNames
-
saveNumberOfServers
-
isHeterogeneousStation
public boolean isHeterogeneousStation(int stationIdx) Checks if a station has heterogeneous server configuration.- Parameters:
stationIdx- the station index- Returns:
- true if the station has heterogeneous servers
-
serverPools
Builds the server pools of nodeind, or null when the station declares neither server types nor job parallelism.- Parameters:
ind- the node index- Returns:
- the pools, or null when the Server section needs no pool block
-
saveClassParallelism
Saves the per-class job parallelism to JMT XML. Generates the classParallelism parameter array (Server.serverNumRequired).- Parameters:
documentSectionPair- the document/section pairind- the node index- Returns:
- updated document/section pair
-
saveServerTypeNames
Saves heterogeneous server type names to JMT XML. Generates the serverNames parameter array.- Parameters:
documentSectionPair- the document/section pairind- the node index- Returns:
- updated document/section pair
-
saveServersPerType
Saves the number of servers per server type to JMT XML. Generates the serversPerServerType parameter array.- Parameters:
documentSectionPair- the document/section pairind- the node index- Returns:
- updated document/section pair
-
saveServerCompatibilities
public DocumentSectionPair saveServerCompatibilities(DocumentSectionPair documentSectionPair, int ind) Saves server-class compatibility matrix to JMT XML. Generates the serverCompatibilities parameter array.- Parameters:
documentSectionPair- the document/section pairind- the node index- Returns:
- updated document/section pair
-
saveHeteroSchedPolicy
Saves heterogeneous scheduling policy to JMT XML. Generates the schedulingPolicy parameter.- Parameters:
documentSectionPair- the document/section pairind- the node index- Returns:
- updated document/section pair
-
warnHeteroRates
public void warnHeteroRates(int ind) Warns that per-server-type service rates cannot reach the JMT engine.JMT keys the ServiceStrategy array of a station by refClass, so its loader (
jmt.engine.simEngine.SimLoader) keeps one strategy per class however many (type, class) entries are written, and every pool of a station ends up serving at the class rate. Pool sizes, class compatibilities and the assignment policy do cross; setService(class, type, distribution) rates do not.- Parameters:
ind- the node index
-
saveHeterogeneousServerConfig
public DocumentSectionPair saveHeterogeneousServerConfig(DocumentSectionPair documentSectionPair, int ind) Saves all heterogeneous server configuration to JMT XML. This is a convenience method that calls all hetero save methods.- Parameters:
documentSectionPair- the document/section pairind- the node index- Returns:
- updated document/section pair
-
saveNumbersOfServers
-
savePlaceCapacities
-
savePreemptiveStrategy
-
savePreemptiveWeights
-
savePutStrategies
-
savePutStrategy
-
saveImpatience
-
saveRetrialDistributions
public DocumentSectionPair saveRetrialDistributions(DocumentSectionPair documentSectionPair, int ind) -
saveRegions
-
saveRoutingStrategy
-
saveServerVisits
-
saveServiceStrategy
-
saveTimingStrategies
-
saveTotalCapacity
-
saveXMLHeader
- Throws:
ParserConfigurationException
-