D KSL Utility Packages

Learning Objectives

  • To be become familiar with the classes and functionality associated with KSL utilities

  • To be able to use the KSL file input and output related utilities for CSV, Excel, data frames, and databases

  • To be able to use the KSL array related utilities

  • To be able to use the KSL plotting functionality

  • To be able to use the KSL functionality for performing designed experiments

The purpose of this appendix is to describe the general utilities available within the KSL. The utilities are meant to assist programmers in using Kotlin and especially the use of the simulation constructs available within the KSL. The package ksl.utilities hold a wide variety of classes that support both the programmer and the developer of simulation models. The important items to be discussed in this appendix include:

  • The ksl.utilities.io package, which provides support mostly for file input and output some of which, e.g. the MarkDown and StatisticReporter classes have already been mentioned.
  • The KSLArrays and RArrays classes provide support for working with 1-D and 2-D arrays, including a number of extension functions that are useful for computational work and simulation related activities.
  • Miscellaneous utilities involving observers, math, and useful interfaces and classes that facilitate working within the KSL

NOTE! This chapter provides illustrative examples of some of the functionality of the ksl.utilities package. The full source code of the examples can be found in the accompanying KSLExamples project associated with the KSL repository. The files for each example of this chapter can be found here.

We will start by looking at the utilities for input and output.