public OpenFiscaResource Build(MotorVehicleSimulationCase rule, MotorVehiclePerson person)
        {
            var result = new OpenFiscaResource();

            for (int i = 0; i < person.WeeklySchedule.Hours.Count; i++)
            {
                var hourSet    = person.WeeklySchedule.Hours[i];
                var personName = $"day_{i+1}";
                result.CreatePerson(personName);
                result.SetProp(personName, OF.DailyOTHours, null);
                result.SetProp(personName, OF.DailyHmvoHours, hourSet.HoursHmvo);
                result.SetProp(personName, OF.DailyCmvoHours, hourSet.HoursCmvo);
                result.SetProp(personName, OF.DailyBusHours, 0);
                result.SetProp(personName, OF.DailyOtherHours, hourSet.HoursOther);

                result.SetProp(personName, OF.StandardClcDailyHours, rule.StandardOtherDaily);
                result.SetProp(personName, OF.StandardCmvoDailyHours, rule.StandardCmvoDaily);

                result.SetProp(personName, OF.IsHoliday, hourSet.IsHoliday);
            }
            return(result);
        }
Exemplo n.º 2
0
        public OpenFiscaResource Build(MotorVehicleSimulationCase rule, MotorVehiclePerson person, decimal dailyResult)
        {
            var    result     = new OpenFiscaResource();
            string personName = "person1";

            result.CreatePerson(personName);

            // Target value
            result.SetProp(personName, OF.TotalOTHours, null);

            // Person vars
            result.SetProp(personName, OF.WeeklyHmvoHours, person.WeeklyHmvoHours);
            result.SetProp(personName, OF.WeeklyBusHours, 0);
            result.SetProp(personName, OF.WeeklyCmvoHours, person.WeeklyCmvoHours);
            result.SetProp(personName, OF.WeeklyOtherHours, person.WeeklyOtherHours);
            result.SetProp(personName, OF.NumHolidaysInPeriod, person.NumHolidays);

            // Parameter overrides
            result.SetProp(personName, OF.StandardClcDailyHours, rule.StandardOtherDaily);
            result.SetProp(personName, OF.StandardCmvoDailyHours, rule.StandardCmvoDaily);
            result.SetProp(personName, OF.StandardClcWeeklyHours, rule.StandardOtherWeekly);
            result.SetProp(personName, OF.StandardCmvoWeeklyHours, rule.StandardCmvoWeekly);
            result.SetProp(personName, OF.StandardHmvoHolidayReduction, rule.StandardHighwayReduction);
            result.SetProp(personName, OF.StandardHmvoWeeklyHours, rule.StandardHighwayWeekly);

            // Daily result
            result.SetProp(personName, OF.DailyOTHours, dailyResult);

            return(result);
        }