wboler05 / cs-budgetcontroller Goto Github PK
View Code? Open in Web Editor NEWThis is a mod for Cities:Skylines that controls the water and electricity budget automatically based on consumption rates.
License: MIT License
This is a mod for Cities:Skylines that controls the water and electricity budget automatically based on consumption rates.
License: MIT License
Mod options need to be implemented for the following:
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.
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 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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.