aivika-experiment-chart 5.1 → 5.3
raw patch · 5 files changed
+78/−26 lines, 5 filesdep ~aivikadep ~aivika-experimentPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aivika, aivika-experiment
API changes (from Hackage documentation)
+ Simulation.Aivika.Experiment.Chart.TimeSeriesView: [timeSeriesGridSize] :: TimeSeriesView -> Maybe Int
+ Simulation.Aivika.Experiment.Chart.XYChartView: [xyChartGridSize] :: XYChartView -> Maybe Int
- Simulation.Aivika.Experiment.Chart.TimeSeriesView: TimeSeriesView :: String -> String -> Int -> Int -> ExperimentFilePath -> Event Bool -> ResultTransform -> ResultTransform -> ResultTransform -> String -> String -> [PlotLines Double Double -> PlotLines Double Double] -> (LayoutAxis Double -> LayoutAxis Double) -> (LayoutLR Double Double Double -> LayoutLR Double Double Double) -> TimeSeriesView
+ Simulation.Aivika.Experiment.Chart.TimeSeriesView: TimeSeriesView :: String -> String -> Int -> Int -> Maybe Int -> ExperimentFilePath -> Event Bool -> ResultTransform -> ResultTransform -> ResultTransform -> String -> String -> [PlotLines Double Double -> PlotLines Double Double] -> (LayoutAxis Double -> LayoutAxis Double) -> (LayoutLR Double Double Double -> LayoutLR Double Double Double) -> TimeSeriesView
- Simulation.Aivika.Experiment.Chart.XYChartView: XYChartView :: String -> String -> Int -> Int -> ExperimentFilePath -> Event Bool -> ResultTransform -> ResultTransform -> ResultTransform -> ResultTransform -> String -> String -> [PlotLines Double Double -> PlotLines Double Double] -> (LayoutAxis Double -> LayoutAxis Double) -> (LayoutLR Double Double Double -> LayoutLR Double Double Double) -> XYChartView
+ Simulation.Aivika.Experiment.Chart.XYChartView: XYChartView :: String -> String -> Int -> Int -> Maybe Int -> ExperimentFilePath -> Event Bool -> ResultTransform -> ResultTransform -> ResultTransform -> ResultTransform -> String -> String -> [PlotLines Double Double -> PlotLines Double Double] -> (LayoutAxis Double -> LayoutAxis Double) -> (LayoutLR Double Double Double -> LayoutLR Double Double Double) -> XYChartView
Files
- CHANGELOG.md +6/−0
- Simulation/Aivika/Experiment/Chart/TimeSeriesView.hs +21/−9
- Simulation/Aivika/Experiment/Chart/XYChartView.hs +25/−13
- aivika-experiment-chart.cabal +3/−3
- examples/TruckHaulingSituation/Experiment.hs +23/−1
CHANGELOG.md view
@@ -1,4 +1,10 @@ +Version 5.3+-----++* The time series and XY chart use a fixed grid to improve+ the performance of the Diagrams-based charting backend.+ Version 5.1 -----
Simulation/Aivika/Experiment/Chart/TimeSeriesView.hs view
@@ -50,6 +50,8 @@ -- ^ The width of the chart. timeSeriesHeight :: Int, -- ^ The height of the chart.+ timeSeriesGridSize :: Maybe Int,+ -- ^ The size of the grid, where the series data are processed. timeSeriesFileName :: ExperimentFilePath, -- ^ It defines the file name with optional extension for each image to be saved. -- It may include special variables @$TITLE@, @$RUN_INDEX@ and @$RUN_COUNT@.@@ -117,6 +119,7 @@ timeSeriesDescription = "It shows the Time Series chart(s).", timeSeriesWidth = 640, timeSeriesHeight = 480,+ timeSeriesGridSize = Just (2 * 640), timeSeriesFileName = UniqueFilePath "TimeSeries($RUN_INDEX)", timeSeriesPredicate = return True, timeSeriesTransform = id,@@ -220,17 +223,26 @@ replace "$RUN_COUNT" (show n) $ replace "$PLOT_TITLE" plotTitle' runPlotTitle+ inputSignal ext =+ case timeSeriesGridSize view of+ Just m ->+ liftEvent $+ fmap (mapSignal $ const ()) $+ newSignalInTimeGrid m+ Nothing ->+ return $+ pureResultSignal signals $+ resultValueSignal ext inputHistory exts = forM exts $ \ext ->- let transform () =- do x <- predicate- if x- then resultValueData ext- else return (1/0) -- the infinite values will be ignored then- in newSignalHistory $- mapSignalM transform $- pureResultSignal signals $- resultValueSignal ext+ do let transform () =+ do x <- predicate+ if x+ then resultValueData ext+ else return (1/0) -- the infinite values will be ignored then+ s <- inputSignal ext+ newSignalHistory $+ mapSignalM transform s hs1 <- inputHistory exts1 hs2 <- inputHistory exts2 disposableComposite $
Simulation/Aivika/Experiment/Chart/XYChartView.hs view
@@ -50,6 +50,8 @@ -- ^ The width of the chart. xyChartHeight :: Int, -- ^ The height of the chart.+ xyChartGridSize :: Maybe Int,+ -- ^ The size of the grid, where the series data are processed. xyChartFileName :: ExperimentFilePath, -- ^ It defines the file name with optional extension for each image to be saved. -- It may include special variables @$TITLE@, @$RUN_INDEX@ and @$RUN_COUNT@.@@ -125,6 +127,7 @@ xyChartDescription = "It shows the XY chart(s).", xyChartWidth = 640, xyChartHeight = 480,+ xyChartGridSize = Just (2 * 640), xyChartFileName = UniqueFilePath "XYChart($RUN_INDEX)", xyChartPredicate = return True, xyChartTransform = id,@@ -236,21 +239,30 @@ replace "$RUN_COUNT" (show n) $ replace "$PLOT_TITLE" plotTitle' runPlotTitle+ inputSignal ext =+ case xyChartGridSize view of+ Just m ->+ liftEvent $+ fmap (mapSignal $ const ()) $+ newSignalInTimeGrid m+ Nothing ->+ return $+ pureResultSignal signals $+ resultValueSignal ext inputHistory exts = forM exts $ \ext ->- let x = resultValueData ext0- y = resultValueData ext- transform () =- do p <- predicate- if p- then liftM2 (,) x y- else return (1/0, 1/0) -- such values will be ignored then- signalx = resultValueSignal ext0- signaly = resultValueSignal ext- in newSignalHistory $- mapSignalM transform $- pureResultSignal signals $- signalx <> signaly+ do let x = resultValueData ext0+ y = resultValueData ext+ transform () =+ do p <- predicate+ if p+ then liftM2 (,) x y+ else return (1/0, 1/0) -- such values will be ignored then+ signalx = resultValueSignal ext0+ signaly = resultValueSignal ext+ s <- inputSignal ext+ newSignalHistory $+ mapSignalM transform s hs1 <- inputHistory exts1 hs2 <- inputHistory exts2 disposableComposite $
aivika-experiment-chart.cabal view
@@ -1,5 +1,5 @@ name: aivika-experiment-chart-version: 5.1+version: 5.3 synopsis: Simulation experiments with charting for the Aivika library description: This package complements the aivika [1] and aivika-experiment [2] packages with@@ -145,8 +145,8 @@ lens >= 3.9, data-default-class >= 0.0.1, colour >= 2.3.3,- aivika >= 5.3,- aivika-experiment >= 5.1+ aivika >= 5.5,+ aivika-experiment >= 5.3 extensions: MultiParamTypeClasses
examples/TruckHaulingSituation/Experiment.hs view
@@ -27,7 +27,29 @@ experimentSpecs = specs, experimentRunCount = 1000, -- experimentRunCount = 10,- experimentTitle = "A Truck Hauling Situation" }+ experimentTitle = "A Truck Hauling Situation",+ experimentDescription = description }++description =+ "The system to be modeled in this example consists of one bulldozer, four trucks, \+ \ and two man-machine loaders. The bulldozer stockpiles material for the loaders. \+ \ Two piles of material must be stocked prior to the initiation of any load operation. \+ \ The time for the bulldozer to stockpile material is Erlang distributed and consists \+ \ of the sum of two exponential variables each with a men of 4. (This corresponds to \+ \ an Erlang variable with a mean of 8 and a variance of 32.) In addition to this \+ \ material, a loader and an unloaded truck must be available before the loading \+ \ operations can begin. Loading time is exponentially distributed with a mean time of \+ \ 14 minutes for server 1 and 12 minutes for server 2. \+ \ \+ \ After a truck is loaded, it is hauled, then dumped and must be returned before \+ \ the truck is available for further loading. Hauling time is normally distributed. \+ \ When loaded, the average hauling time is 22 minutes. When unloaded, the average \+ \ time is 18 minutes. In both cases, the standard deviation is 3 minutes. Dumping \+ \ time is uniformly distributed between 2 and 8 minutes. Following a loading \+ \ operation, the loaded must rest for a 5 minute period before he is available \+ \ to begin loading again. The system is to be analyzed for 8 hours and all operations \+ \ in progress at the end of 8 hours should be completed before terminating \+ \ the operations for a run." loadQueue = T.Queue $ resultByName "loadQueue" loadQueueCount = T.queueCount loadQueue