Skip to content

Commit

Permalink
Packaging cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
m-hoff committed Dec 22, 2020
1 parent 8c932af commit 2df7cdd
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 564 deletions.
4 changes: 0 additions & 4 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
MIT License

<<<<<<< HEAD
Copyright (c) 2019 Michael Hoffman
=======
Copyright (c) 2020 Michael Hoffman
>>>>>>> dev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Simantha

<<<<<<< HEAD
`maintsim` can be used to model a discrete manufacturing system where components degrade over time and receive maintenance. Users can define the configuration and parameters of the system, as well as the maintenance policy to be carried out. It is built on the `SimPy` discrete-event simulation package.

## Installing maintsim

`pip install maintsim`
=======
Simantha uses discrete event simulation to model the behavior of discrete manufacturing systems, in particular the production and maintenance functions of a system.
>>>>>>> dev
Simantha uses discrete event simulation to model the behavior of discrete manufacturing systems, in particular the production and maintenance functions mass production systems.

## Using this package

### Requirements

Simantha requires Python &ge; 3.6 and [SciPy](https://www.scipy.org/) &ge; 1.5.2 for running tests.

### Installation

Install from PyPi using

```
pip install simantha
```

### Setting up a manufacturing system

A system consists of various assets that are linked together by a specified routing. The available assets are described below.
Expand All @@ -37,9 +37,7 @@ Parameters

While a machine operates it will continuously take parts from an upstream container (if the container is not empty), process the part, and place the part in a downstream container (if the container is not full). Machines can be subject to periodic degradation and failure, at which point they will require maintenance action before they can be restored.

Currently, machines may only follow a Markovian degradation process[^1]. Under this degradation mode, a degradation transition matrix is specified as a parameter of a machine. State transitions of this Markov process represent changes in the degradation level of the machine. In general, it is assumed that there is one absorbing state that represents machine failure.

[^1]: Chan, G. K., & Asgarpoor, S. (2006). Optimum maintenance policy with Markov processes. Electric power systems research, 76(6-7), 452-456. https://doi.org/10.1016/j.epsr.2005.09.010
Currently, machines may only follow a Markovian degradation process.<sup>[1](#chan)</sup> Under this degradation mode, a degradation transition matrix is specified as a parameter of a machine. State transitions of this Markov process represent changes in the degradation level of the machine. In general, it is assumed that there is one absorbing state that represents machine failure.

Parameters
- `cycle_time` - the duration of time a machine must process a part before it can be placed at the next station.
Expand Down Expand Up @@ -128,9 +126,7 @@ Simulation finished in 0.00s
Parts produced: 100
```

As a slightly more complex example, the code below constructs a two-machine one-buffer line where each machine is subject to degradation. The degradation transition matrix will represent Bernoulli reliability with p = 0.01.[^2] Additionally, the maintainer capacity is set to 1, indicating that only one machine may be repaired at a time.

[^2]: Li, J., & Meerkov, S. M. (2008). Production systems engineering. Springer Science & Business Media. https://doi.org/10.1007/978-0-387-75579-3
As a slightly more complex example, the code below constructs a two-machine one-buffer line where each machine is subject to degradation. The degradation transition matrix will represent Bernoulli reliability with p = 0.01.<sup>[2](#li)</sup> Additionally, the maintainer capacity is set to 1, indicating that only one machine may be repaired at a time.

```python
>>> from simantha import Source, Machine, Buffer, Sink, System, Maintainer
Expand Down Expand Up @@ -192,10 +188,10 @@ Parts produced: 200

The elements of these examples can be used to more complex configurations of arbitrary structure. Additionally, the `Machine` class may represent other operations in a manufacturing system, such as an inspection station or a material handling process.

## Planned features
Additional examples are located in `simantha/examples/`.

## References

Key planned features include
<a name="chan">1.</a> Chan, G. K., & Asgarpoor, S. (2006). Optimum maintenance policy with Markov processes. Electric power systems research, 76(6-7), 452-456. https://doi.org/10.1016/j.epsr.2005.09.010

- Parallelization of simulation iterations
- Improved efficiency for iterating a simulation
- Exporting system model for reuse
<a name="li">2.</a> Li, J., & Meerkov, S. M. (2008). Production systems engineering. Springer Science & Business Media. https://doi.org/10.1007/978-0-387-75579-3
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
long_description = f.read()

setuptools.setup(
name='maintsim',
version='0.1.3',
name='simantha',
version='0.0.1',
author='Michael Hoffman',
author_email='MichaelHoffman@psu.edu',
description='Simulation of maintenance for manufacturing',
author_email='hoffman@psu.edu',
description='Simulation of Manufacturing Systems',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/m-hoff/maintsim',
packages=setuptools.find_packages(),
classifiers=[
'Programming Language :: Python :: 3',
'Intended Audience :: Manufacturing',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent'
]
)
)
78 changes: 0 additions & 78 deletions simantha/Evaluator.py

This file was deleted.

11 changes: 5 additions & 6 deletions simantha/Machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def get_part(self):
self.target_giver = None

def request_space(self):
#request_space_start = time.time()
self.has_finished_part = True
candidate_receivers = [obj for obj in self.downstream if obj.can_receive()]
if len(candidate_receivers) > 0:
Expand Down Expand Up @@ -188,7 +187,7 @@ def put_part(self):
source = f'{self.name}.put_part at {self.env.now}'
self.env.schedule_event(self.env.now, self, self.request_part, source)

# check if this event fed another machine
# Check if this event fed another machine
for asset in self.target_receiver.downstream:
if self.target_receiver.can_give() and asset.can_receive() and not asset.has_content_request():
source = f'{self.name}.put_part at {self.env.now}'
Expand Down Expand Up @@ -384,7 +383,7 @@ def can_give(self):
)

def has_content_request(self):
# check if a machine has an existing request for a part
# Check if a machine has an existing request for a part
for event in self.env.events:
if (
((event.location is self) and (event.action.__name__ == 'request_part'))
Expand All @@ -400,14 +399,14 @@ def has_vacancy_request(self):
return False

def cancel_all_events(self):
# cancel all events scheduled on this machine
# Cancel all events scheduled on this machine
for event in self.env.events:
if event.location == self:
event.canceled = True

def get_candidate_givers(self, only_free=False, blocked=False):
if blocked:
# get only candidate givers that can give a part
# Get only candidate givers that can give a part
return [obj for obj in self.get_candidate_givers() if obj.blocked]
else:
return [obj for obj in self.upstream if obj.can_give()]
Expand All @@ -416,5 +415,5 @@ def get_candidate_receivers(self, only_free=False, starved=False):
if starved:
return [obj for obj in self.get_candidate_receivers() if obj.starved]
else:
# get only candidate receivers that can accept a part
# Get only candidate receivers that can accept a part
return [obj for obj in self.downstream if obj.can_receive()]
105 changes: 0 additions & 105 deletions simantha/Repairman.py

This file was deleted.

Loading

0 comments on commit 2df7cdd

Please sign in to comment.