org.unizone.finance.power

Type ConvenienceYield

org.unizone.0.6570
Instance of Type
Inheriting from SourceAdapterSingleTimeseries

Type dataValue
org.uninode.Type.displayPattern{att:org.unizone.source.Source.displayName}
org.unizone.source.Source.valueAttribute
org.uninode.Resource.resourceType
org.uninode.Resource.label
org.uninode.Resource.resourceOfList{}
org.uninode.Listable.resourcesReference[org.uninode.Listable.resources] of org.unizone.finance.power.ConvenienceYield

Attribute summaryDefined inUninode® IdPropertiesDefault
Reference[org.uninode.Listable.resources]resourcesListableorg.uninode.0.2001type
StringtoString
This is the display string.
Nodeorg.uninode.0.102
Typetype
The type of an object determines the behaviour and attributes of the object.
Nodeorg.uninode.0.101
StringuriNodeorg.uninode.0.103
StringlabelResourceorg.uninode.0.2041type
List[Type]resourceOfResourceorg.uninode.0.2042type
SignatureresourceType
This defines the type of resource. It can be 'view', 'adapter' or 'action'
Resourceorg.uninode.0.2043type
StringdisplayName
The display name is the name that is shown in lists, displays and graphs.
Sourceorg.unizone.0.4001essential
AttributevalueAttribute
The value attribute is used for determining the default value that should be used for displaying this source in a graph.
Sourceorg.unizone.0.4011type
inheritValue
SignaturevalueType
The value type determines which axes should be used in graphs.
Sourceorg.unizone.0.4002inheritValue
SourcesourceSourceAdapterSingleorg.unizone.0.4051

Method summaryDefined inOverridesProperties
voidactivateListable
voidcheckRangeSourceAdapterSingleSource
voiddesignEditor(WidgetWorkspace ws)Listable
voidgenerateScript(ScriptGenerationInfo info)SourceAdapterSingleScriptGenerator
Realget(DateTime timestamp)SourceAdapterSingleTimeseries
BooleanisResourceOf(Listable listable, Signature aspect)Mixabletype
ListablemixOn(Mixable mix)Mixable
ListablemixWith(Mixable mix)Mixable
voidput(DateTime timestamp, Real value)SourceAdapterSingleTimeseries
StringresourceStringListableintrospection
voidsetSource(Source source)SourceAdapterSingle
SourcesourceSourceAdapterSingle
voidXXXcom.nodelab.java.sourceadaptersingle.CheckRangeSourceAdapterSingle
SignatureXXXcom.nodelab.java.sourceadaptersingle.ValueTypeSourceAdapterSingle
voidcom.nodelab.java.source.ActivateSourceListable
Listablecom.nodelab.java.source.MixWithMiSourceMixable

Script summary
org.unizone.0.8545
/*
instance InstrumentPower power;
instance InstrumentPower spot;
instance InstrumentPower yieldGovBond;
constructor() {
  TimeBuffer:();
  instance spot = ~power_system_average;
  instance yieldGovBond = ~yieldGovBond;
  addNextSource(instance spot);
  addNextSource(instance yieldGovBond);
}
constructor(InstrumentPower power) {
  TimeBuffer:();
  instance power = power;
  instance spot = ~power_system_average;
  instance yieldGovBond = ~yieldGovBond;
  addNextSource(power);
  addNextSource(instance spot);
  addNextSource(instance yieldGovBond);
}
Object preferredFrom(Condition condition) {
  if (condition.class == ConditionHistory) 
    return Time{ConditionHistory{condition}.to}.addDays(-30);
  TimeBuffer:preferredFrom(condition);
}
Void setPower(InstrumentPower power) {
  instance power = power;
  addNextSource(power);
}
class Boolean isResourceOf(Listable node, Symbol aspect) {
  if (aspect == #adaptors) return true;
  false;
}
class String resourceLabel() "Name of resource" {
  "convenience yield";
}
String resourceString() "Description of resource" {
  "convenience yield of " + instance power.toString();
}
Mixable mixWith(Mixable item) {
  if (item.class.subclassOf(InstrumentPower)) {
    setPower(InstrumentPower{item});
    return this;
  }
  return TimeBuffer:mixWith(item);
}
Symbol valueType() {#convenienceYield}

trace TimeData createData(Time time, Symbol resolution) {
  Producer.report("Preparing " + toString() + " at " + time.toString);
  instance power.addLoadAspect(#deliveryStart);
  instance power.addLoadAspect(#deliveryStop);
  instance power.addLoadAspect(#tradingStop);
  TimeData data = new TimeData(this, time);
  external cond_history = time;
  Time date = Time{instance power.aspectValue(#deliveryStart)};
  if (date==null) return data;
  Time lastDate = Time{instance power.aspectValue(#deliveryStop)};
  Time t = date.addDays(((lastDate.subtractDate(date))/2).floor);
  Real sum = 0.0;
  Int count = 0;
  Time focus = time;
//bryt vid sista handelsdagen (annars kommer några x-tra helgvärden med);
  if (focus > instance power.aspectValue(#tradingStop)) {return data}
  Real spotValue = instance spot.aspectReal(#value);
  Real powerValue = instance power.aspectReal(#value);
// räntefuturering;
  while (date <= lastDate) {
//delta-T;
    external cond_maturity = date.subtractDate(time)/365;
//sum = sum + 2.718281828^(yieldGovBond.valueAspect*date.subtractDate(focus) / 365);
    if (date.subtractDate(focus) <= 365)
      sum = sum + (1 + instance yieldGovBond.aspectReal(#value) * date.subtractDate(focus) / 36500);
    else
      sum = sum + (1 + instance yieldGovBond.aspectReal(#value) / 100)^(date.subtractDate(focus) / 365);
    count = count + 1;
    date = date.addDays(1);
  }
  data.setAspect(#value, (sum / count*(spotValue / powerValue)).ln / ((t.subtractDate(focus))/365));
  Producer.report("");
  data;
}
String instanceScript(InstanceScriptInfo info) {
  nextSource().instanceScript(info); // create variables
  info.objectId(this, AdaptorAverageDay, "ave");
}
String initScript(InstanceScriptInfo info) {
  String prefix = info.methodPrefix(this);
  "  " + prefix + "setPower(" + instance power.instanceScript(info) + ");
";
}

*/