Go to the documentation of this file.00001
00008 #include "load.h"
00009 #include <string.h>
00010 #include <SCControl/SCControl.h>
00011
00012
00013 load :: load(dsim_model_setup *setup) : dsim_model(setup)
00014 {
00015 }
00016
00017 void load :: initialize_data()
00018 {
00019 dsim_model::initialize_data();
00020
00021 double power_consumed = 10;
00022 double power = 10;
00023
00024 power_consumed_dsim = create_output("power_consumed", sd_type_double, &power_consumed, 1,1, "W", "Power consumed by load");
00025
00026 power_consumed_dsim.mark_telemetry_and_command();
00027
00028 power_dsim = create_output("power", sd_type_double, &power, 1,1, "W", "Power consumed");
00029 power_dsim.mark_telemetry();
00030
00031 configure_timestep(true, false, false);
00032
00033 }
00034
00035 void load :: initialization_complete()
00036 {
00037 dsim_model::initialization_complete();
00038 }
00039
00040 void load :: pre_calculate()
00041 {
00042 dsim_model::initialize_timestep();
00043
00044 double power_consumed = power_consumed_dsim.value_as_double();
00045
00046 power_dsim.set_value_as_double( power_consumed );
00047 }
00048
00049
00050 extern "C"
00051 {
00052 dsim_model *Load(void *setup);
00053
00054 dsim_model *Load(void *setup)
00055 {
00056 return new load((dsim_model_setup *)setup);
00057 }
00058 }