Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define aircraft load factor as parameter #76

Closed
MicheleMUC opened this issue Mar 15, 2016 · 2 comments
Closed

Define aircraft load factor as parameter #76

MicheleMUC opened this issue Mar 15, 2016 · 2 comments

Comments

@MicheleMUC
Copy link
Contributor

Either definition of number of passengers per seating class or load factor

@MicheleMUC MicheleMUC added this to the Alpha 0.7 milestone Mar 15, 2016
@MicheleMUC MicheleMUC self-assigned this Mar 15, 2016
@MicheleMUC MicheleMUC modified the milestones: Alpha 0.6, Alpha 0.7 Mar 15, 2016
@MicheleMUC
Copy link
Contributor Author

@marcengelmann Until now only the_ First Class Passenger_ number (first element in tree) is calculated based on the load factor. Do you've any idea why? tc.getAvailableSeats() and tc.getLoadFactor() aren't zero but numberPax returns zero.

    private void updateTravelClassProperties() {
        for (TravelClass tc : cabin.getClasses()) {
            // set number of seats
            int numberSeats = ModelHelper.getChildrenByClass(tc, Seat.class).size();
            tc.setAvailableSeats(numberSeats);
            // calculate load factor and number of passengers
            if (tc.getPassengers() == 0 && tc.getLoadFactor() != 0){
                int numberPax = tc.getAvailableSeats()*tc.getLoadFactor()/100;
                tc.setPassengers(numberPax);
            }
            else {
                int loadFactor = tc.getPassengers()*100/tc.getAvailableSeats();
                tc.setLoadFactor(loadFactor);
            }
        }
    }

@marcengelmann
Copy link
Member

dividing by 100 as Int rounds the whole Expression to integer -> divide by 100.0 and round to in in the end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants