Giter VIP home page Giter VIP logo

cs-budgetcontroller's People

Contributors

wboler05 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

headkillah

cs-budgetcontroller's Issues

Mod Options

Mod options need to be implemented for the following:

  • Enable/Disable the mod itself (Checkbox)
  • Enable/Disable each budget item (Checkbox)
  • Control the percentage offset of consumption for capacity (Slider)

This should be simple and straightforward, but with me being new to C# and a familiar with C++, I will need to examine the the callback methods used for GUI operations.

PID Tuning

In control theory, PID controllers are simple ways for controlling closed-loop systems. The output of the system is fed back to the input, and an error is fed into a controller. The controller sums three components: proportionality, integral, and derivative (PID), and feeds its output to the system.

image
Image Source: Wikipedia

Currently, a rudimentary PID controller has been designed for the mod but needs to be further evaluated. System sampling occurs sporadically (whenever money is called to be adjusted) and actual system time is not considered. The error that I use is actually the mean squared error (MSE), which is non-linear but has a smooth derivative. In my actual research, MSE and other high-order errors have proven to perform better than a strictly linear difference, due to the removal of the discontinuity at 0, but the effects should be evaluated for the PID controller.

The input is shifted, based on a percentage of the consumption, so that the controller attempts to zero on an offset, i.e. +15% of consumption. The input is also normalized based on a ratio of the budget range (100) and the capacity of the budget item (which returns 0 if the capacity is 0). The output itself is clamped between 50% and 150% (the game's limits for budget settings). The actual PID function is written with a windowed queue that takes historical errors and uses the queue for the derivative (difference) and integral (summation) components (which may be improper to do).

All of these concepts should be evaluated for performance and scalability. All the tuning is done by hand, which is tedious and can introduce instability. Each of the budget item's impulse response needs to be analyzed, which I believe would mimic a simple first-order system with some "noise" caused by other obvious factors. Once proper sampling and system modelling is implemented and a Tau and system gain loss can be calculated, the PID controller can automatically be tuned for each budget item.

In all, this issue's objective is to implement a PID tuner. I will spend some free-time combing over my "Modern Control Systems" book for educational reinforcement and formulate a better method for implementing budget controls.

Level Upgrade

For now, the mod turns on automatically like a tool. I would like to be able to add it with level progression, as well as to make it so that you hire an actual "manager" that costs money. That means there will need to be GUI work to allow a player to hire a manager, which could be a simple checkbox. In the final version, this option would enable by default, but the player will have the option to override the setting, much like a cheat.

Education Manager

Currently, the mod only works for water and electricity. Work will need to be done in order to adjust budget for education. For now, the best way to judge education would be to assess the accessibility to students across the city for Elementary, High School, and University, and to take the minimum capacity of the three. It will also need to be evaluated to determine if setting education too low has unforeseen consequences (other than accessibility). Work may need to be implemented to verify whether or not education is enabled, and tuning will need to be evaluated for availability issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.