コード例 #1
0
ファイル: main.go プロジェクト: turing-complete/laboratory
func New(config *config.System) (*System, error) {
	platform, application, err := system.Load(config.Specification)
	if err != nil {
		return nil, err
	}

	time := time.NewList(platform, application)
	schedule := time.Compute(system.NewProfile(platform, application).Mobility)
	dynamicPower := dynamic.New(platform, application)

	staticPower, err := createStaticPower(dynamicPower, schedule, &config.StaticPower)
	if err != nil {
		return nil, err
	}

	temperature, err := temperature.NewFixed(&config.Config)
	if err != nil {
		return nil, err
	}

	return &System{
		Platform:    platform,
		Application: application,

		time:         time,
		schedule:     schedule,
		dynamicPower: dynamicPower,
		staticPower:  staticPower,
		temperature:  temperature,

		Δt: config.TimeStep,
	}, nil
}
コード例 #2
0
ファイル: main_test.go プロジェクト: turing-complete/power
func prepare(name string) (*Power, *time.Schedule) {
	platform, application, _ := system.Load(findFixture(fmt.Sprintf("%s.tgff", name)))
	power := New(platform, application)
	profile := system.NewProfile(platform, application)
	list := time.NewList(platform, application)
	schedule := list.Compute(profile.Mobility)
	return power, schedule
}