From 12731b2dc90a434da6de2504eb0c004db1fb148c Mon Sep 17 00:00:00 2001 From: Stefan Woltmann <56683670+IngStefan@users.noreply.github.com> Date: Sun, 27 Jun 2021 12:29:25 +0200 Subject: [PATCH 1/5] Bugfixes and minor changes --- .../mas/Simulation/ConsumingRest_VPP.java | 2 +- .../java/mas/Simulation/ProducingRest_TU.java | 18 +- .../src/main/java/mas/Simulation/Startup.java | 252 +++++++++++------- 3 files changed, 157 insertions(+), 115 deletions(-) diff --git a/Simulation/src/main/java/mas/Simulation/ConsumingRest_VPP.java b/Simulation/src/main/java/mas/Simulation/ConsumingRest_VPP.java index 496c2ba..23ab01d 100644 --- a/Simulation/src/main/java/mas/Simulation/ConsumingRest_VPP.java +++ b/Simulation/src/main/java/mas/Simulation/ConsumingRest_VPP.java @@ -45,7 +45,7 @@ public void putNodeRed(final String URL_NODERED, PutVariable INJECT, Object valu restTemplate.put(URL_NODERED+"/vpp-agent/scheduling_reject-proposal", value); break; case ACCOUNTINGECPRECEIVED: - restTemplate.put(URL_NODERED+"/vpp-agent/accounting_ecpReceived", value); + restTemplate.put(URL_NODERED+"/vpp-agent/accounting_ECPReceived", value); break; case LOADTIMEWINDOWSINFORM: restTemplate.put(URL_NODERED+"/vpp-agent/loadTimeWindows_broadcast", value); diff --git a/Simulation/src/main/java/mas/Simulation/ProducingRest_TU.java b/Simulation/src/main/java/mas/Simulation/ProducingRest_TU.java index 7bf73b2..4451b0d 100644 --- a/Simulation/src/main/java/mas/Simulation/ProducingRest_TU.java +++ b/Simulation/src/main/java/mas/Simulation/ProducingRest_TU.java @@ -64,11 +64,7 @@ public String balancingInform( public String freqRelay_enableInform( @RequestParam(name = "agentName") String _setpointFR, @RequestParam(name = "tuName") String _tuName) { - long startTime = System.nanoTime(); - System.out.println("Roundtrip END time in milliseconds : " + startTime / 1000000); //AUSGABE System.out.println("Answer received from "+_tuName); - - return _tuName; } @@ -76,19 +72,9 @@ public String freqRelay_enableInform( @RequestMapping (method=RequestMethod.PUT, value = "/vpp/accounting_energyConsumptionProfileReference") public String accountingInform( @RequestParam(name = "tuName") String _tuName) { -// Global.accountingTrigger = true; -// Global.accountingList.add(_tuName); -// try { + Global.accountingList.add(_tuName); + Global.accountingTrigger = true; System.out.println("Accounting received"); - InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_tuName); - ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); - //Thread.sleep(100); - putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.ACCOUNTINGECPRECEIVED,payload); - //Thread.sleep(100); -// } catch (InterruptedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } return _tuName; } diff --git a/Simulation/src/main/java/mas/Simulation/Startup.java b/Simulation/src/main/java/mas/Simulation/Startup.java index 54e93c2..4ce2c96 100644 --- a/Simulation/src/main/java/mas/Simulation/Startup.java +++ b/Simulation/src/main/java/mas/Simulation/Startup.java @@ -20,7 +20,7 @@ @SpringBootApplication public class Startup { - private static String DATE = "2021-05-04 "; + private static String DATE = "2021-06-27 "; private static int i = 0; public static void main(String[] args) //throws URISyntaxException { @@ -30,8 +30,7 @@ public static void main(String[] args) //throws URISyntaxException builder.headless(false); @SuppressWarnings("unused") ConfigurableApplicationContext context = builder.run(args); - - + boolean oneTimeTest = true; Date date = new Date(); Date startdate = new Date(); String dateNowString = "0000"; @@ -39,11 +38,9 @@ public static void main(String[] args) //throws URISyntaxException Date afterAdding15Min=new Date(t + (1 * 15 * 60000)); Date afterAddingOneMin=new Date(t + (1 * 60000)); Date afterAdding15Secs=new Date(t + (1 * 15000)); - int step = 0; int quarterMinute = 0; boolean stateActivated = false; - long startTime; //needed for time measurements long endTime; //needed for time measurements long timeElapsed; //needed for time measurements @@ -96,6 +93,15 @@ public static void main(String[] args) //throws URISyntaxException e.printStackTrace(); } } + if(Global.accountingTrigger) { + String _tuName = Global.accountingList.remove(Global.accountingList.size()-1); + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_tuName); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.ACCOUNTINGECPRECEIVED,payload); + if(Global.accountingList.isEmpty()) { + Global.accountingTrigger = false; + } + } //******SIMULATION SPEED SETTINGS ****************** @@ -110,7 +116,7 @@ public static void main(String[] args) //throws URISyntaxException // Hybrid Setting - // Change the simulation speed at the activation day. before that, a quicker simulations speed for the planning mechanisms + // Change the simulation speed at the activation day. before that, a faster simulation speed for the planning mechanisms is used if(step >= 3) { //Normal Operation Time //********* 15 Minutes Operations ************* @@ -180,13 +186,34 @@ public static void main(String[] args) //throws URISyntaxException */ + //*****************one shot tests************ +// if(oneTimeTest){ +// String time ="16:42:00.0"; +// try { +// requestNewSetpoint(2000,"TU_Company1_SRL",DATE+time); +// Thread.sleep(39); +// startBalancing("TU_Company1_SRL", dateNowString,DATE+time); +// Thread.sleep(39); +// enableFR("TU_Company6_SOL"); +// Thread.sleep(39); +// blockFR("TU_Company7_SOL"); +// Thread.sleep(39); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// oneTimeTest = false; +// } + //******************** SIMULATION SCENARIO ********** //State machine for hour blocks +// /* if(!stateActivated) { stateActivated = true; String activationDay = DATE; + try { switch(step){ + //********** Starting the Activation Simulation (t - 3 hours) ********** case 0: if(quarterMinute == 0) { System.out.println( "Timestamp: before 21.02.2022 00:00" ); @@ -210,57 +237,42 @@ public static void main(String[] args) //throws URISyntaxException startScheduling("FLEX","2022-02-21 00:00:00.0","2022-02-22 00:00:00.0", "2022-02-20 00:00:00.0"); } break; - //********** Starting the Activation Simulation ********** + //********** Starting the Activation Simulation (t = 00:00) ********** case 3: if(quarterMinute == 0) { System.out.println( "***** Planning Phase Ended *****" ); System.out.println( "***** Activation Phase started *****" ); System.out.println( "Timestamp: 21.02.2022 00:00"); - startBalancing("TU_Company1_PRL", dateNowString,activationDay+"23:59:59.0"); - startBalancing("TU_Company3_PRL", dateNowString,activationDay+"13:45:00.0"); + startBalancing("TU_Company1_PRL", dateNowString,activationDay+"04:15:00.0"); + Thread.sleep(39); startBalancing("TU_Company1_SRL", dateNowString,activationDay+"23:59:59.0"); - requestNewSetpoint(2000,"TU_Company1_SRL",activationDay+"23:59:59.0"); - startBalancing("TU_Company5_SRL", dateNowString,activationDay+"02:00:00.0"); - requestNewSetpoint(-450,"TU_Company5_SRL",activationDay+"02:00:00.0"); - startBalancing("TU_Company4_MRL", dateNowString,activationDay+"05:30:00.0"); - requestNewSetpoint(4000,"TU_Company4_MRL",activationDay+"05:30:00.0"); - startBalancing("TU_Company6_SOL", dateNowString,activationDay+"08:15:00.0"); - enableFR("TU_Company6_SOL"); - startBalancing("TU_Company7_SOL", dateNowString,activationDay+"10:30:00.0"); - enableFR("TU_Company7_SOL"); - startBalancing("TU_Company8_SOL", dateNowString,activationDay+"10:30:00.0"); - enableFR("TU_Company8_SOL"); - + Thread.sleep(39); + requestNewSetpoint(2000,"TU_Company1_SRL",activationDay+"05:30:00.0"); + Thread.sleep(39); + }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 00:15"); - startBalancing("TU_Company2_MRL", dateNowString,activationDay+"04:30:00.0"); - requestNewSetpoint(600,"TU_Company2_MRL",activationDay+"04:30:00.0"); - startBalancing("TU_Company18_FLEX", dateNowString,activationDay+"10:45:00.0"); - requestNewSetpoint(6900,"TU_Company18_FLEX",activationDay+"10:45:00.0"); startBalancing("TU_Company28_FLEX", dateNowString,activationDay+"03:30:00.0"); + Thread.sleep(39); requestNewSetpoint(6000,"TU_Company28_FLEX",activationDay+"03:30:00.0"); - startBalancing("TU_Company30_FLEX", dateNowString,activationDay+"09:30:00.0"); - requestNewSetpoint(12000,"TU_Company30_FLEX",activationDay+"09:30:00.0"); - + }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 00:30"); - startBalancing("TU_Company15_SNL", dateNowString,activationDay+"17:45:00.0"); - requestNewSetpoint(5000,"TU_Company15_SNL",activationDay+"17:45:00.0"); - startBalancing("TU_Company20_FLEX", dateNowString,activationDay+"01:15:00.0"); - requestNewSetpoint(-2000,"TU_Company20_FLEX",activationDay+"01:15:00.0"); startBalancing("TU_Company26_FLEX", dateNowString,activationDay+"03:30:00.0"); + Thread.sleep(39); requestNewSetpoint(-3800,"TU_Company26_FLEX",activationDay+"03:30:00.0"); - }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 00:45"); - - + startBalancing("TU_Company15_SNL", dateNowString,activationDay+"04:45:00.0"); + Thread.sleep(39); + requestNewSetpoint(5000,"TU_Company15_SNL",activationDay+"04:45:00.0"); } break; case 4: if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 01:00"); startBalancing("TU_Company19_FLEX", dateNowString,activationDay+"02:30:00.0"); + Thread.sleep(39); requestNewSetpoint(13000,"TU_Company19_FLEX",activationDay+"02:30:00.0"); }else if(quarterMinute == 1) { @@ -283,7 +295,9 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 02:15"); - + startBalancing("TU_Company30_FLEX", dateNowString,activationDay+"09:30:00.0"); + Thread.sleep(39); + requestNewSetpoint(12000,"TU_Company30_FLEX",activationDay+"09:30:00.0"); }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 02:30"); @@ -299,21 +313,25 @@ public static void main(String[] args) //throws URISyntaxException case 6: if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 03:00"); - startBalancing("TU_Company14_SNL", dateNowString,activationDay+"11:15:00.0"); - requestNewSetpoint(8000,"TU_Company14_SNL",activationDay+"11:15:00.0"); startBalancing("TU_Company24_FLEX", dateNowString,activationDay+"09:30:00.0"); + Thread.sleep(39); requestNewSetpoint(5500,"TU_Company24_FLEX",activationDay+"09:30:00.0"); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 03:15"); - + startBalancing("TU_Company14_SNL", dateNowString,activationDay+"11:15:00.0"); + Thread.sleep(39); + requestNewSetpoint(8000,"TU_Company14_SNL",activationDay+"11:15:00.0"); }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 03:30"); - + startBalancing("TU_Company2_MRL", dateNowString,activationDay+"04:30:00.0"); + Thread.sleep(39); + requestNewSetpoint(600,"TU_Company2_MRL",activationDay+"04:30:00.0"); }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 03:45"); startBalancing("TU_Company29_FLEX", dateNowString,activationDay+"06:30:00.0"); + Thread.sleep(39); requestNewSetpoint(-43000,"TU_Company29_FLEX",activationDay+"06:30:00.0"); @@ -326,13 +344,12 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 04:15"); startBalancing("TU_Company21_FLEX", dateNowString,activationDay+"09:00:00.0"); + Thread.sleep(39); requestNewSetpoint(-100000,"TU_Company21_FLEX",activationDay+"09:00:00.0"); }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 04:30"); - startBalancing("TU_Company25_FLEX", dateNowString,activationDay+"06:00:00.0"); - requestNewSetpoint(5900,"TU_Company25_FLEX",activationDay+"06:00:00.0"); - + startBalancing("TU_Company3_PRL", dateNowString,activationDay+"08:00:00.0"); }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 04:45"); @@ -342,8 +359,9 @@ public static void main(String[] args) //throws URISyntaxException case 8: if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 05:00"); - startBalancing("TU_Company5_MRL_B", dateNowString,activationDay+"20:45:00.0"); - requestNewSetpoint(-2500,"TU_Company5_MRL_B",activationDay+"20:45:00.0"); + startBalancing("TU_Company5_MRL_B", dateNowString,activationDay+"12:00:00.0"); + Thread.sleep(39); + requestNewSetpoint(-2500,"TU_Company5_MRL_B",activationDay+"12:00:00.0"); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 05:15"); startBalancing("TU_Company2_PRL", dateNowString,activationDay+"23:59:59.0"); @@ -354,8 +372,7 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 05:45"); - startBalancing("TU_Company16_FLEX", dateNowString,activationDay+"22:00:00.0"); - requestNewSetpoint(-350000,"TU_Company16_FLEX",activationDay+"22:00:00.0"); + } break; @@ -363,7 +380,9 @@ public static void main(String[] args) //throws URISyntaxException if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 06:00"); startBalancing("TU_Company3_SRL", dateNowString,activationDay+"12:00:00.0"); + Thread.sleep(39); requestNewSetpoint(35000,"TU_Company3_SRL",activationDay+"12:00:00.0"); + Thread.sleep(39); broadcastLTW(2021); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 06:15"); @@ -371,14 +390,15 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 06:30"); - + startBalancing("TU_Company18_FLEX", dateNowString,activationDay+"10:45:00.0"); + Thread.sleep(39); + requestNewSetpoint(6900,"TU_Company18_FLEX",activationDay+"10:45:00.0"); }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 06:45"); - startBalancing("TU_Company4_SRL", dateNowString,activationDay+"13:00:00.0"); - requestNewSetpoint(-350,"TU_Company4_SRL",activationDay+"13:00:00.0"); - startBalancing("TU_Company1_MRL", dateNowString,activationDay+"23:59:59.0"); - requestNewSetpoint(2000,"TU_Company1_MRL",activationDay+"23:59:59.0"); + startBalancing("TU_Company1_MRL", dateNowString,activationDay+"11:15:00.0"); + Thread.sleep(39); + requestNewSetpoint(2000,"TU_Company1_MRL",activationDay+"11:15:00.0"); } break; case 10: @@ -387,12 +407,15 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 07:15"); - + startBalancing("TU_Company6_SOL", dateNowString,activationDay+"08:15:00.0"); + Thread.sleep(39); + enableFR("TU_Company6_SOL"); }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 07:30"); - startBalancing("TU_Company19_FLEX", dateNowString,activationDay+"10:15:00.0"); - requestNewSetpoint(13000,"TU_Company19_FLEX",activationDay+"10:15:00.0"); + startBalancing("TU_Company4_SRL", dateNowString,activationDay+"09:00:00.0"); + Thread.sleep(39); + requestNewSetpoint(-350,"TU_Company4_SRL",activationDay+"09:00:00.0"); }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 07:45"); @@ -407,12 +430,15 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 08:15"); blockFR("TU_Company6_SOL"); + Thread.sleep(39); startBalancing("TU_Company25_FLEX", dateNowString,activationDay+"13:00:00.0"); + Thread.sleep(39); requestNewSetpoint(5900,"TU_Company25_FLEX",activationDay+"13:00:00.0"); }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 08:30"); startBalancing("TU_Company5_MRL_C", dateNowString,activationDay+"20:15:00.0"); + Thread.sleep(39); requestNewSetpoint(3000,"TU_Company5_MRL_C",activationDay+"20:15:00.0"); }else if(quarterMinute == 3) { @@ -450,8 +476,11 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 10:30"); blockFR("TU_Company7_SOL"); + Thread.sleep(39); blockFR("TU_Company8_SOL"); + Thread.sleep(39); startBalancing("TU_Company20_FLEX", dateNowString,activationDay+"16:00:00.0"); + Thread.sleep(39); requestNewSetpoint(-2000,"TU_Company20_FLEX",activationDay+"16:00:00.0"); }else if(quarterMinute == 3) { @@ -491,13 +520,15 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 12:30"); startBalancing("TU_Company3_MRL", dateNowString,activationDay+"17:30:00.0"); + Thread.sleep(39); requestNewSetpoint(1000,"TU_Company3_MRL",activationDay+"17:30:00.0"); - startBalancing("TU_Company4_MRL", dateNowString,activationDay+"20:00:00.0"); - requestNewSetpoint(4000,"TU_Company4_MRL",activationDay+"20:00:00.0"); + + }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 12:45"); startBalancing("TU_Company5_SRL", dateNowString,activationDay+"18:00:00.0"); + Thread.sleep(39); requestNewSetpoint(-450,"TU_Company5_SRL",activationDay+"18:00:00.0"); } @@ -512,7 +543,9 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 13:30"); - + startBalancing("TU_Company4_MRL", dateNowString,activationDay+"20:00:00.0"); + Thread.sleep(39); + requestNewSetpoint(4000,"TU_Company4_MRL",activationDay+"20:00:00.0"); }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 13:45"); @@ -526,15 +559,10 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 14:15"); - startBalancing("TU_Company6_SOL", dateNowString,activationDay+"23:59:59.0"); - startBalancing("TU_Company7_SOL", dateNowString,activationDay+"23:59:59.0"); - startBalancing("TU_Company8_SOL", dateNowString,activationDay+"18:00:00.0"); - enableFR("TU_Company6_SOL"); - enableFR("TU_Company7_SOL"); + startBalancing("TU_Company8_SOL", dateNowString,activationDay+"18:00:00.0"); + Thread.sleep(39); enableFR("TU_Company8_SOL"); - startBalancing("TU_Company17_FLEX", dateNowString,activationDay+"22:00:00.0"); - requestNewSetpoint(-5600,"TU_Company17_FLEX",activationDay+"22:00:00.0"); - + }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 14:30"); @@ -552,6 +580,7 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 15:15"); startBalancing("TU_Company24_FLEX", dateNowString,activationDay+"19:45:00.0"); + Thread.sleep(39); requestNewSetpoint(5500,"TU_Company24_FLEX",activationDay+"19:45:00.0"); }else if(quarterMinute == 2) { @@ -568,6 +597,7 @@ public static void main(String[] args) //throws URISyntaxException if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 16:00"); startBalancing("TU_Company2_SRL", dateNowString,activationDay+"23:59:59.0"); + Thread.sleep(39); requestNewSetpoint(30000,"TU_Company2_SRL",activationDay+"23:59:59.0"); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 16:15"); @@ -575,7 +605,8 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 16:30"); - startBalancing("TU_Company9_SOL", dateNowString,activationDay+"20:15:00.0"); + startBalancing("TU_Company9_SOL", dateNowString,activationDay+"20:15:00.0"); + Thread.sleep(39); enableFR("TU_Company9_SOL"); }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 16:45"); @@ -587,6 +618,7 @@ public static void main(String[] args) //throws URISyntaxException if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 17:00"); startBalancing("TU_Company5_MRL_A", dateNowString,activationDay+"23:15:00.0"); + Thread.sleep(39); requestNewSetpoint(2000,"TU_Company5_MRL_A",activationDay+"23:15:00.0"); }else if(quarterMinute == 1) { @@ -607,23 +639,28 @@ public static void main(String[] args) //throws URISyntaxException if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 18:00"); blockFR("TU_Company8_SOL"); - startBalancing("TU_Company25_FLEX", dateNowString,activationDay+"23:59:59.0"); - requestNewSetpoint(5900,"TU_Company25_FLEX",activationDay+"23:59:59.0"); + Thread.sleep(39); + startBalancing("TU_Company25_FLEX", dateNowString,activationDay+"21:00:00.0"); + Thread.sleep(39); + requestNewSetpoint(5900,"TU_Company25_FLEX",activationDay+"21:00:00.0"); + Thread.sleep(39); broadcastLTW(2021); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 18:15"); - startBalancing("TU_Company10_SNL", dateNowString,activationDay+"23:59:59.0"); - requestNewSetpoint(3000,"TU_Company10_SNL",activationDay+"23:59:59."); + }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 18:30"); startBalancing("TU_Company27_FLEX", dateNowString,activationDay+"22:15:00.0"); + Thread.sleep(39); requestNewSetpoint(-8000,"TU_Company27_FLEX",activationDay+"22:15:00.0"); }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 18:45"); - + startBalancing("TU_Company16_FLEX", dateNowString,activationDay+"22:00:00.0"); + Thread.sleep(39); + requestNewSetpoint(-350000,"TU_Company16_FLEX",activationDay+"22:00:00.0"); } break; @@ -631,10 +668,12 @@ public static void main(String[] args) //throws URISyntaxException if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 19:00"); startBalancing("TU_Company11_SNL", dateNowString,activationDay+"23:59:59.0"); + Thread.sleep(39); requestNewSetpoint(3000,"TU_Company11_SNL",activationDay+"23:59:59."); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 19:15"); startBalancing("TU_Company29_FLEX", dateNowString,activationDay+"20:45:00.0"); + Thread.sleep(39); requestNewSetpoint(-43000,"TU_Company29_FLEX",activationDay+"20:45:00.0"); }else if(quarterMinute == 2) { @@ -643,8 +682,9 @@ public static void main(String[] args) //throws URISyntaxException }else if(quarterMinute == 3) { System.out.println( "Timestamp: 21.02.2022 19:45"); - startBalancing("TU_Company23_FLEX", dateNowString,activationDay+"23:59:59.0"); - requestNewSetpoint(4000,"TU_Company23_FLEX",activationDay+"23:59:59.0"); + startBalancing("TU_Company23_FLEX", dateNowString,activationDay+"21:15:00.0"); + Thread.sleep(39); + requestNewSetpoint(4000,"TU_Company23_FLEX",activationDay+"21:15:00.0"); } break; @@ -669,11 +709,14 @@ public static void main(String[] args) //throws URISyntaxException case 24: if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 21:00"); - + startBalancing("TU_Company6_SOL", dateNowString,activationDay+"23:59:59.0"); + Thread.sleep(39); + enableFR("TU_Company6_SOL"); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 21:15"); - - + startBalancing("TU_Company7_SOL", dateNowString,activationDay+"22:30:00.0"); + Thread.sleep(39); + enableFR("TU_Company7_SOL"); }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 21:30"); @@ -687,11 +730,14 @@ public static void main(String[] args) //throws URISyntaxException case 25: if(quarterMinute == 0) { System.out.println( "Timestamp: 21.02.2022 22:00"); - startBalancing("TU_Company18_FLEX", dateNowString,activationDay+"23:59:59.0"); - requestNewSetpoint(6900,"TU_Company18_FLEX",activationDay+"23:59:59.0"); + startBalancing("TU_Company18_FLEX", dateNowString,activationDay+"23:15:00.0"); + Thread.sleep(39); + requestNewSetpoint(6900,"TU_Company18_FLEX",activationDay+"23:15:00.0"); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 22:15"); - + startBalancing("TU_Company17_FLEX", dateNowString,activationDay+"22:45:00.0"); + Thread.sleep(39); + requestNewSetpoint(6900,"TU_Company17_FLEX",activationDay+"22:45:00.0"); }else if(quarterMinute == 2) { System.out.println( "Timestamp: 21.02.2022 22:30"); @@ -705,7 +751,10 @@ public static void main(String[] args) //throws URISyntaxException break; case 26: if(quarterMinute == 0) { - System.out.println( "Timestamp: 21.02.2022 23:00"); + System.out.println( "Timestamp: 21.02.2022 23:00"); + startBalancing("TU_Company10_SNL", dateNowString,activationDay+"23:30:00.0"); + Thread.sleep(39); + requestNewSetpoint(3000,"TU_Company10_SNL",activationDay+"23:30:00.0"); }else if(quarterMinute == 1) { System.out.println( "Timestamp: 21.02.2022 23:15"); @@ -725,6 +774,7 @@ public static void main(String[] args) //throws URISyntaxException if(quarterMinute == 0) { System.out.println( "Timestamp: 22.02.2022"); blockFR("TU_Company6_SOL"); + Thread.sleep(39); blockFR("TU_Company7_SOL"); }else if(quarterMinute == 1) { @@ -746,13 +796,17 @@ public static void main(String[] args) //throws URISyntaxException step = 0; } + } catch (InterruptedException e) { + e.printStackTrace(); + } } +// */ } } } - + @@ -811,31 +865,32 @@ public static void requestNewSetpoint(int maxPower, String tuName, String _endTi Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { int count = 0; + boolean negative = false; // int limit = _limitInS; Date _dateNow = new Date(); String endTime = _endTime; int upperbound = maxPower; int lowerbound = (int)(maxPower*0.9); Date endTimeDate; - - @Override public void run() { - //generating random energy value SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN); formatter.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); try { endTimeDate = formatter.parse(endTime); } catch (ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + e.printStackTrace(); } if(upperbound < 0) { - int swap = upperbound; - upperbound = lowerbound; - lowerbound = swap; + upperbound = upperbound * (-1); + lowerbound = lowerbound * (-1); + negative = true; } - int newSetpoint = ThreadLocalRandom.current().nextInt(lowerbound, upperbound); + int newSetpoint = ThreadLocalRandom.current().nextInt(lowerbound, upperbound); + if(negative) { + newSetpoint = newSetpoint * (-1); + } + InterfacePayloadNewSetpoint payload = new InterfacePayloadNewSetpoint(newSetpoint,tuName); ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SETPOINT,payload); @@ -849,11 +904,10 @@ public void run() { //request new setpoint so gestalten, dass einfach enddatum uebergeben werden kann if(_dateNow.after(endTimeDate)) { timer.cancel(); - timer.purge(); +// timer.purge(); // System.out.println( "Timer ended"); return; } - } }, 0, 1000); } @@ -863,7 +917,7 @@ public void run() { public static void requestNewSetpointLoadProfile(int maxPower, String tuName, String _endTime) { Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { - int count = 0; + boolean negative = false; // int limit = _limitInS; Date _dateNow = new Date(); String endTime = _endTime; @@ -880,15 +934,17 @@ public void run() { try { endTimeDate = formatter.parse(endTime); } catch (ParseException e) { - // TODO Auto-generated catch block e.printStackTrace(); } if(upperbound < 0) { - int swap = upperbound; - upperbound = lowerbound; - lowerbound = swap; + upperbound = upperbound * (-1); + lowerbound = lowerbound * (-1); + negative = true; } int newSetpoint = ThreadLocalRandom.current().nextInt(lowerbound, upperbound); + if(negative) { + newSetpoint = newSetpoint * (-1); + } InterfacePayloadNewSetpoint payload = new InterfacePayloadNewSetpoint(newSetpoint,tuName); ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.LOADPROFILE,payload); From 9b9ada7fca589c29fd5531bd5e92e6380d1ca320 Mon Sep 17 00:00:00 2001 From: Stefan Woltmann <56683670+IngStefan@users.noreply.github.com> Date: Sun, 27 Jun 2021 12:32:18 +0200 Subject: [PATCH 2/5] Bugfixes and minor changes --- .../java/mas/JADE_VPP/ContainerManager.java | 10 ++- .../java/mas/JADE_VPP/ProducingRest_TU.java | 46 ++++++++++- .../src/main/java/mas/JADE_VPP/Startup.java | 18 ++--- .../src/main/java/mas/JADE_VPP/TU.java | 78 ++++++++++++++----- .../main/java/mas/JADE_VPP/TuVariables.java | 1 + 5 files changed, 119 insertions(+), 34 deletions(-) diff --git a/TU_Simulation/src/main/java/mas/JADE_VPP/ContainerManager.java b/TU_Simulation/src/main/java/mas/JADE_VPP/ContainerManager.java index 2b019ba..fe7ae24 100644 --- a/TU_Simulation/src/main/java/mas/JADE_VPP/ContainerManager.java +++ b/TU_Simulation/src/main/java/mas/JADE_VPP/ContainerManager.java @@ -40,9 +40,17 @@ private void init(){ ////***** for Agent CONTAINER (TU) ************ //Alternative profile to join a Main Container (for TU-Agents) Profile p = new jade.core.ProfileImpl(); - p.setParameter(jade.core.Profile.CONTAINER_NAME, "TU_Company3"); + p.setParameter(jade.core.Profile.CONTAINER_NAME, "TU_Simulation"); p.setParameter(jade.core.Profile.MAIN_HOST, "192.168.152.233"); //für TU containerController = runtime.createAgentContainer(p); + + ////***** TEMPPPPP******************** +// Profile p = new jade.core.ProfileImpl(); +// p.setParameter(jade.core.Profile.CONTAINER_NAME, "TU_Simulation"); +// p.setParameter(jade.core.Profile.GUI, "true"); +// p.setParameter(jade.core.Profile.MAIN_HOST, "192.168.152.208"); //für TU +// containerController = runtime.createAgentContainer(p); + } public AgentController instantiateAgent(String name, String className) throws StaleProxyException{ diff --git a/TU_Simulation/src/main/java/mas/JADE_VPP/ProducingRest_TU.java b/TU_Simulation/src/main/java/mas/JADE_VPP/ProducingRest_TU.java index 8ae8815..aad2411 100644 --- a/TU_Simulation/src/main/java/mas/JADE_VPP/ProducingRest_TU.java +++ b/TU_Simulation/src/main/java/mas/JADE_VPP/ProducingRest_TU.java @@ -158,6 +158,50 @@ public InterfacePayloadBalancing newBalancingRefuse(@RequestParam(name = "tuName return payload; } + @RequestMapping (method=RequestMethod.PUT, value = "/tu-agent/balancing_informInstant") + public InterfacePayloadBalancing newBalancingInformInstant( + @RequestParam(name = "tuName") String _tuName, + @RequestParam(name = "feedIn") int _feedIn, + @RequestParam(name = "operatingPoint") int _operatingPoint, + @RequestParam(name = "leadingOperatingPoint") int _leadingOperatingPoint, + @RequestParam(name = "currentValueFR") int _currentValueFR, + @RequestParam(name = "assignedPool") int _assignedPool, + @RequestParam(name = "status") int _status, + @RequestParam(name = "frequency") int _frequency, + @RequestParam(name = "aFRRsetpoint") int _aFRRsetpoint, + @RequestParam(name = "aFRRsetpointEcho") int _aFRRsetpointEcho, + @RequestParam(name = "setpointFR") int _setpointFR, + @RequestParam(name = "aFRRGradientPOS") int _aFRRGradientPOS, + @RequestParam(name = "aFRRGradientNEG") int _aFRRGradientNEG, + @RequestParam(name = "capacityPOS") int _capacityPOS, + @RequestParam(name = "capacityNEG") int _capacityNEG, + @RequestParam(name = "holdingCapacityPOS") int _holdingCapacityPOS, + @RequestParam(name = "holdingCapacityNEG") int _holdingCapacityNEG, + @RequestParam(name = "controlBandPOS") int _controlBandPOS, + @RequestParam(name = "controlBandNEG") int _controlBandNEG) { + InterfacePayloadBalancing payload = new InterfacePayloadBalancing(_tuName); + TuVariables.balancingTuName = _tuName; + TuVariables.feedIn = _feedIn; //Einspeisung + TuVariables.operatingPoint = _operatingPoint; //Arbeitspunkt + TuVariables.leadingOperatingPoint = _leadingOperatingPoint; //vorauseilender Arbeitspunkt + TuVariables.currentValueFR = _currentValueFR; //Regelleistungsistwert + TuVariables.assignedPool = _assignedPool; //Poolzuordnung + TuVariables.status = _status; //Status (Meldung) + TuVariables.frequency = _frequency; //Frequenz + TuVariables.aFRRsetpoint = _aFRRsetpoint; //aFRR-Soll (ÃœNB -> POOL) + TuVariables.aFRRsetpointEcho = _aFRRsetpointEcho; //aFRR-Soll-Echo (Pool -> ÃœNB) + TuVariables.setpointFR = _setpointFR; //Regelleistungs-Soll + TuVariables.aFRRGradientPOS = _aFRRGradientPOS; //aFRR-Gradient POS + TuVariables.aFRRGradientNEG = _aFRRGradientNEG; //aFRR-Gradient NEG + TuVariables.capacityPOS = _capacityPOS; //Arbeitsvermögen POS (bei begrenztem Energiespeicher) + TuVariables.capacityNEG = _capacityNEG; //Arbeitsvermögen NEG (bei begrenzten Energiespeicher) + TuVariables.holdingCapacityPOS = _holdingCapacityPOS; //Aktuelle Vorhalteleistung POS + TuVariables.holdingCapacityNEG = _holdingCapacityNEG; //Aktuelle Vorhalteleistung NEG + TuVariables.controlBandPOS = _controlBandPOS; //Regelband POS + TuVariables.controlBandNEG = _controlBandNEG; //Regelband NEG + TuVariables.balancingInformInstantTrigger = true; + return payload; + } @RequestMapping (method=RequestMethod.PUT, value = "/tu-agent/balancing_inform") public InterfacePayloadBalancing newBalancingInform( @@ -202,7 +246,7 @@ public InterfacePayloadBalancing newBalancingInform( TuVariables.controlBandNEG = _controlBandNEG; //Regelband NEG TuVariables.balancingInformTrigger = true; return payload; - } + } @RequestMapping (method=RequestMethod.PUT, value = "/tu-agent/balancing_failure") public InterfacePayloadBalancing newBalancingFailure(@RequestParam(name = "tuName") String _tuName){ diff --git a/TU_Simulation/src/main/java/mas/JADE_VPP/Startup.java b/TU_Simulation/src/main/java/mas/JADE_VPP/Startup.java index c5a57cf..26ee171 100644 --- a/TU_Simulation/src/main/java/mas/JADE_VPP/Startup.java +++ b/TU_Simulation/src/main/java/mas/JADE_VPP/Startup.java @@ -33,18 +33,12 @@ public static void main(String[] args) //throws URISyntaxException // ContainerManager.getInstance().instantiateAgent("TU_Company1_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); // ContainerManager.getInstance().instantiateAgent("TU_Company2_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); +// ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); -// ContainerManager.getInstance().instantiateAgent("TU_Company1_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); -// ContainerManager.getInstance().instantiateAgent("TU_Company2_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); -// ContainerManager.getInstance().instantiateAgent("TU_Company2_MRL(BACKUP)", "mas.JADE_VPP.TU", new String[]{"MRL"}); -// ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL_pla", "mas.JADE_VPP.TU", new String[]{"MRL_pla"}); -// ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL_act", "mas.JADE_VPP.TU", new String[]{"MRL_act"}); -// ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL_acc", "mas.JADE_VPP.TU", new String[]{"MRL_acc"}); -// ContainerManager.getInstance().instantiateAgent("TU_Company4_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); -// ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); - /* - //******* starting TU Agents (1st parameter: AgentName, 2nd parameter: class name, 3rd parameter: service description in comma separation) + + + //******* starting TU Agents (1st parameter: AgentName, 2nd parameter: class name, 3rd parameter: service description in comma separation) +// /* ContainerManager.getInstance().instantiateAgent("TU_Company1_PRL", "mas.JADE_VPP.TU", new String[]{"PRL"}); ContainerManager.getInstance().instantiateAgent("TU_Company2_PRL", "mas.JADE_VPP.TU", new String[]{"PRL"}); ContainerManager.getInstance().instantiateAgent("TU_Company3_PRL", "mas.JADE_VPP.TU", new String[]{"PRL"}); @@ -166,7 +160,7 @@ public static void main(String[] args) //throws URISyntaxException } - */ +// */ } catch (Exception ex){ ex.printStackTrace(); diff --git a/TU_Simulation/src/main/java/mas/JADE_VPP/TU.java b/TU_Simulation/src/main/java/mas/JADE_VPP/TU.java index efd1682..f4811c7 100644 --- a/TU_Simulation/src/main/java/mas/JADE_VPP/TU.java +++ b/TU_Simulation/src/main/java/mas/JADE_VPP/TU.java @@ -128,7 +128,8 @@ public void action(){ //******************* Collecting Messages from other Agents ************ //******** Handling unknown messages: **************** - MessageTemplate mt = MessageTemplate.not(MessageTemplate.MatchOntology(ontology.getName())); //filter for messages that dont use the VPP_DR_Ontology + MessageTemplate mt = MessageTemplate.not(MessageTemplate.or(MessageTemplate.MatchOntology(ontology.getName()), //filter for messages that dont use the VPP_DR_Ontology + MessageTemplate.MatchOntology("FIPA-Agent-Management"))); ACLMessage msg = receive(mt); //returns the first message of the message queue with the corresponding template if (msg != null){ //if a proper message can be found //********** every Message that does not use the VPP_DR_Ontology can not be understood ******** @@ -662,7 +663,8 @@ public void action(){ e.printStackTrace(); } step = 99; - } + } + step = 99; break; case 99: reset(); @@ -672,8 +674,6 @@ public void action(){ step = 99; } } - - public boolean done(){ return step == 100; } @@ -800,7 +800,7 @@ public void action(){ } step = 99; } - + break; case 2: Date dateNow2 = new Date(); // SimpleDateFormat formatter3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN); @@ -815,6 +815,32 @@ public void action(){ case 3: if(TuVariables.balancingInformTrigger && tuName.equals(TuVariables.balancingTuName)) { TuVariables.balancingInformTrigger = false; + }else if(TuVariables.balancingInformInstantTrigger && tuName.equals(TuVariables.balancingTuName)) { + TuVariables.balancingInformInstantTrigger = false; + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + BalancingSequenceInform newBalancingSequenceInform = new BalancingSequenceInform(); + //giving the data to the newTUDataSet + TUDataSet newTUDataSet = new TUDataSet(TuVariables.feedIn, TuVariables.operatingPoint, + TuVariables.leadingOperatingPoint, TuVariables.currentValueFR, TuVariables.assignedPool, + TuVariables.status, TuVariables.frequency, TuVariables.aFRRsetpoint, TuVariables.aFRRsetpointEcho, + TuVariables.setpointFR, TuVariables.aFRRGradientPOS, TuVariables.aFRRGradientNEG, + TuVariables.capacityPOS, TuVariables.capacityNEG, TuVariables.holdingCapacityPOS, + TuVariables.holdingCapacityNEG, TuVariables.controlBandPOS, TuVariables.controlBandNEG); + newBalancingSequenceInform.setTUDataSet(newTUDataSet); + newBalancingSequenceInform.setTuName(TuVariables.balancingTuName); + newBalancingSequenceInform.setAgentName(getAID().getLocalName()); + cel.add(newBalancingSequenceInform); + cm.fillContent(reply, cel); + myAgent.send(reply); + System.out.println(getAgent().getAID().getLocalName()+"******* Spontaneous Inform sent *******"); + TuVariables.resetBalancing(); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } }else if(TuVariables.balancingFailureTrigger && tuName.equals(TuVariables.balancingTuName)) { TuVariables.balancingFailureTrigger = false; @@ -845,7 +871,8 @@ public void action(){ } break; case 99: - myAgent.addBehaviour(new ScheduleAccounting(tuName,"accounting-"+tuName)); + myAgent.addBehaviour(tbf.wrap(new ScheduleAccounting(tuName,"accounting-"+tuName))); + //myAgent.addBehaviour(new ScheduleAccounting(tuName,"accounting-"+tuName)); TuVariables.resetScheduling(); reset(); timer.cancel(); //stopping the updating behaviour @@ -931,8 +958,12 @@ public void onStart(){ public void action(){ switch(step){ - // sending the energy consumption profile to the VPP case 0: + //CHANGED FOR SIMULATION**** + step =1; + break; + // sending the energy consumption profile to the VPP + case 1: System.out.println(this.getAgent().getAID().getLocalName()+"******* AccountingSequencePerformer started ********"); //searching for the complete AID of the referenced agent DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; //contains the service description list that the schedulingSequence uses @@ -953,13 +984,13 @@ public void action(){ } sdSearchTemplate.clearAllServices(); if(vppAgents.size()>0) { - step = 1; + step = 2; }else { System.out.println("No Agent can be found under that name"); step = 99; } break; - case 1: + case 2: System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out INFORM (energy consumption profiles) to VPP *******"); ACLMessage msg = new ACLMessage(ACLMessage.INFORM); @@ -982,12 +1013,13 @@ public void action(){ cm.fillContent(msg, cel); myAgent.send(msg); msg.reset(); - step = 2; + step = 3; } catch (CodecException | OntologyException e){ e.printStackTrace(); step = 99; } - case 2: + break; + case 3: MessageTemplate mt = MessageTemplate.and( MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( MessageTemplate.MatchConversationId(conversationID), @@ -1002,10 +1034,10 @@ public void action(){ Predicate _pc = (Predicate) ce; if(_pc instanceof AccountingSequenceInformReceived){ //********** Inform the EMS-System about the results********** - AccountingSequenceInformReceived _asir = (AccountingSequenceInformReceived)_pc; - InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(referenceID, getAID().getLocalName(),_asir.getTuName() ); - ConsumingRest_TU putInstance = new ConsumingRest_TU(); - putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.ACCOUNTINGECPRECEIVED, payload); +// AccountingSequenceInformReceived _asir = (AccountingSequenceInformReceived)_pc; +// InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(referenceID, getAID().getLocalName(),_asir.getTuName() ); +// ConsumingRest_TU putInstance = new ConsumingRest_TU(); +// putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.ACCOUNTINGECPRECEIVED, payload); step = 99; } } catch (CodecException | OntologyException e) { @@ -1027,6 +1059,7 @@ public void action(){ default: step = 99; } + } @@ -1345,6 +1378,7 @@ public void action(){ e.printStackTrace(); step = 99; } + break; case 2: MessageTemplate mt = MessageTemplate.and( MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( @@ -1473,6 +1507,7 @@ public void action(){ e.printStackTrace(); step = 99; } + break; case 2: MessageTemplate mt = MessageTemplate.and( MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( @@ -1549,14 +1584,16 @@ public class ScheduleAccounting extends OneShotBehaviour{ } public void action(){ + // adding a random amount of time for the TU to send the ECPs (not realized via wait, so the agent task does not get suspended) + int randomNum = ThreadLocalRandom.current().nextInt(0, 60000); try { - Thread.sleep(20000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + Thread.sleep(randomNum); + } catch (InterruptedException e1) { + e1.printStackTrace(); } - byte[] schedulingplan = new byte[] {(byte)0x00}; + byte[] schedulingplan = new byte[] {(byte)0x01}; myAgent.addBehaviour(tbf.wrap(new AccountingSequencePerformer(schedulingplan, tuName, referenceID))); + } } @@ -1730,6 +1767,7 @@ public void action(){ e.printStackTrace(); step = 99; } + break; case 2: MessageTemplate mt = MessageTemplate.and( MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( diff --git a/TU_Simulation/src/main/java/mas/JADE_VPP/TuVariables.java b/TU_Simulation/src/main/java/mas/JADE_VPP/TuVariables.java index 39d9653..badbba5 100644 --- a/TU_Simulation/src/main/java/mas/JADE_VPP/TuVariables.java +++ b/TU_Simulation/src/main/java/mas/JADE_VPP/TuVariables.java @@ -30,6 +30,7 @@ public class TuVariables { public static boolean balancingRefuseTrigger = false; public static boolean balancingAgreeTrigger = false; public static boolean balancingInformTrigger = false; + public static boolean balancingInformInstantTrigger = false; public static boolean balancingFailureTrigger = false; public static String balancingTuName = "noName"; public static int feedIn; //Einspeisung From 4617f352680353259170920202d3dead5e53b1f1 Mon Sep 17 00:00:00 2001 From: Stefan Woltmann <56683670+IngStefan@users.noreply.github.com> Date: Sun, 27 Jun 2021 12:40:36 +0200 Subject: [PATCH 3/5] Bugfixes and minor changes --- Node-RED/VPP-VPP-Agent.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Node-RED/VPP-VPP-Agent.txt b/Node-RED/VPP-VPP-Agent.txt index 6fada80..9b00762 100644 --- a/Node-RED/VPP-VPP-Agent.txt +++ b/Node-RED/VPP-VPP-Agent.txt @@ -1 +1 @@ -[{"id":"7b0fa635.67ef5","type":"tab","label":"VPP - VPP-Agent","disabled":false,"info":""},{"id":"fd764160.c2182","type":"comment","z":"7b0fa635.67ef5","name":"1.1 Start Scheduling Process (VPP --> Node-RED)","info":"","x":214.11666870117188,"y":105.11666870117188,"wires":[]},{"id":"93d90be7.333288","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_request Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_request","tls":"","persist":false,"proxy":"","authType":"basic","x":1118.3666687011719,"y":142.24996948242188,"wires":[[]]},{"id":"9806f44f.99d148","type":"comment","z":"7b0fa635.67ef5","name":"1. Scheduling Process","info":"","x":125.11666870117188,"y":73.11666870117188,"wires":[]},{"id":"263a31b6.930756","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_request","method":"put","upload":false,"swaggerDoc":"","x":164.11666870117188,"y":142.11666870117188,"wires":[["6669f6db.483d","b7656f7e.47eaa"]]},{"id":"6669f6db.483d","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.11666870117188,"y":177.11666870117188,"wires":[]},{"id":"8bcbad15.6f18b","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var id = msg.payload.referenceID || 0; //id is an optional parameter\nvar serviceDescriptions = msg.payload.serviceDescriptions\nvar start = msg.payload.schedulingStart\nvar end = msg.payload.schedulingEnd\nvar expiration = msg.payload.expiration\n\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.11669921875,"y":143.11666107177734,"wires":[["93d90be7.333288"]]},{"id":"b97afd77.1f1fc","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_schedulingPlan","method":"put","upload":false,"swaggerDoc":"","x":173.11666870117188,"y":329.11663818359375,"wires":[["6703c2bf.318abc","1d3de801.a9daa"]]},{"id":"6703c2bf.318abc","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.41665649414062,"y":362.1166687011719,"wires":[]},{"id":"64ba4993.89a87","type":"comment","z":"7b0fa635.67ef5","name":"1.2 Sending the Scheduling Plans to the VPP (VPP <-- Node-RED)","info":"","x":263.1166687011719,"y":221.11663818359375,"wires":[]},{"id":"9afb9c24.47be2","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_schedulingPlanInfos","method":"put","upload":false,"swaggerDoc":"","x":184,"y":255.2166748046875,"wires":[["596579dd.a4621","90cc8d6.837fa7"]]},{"id":"596579dd.a4621","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":177.11666870117188,"y":287.2166748046875,"wires":[]},{"id":"6926c4e6.6beeac","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n// providing variables for the UI:\n//flow.set(\"schedulingPlanInfos\",schedulingPlanInfos);\n//global.set(\"schedulingPlanInfos\",schedulingPlanInfos);\n///var schedulingPlanInfos = flow.get(\"schedulingPlanInfos\");\n//global.get(\"arrayString\").push(schedulingPlanInfos);\n\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":255.2166748046875,"wires":[["40217cd9.f4f25c"]]},{"id":"1d3de801.a9daa","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = flow.get('schedulingPlanInfos');\n//use filename if you want to save the file in a local folder (save to folder node)\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":624.9500732421875,"y":328.8166198730469,"wires":[[]]},{"id":"1eb27538.8fd263","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1078.2999877929688,"y":254.11666870117188,"wires":[[]]},{"id":"a8c8de28.e92298","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1067.2999877929688,"y":218.11666870117188,"wires":[]},{"id":"b93374a1.44b6d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.5667114257812,"y":329.1166687011719,"wires":[[]]},{"id":"5bc8f24a.c8071c","type":"comment","z":"7b0fa635.67ef5","name":"1.3 Accepting or Rejecting the Proposals (VPP --> Node-RED)","info":"","x":238.11666870117188,"y":473.11663818359375,"wires":[]},{"id":"84d76edd.8b01a","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_accept-proposal","method":"put","upload":false,"swaggerDoc":"","x":186.11666870117188,"y":507.21661376953125,"wires":[["70d6390a.c9915","260fa31f.9b694c"]]},{"id":"40a19a7.cbd8b64","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_reject-proposal","method":"put","upload":false,"swaggerDoc":"","x":186.11666870117188,"y":580.2166137695312,"wires":[["9b8a2c67.c398a8","7ae1d2c0.d88814"]]},{"id":"dfc6ced.16699b","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\nvar start = msg.payload.schedulingStart;\nvar end = msg.payload.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.1166381835938,"y":506.21661376953125,"wires":[["c7d830c5.e26b5"]]},{"id":"79d6989b.6a14f","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.1166687011719,"y":580.2166137695312,"wires":[["95950400.6683d"]]},{"id":"c6836fee.9343a8","type":"comment","z":"7b0fa635.67ef5","name":"1.4 Receiving Inform or Failure of TU (VPP <-- Node-RED)","info":"","x":228.11666870117188,"y":655.416748046875,"wires":[]},{"id":"89847d8.fd27c8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_failure","method":"put","upload":false,"swaggerDoc":"","x":137.11666870117188,"y":765.7166442871094,"wires":[["a26d953a.c69d4","7995e15c.5fec78"]]},{"id":"a26d953a.c69d4","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.41665649414062,"y":800.7166137695312,"wires":[]},{"id":"2a7b5b73.6f8b9c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_done","method":"put","upload":false,"swaggerDoc":"","x":129,"y":691.8167114257812,"wires":[["40cc27ff.3375d","f8dfe605.43a1d8"]]},{"id":"40cc27ff.3375d","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.11666870117188,"y":726.8167419433594,"wires":[]},{"id":"dc6fc640.e2eb68","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":691.8167419433594,"wires":[["cd761dcc.9ca9"]]},{"id":"c7d830c5.e26b5","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_accept-proposal Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_accept-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":1141,"y":504.99993896484375,"wires":[[]]},{"id":"95950400.6683d","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_reject-proposal Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_reject-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":1142,"y":579.9999389648438,"wires":[[]]},{"id":"2b3c2051.b748d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.7833251953125,"y":690.6166687011719,"wires":[[]]},{"id":"8fdfe174.ac4e58","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1079.0499267578125,"y":766.6166687011719,"wires":[[]]},{"id":"7364643d.31052c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.11669921875,"y":764.61669921875,"wires":[["3e3fd9bd.e7f1a6"]]},{"id":"752760e3.511c88","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_refuse","method":"put","upload":false,"swaggerDoc":"","x":142.85000610351562,"y":403.8500061035156,"wires":[["13af9462.45515c","a4ba88a2.2feec"]]},{"id":"13af9462.45515c","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":177.14999389648438,"y":438.85003662109375,"wires":[]},{"id":"316b4f43.5946a8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.683349609375,"y":403.54998779296875,"wires":[[]]},{"id":"865123ce.69afe8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.8499145507812,"y":402.8500061035156,"wires":[[]]},{"id":"d822ac63.b430e8","type":"comment","z":"7b0fa635.67ef5","name":"2.1 Sending out a new Setpoint to TU (VPP --> Node-RED)","info":"","x":233.11669921875,"y":901.916748046875,"wires":[]},{"id":"1e3a2347.f610fd","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newSetpoint","method":"put","upload":false,"swaggerDoc":"","x":163.11669921875,"y":940.0165405273438,"wires":[["9947715.a48e99","eda31a89.b4951","91cb935e.4dddf"]]},{"id":"eda31a89.b4951","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.1166076660156,"y":939.0166625976562,"wires":[[]]},{"id":"4b13d705.4dca3","type":"http request","z":"7b0fa635.67ef5","name":"control_newSetpoint Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newSetpoint","tls":"","persist":false,"proxy":"","authType":"basic","x":1126.0000305175781,"y":939.7999877929688,"wires":[[]]},{"id":"b5abb43c.0ee84","type":"comment","z":"7b0fa635.67ef5","name":"3.1 Requesting balancing (VPP --> Node-RED)","info":"","x":201.11671447753906,"y":1330.0166015625,"wires":[]},{"id":"8eaa7754.ddfe7","type":"http request","z":"7b0fa635.67ef5","name":"balancing_subscribe Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/balancing_subscribe","tls":"","persist":false,"proxy":"","authType":"basic","x":1128.4500885009766,"y":1366.8665771484375,"wires":[[]]},{"id":"89ee77c2.708c18","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var balancingTUName = msg.payload.balancingTUName;\nvar balancingUpdateRate = msg.payload.balancingUpdateRate;\nvar balancingStart = msg.payload.balancingStart;\nvar balancingEnd = msg.payload.balancingEnd;\nvar balancingReferenceID = msg.payload.balancingReferenceID;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":607.1167144775391,"y":1367.216552734375,"wires":[[]]},{"id":"8ea13f38.9cf77","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/balancing_subscribe","method":"put","upload":false,"swaggerDoc":"","x":172.11671447753906,"y":1367.216552734375,"wires":[["89ee77c2.708c18","ea219ae5.fee2b8","2e0ffecf.c10d12"]]},{"id":"3d8a33c1.6fd7ac","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/control_failure","method":"put","upload":false,"swaggerDoc":"","x":122.11666870117188,"y":1197.11669921875,"wires":[["f7c3d01c.268b8","791a0152.12eef8"]]},{"id":"f7c3d01c.268b8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":178.41665649414062,"y":1231.1168212890625,"wires":[]},{"id":"d9489e48.16b4","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1074.0499572753906,"y":1199.0167846679688,"wires":[[]]},{"id":"191fee6d.4393e2","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.1166687011719,"y":1198.0167846679688,"wires":[[]]},{"id":"76051960.573808","type":"comment","z":"7b0fa635.67ef5","name":"2.2 Receiving Failure message (if failed) (VPP <-- Node-RED)","info":"","x":241.00003051757812,"y":1162,"wires":[]},{"id":"cfa47ae8.1f7db8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_agree","method":"put","upload":false,"swaggerDoc":"","x":130.0000457763672,"y":1470,"wires":[["ac75addb.af8b6","20950556.1415ea"]]},{"id":"ac75addb.af8b6","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.300048828125,"y":1505,"wires":[]},{"id":"4ef05b9f.399b04","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1074.9333038330078,"y":1472.9000549316406,"wires":[[]]},{"id":"a664297.b3e5c58","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610.0000152587891,"y":1470.9000244140625,"wires":[[]]},{"id":"4ca490c8.1561d","type":"comment","z":"7b0fa635.67ef5","name":"3.1 VPP <-- Node-RED: receiving agree or refuse message","info":"","x":230.0000457763672,"y":1435,"wires":[]},{"id":"20295959.21889e","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_refuse","method":"put","upload":false,"swaggerDoc":"","x":131.0000457763672,"y":1540,"wires":[["ea7915aa.5d8b8","9cc309a6.f888c"]]},{"id":"ea7915aa.5d8b8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.300048828125,"y":1577,"wires":[]},{"id":"2b12ad8c.bad76a","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1075.933364868164,"y":1541.9000549316406,"wires":[[]]},{"id":"e805ebda.c14dd8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000152587891,"y":1541.9000244140625,"wires":[[]]},{"id":"970aecc6.1192f8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_failure","method":"put","upload":false,"swaggerDoc":"","x":128.0000457763672,"y":1723,"wires":[["86b8f800.d93","47915bc6.0a05d4"]]},{"id":"86b8f800.d93","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":170.30003356933594,"y":1759.0000305175781,"wires":[]},{"id":"4d5c70a0.f49a6","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1069.933364868164,"y":1718.89990234375,"wires":[[]]},{"id":"a5b69353.5ca578","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000762939453,"y":1722.9000244140625,"wires":[[]]},{"id":"c89d360.a68b4c8","type":"comment","z":"7b0fa635.67ef5","name":"3.2 VPP <-- Node-RED: receiving balancing data or failure message","info":"","x":257.0000457763672,"y":1616,"wires":[]},{"id":"e852285b.0a9b58","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_inform","method":"put","upload":false,"swaggerDoc":"","x":128.0000457763672,"y":1651,"wires":[["5aec6876.b400b","d7277b7a.9617e"]]},{"id":"5aec6876.b400b","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":170.30003356933594,"y":1687.0000305175781,"wires":[]},{"id":"80d062f8.8bbd9","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1069.933364868164,"y":1644.9000244140625,"wires":[[]]},{"id":"dd27c947.5c265","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.BalancingSequenceInform.tuName[0];\nvar agentName = msg.payload.BalancingSequenceInform.agentName[0];\nvar feedIn = msg.payload.BalancingSequenceInform.tudataSet[0].feedIn[0];\nvar operatingPoint = msg.payload.BalancingSequenceInform.tudataSet[0].operatingPoint[0];\nvar leadingOperatingPoint = msg.payload.BalancingSequenceInform.tudataSet[0].leadingOperatingPoint[0];\nvar currentValueFR = msg.payload.BalancingSequenceInform.tudataSet[0].currentValueFR[0];\nvar assignedPool = msg.payload.BalancingSequenceInform.tudataSet[0].assignedPool[0];\nvar status = msg.payload.BalancingSequenceInform.tudataSet[0].status[0];\nvar frequency = msg.payload.BalancingSequenceInform.tudataSet[0].frequency[0];\n//var aFRRsetpoint = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRsetpoint[0];\nvar aFRRsetpointEcho = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRsetpointEcho[0];\nvar setpointFR = msg.payload.BalancingSequenceInform.tudataSet[0].setpointFR[0];\nvar aFRRGradientPOS = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRGradientPOS[0];\nvar aFRRGradientNEG = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRGradientNEG[0];\nvar capacityPOS = msg.payload.BalancingSequenceInform.tudataSet[0].capacityPOS[0];\nvar capacityNEG = msg.payload.BalancingSequenceInform.tudataSet[0].capacityNEG[0];\nvar holdingCapacityPOS = msg.payload.BalancingSequenceInform.tudataSet[0].holdingCapacityPOS[0];\nvar holdingCapacityNEG = msg.payload.BalancingSequenceInform.tudataSet[0].holdingCapacityNEG[0];\nvar controlBandPOS = msg.payload.BalancingSequenceInform.tudataSet[0].controlBandPOS[0];\nvar controlBandNEG = msg.payload.BalancingSequenceInform.tudataSet[0].controlBandNEG[0];\n\npayload = \n{\n \"tuName\": tuName, \n \"agentName\" : agentName,\n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n//\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÜNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÜNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n//Needed for UI Tests:\n//global.set(\"arrayStringBalancing\",payload);\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000762939453,"y":1650.9000244140625,"wires":[["d7e193fb.e97838"]]},{"id":"791a0152.12eef8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":449.95001220703125,"y":1198.4666137695312,"wires":[["191fee6d.4393e2"]]},{"id":"20950556.1415ea","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":444.11671447753906,"y":1470.5167236328125,"wires":[["a664297.b3e5c58"]]},{"id":"9cc309a6.f888c","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":442.11671447753906,"y":1541.7166748046875,"wires":[["e805ebda.c14dd8"]]},{"id":"d7277b7a.9617e","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":443.11669921875,"y":1650.7166748046875,"wires":[["dd27c947.5c265"]]},{"id":"47915bc6.0a05d4","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":443.11669921875,"y":1722.7166748046875,"wires":[["a5b69353.5ca578"]]},{"id":"955d08cb.ebe59","type":"comment","z":"7b0fa635.67ef5","name":"2. TU Control Sequence","info":"","x":124.00003051757812,"y":869.7166748046875,"wires":[]},{"id":"f8ced7f2.876ed8","type":"comment","z":"7b0fa635.67ef5","name":"3. TU Balancing","info":"","x":101.00004577636719,"y":1298.300048828125,"wires":[]},{"id":"6f7e558c.3ed5d4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/accounting_energyConsumptionProfileReference","method":"put","upload":false,"swaggerDoc":"","x":230.85003662109375,"y":1977.64990234375,"wires":[["b5c11512.7832a","24bcedde.901022"]]},{"id":"b5c11512.7832a","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.1500244140625,"y":2012.6499328613281,"wires":[]},{"id":"d32af972.122d08","type":"comment","z":"7b0fa635.67ef5","name":"4.1 VPP <-- Node-RED: sending the energy consumption profiles to the VPP ","info":"","x":289.85003662109375,"y":1861.64990234375,"wires":[]},{"id":"674a876.c3cc6f8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/accounting_energyConsumptionProfile","method":"put","upload":false,"swaggerDoc":"","x":200.73336791992188,"y":1904.7499389648438,"wires":[["ec1a4d89.414b4","deb11ce8.5d735"]]},{"id":"ec1a4d89.414b4","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":174.85003662109375,"y":1940.75,"wires":[]},{"id":"91a3c6e6.afba58","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n//code for UI Test:\n//global.set(\"arrayStringAccounting\",msg.payload);\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":719.8499755859375,"y":1976.75,"wires":[["4dfb481c.c9f398"]]},{"id":"deb11ce8.5d735","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = flow.get('energyConsumptionProfile');\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":719.6832275390625,"y":1904.349609375,"wires":[[]]},{"id":"9cee7dfa.9adaa8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1172.0333251953125,"y":1902.64990234375,"wires":[[]]},{"id":"df50ecce.f12f08","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1171.2999267578125,"y":1973.64990234375,"wires":[[]]},{"id":"99b82672.989498","type":"comment","z":"7b0fa635.67ef5","name":"4. Accounting","info":"","x":90.85003662109375,"y":1827.449951171875,"wires":[]},{"id":"24bcedde.901022","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":550.8499755859375,"y":1977.050048828125,"wires":[["91a3c6e6.afba58"]]},{"id":"a5c124b5.33e078","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.85009765625,"y":2076.8502197265625,"wires":[["c9286592.2b2a4"]]},{"id":"c9286592.2b2a4","type":"http request","z":"7b0fa635.67ef5","name":"accounting_ECPReceived Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/accounting_ECPReceived","tls":"","persist":false,"proxy":"","authType":"basic","x":1149.550048828125,"y":2079.8499755859375,"wires":[[]]},{"id":"cb798789.4f5418","type":"comment","z":"7b0fa635.67ef5","name":"4.2 Confirming the ECP has been received (VPP --> Node-RED)","info":"","x":252.85000610351562,"y":2047.4500732421875,"wires":[]},{"id":"4f37ff3d.8db8c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/accounting_ECPReceived","method":"put","upload":false,"swaggerDoc":"","x":184,"y":2082.0501708984375,"wires":[["35f8281d.faff2"]]},{"id":"6306d75c.a18c","type":"comment","z":"7b0fa635.67ef5","name":"5. (A) LoadTimeWindowsShare-Process via direct request","info":"","x":238.00003051757812,"y":2183,"wires":[]},{"id":"cc4d3e1a.b345c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/loadTimeWindows_inform","method":"put","upload":false,"swaggerDoc":"","x":186.00003051757812,"y":2357.0001220703125,"wires":[["1b94c58a.f73582","78732cad.49bf54"]]},{"id":"1b94c58a.f73582","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.00003051757812,"y":2393,"wires":[]},{"id":"78732cad.49bf54","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.loadTimeWindowsReference;\nvar windowHighBegin = msg.payload.windowHighBegin;\nvar windowHighEnd = msg.payload.windowHighEnd;\nvar windowLowBegin = msg.payload.windowLowBegin;\nvar windowLowEnd = msg.payload.windowLowEnd;\n\npayload = \n{\n \"loadTimeWindowsReference\": loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" :windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.6334838867188,"y":2356.30029296875,"wires":[["86fd511a.b8fda"]]},{"id":"86fd511a.b8fda","type":"http request","z":"7b0fa635.67ef5","name":"loadTimeWindows_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_inform","tls":"","persist":false,"proxy":"","authType":"","x":1154.633544921875,"y":2356.3004150390625,"wires":[[]]},{"id":"a8117b63.6a188","type":"comment","z":"7b0fa635.67ef5","name":"5.2 Requesting the VPP to share the LoadTimeWindows (Node-RED <-- VPP)","info":"","x":296.0000305175781,"y":2322,"wires":[]},{"id":"2318e0df.817d9","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n","x":458.00006103515625,"y":2389.10009765625,"wires":[]},{"id":"7803cad9.a821dc","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"payload = {\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.6334228515625,"y":2469.400390625,"wires":[["86fd511a.b8fda"]]},{"id":"34042585.8fcd3a","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":159.00003051757812,"y":2437.2001953125,"wires":[]},{"id":"f2935e79.b2095","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":215.00003051757812,"y":2471,"wires":[["7803cad9.a821dc"]]},{"id":"fa84c689.a05538","type":"comment","z":"7b0fa635.67ef5","name":"5.1 Receiving the LoadTimeWindows (VPP <-- Node-RED)","info":"","x":238,"y":2217.033203125,"wires":[]},{"id":"16e4330f.07cf35","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/loadTimeWindows_request","method":"put","upload":false,"swaggerDoc":"","x":167,"y":2253.1331787109375,"wires":[["d5253f40.a9b318","2fa571b6.1e4c56"]]},{"id":"d5253f40.a9b318","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":183,"y":2286.13330078125,"wires":[]},{"id":"2417057e.0beb4a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\n//var windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\n//var windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\n//var windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\n//var windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\nmsg.payload = {\n \"loadTimeWindowsReference\" : loadTimeWindowsReference,\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.8333740234375,"y":2255.8330078125,"wires":[[]]},{"id":"2fa571b6.1e4c56","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":459.8333740234375,"y":2253.083251953125,"wires":[["2417057e.0beb4a"]]},{"id":"ce44d654.b99c38","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1094.449951171875,"y":2249.2333984375,"wires":[[]]},{"id":"e3122478.73e4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n\"loadTimeWindowsReference\" : \"tariff22\" \n}","x":862.0166015625,"y":2251.2333984375,"wires":[]},{"id":"ccd7c37f.08a3b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/loadTimeWindows_broadcast","method":"put","upload":false,"swaggerDoc":"","x":199.00003051757812,"y":2578,"wires":[["b616ed4e.7387c8","2fa948eb.967e88"]]},{"id":"b616ed4e.7387c8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.00003051757812,"y":2614,"wires":[]},{"id":"ab393d18.32128","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\nvar windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\nvar windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\nvar windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\nvar windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\n\nmsg.payload = \n{\n \"loadTimeWindowsReference\": loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" :windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.6334228515625,"y":2578.30029296875,"wires":[["5e353c9b.dc1aa4"]]},{"id":"5e353c9b.dc1aa4","type":"http request","z":"7b0fa635.67ef5","name":"loadTimeWindows_broadcast Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_broadcast","tls":"","persist":false,"proxy":"","authType":"","x":1173.633544921875,"y":2577.30029296875,"wires":[[]]},{"id":"310fc528.3cb4ba","type":"comment","z":"7b0fa635.67ef5","name":"5.3 Broadcasting new LoadTimeWindows to everyone","info":"","x":228.00003051757812,"y":2542,"wires":[]},{"id":"66aacc19.37c1fc","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n","x":466.00006103515625,"y":2644.10009765625,"wires":[]},{"id":"a7d1eb4f.93483","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":161.00003051757812,"y":2658.7998046875,"wires":[]},{"id":"1d48cb30.f62b35","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":214.00003051757812,"y":2693.599609375,"wires":[["cbf0562.376d728"]]},{"id":"cbf0562.376d728","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"\npayload = {\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n\nmsg.payload = payload;\n// payload = {\"schedulingPlanUploaded\" : true}\n//msg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625,"y":2692,"wires":[["5e353c9b.dc1aa4"]]},{"id":"90cc8d6.837fa7","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.1166687011719,"y":255.11666870117188,"wires":[["6926c4e6.6beeac"]]},{"id":"f8dfe605.43a1d8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":454.1166687011719,"y":691.7166442871094,"wires":[["dc6fc640.e2eb68"]]},{"id":"f4c97494.1eb95","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** SCHEDULING ********************************************","info":"","x":335.1166687011719,"y":40.116668701171875,"wires":[]},{"id":"f6c4085c.daa378","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1117.1166687011719,"y":105.11666870117188,"wires":[]},{"id":"30d600ce.7d3488","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\",\n tuName: \"TUEmden0\"me :\"TUEmden0\"\n}","x":860.11669921875,"y":257.1166687011719,"wires":[]},{"id":"71f1dc5f.e63474","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n//the payload can be any form of XML the VPP needs for the planning of the TU\n//shown in String:\n\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","x":861.5,"y":330.2166748046875,"wires":[]},{"id":"f82b4e6a.fbb53","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\", \n tuName: \"noNameSet\" \n}","x":860.9833374023438,"y":405.2166748046875,"wires":[]},{"id":"70d6390a.c9915","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.11666870117188,"y":542.3166198730469,"wires":[]},{"id":"9b8a2c67.c398a8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.11666870117188,"y":617.3166198730469,"wires":[]},{"id":"884b52c2.6c38","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1110.683349609375,"y":478.31658935546875,"wires":[]},{"id":"e5128683.afd308","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1066.1500244140625,"y":654.6166687011719,"wires":[]},{"id":"32bf6866.c4a3d8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany0, RequestMRL041221\", \n tuName: \"TUEmden0\" \n}","x":855.11669921875,"y":690.5166320800781,"wires":[]},{"id":"1393cb24.6ed505","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\",\n tuName: \"TUEmden0\"\n}","x":855.11669921875,"y":767.5166320800781,"wires":[]},{"id":"7995e15c.5fec78","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":453.8500061035156,"y":764.0499572753906,"wires":[["7364643d.31052c"]]},{"id":"a4ba88a2.2feec","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.8500061035156,"y":403.8500061035156,"wires":[["316b4f43.5946a8"]]},{"id":"744ba7c7.f971d8","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** TU CONTROL********************************************","info":"","x":333.85003662109375,"y":836.449951171875,"wires":[]},{"id":"290e417.5fbacbe","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1115.8500061035156,"y":903.050048828125,"wires":[]},{"id":"81b26319.06a4d8","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1063.8500061035156,"y":1162.050048828125,"wires":[]},{"id":"5fa7843f.3791b4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TU-EMDEN-CompanyXY-ProcessZ\"\n}","x":847.8499755859375,"y":1198.449951171875,"wires":[]},{"id":"aef6a421.62cca","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** TU BALANCING********************************************","info":"","x":348.8500518798828,"y":1265.25,"wires":[]},{"id":"e78d2cfa.a3cc48","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** ACCOUNTING********************************************","info":"","x":335.85003662109375,"y":1794.64990234375,"wires":[]},{"id":"be2e3380.7b29b","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** LOADTIMEWINDOWS-SHARE********************************************","info":"","x":390.85003662109375,"y":2147.449951171875,"wires":[]},{"id":"3ca33c8.d275fc4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newLoadProfile","method":"put","upload":false,"swaggerDoc":"","x":174.00003051757812,"y":1014,"wires":[["9fc17a13.197448","751aa5cc.975834"]]},{"id":"9fc17a13.197448","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.30001831054688,"y":1048,"wires":[]},{"id":"751aa5cc.975834","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":619.9334106445312,"y":1014.2999877929688,"wires":[["df2e2dca.4fd7f8"]]},{"id":"df2e2dca.4fd7f8","type":"http request","z":"7b0fa635.67ef5","name":"control_newLoadProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfile","tls":"","persist":false,"proxy":"","authType":"","x":1132.9333801269531,"y":1015.300048828125,"wires":[[]]},{"id":"c42d76ba.38d74","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newLoadProfileUploaded","method":"put","upload":false,"swaggerDoc":"","x":202.00003051757812,"y":1085.0999908447266,"wires":[["883818ec.815dd8","774c3cf3.b19f24","e02adc48.0aa598"]]},{"id":"883818ec.815dd8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":182.00003051757812,"y":1121.0999755859375,"wires":[]},{"id":"774c3cf3.b19f24","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.6334838867188,"y":1084.4000244140625,"wires":[[]]},{"id":"5ac310c4.37c028","type":"http request","z":"7b0fa635.67ef5","name":"control_newLoadProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1163.6334533691406,"y":1084.4000244140625,"wires":[[]]},{"id":"9947715.a48e99","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":181.85003662109375,"y":972.6500244140625,"wires":[]},{"id":"bc5e69ee.a039d","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1118.116683959961,"y":1333.5167541503906,"wires":[]},{"id":"b6852e5b.8ef9d8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":839.0000152587891,"y":1470,"wires":[]},{"id":"bb839fc9.df20b","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":842.0000152587891,"y":1545,"wires":[]},{"id":"b16096c5.f5f1c","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1065.000015258789,"y":1439,"wires":[]},{"id":"83f9a20e.e10d1","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1061.000015258789,"y":1612,"wires":[]},{"id":"21bc13db.66e90c","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\",\n agentName: \"AgentTUEmdenCompany0\",\n feedIn: \"0\",\n operatingPoint: \"0\",\n leadingOperatingPoint: \"0\",\n currentValueFR: \"0\",\n assignedPool: \"0\",\n status: \"0\",\n frequency: \"0\",\n aFRRsetpoint: \"0\",\n aFRRsetpointEcho: \"0\",\n setpointFR: \"0\",\n aFRRGradientPOS: \"0\",\n aFRRGradientNEG: \"0\",\n capacityPOS: \"0\",\n capacityNEG: \"0\",\n holdingCapacityPOS: \"0\",\n holdingCapacityNEG: \"0\",\n controlBandPOS: \"0\",\n controlBandNEG: \"0\"\n}","x":838.0000152587891,"y":1650,"wires":[]},{"id":"baf539b5.92c29","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":841.0000152587891,"y":1721,"wires":[]},{"id":"e1f777ff.26e368","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":955,"y":1904,"wires":[]},{"id":"5fa05d4b.ac739c","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany1\"\n}","x":955,"y":1974,"wires":[]},{"id":"da274a4e.455ba8","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1131,"y":2044.9998779296875,"wires":[]},{"id":"bcdb708d.0ff79","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1163,"y":1863,"wires":[]},{"id":"249d9f32.672f1","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1082.8499450683594,"y":2215.64990234375,"wires":[]},{"id":"6577eca6.5b9f7c","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1133.8499755859375,"y":2317.85009765625,"wires":[]},{"id":"595c6301.1677a4","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1133.8499755859375,"y":2539.050048828125,"wires":[]},{"id":"9136a9fc.811a88","type":"comment","z":"7b0fa635.67ef5","name":"5. (B) LoadTimeWindowsShare-Process via Broadcast","info":"","x":227.85000610351562,"y":2509.64990234375,"wires":[]},{"id":"af3b68c1.5f3188","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/ams_agentBorn","method":"put","upload":false,"swaggerDoc":"","x":128.00006103515625,"y":4948.999755859375,"wires":[["44fcb56e.c4f32c","56dbcc04.daf3a4"]]},{"id":"44fcb56e.c4f32c","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.300048828125,"y":4983.999755859375,"wires":[]},{"id":"3bf9a243.4ec776","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/ams_agentDead","method":"put","upload":false,"swaggerDoc":"","x":131.88339233398438,"y":4876.099792480469,"wires":[["73401e22.77f56","79d99ed1.9c083"]]},{"id":"73401e22.77f56","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":176.00006103515625,"y":4912.099853515625,"wires":[]},{"id":"56dbcc04.daf3a4","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload;\n\n\nmsg.payload = {\n \"agentName\" : agentName\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622,"y":4948.099609375,"wires":[[]]},{"id":"9c3f5c88.7ba6d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.183349609375,"y":4877.999755859375,"wires":[[]]},{"id":"f18b5b1.c24fda8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1104.449951171875,"y":4946.999755859375,"wires":[[]]},{"id":"6b45ed15.a0c68c","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** PLATFORM INTERACTION ********************************************","info":"","x":368.00006103515625,"y":4841.999755859375,"wires":[]},{"id":"944b4993.56459","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1094.1500244140625,"y":4838.349853515625,"wires":[]},{"id":"79d99ed1.9c083","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload;\n\n\nmsg.payload = {\n \"agentName\" : agentName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.0000610351562,"y":4876.332763671875,"wires":[[]]},{"id":"4083bb5a.a2e824","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName : \"TUEmdenCompany0@192.168.178.29:1099/JADE\"\n}","x":886.0000610351562,"y":4880.332763671875,"wires":[]},{"id":"899f5199.edf59","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName : \"TUEmdenCompany0@192.168.178.29:1099/JADE\"\n}","x":887,"y":4947.332763671875,"wires":[]},{"id":"78a4d703.7ac96","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** SOL/SNL Specific Actions ****************************************","info":"","x":365.85003662109375,"y":2732.666748046875,"wires":[]},{"id":"6e63440c.80f084","type":"comment","z":"7b0fa635.67ef5","name":"6 Enable Frequency Relay","info":"","x":136.00003051757812,"y":2766.9334716796875,"wires":[]},{"id":"7a05001e.7ae57","type":"comment","z":"7b0fa635.67ef5","name":"6.1 Sending out a enable (VPP --> Node-RED)","info":"","x":196.11669921875,"y":2799.133544921875,"wires":[]},{"id":"4f5baa87.87b47c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_enable","method":"put","upload":false,"swaggerDoc":"","x":165.6667022705078,"y":2834.7665405273438,"wires":[["95544204.fb8228","f6d67de4.625868"]]},{"id":"e77e335e.80dd7","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.6666107177734,"y":2833.7666625976562,"wires":[["42326bd2.9c9cbc"]]},{"id":"42326bd2.9c9cbc","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_enable Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_enable","tls":"","persist":false,"proxy":"","authType":"basic","x":1128.550033569336,"y":2832.5499877929688,"wires":[[]]},{"id":"1296cf80.01fc19","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1128.4000396728516,"y":2800.800048828125,"wires":[]},{"id":"95544204.fb8228","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":185.4000244140625,"y":2870.39990234375,"wires":[]},{"id":"c0d73163.1b41b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_enableInform","method":"put","upload":false,"swaggerDoc":"","x":163.66668701171875,"y":3016.666748046875,"wires":[["723607cf.c0378","88745c93.d7579"]]},{"id":"723607cf.c0378","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":185.9666748046875,"y":3052.666778564453,"wires":[]},{"id":"e37305cc.be4d6","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1092.6000061035156,"y":3013.566650390625,"wires":[[]]},{"id":"56377bd6.c9661c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":619.6667175292969,"y":3016.5667724609375,"wires":[["eee9a163.5033f"]]},{"id":"93beaf79.d9a6f8","type":"comment","z":"7b0fa635.67ef5","name":"6.2 VPP <-- Node-RED: receiving inform or failure message","info":"","x":234.66668701171875,"y":2913.666748046875,"wires":[]},{"id":"2889cab3.5a210e","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_enableFailure","method":"put","upload":false,"swaggerDoc":"","x":163.66668701171875,"y":2948.666748046875,"wires":[["293e9824.2c7b38","ab516f10.e2ff2"]]},{"id":"293e9824.2c7b38","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":184.9666748046875,"y":2983.666778564453,"wires":[]},{"id":"36f13523.9e778a","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1093.6000061035156,"y":2948.5667724609375,"wires":[[]]},{"id":"55e19663.d0a4b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.6667022705078,"y":2950.56689453125,"wires":[[]]},{"id":"ab516f10.e2ff2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":455.7833557128906,"y":2950.3834228515625,"wires":[["55e19663.d0a4b8"]]},{"id":"88745c93.d7579","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":454.7833557128906,"y":3016.3834228515625,"wires":[["56377bd6.c9661c"]]},{"id":"64947add.24e6cc","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1082.6666564941406,"y":2914.666748046875,"wires":[]},{"id":"7170556a.39d5f4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":854.6666564941406,"y":2949.666748046875,"wires":[]},{"id":"a0703054.3e615","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":857.6666564941406,"y":3015.666748046875,"wires":[]},{"id":"92f6aa2f.0ab7d8","type":"comment","z":"7b0fa635.67ef5","name":"7 Disable Frequency Relay","info":"","x":132.6666717529297,"y":3165,"wires":[]},{"id":"93ceb3bf.84a8a8","type":"comment","z":"7b0fa635.67ef5","name":"7.1 Sending out a block (VPP --> Node-RED)","info":"","x":192.78334045410156,"y":3197.2000732421875,"wires":[]},{"id":"1818fccc.1ee26b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_block","method":"put","upload":false,"swaggerDoc":"","x":153.33334350585938,"y":3238.8330688476562,"wires":[["aba214be.89c8f8","94cef519.97372"]]},{"id":"e45695de.fec6e","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName \n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.333251953125,"y":3236.833251953125,"wires":[["1e2023e1.d79304"]]},{"id":"1e2023e1.d79304","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_block Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_block","tls":"","persist":false,"proxy":"","authType":"basic","x":1127.2166748046875,"y":3238.6165161132812,"wires":[[]]},{"id":"df02ea30.a2d72","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1136.066650390625,"y":3201.86669921875,"wires":[]},{"id":"aba214be.89c8f8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":182.06668090820312,"y":3273.466552734375,"wires":[]},{"id":"d2eaa357.46a8d8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_blockInform","method":"put","upload":false,"swaggerDoc":"","x":155.3333282470703,"y":3419.7333984375,"wires":[["83d97141.99723","38ea8d15.11fc02"]]},{"id":"83d97141.99723","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.63331604003906,"y":3455.7333068847656,"wires":[]},{"id":"5a50e889.de309","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1105.2666473388672,"y":3416.6331787109375,"wires":[[]]},{"id":"4dd33ee6.15d84","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.3333740234375,"y":3420.63330078125,"wires":[[]]},{"id":"f41cd723.6b3dc8","type":"comment","z":"7b0fa635.67ef5","name":"7.2 VPP <-- Node-RED: receiving inform or failure message","info":"","x":235.33331298828125,"y":3309.7333984375,"wires":[]},{"id":"35524bd0.0abffc","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_blockFailure","method":"put","upload":false,"swaggerDoc":"","x":156.3333282470703,"y":3346.7332763671875,"wires":[["aff9f121.472e78","3ce4ae57.fb27d2"]]},{"id":"aff9f121.472e78","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":178.63331604003906,"y":3382.7333068847656,"wires":[]},{"id":"52e937d1.43551","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.2666473388672,"y":3346.63330078125,"wires":[[]]},{"id":"d72acb58.fab4b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.3333740234375,"y":3346.63330078125,"wires":[[]]},{"id":"3ce4ae57.fb27d2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.45001220703125,"y":3347.449951171875,"wires":[["d72acb58.fab4b8"]]},{"id":"38ea8d15.11fc02","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.45001220703125,"y":3421.449951171875,"wires":[["4dd33ee6.15d84"]]},{"id":"48785394.616ecc","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1092.3332977294922,"y":3314.7332763671875,"wires":[]},{"id":"d44a10b9.1c33f8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":855.3332977294922,"y":3348.7332763671875,"wires":[]},{"id":"71e65eb1.558378","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":859.3332977294922,"y":3419.7332763671875,"wires":[]},{"id":"284c029d.54b0de","type":"comment","z":"7b0fa635.67ef5","name":"Receiving status (frequency relay has been triggered) message of frequency relay (VPP <-- Node-RED)","info":"","x":371.6666717529297,"y":3594,"wires":[]},{"id":"c4c6630c.4c84b8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_triggered","method":"put","upload":false,"swaggerDoc":"","x":144.6666717529297,"y":3636,"wires":[["cf71f945.763ba8","54c46f77.d4f258"]]},{"id":"cf71f945.763ba8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":176.96665954589844,"y":3672.000030517578,"wires":[]},{"id":"a18bfe9f.9ca51","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1113.5999908447266,"y":3632.9000244140625,"wires":[[]]},{"id":"20327dc0.4986ea","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.6667022705078,"y":3638.9000244140625,"wires":[[]]},{"id":"54c46f77.d4f258","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":464.7833251953125,"y":3638.716796875,"wires":[["20327dc0.4986ea"]]},{"id":"e4a4428.4f2944","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1103.6666259765625,"y":3598,"wires":[]},{"id":"310936d1.c4ce4a","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":898.6666412353516,"y":3638,"wires":[]},{"id":"aca7fd28.9f71d8","type":"comment","z":"7b0fa635.67ef5","name":"8 Frequency Relay Status","info":"","x":132.6666717529297,"y":3562,"wires":[]},{"id":"b3411deb.446a3","type":"comment","z":"7b0fa635.67ef5","name":"8.1 Sending out a confirm (VPP --> Node-RED)","info":"","x":202.6666717529297,"y":3706,"wires":[]},{"id":"a46c7074.46e768","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_confirm","method":"put","upload":false,"swaggerDoc":"","x":163.2166748046875,"y":3739.6329956054688,"wires":[["baf3a9e3.a7275","7cbf373d.7b5318"]]},{"id":"baf3a9e3.a7275","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.2165832519531,"y":3740.6331176757812,"wires":[["72490ce2.373bfc"]]},{"id":"72490ce2.373bfc","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_confirm","tls":"","persist":false,"proxy":"","authType":"basic","x":1152.0999755859375,"y":3739.41650390625,"wires":[[]]},{"id":"c8f076e5.44d15","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1152.949951171875,"y":3699.66650390625,"wires":[]},{"id":"7cbf373d.7b5318","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":183.95001220703125,"y":3776.2666015625,"wires":[]},{"id":"f7efb8f6.caf74","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject an Enable***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":157.5499725341797,"y":3126.650146484375,"wires":[["a2591b2b.10ab48"]]},{"id":"a2591b2b.10ab48","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.5499877929688,"y":3125.650146484375,"wires":[["be5fd782.9d624"]]},{"id":"be5fd782.9d624","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_enable Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_enable","tls":"","persist":false,"proxy":"","authType":"basic","x":1133.6666259765625,"y":3124.666748046875,"wires":[[]]},{"id":"adc0e68e.0aea9","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Disable***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156.5499725341797,"y":3527.9833984375,"wires":[["d519a76.89906d8"]]},{"id":"d519a76.89906d8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.5499877929688,"y":3525.9833984375,"wires":[["485c3f9c.003658"]]},{"id":"485c3f9c.003658","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_block Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_block","tls":"","persist":false,"proxy":"","authType":"basic","x":1133.6666259765625,"y":3527,"wires":[[]]},{"id":"16fa85eb.ccbd72","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156.5499725341797,"y":3846.9833984375,"wires":[["315036ad.7555a2"]]},{"id":"315036ad.7555a2","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.5499877929688,"y":3843.9833984375,"wires":[["ecb04700.5c4358"]]},{"id":"ecb04700.5c4358","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_confirm","tls":"","persist":false,"proxy":"","authType":"basic","x":1154.6666259765625,"y":3845,"wires":[[]]},{"id":"ab3c26e5.58647","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":150.6666717529297,"y":3093,"wires":[]},{"id":"7d49616.f2ae5a","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":152.6666717529297,"y":3493,"wires":[]},{"id":"d946bc35.bce1c","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":152.6666717529297,"y":3814,"wires":[]},{"id":"91cb935e.4dddf","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":450.6166687011719,"y":969.1998901367188,"wires":[["3d2473f1.56f8d4"]]},{"id":"3d2473f1.56f8d4","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadNewSetpoint.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":667.8499755859375,"y":969.449951171875,"wires":[["4b13d705.4dca3"]]},{"id":"876022fe.30795","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var id = msg.payload.InterfacePayloadPlanning.referenceID || 0; //id is an optional parameter\nvar serviceDescriptions = msg.payload.InterfacePayloadPlanning.serviceDescriptions;\nvar start = msg.payload.InterfacePayloadPlanning.schedulingStart;\nvar end = msg.payload.InterfacePayloadPlanning.schedulingEnd;\nvar expiration = msg.payload.InterfacePayloadPlanning.expiration;\n\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":674.8499755859375,"y":174.85000610351562,"wires":[["93d90be7.333288"]]},{"id":"b7656f7e.47eaa","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.6166687011719,"y":174.80001831054688,"wires":[["876022fe.30795"]]},{"id":"b0d0b8cb.8966a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var balancingTUName = msg.payload.InterfacePayloadBalancing.balancingTUName;\nvar balancingUpdateRate = msg.payload.InterfacePayloadBalancing.balancingUpdateRate;\nvar balancingStart = msg.payload.InterfacePayloadBalancing.balancingStart;\nvar balancingEnd = msg.payload.InterfacePayloadBalancing.balancingEnd;\nvar balancingReferenceID = msg.payload.InterfacePayloadBalancing.balancingReferenceID;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":656.8499755859375,"y":1401.25,"wires":[["8eaa7754.ddfe7"]]},{"id":"ea219ae5.fee2b8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":441.61669921875,"y":1400.800048828125,"wires":[["b0d0b8cb.8966a"]]},{"id":"f6d67de4.625868","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":458.61669921875,"y":2870.199951171875,"wires":[["48f6c6c1.d178b8"]]},{"id":"48f6c6c1.d178b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.8499755859375,"y":2870.64990234375,"wires":[["42326bd2.9c9cbc"]]},{"id":"94cef519.97372","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":446.8499755859375,"y":3270.050048828125,"wires":[["4fa628f6.31a99"]]},{"id":"4fa628f6.31a99","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":613.0833129882812,"y":3269.5,"wires":[["1e2023e1.d79304"]]},{"id":"40217cd9.f4f25c","type":"http request","z":"7b0fa635.67ef5","name":"***Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_schedulingPlanInfos","tls":"","persist":false,"proxy":"","authType":"basic","x":1096.8499755859375,"y":286.8500061035156,"wires":[[]]},{"id":"843c0b65.fb9f38","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var schedulingPlanReference = msg.payload.InterfacePayloadAcceptReject.schedulingPlanReference;\nvar start = msg.payload.InterfacePayloadAcceptReject.schedulingStart;\nvar end = msg.payload.InterfacePayloadAcceptReject.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672.8499755859375,"y":539.8499450683594,"wires":[["c7d830c5.e26b5"]]},{"id":"260fa31f.9b694c","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.8499755859375,"y":539.8499450683594,"wires":[["843c0b65.fb9f38"]]},{"id":"7ae1d2c0.d88814","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":453,"y":617.9999694824219,"wires":[["bbdc19af.9137c8"]]},{"id":"bbdc19af.9137c8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var schedulingPlanReference = msg.payload.InterfacePayloadAcceptReject.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672,"y":617.9999694824219,"wires":[["95950400.6683d"]]},{"id":"cd761dcc.9ca9","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_done","tls":"","persist":false,"proxy":"","authType":"basic","x":1105,"y":727,"wires":[[]]},{"id":"3e3fd9bd.e7f1a6","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_failure","tls":"","persist":false,"proxy":"","authType":"basic","x":1106,"y":804,"wires":[[]]},{"id":"4dfb481c.c9f398","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/accounting_energyConsumptionProfileReference","tls":"","persist":false,"proxy":"","authType":"basic","x":1201,"y":2006,"wires":[[]]},{"id":"a6dc3532.1dbe8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":675,"y":2111.0001220703125,"wires":[["c9286592.2b2a4"]]},{"id":"35f8281d.faff2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":459.5,"y":2111.0001220703125,"wires":[["a6dc3532.1dbe8"]]},{"id":"d7e193fb.e97838","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/balancing_inform","tls":"","persist":false,"proxy":"","authType":"basic","x":1099.8499755859375,"y":1683.25,"wires":[[]]},{"id":"2e0ffecf.c10d12","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.85000610351562,"y":1401.050048828125,"wires":[]},{"id":"96c2fe94.ae4718","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":632.1499633789062,"y":4067.99951171875,"wires":[["dc4eee7e.3b4918"]]},{"id":"dc4eee7e.3b4918","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_confirm","tls":"","persist":false,"proxy":"","authType":"","x":1178.1500701904297,"y":4065.9996795654297,"wires":[[]]},{"id":"33943318.c6bb84","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":192.1499786376953,"y":4069.199462890625,"wires":[["97686248.818948","96c2fe94.ae4718"]]},{"id":"97686248.818948","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":191.449951171875,"y":4105.19970703125,"wires":[]},{"id":"c882b9f2.d08bc8","type":"comment","z":"7b0fa635.67ef5","name":"9.1 Receiving Cancel for a specific operation from the a TU Agent (VPP <-- Node-RED","info":"","x":327.41668701171875,"y":3918.5162963867188,"wires":[]},{"id":"4e15f456.b6abbc","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface ","info":"","x":1119.300048828125,"y":4031.94970703125,"wires":[]},{"id":"6cfc3a12.59fa14","type":"comment","z":"7b0fa635.67ef5","name":"9.2 Sending confirmation or failure of the operation cancel fto the Agent (VPP --> Node-RED)","info":"","x":352.0000457763672,"y":4030.999755859375,"wires":[]},{"id":"fa66d7ef.52b85","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":159.00003051757812,"y":3954.099853515625,"wires":[["9621885c.2b8fd","cb4b24d4.f26328"]]},{"id":"9621885c.2b8fd","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":189.00003051757812,"y":3991.099609375,"wires":[]},{"id":"828f9146.4055b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":631.8334350585938,"y":3956.7998046875,"wires":[[]]},{"id":"cb4b24d4.f26328","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":467.8333740234375,"y":3956.0498046875,"wires":[["828f9146.4055b8"]]},{"id":"e91f8f9f.389e4","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1120.449951171875,"y":3957.2001953125,"wires":[[]]},{"id":"ba51565a.3f2b2","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":901.0166625976562,"y":3958.2001953125,"wires":[]},{"id":"3d673ddb.39d542","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** CANCEL OPERATIONS ********************************************","info":"","x":369.0000305175781,"y":3883.849365234375,"wires":[]},{"id":"b416239b.85e8f","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":175,"y":4144.3330078125,"wires":[["ff7ef975.49eb7"]]},{"id":"ff7ef975.49eb7","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635,"y":4142.3330078125,"wires":[["dc4eee7e.3b4918"]]},{"id":"f29bec6a.072428","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1112,"y":3924,"wires":[]},{"id":"2fa948eb.967e88","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":457,"y":2578,"wires":[["ab393d18.32128"]]},{"id":"eee9a163.5033f","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/freqRelay_enableInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1124,"y":3046,"wires":[[]]},{"id":"6b21aaab.122004","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":596.1499633789062,"y":4331.549865722656,"wires":[["7818ca27.11d844"]]},{"id":"7818ca27.11d844","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_inform","tls":"","persist":false,"proxy":"","authType":"","x":1169.1500854492188,"y":4328.549911499023,"wires":[[]]},{"id":"63a8858c.e815ac","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":185.14999389648438,"y":4331.749694824219,"wires":[["1eb5ad0b.ca6753","6b21aaab.122004"]]},{"id":"1eb5ad0b.ca6753","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":246.44998168945312,"y":4366.749740600586,"wires":[]},{"id":"f769df0d.b6d478","type":"comment","z":"7b0fa635.67ef5","name":"10.1 SendingCancel for a specific operation from the Planning System (Node-RED <-- VPP)","info":"","x":347.4166564941406,"y":4290.06640625,"wires":[]},{"id":"54bef9b7.22f4a","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (TU-Agent)","info":"","x":1140.2999877929688,"y":4290.499801635742,"wires":[]},{"id":"740a667.efc4218","type":"comment","z":"7b0fa635.67ef5","name":"10.2 Receiving confirmation of the operation cancel from VPP (Node-RED --> VPP)","info":"","x":320,"y":4404.549865722656,"wires":[]},{"id":"cc065227.539e38","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":170,"y":4444.649963378906,"wires":[["ab12692f.e971e","d2f788ea.0b714"]]},{"id":"ab12692f.e971e","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":250,"y":4480.649963378906,"wires":[]},{"id":"e5e9887c.34117","type":"function","z":"7b0fa635.67ef5","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":598.8334045410156,"y":4447.349670410156,"wires":[[]]},{"id":"d2f788ea.0b714","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":416.8334045410156,"y":4446.600158691406,"wires":[["e5e9887c.34117"]]},{"id":"59f8a81f.2df438","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":858.0166320800781,"y":4447.750183105469,"wires":[]},{"id":"3f8c6389.2b0a3c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":597.1500244140625,"y":4374.083068847656,"wires":[["7818ca27.11d844"]]},{"id":"d6ebc7b2.69d0e8","type":"inject","z":"7b0fa635.67ef5","name":"TESTING","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":425.6500244140625,"y":4374.750061035156,"wires":[["3f8c6389.2b0a3c"]]},{"id":"67c2a9c4.56cb18","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1095.8499755859375,"y":4413.350158691406,"wires":[]},{"id":"3a9c14b7.0c7efc","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1106.8499755859375,"y":4448.350158691406,"wires":[[]]},{"id":"57672fe1.ccb3f","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/requestInfo","method":"put","upload":false,"swaggerDoc":"","x":134.39999389648438,"y":4627.7998046875,"wires":[["94f8f779.b06f3","8f46e25a.35aa98"]]},{"id":"94f8f779.b06f3","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":174.13331604003906,"y":4663.433166503906,"wires":[]},{"id":"8f46e25a.35aa98","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":475.3500213623047,"y":4627.233215332031,"wires":[["3480b47e.746164"]]},{"id":"3480b47e.746164","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":644.5832977294922,"y":4623.683166503906,"wires":[["d3b6b14d.ce424"]]},{"id":"d3b6b14d.ce424","type":"http request","z":"7b0fa635.67ef5","name":"requestInfos Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/requestInfo","tls":"","persist":false,"proxy":"","authType":"basic","x":1129.2832946777344,"y":4623.583435058594,"wires":[[]]},{"id":"5f8c1e4a.18edf8","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1149.13330078125,"y":4591.83349609375,"wires":[]},{"id":"a1a2f8e8.5bac18","type":"comment","z":"7b0fa635.67ef5","name":"**************** 11 Requesting Agent Info Sequence**************","info":"","x":234.84999084472656,"y":4592.166809082031,"wires":[]},{"id":"57caba26.33ccc4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/requestInfoData","method":"put","upload":false,"swaggerDoc":"","x":128.0833282470703,"y":4737.699844360352,"wires":[["328f222e.397cde","c6f2bf22.161a18"]]},{"id":"328f222e.397cde","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.1999969482422,"y":4773.699905395508,"wires":[]},{"id":"c6f2bf22.161a18","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var dataName = \"InfoSet\";\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+dataName+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":647.0331878662109,"y":4737.299514770508,"wires":[[]]},{"id":"7c93f50f.bf3064","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1114.383316040039,"y":4732.599990844727,"wires":[[]]},{"id":"471a1bed.8e1834","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":872.3499603271484,"y":4735.949905395508,"wires":[]},{"id":"5496c112.5cfeb","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/requestInfo","method":"get","upload":false,"swaggerDoc":"","x":121.19999694824219,"y":4805.599807739258,"wires":[["2eec3b94.8169c4"]]},{"id":"4e16df4.4683a2","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":805.1999969482422,"y":4805.599807739258,"wires":[]},{"id":"399a86d2.c4f45a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":638.1999969482422,"y":4806.599807739258,"wires":[["4e16df4.4683a2"]]},{"id":"2eec3b94.8169c4","type":"template","z":"7b0fa635.67ef5","name":"INSERT AGENT INFO HERE","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"AGENT\"\n \"ABC\"\n","output":"str","x":409.1999969482422,"y":4805.599807739258,"wires":[["399a86d2.c4f45a"]]},{"id":"5d75ab3d.a62f34","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject Request to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":155.6999969482422,"y":4701.599807739258,"wires":[["76629d87.7098fc"]]},{"id":"76629d87.7098fc","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"\nmsg.payload = {\n \"tuName\" : \"TU_Company1_MRL\"\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":648.1999969482422,"y":4703.599807739258,"wires":[["d3b6b14d.ce424"]]},{"id":"7ce87186.d7645","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n}","x":419.1999969482422,"y":4662.599807739258,"wires":[]},{"id":"e9328489.cd5e88","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635.1499633789062,"y":4178.25,"wires":[["dbe579fd.7dd56"]]},{"id":"dbe579fd.7dd56","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_failure","tls":"","persist":false,"proxy":"","authType":"","x":1181.1500701904297,"y":4175.25016784668,"wires":[[]]},{"id":"58dff453.340fe4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":185.1499786376953,"y":4178.449951171875,"wires":[["7f470248.3b44cc","e9328489.cd5e88"]]},{"id":"7f470248.3b44cc","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":194.449951171875,"y":4214.4501953125,"wires":[]},{"id":"ff6d0031.d35f","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Failure***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":178,"y":4253.58349609375,"wires":[["5a73f948.ba7458"]]},{"id":"5a73f948.ba7458","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":638,"y":4251.58349609375,"wires":[["dbe579fd.7dd56"]]},{"id":"f8cf0271.5bfe9","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":171.6666717529297,"y":4517,"wires":[["c5b67811.cac2d8","47ff44dc.9beae4"]]},{"id":"c5b67811.cac2d8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":251.6666717529297,"y":4553,"wires":[]},{"id":"12f0d993.412706","type":"function","z":"7b0fa635.67ef5","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600.5000762939453,"y":4519.69970703125,"wires":[[]]},{"id":"47ff44dc.9beae4","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":418.5000762939453,"y":4518.9501953125,"wires":[["12f0d993.412706"]]},{"id":"fd3a8ab0.c1762","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":859.6833038330078,"y":4520.1002197265625,"wires":[]},{"id":"4311fce9.be3914","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1108.5166473388672,"y":4520.7001953125,"wires":[[]]},{"id":"18c87b11.b14c55","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadNewSetpoint.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672.6666870117188,"y":1121,"wires":[["5ac310c4.37c028"]]},{"id":"e02adc48.0aa598","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":455.4333801269531,"y":1120.7499389648438,"wires":[["18c87b11.b14c55"]]}] \ No newline at end of file +[{"id":"7b0fa635.67ef5","type":"tab","label":"VPP - VPP-Agent","disabled":false,"info":""},{"id":"fd764160.c2182","type":"comment","z":"7b0fa635.67ef5","name":"1.1 Start Scheduling Process (VPP --> Node-RED)","info":"","x":214.11666870117188,"y":105.11666870117188,"wires":[]},{"id":"93d90be7.333288","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_request Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_request","tls":"","persist":false,"proxy":"","authType":"basic","x":1118.3666687011719,"y":142.24996948242188,"wires":[[]]},{"id":"9806f44f.99d148","type":"comment","z":"7b0fa635.67ef5","name":"1. Scheduling Process","info":"","x":125.11666870117188,"y":73.11666870117188,"wires":[]},{"id":"263a31b6.930756","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_request","method":"put","upload":false,"swaggerDoc":"","x":164.11666870117188,"y":142.11666870117188,"wires":[["6669f6db.483d","b7656f7e.47eaa"]]},{"id":"6669f6db.483d","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.11666870117188,"y":177.11666870117188,"wires":[]},{"id":"8bcbad15.6f18b","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var id = msg.payload.referenceID || 0; //id is an optional parameter\nvar serviceDescriptions = msg.payload.serviceDescriptions\nvar start = msg.payload.schedulingStart\nvar end = msg.payload.schedulingEnd\nvar expiration = msg.payload.expiration\n\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.11669921875,"y":143.11666107177734,"wires":[["93d90be7.333288"]]},{"id":"b97afd77.1f1fc","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_schedulingPlan","method":"put","upload":false,"swaggerDoc":"","x":173.11666870117188,"y":329.11663818359375,"wires":[["6703c2bf.318abc","1d3de801.a9daa"]]},{"id":"6703c2bf.318abc","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.41665649414062,"y":362.1166687011719,"wires":[]},{"id":"64ba4993.89a87","type":"comment","z":"7b0fa635.67ef5","name":"1.2 Sending the Scheduling Plans to the VPP (VPP <-- Node-RED)","info":"","x":263.1166687011719,"y":221.11663818359375,"wires":[]},{"id":"9afb9c24.47be2","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_schedulingPlanInfos","method":"put","upload":false,"swaggerDoc":"","x":184,"y":255.2166748046875,"wires":[["596579dd.a4621","90cc8d6.837fa7"]]},{"id":"596579dd.a4621","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":177.11666870117188,"y":287.2166748046875,"wires":[]},{"id":"6926c4e6.6beeac","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n// providing variables for the UI:\n//flow.set(\"schedulingPlanInfos\",schedulingPlanInfos);\n//global.set(\"schedulingPlanInfos\",schedulingPlanInfos);\n///var schedulingPlanInfos = flow.get(\"schedulingPlanInfos\");\n//global.get(\"arrayString\").push(schedulingPlanInfos);\n\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":255.2166748046875,"wires":[["40217cd9.f4f25c"]]},{"id":"1d3de801.a9daa","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = flow.get('schedulingPlanInfos');\n//use filename if you want to save the file in a local folder (save to folder node)\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":624.9500732421875,"y":328.8166198730469,"wires":[[]]},{"id":"1eb27538.8fd263","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1078.2999877929688,"y":254.11666870117188,"wires":[[]]},{"id":"a8c8de28.e92298","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1067.2999877929688,"y":218.11666870117188,"wires":[]},{"id":"b93374a1.44b6d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.5667114257812,"y":329.1166687011719,"wires":[[]]},{"id":"5bc8f24a.c8071c","type":"comment","z":"7b0fa635.67ef5","name":"1.3 Accepting or Rejecting the Proposals (VPP --> Node-RED)","info":"","x":238.11666870117188,"y":473.11663818359375,"wires":[]},{"id":"84d76edd.8b01a","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_accept-proposal","method":"put","upload":false,"swaggerDoc":"","x":186.11666870117188,"y":507.21661376953125,"wires":[["70d6390a.c9915","260fa31f.9b694c"]]},{"id":"40a19a7.cbd8b64","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_reject-proposal","method":"put","upload":false,"swaggerDoc":"","x":186.11666870117188,"y":580.2166137695312,"wires":[["9b8a2c67.c398a8","7ae1d2c0.d88814"]]},{"id":"dfc6ced.16699b","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\nvar start = msg.payload.schedulingStart;\nvar end = msg.payload.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.1166381835938,"y":506.21661376953125,"wires":[["c7d830c5.e26b5"]]},{"id":"79d6989b.6a14f","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.1166687011719,"y":580.2166137695312,"wires":[["95950400.6683d"]]},{"id":"c6836fee.9343a8","type":"comment","z":"7b0fa635.67ef5","name":"1.4 Receiving Inform or Failure of TU (VPP <-- Node-RED)","info":"","x":228.11666870117188,"y":655.416748046875,"wires":[]},{"id":"89847d8.fd27c8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_failure","method":"put","upload":false,"swaggerDoc":"","x":137.11666870117188,"y":765.7166442871094,"wires":[["a26d953a.c69d4","7995e15c.5fec78"]]},{"id":"a26d953a.c69d4","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.41665649414062,"y":800.7166137695312,"wires":[]},{"id":"2a7b5b73.6f8b9c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_done","method":"put","upload":false,"swaggerDoc":"","x":129,"y":691.8167114257812,"wires":[["40cc27ff.3375d","f8dfe605.43a1d8"]]},{"id":"40cc27ff.3375d","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.11666870117188,"y":726.8167419433594,"wires":[]},{"id":"dc6fc640.e2eb68","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":691.8167419433594,"wires":[["cd761dcc.9ca9"]]},{"id":"c7d830c5.e26b5","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_accept-proposal Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_accept-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":1141,"y":504.99993896484375,"wires":[[]]},{"id":"95950400.6683d","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_reject-proposal Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_reject-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":1142,"y":579.9999389648438,"wires":[[]]},{"id":"2b3c2051.b748d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.7833251953125,"y":690.6166687011719,"wires":[[]]},{"id":"8fdfe174.ac4e58","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1079.0499267578125,"y":766.6166687011719,"wires":[[]]},{"id":"7364643d.31052c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.11669921875,"y":764.61669921875,"wires":[["3e3fd9bd.e7f1a6"]]},{"id":"752760e3.511c88","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_refuse","method":"put","upload":false,"swaggerDoc":"","x":142.85000610351562,"y":403.8500061035156,"wires":[["13af9462.45515c","a4ba88a2.2feec"]]},{"id":"13af9462.45515c","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":177.14999389648438,"y":438.85003662109375,"wires":[]},{"id":"316b4f43.5946a8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.683349609375,"y":403.54998779296875,"wires":[[]]},{"id":"865123ce.69afe8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.8499145507812,"y":402.8500061035156,"wires":[[]]},{"id":"d822ac63.b430e8","type":"comment","z":"7b0fa635.67ef5","name":"2.1 Sending out a new Setpoint to TU (VPP --> Node-RED)","info":"","x":233.11669921875,"y":901.916748046875,"wires":[]},{"id":"1e3a2347.f610fd","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newSetpoint","method":"put","upload":false,"swaggerDoc":"","x":163.11669921875,"y":940.0165405273438,"wires":[["9947715.a48e99","eda31a89.b4951","91cb935e.4dddf"]]},{"id":"eda31a89.b4951","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.1166076660156,"y":939.0166625976562,"wires":[[]]},{"id":"4b13d705.4dca3","type":"http request","z":"7b0fa635.67ef5","name":"control_newSetpoint Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newSetpoint","tls":"","persist":false,"proxy":"","authType":"basic","x":1126.0000305175781,"y":939.7999877929688,"wires":[[]]},{"id":"b5abb43c.0ee84","type":"comment","z":"7b0fa635.67ef5","name":"3.1 Requesting balancing (VPP --> Node-RED)","info":"","x":201.11671447753906,"y":1330.0166015625,"wires":[]},{"id":"8eaa7754.ddfe7","type":"http request","z":"7b0fa635.67ef5","name":"balancing_subscribe Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/balancing_subscribe","tls":"","persist":false,"proxy":"","authType":"basic","x":1128.4500885009766,"y":1366.8665771484375,"wires":[[]]},{"id":"89ee77c2.708c18","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var balancingTUName = msg.payload.balancingTUName;\nvar balancingUpdateRate = msg.payload.balancingUpdateRate;\nvar balancingStart = msg.payload.balancingStart;\nvar balancingEnd = msg.payload.balancingEnd;\nvar balancingReferenceID = msg.payload.balancingReferenceID;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":607.1167144775391,"y":1367.216552734375,"wires":[[]]},{"id":"8ea13f38.9cf77","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/balancing_subscribe","method":"put","upload":false,"swaggerDoc":"","x":172.11671447753906,"y":1367.216552734375,"wires":[["89ee77c2.708c18","ea219ae5.fee2b8","2e0ffecf.c10d12"]]},{"id":"3d8a33c1.6fd7ac","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/control_failure","method":"put","upload":false,"swaggerDoc":"","x":122.11666870117188,"y":1197.11669921875,"wires":[["f7c3d01c.268b8","791a0152.12eef8"]]},{"id":"f7c3d01c.268b8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":178.41665649414062,"y":1231.1168212890625,"wires":[]},{"id":"d9489e48.16b4","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1074.0499572753906,"y":1199.0167846679688,"wires":[[]]},{"id":"191fee6d.4393e2","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.1166687011719,"y":1198.0167846679688,"wires":[[]]},{"id":"76051960.573808","type":"comment","z":"7b0fa635.67ef5","name":"2.2 Receiving Failure message (if failed) (VPP <-- Node-RED)","info":"","x":241.00003051757812,"y":1162,"wires":[]},{"id":"cfa47ae8.1f7db8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_agree","method":"put","upload":false,"swaggerDoc":"","x":130.0000457763672,"y":1470,"wires":[["ac75addb.af8b6","20950556.1415ea"]]},{"id":"ac75addb.af8b6","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.300048828125,"y":1505,"wires":[]},{"id":"4ef05b9f.399b04","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1074.9333038330078,"y":1472.9000549316406,"wires":[[]]},{"id":"a664297.b3e5c58","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610.0000152587891,"y":1470.9000244140625,"wires":[[]]},{"id":"4ca490c8.1561d","type":"comment","z":"7b0fa635.67ef5","name":"3.1 VPP <-- Node-RED: receiving agree or refuse message","info":"","x":230.0000457763672,"y":1435,"wires":[]},{"id":"20295959.21889e","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_refuse","method":"put","upload":false,"swaggerDoc":"","x":131.0000457763672,"y":1540,"wires":[["ea7915aa.5d8b8","9cc309a6.f888c"]]},{"id":"ea7915aa.5d8b8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.300048828125,"y":1577,"wires":[]},{"id":"2b12ad8c.bad76a","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1075.933364868164,"y":1541.9000549316406,"wires":[[]]},{"id":"e805ebda.c14dd8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000152587891,"y":1541.9000244140625,"wires":[[]]},{"id":"970aecc6.1192f8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_failure","method":"put","upload":false,"swaggerDoc":"","x":128.0000457763672,"y":1723,"wires":[["86b8f800.d93","47915bc6.0a05d4"]]},{"id":"86b8f800.d93","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":170.30003356933594,"y":1759.0000305175781,"wires":[]},{"id":"4d5c70a0.f49a6","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1069.933364868164,"y":1718.89990234375,"wires":[[]]},{"id":"a5b69353.5ca578","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000762939453,"y":1722.9000244140625,"wires":[[]]},{"id":"c89d360.a68b4c8","type":"comment","z":"7b0fa635.67ef5","name":"3.2 VPP <-- Node-RED: receiving balancing data or failure message","info":"","x":257.0000457763672,"y":1616,"wires":[]},{"id":"e852285b.0a9b58","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_inform","method":"put","upload":false,"swaggerDoc":"","x":128.0000457763672,"y":1651,"wires":[["5aec6876.b400b","d7277b7a.9617e"]]},{"id":"5aec6876.b400b","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":170.30003356933594,"y":1687.0000305175781,"wires":[]},{"id":"80d062f8.8bbd9","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1069.933364868164,"y":1644.9000244140625,"wires":[[]]},{"id":"dd27c947.5c265","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.BalancingSequenceInform.tuName[0];\nvar agentName = msg.payload.BalancingSequenceInform.agentName[0];\nvar feedIn = msg.payload.BalancingSequenceInform.tudataSet[0].feedIn[0];\nvar operatingPoint = msg.payload.BalancingSequenceInform.tudataSet[0].operatingPoint[0];\nvar leadingOperatingPoint = msg.payload.BalancingSequenceInform.tudataSet[0].leadingOperatingPoint[0];\nvar currentValueFR = msg.payload.BalancingSequenceInform.tudataSet[0].currentValueFR[0];\nvar assignedPool = msg.payload.BalancingSequenceInform.tudataSet[0].assignedPool[0];\nvar status = msg.payload.BalancingSequenceInform.tudataSet[0].status[0];\nvar frequency = msg.payload.BalancingSequenceInform.tudataSet[0].frequency[0];\nvar aFRRsetpoint = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRsetpoint[0];\nvar aFRRsetpointEcho = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRsetpointEcho[0];\nvar setpointFR = msg.payload.BalancingSequenceInform.tudataSet[0].setpointFR[0];\nvar aFRRGradientPOS = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRGradientPOS[0];\nvar aFRRGradientNEG = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRGradientNEG[0];\nvar capacityPOS = msg.payload.BalancingSequenceInform.tudataSet[0].capacityPOS[0];\nvar capacityNEG = msg.payload.BalancingSequenceInform.tudataSet[0].capacityNEG[0];\nvar holdingCapacityPOS = msg.payload.BalancingSequenceInform.tudataSet[0].holdingCapacityPOS[0];\nvar holdingCapacityNEG = msg.payload.BalancingSequenceInform.tudataSet[0].holdingCapacityNEG[0];\nvar controlBandPOS = msg.payload.BalancingSequenceInform.tudataSet[0].controlBandPOS[0];\nvar controlBandNEG = msg.payload.BalancingSequenceInform.tudataSet[0].controlBandNEG[0];\n\npayload = \n{\n \"tuName\": tuName, \n \"agentName\" : agentName,\n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÜNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÜNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n//Needed for UI Tests:\n//global.set(\"arrayStringBalancing\",payload);\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000762939453,"y":1650.9000244140625,"wires":[["d7e193fb.e97838"]]},{"id":"791a0152.12eef8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":449.95001220703125,"y":1198.4666137695312,"wires":[["191fee6d.4393e2"]]},{"id":"20950556.1415ea","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":444.11671447753906,"y":1470.5167236328125,"wires":[["a664297.b3e5c58"]]},{"id":"9cc309a6.f888c","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":442.11671447753906,"y":1541.7166748046875,"wires":[["e805ebda.c14dd8"]]},{"id":"d7277b7a.9617e","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":443.11669921875,"y":1650.7166748046875,"wires":[["dd27c947.5c265"]]},{"id":"47915bc6.0a05d4","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":443.11669921875,"y":1722.7166748046875,"wires":[["a5b69353.5ca578"]]},{"id":"955d08cb.ebe59","type":"comment","z":"7b0fa635.67ef5","name":"2. TU Control Sequence","info":"","x":124.00003051757812,"y":869.7166748046875,"wires":[]},{"id":"f8ced7f2.876ed8","type":"comment","z":"7b0fa635.67ef5","name":"3. TU Balancing","info":"","x":101.00004577636719,"y":1298.300048828125,"wires":[]},{"id":"6f7e558c.3ed5d4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/accounting_energyConsumptionProfileReference","method":"put","upload":false,"swaggerDoc":"","x":230.85003662109375,"y":1977.64990234375,"wires":[["b5c11512.7832a","24bcedde.901022"]]},{"id":"b5c11512.7832a","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.1500244140625,"y":2012.6499328613281,"wires":[]},{"id":"d32af972.122d08","type":"comment","z":"7b0fa635.67ef5","name":"4.1 VPP <-- Node-RED: sending the energy consumption profiles to the VPP ","info":"","x":289.85003662109375,"y":1861.64990234375,"wires":[]},{"id":"674a876.c3cc6f8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/accounting_energyConsumptionProfile","method":"put","upload":false,"swaggerDoc":"","x":200.73336791992188,"y":1904.7499389648438,"wires":[["ec1a4d89.414b4","deb11ce8.5d735"]]},{"id":"ec1a4d89.414b4","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":174.85003662109375,"y":1940.75,"wires":[]},{"id":"91a3c6e6.afba58","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n//code for UI Test:\n//global.set(\"arrayStringAccounting\",msg.payload);\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":718.4214401245117,"y":1976.7499885559082,"wires":[["4dfb481c.c9f398"]]},{"id":"deb11ce8.5d735","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = flow.get('energyConsumptionProfile');\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":719.6832275390625,"y":1904.349609375,"wires":[[]]},{"id":"9cee7dfa.9adaa8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1172.0333251953125,"y":1902.64990234375,"wires":[[]]},{"id":"df50ecce.f12f08","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1171.2999267578125,"y":1973.64990234375,"wires":[[]]},{"id":"99b82672.989498","type":"comment","z":"7b0fa635.67ef5","name":"4. Accounting","info":"","x":90.85003662109375,"y":1827.449951171875,"wires":[]},{"id":"24bcedde.901022","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":550.8499755859375,"y":1977.050048828125,"wires":[["91a3c6e6.afba58"]]},{"id":"a5c124b5.33e078","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.85009765625,"y":2076.8502197265625,"wires":[["c9286592.2b2a4"]]},{"id":"c9286592.2b2a4","type":"http request","z":"7b0fa635.67ef5","name":"accounting_ECPReceived Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/accounting_ECPReceived","tls":"","persist":false,"proxy":"","authType":"basic","x":1149.550048828125,"y":2079.8499755859375,"wires":[[]]},{"id":"cb798789.4f5418","type":"comment","z":"7b0fa635.67ef5","name":"4.2 Confirming the ECP has been received (VPP --> Node-RED)","info":"","x":252.85000610351562,"y":2047.4500732421875,"wires":[]},{"id":"4f37ff3d.8db8c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/accounting_ECPReceived","method":"put","upload":false,"swaggerDoc":"","x":184,"y":2082.0501708984375,"wires":[["35f8281d.faff2","9395992a.39d0e8"]]},{"id":"6306d75c.a18c","type":"comment","z":"7b0fa635.67ef5","name":"5. (A) LoadTimeWindowsShare-Process via direct request","info":"","x":238.00003051757812,"y":2183,"wires":[]},{"id":"cc4d3e1a.b345c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/loadTimeWindows_inform","method":"put","upload":false,"swaggerDoc":"","x":186.00003051757812,"y":2357.0001220703125,"wires":[["1b94c58a.f73582","78732cad.49bf54"]]},{"id":"1b94c58a.f73582","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.00003051757812,"y":2393,"wires":[]},{"id":"78732cad.49bf54","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.loadTimeWindowsReference;\nvar windowHighBegin = msg.payload.windowHighBegin;\nvar windowHighEnd = msg.payload.windowHighEnd;\nvar windowLowBegin = msg.payload.windowLowBegin;\nvar windowLowEnd = msg.payload.windowLowEnd;\n\npayload = \n{\n \"loadTimeWindowsReference\": loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" :windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.6334838867188,"y":2356.30029296875,"wires":[["86fd511a.b8fda"]]},{"id":"86fd511a.b8fda","type":"http request","z":"7b0fa635.67ef5","name":"loadTimeWindows_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_inform","tls":"","persist":false,"proxy":"","authType":"","x":1154.633544921875,"y":2356.3004150390625,"wires":[[]]},{"id":"a8117b63.6a188","type":"comment","z":"7b0fa635.67ef5","name":"5.2 Requesting the VPP to share the LoadTimeWindows (Node-RED <-- VPP)","info":"","x":296.0000305175781,"y":2322,"wires":[]},{"id":"2318e0df.817d9","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n","x":458.00006103515625,"y":2389.10009765625,"wires":[]},{"id":"7803cad9.a821dc","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"payload = {\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.6334228515625,"y":2469.400390625,"wires":[["86fd511a.b8fda"]]},{"id":"34042585.8fcd3a","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":159.00003051757812,"y":2437.2001953125,"wires":[]},{"id":"f2935e79.b2095","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":215.00003051757812,"y":2471,"wires":[["7803cad9.a821dc"]]},{"id":"fa84c689.a05538","type":"comment","z":"7b0fa635.67ef5","name":"5.1 Receiving the LoadTimeWindows (VPP <-- Node-RED)","info":"","x":238,"y":2217.033203125,"wires":[]},{"id":"16e4330f.07cf35","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/loadTimeWindows_request","method":"put","upload":false,"swaggerDoc":"","x":167,"y":2253.1331787109375,"wires":[["d5253f40.a9b318","2fa571b6.1e4c56"]]},{"id":"d5253f40.a9b318","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":183,"y":2286.13330078125,"wires":[]},{"id":"2417057e.0beb4a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\n//var windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\n//var windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\n//var windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\n//var windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\nmsg.payload = {\n \"loadTimeWindowsReference\" : loadTimeWindowsReference,\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.8333740234375,"y":2255.8330078125,"wires":[[]]},{"id":"2fa571b6.1e4c56","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":459.8333740234375,"y":2253.083251953125,"wires":[["2417057e.0beb4a"]]},{"id":"ce44d654.b99c38","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1094.449951171875,"y":2249.2333984375,"wires":[[]]},{"id":"e3122478.73e4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n\"loadTimeWindowsReference\" : \"tariff22\" \n}","x":862.0166015625,"y":2251.2333984375,"wires":[]},{"id":"ccd7c37f.08a3b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/loadTimeWindows_broadcast","method":"put","upload":false,"swaggerDoc":"","x":199.00003051757812,"y":2578,"wires":[["b616ed4e.7387c8","2fa948eb.967e88"]]},{"id":"b616ed4e.7387c8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.00003051757812,"y":2614,"wires":[]},{"id":"ab393d18.32128","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\nvar windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\nvar windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\nvar windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\nvar windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\n\nmsg.payload = \n{\n \"loadTimeWindowsReference\": loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" :windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.6334228515625,"y":2578.30029296875,"wires":[["5e353c9b.dc1aa4"]]},{"id":"5e353c9b.dc1aa4","type":"http request","z":"7b0fa635.67ef5","name":"loadTimeWindows_broadcast Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_broadcast","tls":"","persist":false,"proxy":"","authType":"","x":1173.633544921875,"y":2577.30029296875,"wires":[[]]},{"id":"310fc528.3cb4ba","type":"comment","z":"7b0fa635.67ef5","name":"5.3 Broadcasting new LoadTimeWindows to everyone","info":"","x":228.00003051757812,"y":2542,"wires":[]},{"id":"66aacc19.37c1fc","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n","x":466.00006103515625,"y":2644.10009765625,"wires":[]},{"id":"a7d1eb4f.93483","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":161.00003051757812,"y":2658.7998046875,"wires":[]},{"id":"1d48cb30.f62b35","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":214.00003051757812,"y":2693.599609375,"wires":[["cbf0562.376d728"]]},{"id":"cbf0562.376d728","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"\npayload = {\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n\nmsg.payload = payload;\n// payload = {\"schedulingPlanUploaded\" : true}\n//msg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625,"y":2692,"wires":[["5e353c9b.dc1aa4"]]},{"id":"90cc8d6.837fa7","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.1166687011719,"y":255.11666870117188,"wires":[["6926c4e6.6beeac"]]},{"id":"f8dfe605.43a1d8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":454.1166687011719,"y":691.7166442871094,"wires":[["dc6fc640.e2eb68"]]},{"id":"f4c97494.1eb95","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** SCHEDULING ********************************************","info":"","x":335.1166687011719,"y":40.116668701171875,"wires":[]},{"id":"f6c4085c.daa378","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1117.1166687011719,"y":105.11666870117188,"wires":[]},{"id":"30d600ce.7d3488","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\",\n tuName: \"TUEmden0\"me :\"TUEmden0\"\n}","x":860.11669921875,"y":257.1166687011719,"wires":[]},{"id":"71f1dc5f.e63474","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n//the payload can be any form of XML the VPP needs for the planning of the TU\n//shown in String:\n\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","x":861.5,"y":330.2166748046875,"wires":[]},{"id":"f82b4e6a.fbb53","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\", \n tuName: \"noNameSet\" \n}","x":860.9833374023438,"y":405.2166748046875,"wires":[]},{"id":"70d6390a.c9915","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.11666870117188,"y":542.3166198730469,"wires":[]},{"id":"9b8a2c67.c398a8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.11666870117188,"y":617.3166198730469,"wires":[]},{"id":"884b52c2.6c38","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1110.683349609375,"y":478.31658935546875,"wires":[]},{"id":"e5128683.afd308","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1066.1500244140625,"y":654.6166687011719,"wires":[]},{"id":"32bf6866.c4a3d8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany0, RequestMRL041221\", \n tuName: \"TUEmden0\" \n}","x":855.11669921875,"y":690.5166320800781,"wires":[]},{"id":"1393cb24.6ed505","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\",\n tuName: \"TUEmden0\"\n}","x":855.11669921875,"y":767.5166320800781,"wires":[]},{"id":"7995e15c.5fec78","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":453.8500061035156,"y":764.0499572753906,"wires":[["7364643d.31052c"]]},{"id":"a4ba88a2.2feec","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.8500061035156,"y":403.8500061035156,"wires":[["316b4f43.5946a8"]]},{"id":"744ba7c7.f971d8","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** TU CONTROL********************************************","info":"","x":333.85003662109375,"y":836.449951171875,"wires":[]},{"id":"290e417.5fbacbe","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1115.8500061035156,"y":903.050048828125,"wires":[]},{"id":"81b26319.06a4d8","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1063.8500061035156,"y":1162.050048828125,"wires":[]},{"id":"5fa7843f.3791b4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TU-EMDEN-CompanyXY-ProcessZ\"\n}","x":847.8499755859375,"y":1198.449951171875,"wires":[]},{"id":"aef6a421.62cca","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** TU BALANCING********************************************","info":"","x":348.8500518798828,"y":1265.25,"wires":[]},{"id":"e78d2cfa.a3cc48","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** ACCOUNTING********************************************","info":"","x":335.85003662109375,"y":1794.64990234375,"wires":[]},{"id":"be2e3380.7b29b","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** LOADTIMEWINDOWS-SHARE********************************************","info":"","x":390.85003662109375,"y":2147.449951171875,"wires":[]},{"id":"3ca33c8.d275fc4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newLoadProfile","method":"put","upload":false,"swaggerDoc":"","x":174.00003051757812,"y":1014,"wires":[["9fc17a13.197448","751aa5cc.975834"]]},{"id":"9fc17a13.197448","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.30001831054688,"y":1048,"wires":[]},{"id":"751aa5cc.975834","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":619.9334106445312,"y":1014.2999877929688,"wires":[["df2e2dca.4fd7f8"]]},{"id":"df2e2dca.4fd7f8","type":"http request","z":"7b0fa635.67ef5","name":"control_newLoadProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfile","tls":"","persist":false,"proxy":"","authType":"","x":1132.9333801269531,"y":1015.300048828125,"wires":[[]]},{"id":"c42d76ba.38d74","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newLoadProfileUploaded","method":"put","upload":false,"swaggerDoc":"","x":202.00003051757812,"y":1085.0999908447266,"wires":[["883818ec.815dd8","774c3cf3.b19f24","e02adc48.0aa598"]]},{"id":"883818ec.815dd8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":182.00003051757812,"y":1121.0999755859375,"wires":[]},{"id":"774c3cf3.b19f24","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.6334838867188,"y":1084.4000244140625,"wires":[[]]},{"id":"5ac310c4.37c028","type":"http request","z":"7b0fa635.67ef5","name":"control_newLoadProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1163.6334533691406,"y":1084.4000244140625,"wires":[[]]},{"id":"9947715.a48e99","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":181.85003662109375,"y":972.6500244140625,"wires":[]},{"id":"bc5e69ee.a039d","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1118.116683959961,"y":1333.5167541503906,"wires":[]},{"id":"b6852e5b.8ef9d8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":839.0000152587891,"y":1470,"wires":[]},{"id":"bb839fc9.df20b","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":842.0000152587891,"y":1545,"wires":[]},{"id":"b16096c5.f5f1c","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1065.000015258789,"y":1439,"wires":[]},{"id":"83f9a20e.e10d1","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1061.000015258789,"y":1612,"wires":[]},{"id":"21bc13db.66e90c","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\",\n agentName: \"AgentTUEmdenCompany0\",\n feedIn: \"0\",\n operatingPoint: \"0\",\n leadingOperatingPoint: \"0\",\n currentValueFR: \"0\",\n assignedPool: \"0\",\n status: \"0\",\n frequency: \"0\",\n aFRRsetpoint: \"0\",\n aFRRsetpointEcho: \"0\",\n setpointFR: \"0\",\n aFRRGradientPOS: \"0\",\n aFRRGradientNEG: \"0\",\n capacityPOS: \"0\",\n capacityNEG: \"0\",\n holdingCapacityPOS: \"0\",\n holdingCapacityNEG: \"0\",\n controlBandPOS: \"0\",\n controlBandNEG: \"0\"\n}","x":838.0000152587891,"y":1650,"wires":[]},{"id":"baf539b5.92c29","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":841.0000152587891,"y":1721,"wires":[]},{"id":"e1f777ff.26e368","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":955,"y":1904,"wires":[]},{"id":"5fa05d4b.ac739c","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany1\"\n}","x":955,"y":1974,"wires":[]},{"id":"da274a4e.455ba8","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1131,"y":2044.9998779296875,"wires":[]},{"id":"bcdb708d.0ff79","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1163,"y":1863,"wires":[]},{"id":"249d9f32.672f1","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1082.8499450683594,"y":2215.64990234375,"wires":[]},{"id":"6577eca6.5b9f7c","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1133.8499755859375,"y":2317.85009765625,"wires":[]},{"id":"595c6301.1677a4","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1133.8499755859375,"y":2539.050048828125,"wires":[]},{"id":"9136a9fc.811a88","type":"comment","z":"7b0fa635.67ef5","name":"5. (B) LoadTimeWindowsShare-Process via Broadcast","info":"","x":227.85000610351562,"y":2509.64990234375,"wires":[]},{"id":"af3b68c1.5f3188","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/ams_agentBorn","method":"put","upload":false,"swaggerDoc":"","x":128.00006103515625,"y":4948.999755859375,"wires":[["44fcb56e.c4f32c","56dbcc04.daf3a4"]]},{"id":"44fcb56e.c4f32c","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.300048828125,"y":4983.999755859375,"wires":[]},{"id":"3bf9a243.4ec776","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/ams_agentDead","method":"put","upload":false,"swaggerDoc":"","x":131.88339233398438,"y":4876.099792480469,"wires":[["73401e22.77f56","79d99ed1.9c083"]]},{"id":"73401e22.77f56","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":176.00006103515625,"y":4912.099853515625,"wires":[]},{"id":"56dbcc04.daf3a4","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload;\n\n\nmsg.payload = {\n \"agentName\" : agentName\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622,"y":4948.099609375,"wires":[[]]},{"id":"9c3f5c88.7ba6d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.183349609375,"y":4877.999755859375,"wires":[[]]},{"id":"f18b5b1.c24fda8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1104.449951171875,"y":4946.999755859375,"wires":[[]]},{"id":"6b45ed15.a0c68c","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** PLATFORM INTERACTION ********************************************","info":"","x":368.00006103515625,"y":4841.999755859375,"wires":[]},{"id":"944b4993.56459","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1094.1500244140625,"y":4838.349853515625,"wires":[]},{"id":"79d99ed1.9c083","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload;\n\n\nmsg.payload = {\n \"agentName\" : agentName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.0000610351562,"y":4876.332763671875,"wires":[[]]},{"id":"4083bb5a.a2e824","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName : \"TUEmdenCompany0@192.168.178.29:1099/JADE\"\n}","x":886.0000610351562,"y":4880.332763671875,"wires":[]},{"id":"899f5199.edf59","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName : \"TUEmdenCompany0@192.168.178.29:1099/JADE\"\n}","x":887,"y":4947.332763671875,"wires":[]},{"id":"78a4d703.7ac96","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** SOL/SNL Specific Actions ****************************************","info":"","x":365.85003662109375,"y":2732.666748046875,"wires":[]},{"id":"6e63440c.80f084","type":"comment","z":"7b0fa635.67ef5","name":"6 Enable Frequency Relay","info":"","x":136.00003051757812,"y":2766.9334716796875,"wires":[]},{"id":"7a05001e.7ae57","type":"comment","z":"7b0fa635.67ef5","name":"6.1 Sending out a enable (VPP --> Node-RED)","info":"","x":196.11669921875,"y":2799.133544921875,"wires":[]},{"id":"4f5baa87.87b47c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_enable","method":"put","upload":false,"swaggerDoc":"","x":165.6667022705078,"y":2834.7665405273438,"wires":[["95544204.fb8228","f6d67de4.625868"]]},{"id":"e77e335e.80dd7","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.6666107177734,"y":2833.7666625976562,"wires":[["42326bd2.9c9cbc"]]},{"id":"42326bd2.9c9cbc","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_enable Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_enable","tls":"","persist":false,"proxy":"","authType":"basic","x":1128.550033569336,"y":2832.5499877929688,"wires":[[]]},{"id":"1296cf80.01fc19","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1128.4000396728516,"y":2800.800048828125,"wires":[]},{"id":"95544204.fb8228","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":185.4000244140625,"y":2870.39990234375,"wires":[]},{"id":"c0d73163.1b41b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_enableInform","method":"put","upload":false,"swaggerDoc":"","x":163.66668701171875,"y":3016.666748046875,"wires":[["723607cf.c0378","88745c93.d7579"]]},{"id":"723607cf.c0378","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":185.9666748046875,"y":3052.666778564453,"wires":[]},{"id":"e37305cc.be4d6","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1092.6000061035156,"y":3013.566650390625,"wires":[[]]},{"id":"56377bd6.c9661c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":619.6667175292969,"y":3016.5667724609375,"wires":[["eee9a163.5033f"]]},{"id":"93beaf79.d9a6f8","type":"comment","z":"7b0fa635.67ef5","name":"6.2 VPP <-- Node-RED: receiving inform or failure message","info":"","x":234.66668701171875,"y":2913.666748046875,"wires":[]},{"id":"2889cab3.5a210e","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_enableFailure","method":"put","upload":false,"swaggerDoc":"","x":163.66668701171875,"y":2948.666748046875,"wires":[["293e9824.2c7b38","ab516f10.e2ff2"]]},{"id":"293e9824.2c7b38","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":184.9666748046875,"y":2983.666778564453,"wires":[]},{"id":"36f13523.9e778a","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1093.6000061035156,"y":2948.5667724609375,"wires":[[]]},{"id":"55e19663.d0a4b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.6667022705078,"y":2950.56689453125,"wires":[[]]},{"id":"ab516f10.e2ff2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":455.7833557128906,"y":2950.3834228515625,"wires":[["55e19663.d0a4b8"]]},{"id":"88745c93.d7579","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":454.7833557128906,"y":3016.3834228515625,"wires":[["56377bd6.c9661c"]]},{"id":"64947add.24e6cc","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1082.6666564941406,"y":2914.666748046875,"wires":[]},{"id":"7170556a.39d5f4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":854.6666564941406,"y":2949.666748046875,"wires":[]},{"id":"a0703054.3e615","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":857.6666564941406,"y":3015.666748046875,"wires":[]},{"id":"92f6aa2f.0ab7d8","type":"comment","z":"7b0fa635.67ef5","name":"7 Disable Frequency Relay","info":"","x":132.6666717529297,"y":3165,"wires":[]},{"id":"93ceb3bf.84a8a8","type":"comment","z":"7b0fa635.67ef5","name":"7.1 Sending out a block (VPP --> Node-RED)","info":"","x":192.78334045410156,"y":3197.2000732421875,"wires":[]},{"id":"1818fccc.1ee26b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_block","method":"put","upload":false,"swaggerDoc":"","x":153.33334350585938,"y":3238.8330688476562,"wires":[["aba214be.89c8f8","94cef519.97372"]]},{"id":"e45695de.fec6e","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName \n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.333251953125,"y":3236.833251953125,"wires":[["1e2023e1.d79304"]]},{"id":"1e2023e1.d79304","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_block Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_block","tls":"","persist":false,"proxy":"","authType":"basic","x":1127.2166748046875,"y":3238.6165161132812,"wires":[[]]},{"id":"df02ea30.a2d72","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1136.066650390625,"y":3201.86669921875,"wires":[]},{"id":"aba214be.89c8f8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":182.06668090820312,"y":3273.466552734375,"wires":[]},{"id":"d2eaa357.46a8d8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_blockInform","method":"put","upload":false,"swaggerDoc":"","x":155.3333282470703,"y":3419.7333984375,"wires":[["83d97141.99723","38ea8d15.11fc02"]]},{"id":"83d97141.99723","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.63331604003906,"y":3455.7333068847656,"wires":[]},{"id":"5a50e889.de309","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1105.2666473388672,"y":3416.6331787109375,"wires":[[]]},{"id":"4dd33ee6.15d84","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.3333740234375,"y":3420.63330078125,"wires":[[]]},{"id":"f41cd723.6b3dc8","type":"comment","z":"7b0fa635.67ef5","name":"7.2 VPP <-- Node-RED: receiving inform or failure message","info":"","x":235.33331298828125,"y":3309.7333984375,"wires":[]},{"id":"35524bd0.0abffc","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_blockFailure","method":"put","upload":false,"swaggerDoc":"","x":156.3333282470703,"y":3346.7332763671875,"wires":[["aff9f121.472e78","3ce4ae57.fb27d2"]]},{"id":"aff9f121.472e78","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":178.63331604003906,"y":3382.7333068847656,"wires":[]},{"id":"52e937d1.43551","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.2666473388672,"y":3346.63330078125,"wires":[[]]},{"id":"d72acb58.fab4b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.3333740234375,"y":3346.63330078125,"wires":[[]]},{"id":"3ce4ae57.fb27d2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.45001220703125,"y":3347.449951171875,"wires":[["d72acb58.fab4b8"]]},{"id":"38ea8d15.11fc02","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.45001220703125,"y":3421.449951171875,"wires":[["4dd33ee6.15d84"]]},{"id":"48785394.616ecc","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1092.3332977294922,"y":3314.7332763671875,"wires":[]},{"id":"d44a10b9.1c33f8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":855.3332977294922,"y":3348.7332763671875,"wires":[]},{"id":"71e65eb1.558378","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":859.3332977294922,"y":3419.7332763671875,"wires":[]},{"id":"284c029d.54b0de","type":"comment","z":"7b0fa635.67ef5","name":"Receiving status (frequency relay has been triggered) message of frequency relay (VPP <-- Node-RED)","info":"","x":371.6666717529297,"y":3594,"wires":[]},{"id":"c4c6630c.4c84b8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_triggered","method":"put","upload":false,"swaggerDoc":"","x":144.6666717529297,"y":3636,"wires":[["cf71f945.763ba8","54c46f77.d4f258"]]},{"id":"cf71f945.763ba8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":176.96665954589844,"y":3672.000030517578,"wires":[]},{"id":"a18bfe9f.9ca51","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1113.5999908447266,"y":3632.9000244140625,"wires":[[]]},{"id":"20327dc0.4986ea","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.6667022705078,"y":3638.9000244140625,"wires":[[]]},{"id":"54c46f77.d4f258","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":464.7833251953125,"y":3638.716796875,"wires":[["20327dc0.4986ea"]]},{"id":"e4a4428.4f2944","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1103.6666259765625,"y":3598,"wires":[]},{"id":"310936d1.c4ce4a","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":898.6666412353516,"y":3638,"wires":[]},{"id":"aca7fd28.9f71d8","type":"comment","z":"7b0fa635.67ef5","name":"8 Frequency Relay Status","info":"","x":132.6666717529297,"y":3562,"wires":[]},{"id":"b3411deb.446a3","type":"comment","z":"7b0fa635.67ef5","name":"8.1 Sending out a confirm (VPP --> Node-RED)","info":"","x":202.6666717529297,"y":3706,"wires":[]},{"id":"a46c7074.46e768","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_confirm","method":"put","upload":false,"swaggerDoc":"","x":163.2166748046875,"y":3739.6329956054688,"wires":[["baf3a9e3.a7275","7cbf373d.7b5318"]]},{"id":"baf3a9e3.a7275","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.2165832519531,"y":3740.6331176757812,"wires":[["72490ce2.373bfc"]]},{"id":"72490ce2.373bfc","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_confirm","tls":"","persist":false,"proxy":"","authType":"basic","x":1152.0999755859375,"y":3739.41650390625,"wires":[[]]},{"id":"c8f076e5.44d15","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1152.949951171875,"y":3699.66650390625,"wires":[]},{"id":"7cbf373d.7b5318","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":183.95001220703125,"y":3776.2666015625,"wires":[]},{"id":"f7efb8f6.caf74","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject an Enable***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":157.5499725341797,"y":3126.650146484375,"wires":[["a2591b2b.10ab48"]]},{"id":"a2591b2b.10ab48","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.5499877929688,"y":3125.650146484375,"wires":[["be5fd782.9d624"]]},{"id":"be5fd782.9d624","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_enable Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_enable","tls":"","persist":false,"proxy":"","authType":"basic","x":1133.6666259765625,"y":3124.666748046875,"wires":[[]]},{"id":"adc0e68e.0aea9","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Disable***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156.5499725341797,"y":3527.9833984375,"wires":[["d519a76.89906d8"]]},{"id":"d519a76.89906d8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.5499877929688,"y":3525.9833984375,"wires":[["485c3f9c.003658"]]},{"id":"485c3f9c.003658","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_block Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_block","tls":"","persist":false,"proxy":"","authType":"basic","x":1133.6666259765625,"y":3527,"wires":[[]]},{"id":"16fa85eb.ccbd72","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156.5499725341797,"y":3846.9833984375,"wires":[["315036ad.7555a2"]]},{"id":"315036ad.7555a2","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.5499877929688,"y":3843.9833984375,"wires":[["ecb04700.5c4358"]]},{"id":"ecb04700.5c4358","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_confirm","tls":"","persist":false,"proxy":"","authType":"basic","x":1154.6666259765625,"y":3845,"wires":[[]]},{"id":"ab3c26e5.58647","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":150.6666717529297,"y":3093,"wires":[]},{"id":"7d49616.f2ae5a","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":152.6666717529297,"y":3493,"wires":[]},{"id":"d946bc35.bce1c","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":152.6666717529297,"y":3814,"wires":[]},{"id":"91cb935e.4dddf","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":450.6166687011719,"y":969.1998901367188,"wires":[["3d2473f1.56f8d4"]]},{"id":"3d2473f1.56f8d4","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadNewSetpoint.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":667.8499755859375,"y":969.449951171875,"wires":[["4b13d705.4dca3"]]},{"id":"876022fe.30795","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var id = msg.payload.InterfacePayloadPlanning.referenceID || 0; //id is an optional parameter\nvar serviceDescriptions = msg.payload.InterfacePayloadPlanning.serviceDescriptions;\nvar start = msg.payload.InterfacePayloadPlanning.schedulingStart;\nvar end = msg.payload.InterfacePayloadPlanning.schedulingEnd;\nvar expiration = msg.payload.InterfacePayloadPlanning.expiration;\n\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":673.8499755859375,"y":175.85000610351562,"wires":[["93d90be7.333288"]]},{"id":"b7656f7e.47eaa","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":444.61669921875,"y":176.80001831054688,"wires":[["876022fe.30795"]]},{"id":"b0d0b8cb.8966a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var balancingTUName = msg.payload.InterfacePayloadBalancing.balancingTUName;\nvar balancingUpdateRate = msg.payload.InterfacePayloadBalancing.balancingUpdateRate;\nvar balancingStart = msg.payload.InterfacePayloadBalancing.balancingStart;\nvar balancingEnd = msg.payload.InterfacePayloadBalancing.balancingEnd;\nvar balancingReferenceID = msg.payload.InterfacePayloadBalancing.balancingReferenceID;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":656.8499755859375,"y":1401.25,"wires":[["8eaa7754.ddfe7"]]},{"id":"ea219ae5.fee2b8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":441.61669921875,"y":1400.800048828125,"wires":[["b0d0b8cb.8966a"]]},{"id":"f6d67de4.625868","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":458.61669921875,"y":2870.199951171875,"wires":[["48f6c6c1.d178b8"]]},{"id":"48f6c6c1.d178b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.8499755859375,"y":2870.64990234375,"wires":[["42326bd2.9c9cbc"]]},{"id":"94cef519.97372","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":446.8499755859375,"y":3270.050048828125,"wires":[["4fa628f6.31a99"]]},{"id":"4fa628f6.31a99","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":613.0833129882812,"y":3269.5,"wires":[["1e2023e1.d79304"]]},{"id":"40217cd9.f4f25c","type":"http request","z":"7b0fa635.67ef5","name":"***Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_schedulingPlanInfos","tls":"","persist":false,"proxy":"","authType":"basic","x":1096.8499755859375,"y":288.8500061035156,"wires":[[]]},{"id":"843c0b65.fb9f38","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var schedulingPlanReference = msg.payload.InterfacePayloadAcceptReject.schedulingPlanReference;\nvar start = msg.payload.InterfacePayloadAcceptReject.schedulingStart;\nvar end = msg.payload.InterfacePayloadAcceptReject.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672.8499755859375,"y":539.8499450683594,"wires":[["c7d830c5.e26b5"]]},{"id":"260fa31f.9b694c","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.8499755859375,"y":539.8499450683594,"wires":[["843c0b65.fb9f38"]]},{"id":"7ae1d2c0.d88814","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":453,"y":617.9999694824219,"wires":[["bbdc19af.9137c8"]]},{"id":"bbdc19af.9137c8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var schedulingPlanReference = msg.payload.InterfacePayloadAcceptReject.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672,"y":617.9999694824219,"wires":[["95950400.6683d"]]},{"id":"cd761dcc.9ca9","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_done","tls":"","persist":false,"proxy":"","authType":"basic","x":1105,"y":727,"wires":[[]]},{"id":"3e3fd9bd.e7f1a6","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_failure","tls":"","persist":false,"proxy":"","authType":"basic","x":1106,"y":804,"wires":[[]]},{"id":"4dfb481c.c9f398","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/accounting_energyConsumptionProfileReference","tls":"","persist":false,"proxy":"","authType":"basic","x":1201,"y":2006,"wires":[[]]},{"id":"a6dc3532.1dbe8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":675,"y":2111.0001220703125,"wires":[["c9286592.2b2a4"]]},{"id":"35f8281d.faff2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":459.5,"y":2111.0001220703125,"wires":[["a6dc3532.1dbe8"]]},{"id":"d7e193fb.e97838","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/balancing_inform","tls":"","persist":false,"proxy":"","authType":"basic","x":1099.8499755859375,"y":1683.25,"wires":[[]]},{"id":"2e0ffecf.c10d12","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.85000610351562,"y":1401.050048828125,"wires":[]},{"id":"96c2fe94.ae4718","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":632.1499633789062,"y":4067.99951171875,"wires":[["dc4eee7e.3b4918"]]},{"id":"dc4eee7e.3b4918","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_confirm","tls":"","persist":false,"proxy":"","authType":"","x":1178.1500701904297,"y":4065.9996795654297,"wires":[[]]},{"id":"33943318.c6bb84","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":192.1499786376953,"y":4069.199462890625,"wires":[["97686248.818948","96c2fe94.ae4718"]]},{"id":"97686248.818948","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":191.449951171875,"y":4105.19970703125,"wires":[]},{"id":"c882b9f2.d08bc8","type":"comment","z":"7b0fa635.67ef5","name":"9.1 Receiving Cancel for a specific operation from the a TU Agent (VPP <-- Node-RED","info":"","x":327.41668701171875,"y":3918.5162963867188,"wires":[]},{"id":"4e15f456.b6abbc","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface ","info":"","x":1119.300048828125,"y":4031.94970703125,"wires":[]},{"id":"6cfc3a12.59fa14","type":"comment","z":"7b0fa635.67ef5","name":"9.2 Sending confirmation or failure of the operation cancel fto the Agent (VPP --> Node-RED)","info":"","x":352.0000457763672,"y":4030.999755859375,"wires":[]},{"id":"fa66d7ef.52b85","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":159.00003051757812,"y":3954.099853515625,"wires":[["9621885c.2b8fd","cb4b24d4.f26328"]]},{"id":"9621885c.2b8fd","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":189.00003051757812,"y":3991.099609375,"wires":[]},{"id":"828f9146.4055b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":631.8334350585938,"y":3956.7998046875,"wires":[[]]},{"id":"cb4b24d4.f26328","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":467.8333740234375,"y":3956.0498046875,"wires":[["828f9146.4055b8"]]},{"id":"e91f8f9f.389e4","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1120.449951171875,"y":3957.2001953125,"wires":[[]]},{"id":"ba51565a.3f2b2","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":901.0166625976562,"y":3958.2001953125,"wires":[]},{"id":"3d673ddb.39d542","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** CANCEL OPERATIONS ********************************************","info":"","x":369.0000305175781,"y":3883.849365234375,"wires":[]},{"id":"b416239b.85e8f","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":175,"y":4144.3330078125,"wires":[["ff7ef975.49eb7"]]},{"id":"ff7ef975.49eb7","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635,"y":4142.3330078125,"wires":[["dc4eee7e.3b4918"]]},{"id":"f29bec6a.072428","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1112,"y":3924,"wires":[]},{"id":"2fa948eb.967e88","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":457,"y":2578,"wires":[["ab393d18.32128"]]},{"id":"eee9a163.5033f","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/freqRelay_enableInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1124,"y":3046,"wires":[[]]},{"id":"6b21aaab.122004","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":596.1499633789062,"y":4331.549865722656,"wires":[["7818ca27.11d844"]]},{"id":"7818ca27.11d844","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_inform","tls":"","persist":false,"proxy":"","authType":"","x":1169.1500854492188,"y":4328.549911499023,"wires":[[]]},{"id":"63a8858c.e815ac","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":185.14999389648438,"y":4331.749694824219,"wires":[["1eb5ad0b.ca6753","6b21aaab.122004"]]},{"id":"1eb5ad0b.ca6753","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":246.44998168945312,"y":4366.749740600586,"wires":[]},{"id":"f769df0d.b6d478","type":"comment","z":"7b0fa635.67ef5","name":"10.1 SendingCancel for a specific operation from the Planning System (Node-RED <-- VPP)","info":"","x":347.4166564941406,"y":4290.06640625,"wires":[]},{"id":"54bef9b7.22f4a","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (TU-Agent)","info":"","x":1140.2999877929688,"y":4290.499801635742,"wires":[]},{"id":"740a667.efc4218","type":"comment","z":"7b0fa635.67ef5","name":"10.2 Receiving confirmation of the operation cancel from VPP (Node-RED --> VPP)","info":"","x":320,"y":4404.549865722656,"wires":[]},{"id":"cc065227.539e38","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":170,"y":4444.649963378906,"wires":[["ab12692f.e971e","d2f788ea.0b714"]]},{"id":"ab12692f.e971e","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":250,"y":4480.649963378906,"wires":[]},{"id":"e5e9887c.34117","type":"function","z":"7b0fa635.67ef5","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":598.8334045410156,"y":4447.349670410156,"wires":[[]]},{"id":"d2f788ea.0b714","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":416.8334045410156,"y":4446.600158691406,"wires":[["e5e9887c.34117"]]},{"id":"59f8a81f.2df438","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":858.0166320800781,"y":4447.750183105469,"wires":[]},{"id":"3f8c6389.2b0a3c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":597.1500244140625,"y":4374.083068847656,"wires":[["7818ca27.11d844"]]},{"id":"d6ebc7b2.69d0e8","type":"inject","z":"7b0fa635.67ef5","name":"TESTING","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":425.6500244140625,"y":4374.750061035156,"wires":[["3f8c6389.2b0a3c"]]},{"id":"67c2a9c4.56cb18","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1095.8499755859375,"y":4413.350158691406,"wires":[]},{"id":"3a9c14b7.0c7efc","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1106.8499755859375,"y":4448.350158691406,"wires":[[]]},{"id":"57672fe1.ccb3f","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/requestInfo","method":"put","upload":false,"swaggerDoc":"","x":134.39999389648438,"y":4627.7998046875,"wires":[["94f8f779.b06f3","8f46e25a.35aa98"]]},{"id":"94f8f779.b06f3","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":174.13331604003906,"y":4663.433166503906,"wires":[]},{"id":"8f46e25a.35aa98","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":475.3500213623047,"y":4627.233215332031,"wires":[["3480b47e.746164"]]},{"id":"3480b47e.746164","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":644.5832977294922,"y":4623.683166503906,"wires":[["d3b6b14d.ce424"]]},{"id":"d3b6b14d.ce424","type":"http request","z":"7b0fa635.67ef5","name":"requestInfos Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/requestInfo","tls":"","persist":false,"proxy":"","authType":"basic","x":1129.2832946777344,"y":4623.583435058594,"wires":[[]]},{"id":"5f8c1e4a.18edf8","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1149.13330078125,"y":4591.83349609375,"wires":[]},{"id":"a1a2f8e8.5bac18","type":"comment","z":"7b0fa635.67ef5","name":"**************** 11 Requesting Agent Info Sequence**************","info":"","x":234.84999084472656,"y":4592.166809082031,"wires":[]},{"id":"57caba26.33ccc4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/requestInfoData","method":"put","upload":false,"swaggerDoc":"","x":128.0833282470703,"y":4737.699844360352,"wires":[["328f222e.397cde","c6f2bf22.161a18"]]},{"id":"328f222e.397cde","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.1999969482422,"y":4773.699905395508,"wires":[]},{"id":"c6f2bf22.161a18","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var dataName = \"InfoSet\";\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+dataName+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":647.0331878662109,"y":4737.299514770508,"wires":[[]]},{"id":"7c93f50f.bf3064","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1114.383316040039,"y":4732.599990844727,"wires":[[]]},{"id":"471a1bed.8e1834","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":872.3499603271484,"y":4735.949905395508,"wires":[]},{"id":"5496c112.5cfeb","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/requestInfo","method":"get","upload":false,"swaggerDoc":"","x":121.19999694824219,"y":4805.599807739258,"wires":[["2eec3b94.8169c4"]]},{"id":"4e16df4.4683a2","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":805.1999969482422,"y":4805.599807739258,"wires":[]},{"id":"399a86d2.c4f45a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":638.1999969482422,"y":4806.599807739258,"wires":[["4e16df4.4683a2"]]},{"id":"2eec3b94.8169c4","type":"template","z":"7b0fa635.67ef5","name":"INSERT AGENT INFO HERE","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"AGENT\"\n \"ABC\"\n","output":"str","x":409.1999969482422,"y":4805.599807739258,"wires":[["399a86d2.c4f45a"]]},{"id":"5d75ab3d.a62f34","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject Request to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":155.6999969482422,"y":4701.599807739258,"wires":[["76629d87.7098fc"]]},{"id":"76629d87.7098fc","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"\nmsg.payload = {\n \"tuName\" : \"TU_Company1_MRL\"\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":648.1999969482422,"y":4703.599807739258,"wires":[["d3b6b14d.ce424"]]},{"id":"7ce87186.d7645","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n}","x":419.1999969482422,"y":4662.599807739258,"wires":[]},{"id":"e9328489.cd5e88","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635.1499633789062,"y":4178.25,"wires":[["dbe579fd.7dd56"]]},{"id":"dbe579fd.7dd56","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_failure","tls":"","persist":false,"proxy":"","authType":"","x":1181.1500701904297,"y":4175.25016784668,"wires":[[]]},{"id":"58dff453.340fe4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":185.1499786376953,"y":4178.449951171875,"wires":[["7f470248.3b44cc","e9328489.cd5e88"]]},{"id":"7f470248.3b44cc","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":194.449951171875,"y":4214.4501953125,"wires":[]},{"id":"ff6d0031.d35f","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Failure***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":178,"y":4253.58349609375,"wires":[["5a73f948.ba7458"]]},{"id":"5a73f948.ba7458","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":638,"y":4251.58349609375,"wires":[["dbe579fd.7dd56"]]},{"id":"f8cf0271.5bfe9","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":171.6666717529297,"y":4517,"wires":[["c5b67811.cac2d8","47ff44dc.9beae4"]]},{"id":"c5b67811.cac2d8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":251.6666717529297,"y":4553,"wires":[]},{"id":"12f0d993.412706","type":"function","z":"7b0fa635.67ef5","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600.5000762939453,"y":4519.69970703125,"wires":[[]]},{"id":"47ff44dc.9beae4","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":418.5000762939453,"y":4518.9501953125,"wires":[["12f0d993.412706"]]},{"id":"fd3a8ab0.c1762","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":859.6833038330078,"y":4520.1002197265625,"wires":[]},{"id":"4311fce9.be3914","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1108.5166473388672,"y":4520.7001953125,"wires":[[]]},{"id":"18c87b11.b14c55","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadNewSetpoint.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672.6666870117188,"y":1121,"wires":[["5ac310c4.37c028"]]},{"id":"e02adc48.0aa598","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":455.4333801269531,"y":1120.7499389648438,"wires":[["18c87b11.b14c55"]]},{"id":"9395992a.39d0e8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186,"y":2118.8573122024536,"wires":[]}] \ No newline at end of file From ee12cb4e78c7e00e5d0894946baa523efa8310bf Mon Sep 17 00:00:00 2001 From: Stefan Woltmann <56683670+IngStefan@users.noreply.github.com> Date: Sun, 27 Jun 2021 12:42:00 +0200 Subject: [PATCH 4/5] Bugfixes and minor changes --- Node-RED/all_flows.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Node-RED/all_flows.json b/Node-RED/all_flows.json index 64ab775..1d01f84 100644 --- a/Node-RED/all_flows.json +++ b/Node-RED/all_flows.json @@ -1 +1 @@ -[{"id":"16acb04.7bc525","type":"tab","label":"VPP Dashboard","disabled":false,"info":""},{"id":"7b0fa635.67ef5","type":"tab","label":"VPP - VPP-Agent","disabled":false,"info":""},{"id":"249aeb13.444e84","type":"tab","label":"TU-Agent - Planning","disabled":false,"info":""},{"id":"80f5f744.445108","type":"tab","label":"TU-Agent - TU","disabled":false,"info":""},{"id":"43429a7f.e2c06c","type":"tab","label":"TU-Agent - EMS","disabled":false,"info":""},{"id":"99325b1f.e4e488","type":"soap-config","z":"80f5f744.445108","wsdl":"http://www.webservicex.net/geoipservice.asmx?wsdl","auth":"0","user":"","pass":"","key":"","cert":"","token":""},{"id":"500ae9ad.9ec368","type":"soap-config","z":"80f5f744.445108","wsdl":"http://www.webservicex.net/globalweather.asmx?WSDL","auth":"0","user":"","pass":"","cert":"","token":""},{"id":"268dcadf.8f2d9e","type":"soap-config","z":"80f5f744.445108","wsdl":"http://www.webservicex.net/geoipservice.asmx?wsdl","auth":"0","user":"","pass":"","key":"","cert":"","token":""},{"id":"7b2edbef.0d9274","type":"ui_group","z":"","name":"Accounting","tab":"f1c1dbec.dff76","order":1,"disp":true,"width":"6","collapse":false},{"id":"a1280549.92b49","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"7a0ced2c.74f9ec","type":"ui_tab","z":"","name":"Scheduling","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"df5c4bc4.8dc3","type":"ui_group","z":"","name":"Scheduling","tab":"7a0ced2c.74f9ec","order":1,"disp":true,"width":"6","collapse":false},{"id":"feeaec25.af6ba8","type":"ui_tab","z":"","name":"TU-Control","icon":"dashboard","order":2,"disabled":false,"hidden":false},{"id":"43be54a9.7cf664","type":"ui_group","z":"","name":"TU Control: New Setpoint","tab":"feeaec25.af6ba8","order":1,"disp":true,"width":"6","collapse":false},{"id":"9c1cc111.5b1678","type":"ui_group","z":"","name":"Device Status","tab":"29d4c607.37ee1a","order":1,"disp":true,"width":"6","collapse":false},{"id":"2f58a8ea.b6d678","type":"ui_group","z":"","name":"Device Management","tab":"29d4c607.37ee1a","order":4,"disp":true,"width":"6","collapse":false},{"id":"2b01bfb4.ee1ea8","type":"ui_group","z":"","name":"Control Output 1","tab":"29d4c607.37ee1a","order":2,"disp":true,"width":"6","collapse":false},{"id":"6fc5d75c.1627a8","type":"ui_group","z":"","name":"O1 - O4 Output States","tab":"29d4c607.37ee1a","order":3,"disp":true,"width":"6","collapse":false},{"id":"29d4c607.37ee1a","type":"ui_tab","z":"","name":"NETIO AN31 (REST XML)","icon":"dashboard","order":3,"disabled":false,"hidden":false},{"id":"470c886e.9dacf8","type":"ui_group","z":"","name":"Device Status","tab":"6bf1537b.697844","order":1,"disp":true,"width":"6","collapse":false},{"id":"820e4557.96e61","type":"ui_group","z":"","name":"Device Management","tab":"6bf1537b.697844","order":4,"disp":true,"width":"6","collapse":false},{"id":"45d5fa9.3621304","type":"ui_group","z":"","name":"Control Output 1","tab":"6bf1537b.697844","order":2,"disp":true,"width":"6","collapse":false},{"id":"dd943096.9b32e8","type":"ui_group","z":"","name":"O1 - O4 Output States","tab":"6bf1537b.697844","order":3,"disp":true,"width":"6","collapse":false},{"id":"6bf1537b.697844","type":"ui_tab","z":"","name":"NETIO AN31 (REST XML)","icon":"dashboard","order":4,"disabled":false,"hidden":false},{"id":"d7fd7295.17f8e","type":"ui_tab","z":"","name":"Post ANN time windows","icon":"dashboard","order":6,"disabled":false,"hidden":false},{"id":"21ffbe58.69dc12","type":"ui_group","z":"","name":"ANN","tab":"d7fd7295.17f8e","order":1,"disp":true,"width":"6","collapse":false},{"id":"f1c1dbec.dff76","type":"ui_tab","z":"","name":"Accounting","icon":"dashboard","order":5,"disabled":false,"hidden":false},{"id":"ddbdad88.35331","type":"comment","z":"249aeb13.444e84","name":"1.1 Receiving Load Schedule Plans from Agent (Node-RED --> Planning)","info":"","x":286.1166687011719,"y":118.11666870117188,"wires":[]},{"id":"41a78e3f.0db35","type":"ui_button","z":"16acb04.7bc525","name":"","group":"df5c4bc4.8dc3","order":19,"width":0,"height":0,"passthru":false,"label":"Start Scheduling","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":98.44998168945312,"y":737.9000549316406,"wires":[["cd908004.a44d9","1e39238e.1fafc4"]]},{"id":"c9c94f34.0da6b","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":469.4500427246094,"y":693.0834045410156,"wires":[]},{"id":"d0063b9.8688548","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Time Window Start","tooltip":"","group":"df5c4bc4.8dc3","order":10,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":114.45001220703125,"y":359.76666259765625,"wires":[["feec11e5.0a10a8"]]},{"id":"feec11e5.0a10a8","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeStart = date.toISOString().substr(11, 8);\n\nflow.set(\"TimeStart\",TimeStart);\nmsg.payload = TimeStart;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":306.4500427246094,"y":359.3500061035156,"wires":[[]]},{"id":"3cced0d4.8c003","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Time Window End","tooltip":"","group":"df5c4bc4.8dc3","order":13,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":113.11669921875,"y":477.1166687011719,"wires":[["9eb9496b.0381a8"]]},{"id":"9eb9496b.0381a8","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"TimeEnd\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":304.1166687011719,"y":477.1166687011719,"wires":[[]]},{"id":"cd908004.a44d9","type":"function","z":"16acb04.7bc525","name":"Load Values","func":"if (msg.payload === true)\n{\nvar start = flow.get('TimeStart') || 0;\nvar end = flow.get('TimeEnd') || 0;\nvar activationDateStart = flow.get('ActivationDateStart') || 0;\nvar activationDateEnd = flow.get('ActivationDateEnd') || 0;\nvar expirationTime = flow.get('ExpirationTime') || 0;\nvar expirationDate = flow.get('ExpirationDate') || 0;\nvar id = flow.get('ID') || 0;\n\n//\n/*\nvar prl = flow.get('PRL') || 0;\nvar srl = flow.get('SRL') || 0;\nvar mrl = flow.get('MRL') || 0;\nvar sol = flow.get('SOL') || 0;\nvar snl = flow.get('SNL') || 0;\nvar spot = flow.get('SPOT') || 0;\n//var ann = flow.get('ANN') || 0;\n*/\n\nif(flow.get('PRL') || 0){var prl = \"PRL,\";}else{var prl =\"\";}\nif(flow.get('SRL') || 0){var srl = \"SRL,\";}else{var srl =\"\";}\nif(flow.get('MRL') || 0){var mrl = \"MRL,\";}else{var mrl =\"\";}\nif(flow.get('SOL') || 0){var sol = \"SOL,\";}else{var sol =\"\";}\nif(flow.get('SNL') || 0){var snl = \"SNL,\";}else{var snl =\"\";}\nif(flow.get('SPOT') || 0){var spot = \"SPOT,\";}else{var spot =\"\";}\nif(flow.get('PRL') || flow.get('SRL') || flow.get('MRL') || flow.get('SOL') || flow.get('SNL') || flow.get('SPOT')){\n var serviceDescriptions = prl + srl + mrl + sol + snl + spot;\n}else{ var serviceDescriptions = \"empty\";}\n\n\n//serviceDescriptions = prl+\",\"+mrl+\",\"+srl+\",\"+sol+\",\"+snl+\",\"+spot;\n\n//adding the date to the start and stop time\nstart = activationDateStart +\" \"+ start;\nend = activationDateEnd +\" \"+ end;\nexpiration = expirationDate + \" \" + expirationTime;\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\nreturn msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":293.1166687011719,"y":738.1167297363281,"wires":[["c9c94f34.0da6b","52eb527f.939da4"]]},{"id":"72cf2e6d.fed82","type":"ui_button","z":"16acb04.7bc525","name":"","group":"43be54a9.7cf664","order":4,"width":0,"height":0,"passthru":false,"label":"Set NewSetpoint","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":116.11666870117188,"y":1329.1167602539062,"wires":[["e35e8cae.9eba68"]]},{"id":"d982ad23.33665","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"TU name","tooltip":"","group":"43be54a9.7cf664","order":2,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":87.78335571289062,"y":1252.3333435058594,"wires":[["4db62ce9.25f814"]]},{"id":"4db62ce9.25f814","type":"function","z":"16acb04.7bc525","name":"","func":"var value = msg.payload;\nflow.set(\"activation_tuName\",value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":325.7833557128906,"y":1257.3333129882812,"wires":[[]]},{"id":"e35e8cae.9eba68","type":"function","z":"16acb04.7bc525","name":"","func":"agentName = flow.get(\"activation_agentName\");\ntuName = flow.get(\"activation_tuName\");\nnewSetpoint = flow.get(\"activation_newSetpoint\");\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName,\n \"newSetpoint\" : newSetpoint\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330.7833557128906,"y":1329.3334350585938,"wires":[["24c537cd.d2ec08"]]},{"id":"4ad14c6b.d0f31c","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Date Start","group":"df5c4bc4.8dc3","order":9,"width":0,"height":0,"passthru":true,"topic":"","x":85.44998168945312,"y":326.2833557128906,"wires":[["6727a78c.b47a68"]]},{"id":"6727a78c.b47a68","type":"function","z":"16acb04.7bc525","name":"","func":"var activationDateStart = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nactivationDateStart = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"ActivationDateStart\",activationDateStart);\nmsg.payload = activationDateStart;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":305.1166687011719,"y":326.1166687011719,"wires":[[]]},{"id":"6de2332a.f321ac","type":"comment","z":"16acb04.7bc525","name":"Communication direction: VPP Dashboard --> VPP Agent (JADE)","info":"","x":250.11666870117188,"y":24.116668701171875,"wires":[]},{"id":"e73f5787.962e1","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_request","tls":"","persist":false,"proxy":"","authType":"basic","x":720.7000732421875,"y":738.2167053222656,"wires":[["3c93d809.3585a8"]]},{"id":"63b91130.ba5fb8","type":"comment","z":"16acb04.7bc525","name":"TU-Control","info":"","x":90,"y":1178.2166137695312,"wires":[]},{"id":"52eb527f.939da4","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":499.9999694824219,"y":738.2167358398438,"wires":[["e73f5787.962e1","fce616b8.13ea48"]]},{"id":"92e00400.afded8","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1106.199951171875,"y":736.2166748046875,"wires":[["9c44460d.9945a"]]},{"id":"27727eb3.d95cda","type":"function","z":"16acb04.7bc525","name":"","func":"var sol = msg.payload;\nflow.set(\"SOL\",sol);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":532.11669921875,"y":169.2166748046875,"wires":[[]]},{"id":"fce616b8.13ea48","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":703.11669921875,"y":693.1167297363281,"wires":[]},{"id":"3c93d809.3585a8","type":"debug","z":"16acb04.7bc525","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":904.11669921875,"y":690.1167297363281,"wires":[]},{"id":"9c44460d.9945a","type":"debug","z":"16acb04.7bc525","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":955.11669921875,"y":773.1167297363281,"wires":[]},{"id":"dbf8db70.6de598","type":"comment","z":"249aeb13.444e84","name":"1.2 Receiving Answers from ERP System (Node-RED <-- Planning)","info":"","x":262.0000305175781,"y":311.416748046875,"wires":[]},{"id":"1e4bd12e.c69e8f","type":"file in","z":"249aeb13.444e84","d":true,"name":"**TEST**Testfile from Desktop","filename":"C:\\Users\\Woltmann\\Desktop\\pom2.xml","format":"","chunk":false,"sendError":false,"encoding":"none","x":512.9999694824219,"y":1191.1667785644531,"wires":[["7a53b332.281004"]]},{"id":"b0d88e9c.b15188","type":"inject","z":"249aeb13.444e84","d":true,"name":"**TEST**Inject a XML File to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":186,"y":1191.266845703125,"wires":[["1e4bd12e.c69e8f"]]},{"id":"7a53b332.281004","type":"function","z":"249aeb13.444e84","d":true,"name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":819.666748046875,"y":1190.1835021972656,"wires":[["7c3fb223.5bd574"]]},{"id":"7c3fb223.5bd574","type":"http request","z":"249aeb13.444e84","d":true,"name":"scheduling_schedulingPlan Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlan","tls":"","persist":false,"proxy":"","authType":"","x":1106.11669921875,"y":1191.1667785644531,"wires":[[]]},{"id":"79ab94b3.c6415c","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_schedulingPlan","method":"put","upload":false,"swaggerDoc":"","x":193.11666870117188,"y":350.11669921875,"wires":[["b11283c4.3b27a8","c5c844c8.c4ab5"]]},{"id":"b11283c4.3b27a8","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":294.4166564941406,"y":385.11669921875,"wires":[]},{"id":"cf5fe0da.0f007","type":"comment","z":"249aeb13.444e84","name":"Testing Upload SchedulingPlans via predefined XML data","info":"","x":234.11666870117188,"y":1106.11669921875,"wires":[]},{"id":"fd764160.c2182","type":"comment","z":"7b0fa635.67ef5","name":"1.1 Start Scheduling Process (VPP --> Node-RED)","info":"","x":214.11666870117188,"y":105.11666870117188,"wires":[]},{"id":"7b1bd406.37964c","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":822.11669921875,"y":1143.2167053222656,"wires":[["d7b4a422.83f928"]]},{"id":"d7b4a422.83f928","type":"http request","z":"249aeb13.444e84","name":"scheduling_schedulingPlan Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlan","tls":"","persist":false,"proxy":"","authType":"","x":1105.11669921875,"y":1143.2167053222656,"wires":[[]]},{"id":"9db74b9a.6bbb08","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a predefined XML to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"a\":1}","payloadType":"str","x":209.11666870117188,"y":1145.7166748046875,"wires":[["fbcfe0dd.ec5ec8"]]},{"id":"4232d543.0180bc","type":"comment","z":"16acb04.7bc525","name":"Scheduling","info":"","x":96.11666870117188,"y":92.11666870117188,"wires":[]},{"id":"4e27e447.15d334","type":"comment","z":"16acb04.7bc525","name":"Accounting","info":"","x":85.11666870117188,"y":1987.5167236328125,"wires":[]},{"id":"26d9ad6d.480412","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Date End","group":"df5c4bc4.8dc3","order":12,"width":0,"height":0,"passthru":true,"topic":"","x":83.11666870117188,"y":443.1166687011719,"wires":[["8cbc4366.516118"]]},{"id":"8cbc4366.516118","type":"function","z":"16acb04.7bc525","name":"","func":"var activationDateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nactivationDateEnd = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"ActivationDateEnd\",activationDateEnd);\nmsg.payload = activationDateEnd;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":305.1166687011719,"y":443.1166687011719,"wires":[[]]},{"id":"27d52dd9.8301ea","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":8,"width":0,"height":0,"name":"","label":"Start time of the scheduling process","format":"{{msg.payload}}","layout":"row-spread","x":164.94992065429688,"y":289.98333740234375,"wires":[]},{"id":"93e6a31c.764bb8","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":11,"width":0,"height":0,"name":"","label":"End time of the scheduling process","format":"{{msg.payload}}","layout":"row-spread","x":164.11666870117188,"y":409.1166687011719,"wires":[]},{"id":"7a219d5f.e01bfc","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":1,"width":0,"height":0,"name":"","label":"Market related settings","format":"{{msg.payload}}","layout":"row-spread","x":125.11666870117188,"y":136.11666870117188,"wires":[]},{"id":"108db088.1c206f","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":14,"width":0,"height":0,"name":"","label":"Expiration date of the request","format":"{{msg.payload}}","layout":"row-spread","x":144,"y":521.2166748046875,"wires":[]},{"id":"b2983b1b.057ff8","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Time Offer-Expiration","tooltip":"","group":"df5c4bc4.8dc3","order":16,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":125.00003051757812,"y":590.2166748046875,"wires":[["81dcb187.886f88"]]},{"id":"81dcb187.886f88","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar expirationTime = date.toISOString().substr(11, 8);\n\n\nflow.set(\"ExpirationTime\",expirationTime);\nmsg.payload = expirationTime;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":306,"y":590.2166748046875,"wires":[[]]},{"id":"7d085799.3a5248","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Date Offer-Expiration","group":"df5c4bc4.8dc3","order":15,"width":0,"height":0,"passthru":true,"topic":"","x":125,"y":556.2166748046875,"wires":[["a5f0afb2.568f4"]]},{"id":"a5f0afb2.568f4","type":"function","z":"16acb04.7bc525","name":"","func":"var activationDateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nexpirationDate = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"ExpirationDate\",expirationDate);\nmsg.payload = expirationDate;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":307,"y":556.2166748046875,"wires":[[]]},{"id":"4671b29b.b70254","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":17,"width":0,"height":0,"name":"","label":"Induvidual ID of this action","format":"{{msg.payload}}","layout":"row-spread","x":141.00003051757812,"y":642.3166809082031,"wires":[]},{"id":"2e3b062d.92b7fa","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"ReferenceID","tooltip":"","group":"df5c4bc4.8dc3","order":18,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":88,"y":676.316650390625,"wires":[["e8a17baf.0c03a"]]},{"id":"e8a17baf.0c03a","type":"function","z":"16acb04.7bc525","name":"","func":"var id = msg.payload;\nflow.set(\"ID\",id);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":299.1166687011719,"y":676.9166259765625,"wires":[[]]},{"id":"36408f7b.a30e58","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"PRL","tooltip":"","group":"df5c4bc4.8dc3","order":2,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":73.94998168945312,"y":172.91665649414062,"wires":[["3aae9aed.d79c7e"]]},{"id":"fee49128.64cca","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"SRL","tooltip":"","group":"df5c4bc4.8dc3","order":3,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":73.11666870117188,"y":209.2166748046875,"wires":[["3d97a207.eed8ee"]]},{"id":"88ef07c4.0c1668","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"MRL","tooltip":"","group":"df5c4bc4.8dc3","order":4,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":71.11666870117188,"y":245.2166748046875,"wires":[["58eb5858.6814d8"]]},{"id":"df3b0df2.630578","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"SOL","tooltip":"","group":"df5c4bc4.8dc3","order":5,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":391.1166687011719,"y":169.2166748046875,"wires":[["27727eb3.d95cda"]]},{"id":"34f51174.4e5f46","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"SNL","tooltip":"","group":"df5c4bc4.8dc3","order":6,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":392.1166687011719,"y":206.2166748046875,"wires":[["561712ae.b576d4"]]},{"id":"4ca71186.c0e41","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"FLEX","tooltip":"","group":"df5c4bc4.8dc3","order":7,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":394.1166687011719,"y":244.2166748046875,"wires":[["6896ff96.58183"]]},{"id":"3aae9aed.d79c7e","type":"function","z":"16acb04.7bc525","name":"","func":"var prl = msg.payload;\nflow.set(\"PRL\",prl);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":206.11666870117188,"y":170.11666870117188,"wires":[[]]},{"id":"3d97a207.eed8ee","type":"function","z":"16acb04.7bc525","name":"","func":"var srl = msg.payload;\nflow.set(\"SRL\",srl);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":205.11666870117188,"y":208.11666870117188,"wires":[[]]},{"id":"58eb5858.6814d8","type":"function","z":"16acb04.7bc525","name":"","func":"var mrl = msg.payload;\nflow.set(\"MRL\",mrl);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":206.11666870117188,"y":244.11666870117188,"wires":[[]]},{"id":"561712ae.b576d4","type":"function","z":"16acb04.7bc525","name":"","func":"var snl = msg.payload;\nflow.set(\"SNL\",snl);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":531.11669921875,"y":206.11666870117188,"wires":[[]]},{"id":"6896ff96.58183","type":"function","z":"16acb04.7bc525","name":"","func":"var spot = msg.payload;\nflow.set(\"FLEX\",spot);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":531.11669921875,"y":243.11666870117188,"wires":[[]]},{"id":"58365a3b.ebe174","type":"comment","z":"16acb04.7bc525","name":"ANN","info":"","x":78.11666870117188,"y":2119.916748046875,"wires":[]},{"id":"307fb841.f25fd","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/scheduling_startScheduling","method":"put","upload":false,"swaggerDoc":"","x":177.11666870117188,"y":160.11666870117188,"wires":[["7d3b5a3.f7c8524","b1d31393.b900a8","5659bae2.002f14"]]},{"id":"7d3b5a3.f7c8524","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":255.11666870117188,"y":198.11666870117188,"wires":[]},{"id":"3cc71fbb.5b725","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var schedulingStart = msg.payload.InterfacePayloadPlanning.schedulingStart.toString();\nvar schedulingEnd = msg.payload.InterfacePayloadPlanning.schedulingEnd.toString();\nvar expiration = msg.payload.InterfacePayloadPlanning.expiration.toString();\nvar referenceID = msg.payload.InterfacePayloadPlanning.referenceID.toString();\n\npayload = \n{\n\"schedulingStart\" : schedulingStart,\n\"schedulingEnd\" : schedulingEnd,\n\"expiration\" : expiration,\n\"referenceID\" : referenceID,\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":607.9500732421875,"y":201.81666564941406,"wires":[["9fa3384b.12fc1"]]},{"id":"22bb0d26.19069a","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"{\n schedulingStart: \"2021-02-05 12:00:00\",\n schedulingEnd: \"2021-02-05 13:00:00\",\n expiration: \"2021-02-04 22:00:00\",\n referenceID: \"scheduling-1\"\n}","x":865.11669921875,"y":203.11666870117188,"wires":[]},{"id":"b1d31393.b900a8","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":410.9500427246094,"y":202.06666564941406,"wires":[["3cc71fbb.5b725"]]},{"id":"5659bae2.002f14","type":"function","z":"249aeb13.444e84","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":608.9500427246094,"y":161.43333435058594,"wires":[[]]},{"id":"5352374.fea4ec8","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1111.11669921875,"y":157.11666870117188,"wires":[["190becde.dfbeeb"]]},{"id":"190becde.dfbeeb","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1349.61669921875,"y":156.11666870117188,"wires":[[]]},{"id":"2c343cfc.c7f644","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1092.11669921875,"y":123.11666870117188,"wires":[]},{"id":"fbcfe0dd.ec5ec8","type":"template","z":"249aeb13.444e84","name":"**TEST**XML-Template","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","output":"str","x":528.1166687011719,"y":1143.7166748046875,"wires":[["7b1bd406.37964c"]]},{"id":"39c59dca.e8a5ba","type":"http in","z":"249aeb13.444e84","d":true,"name":"","url":"/erp/schedulingPlan","method":"put","upload":false,"swaggerDoc":"","x":154.11666870117188,"y":1362.916748046875,"wires":[["3b6d7fe0.61c9d","683c651f.c51cec"]]},{"id":"3b6d7fe0.61c9d","type":"http response","z":"249aeb13.444e84","d":true,"name":"Response","statusCode":"","headers":{},"x":202.41665649414062,"y":1399.916748046875,"wires":[]},{"id":"683c651f.c51cec","type":"file","z":"249aeb13.444e84","d":true,"name":"","filename":"C:/Users/Woltmann/Desktop/newFile/ausNodeRed.xml","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"utf8","x":533.9500427246094,"y":1362.9834594726562,"wires":[[]]},{"id":"f9c4bd75.d2a9e8","type":"comment","z":"249aeb13.444e84","name":"Testing the Node-RED Interface by saving the Data to a file","info":"","x":234.11666870117188,"y":1326.916748046875,"wires":[]},{"id":"c5c844c8.c4ab5","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610.050048828125,"y":350.41668701171875,"wires":[["3c0cfc8f.88b53c"]]},{"id":"3c0cfc8f.88b53c","type":"http request","z":"249aeb13.444e84","name":"scheduling_schedulingPlan Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlan","tls":"","persist":false,"proxy":"","authType":"","x":1162.050048828125,"y":348.41668701171875,"wires":[[]]},{"id":"6b7a1061.30328","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_refuseScheduling","method":"put","upload":false,"swaggerDoc":"","x":203.11666870117188,"y":512.11669921875,"wires":[["f58bb624.e61438","5c1a0033.a65fd"]]},{"id":"f58bb624.e61438","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":311.1166687011719,"y":550.11669921875,"wires":[]},{"id":"5c1a0033.a65fd","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":608.7501220703125,"y":511.416748046875,"wires":[["5d9252e5.13e0b4"]]},{"id":"5d9252e5.13e0b4","type":"http request","z":"249aeb13.444e84","name":"scheduling_refuseScheduling Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_refuseScheduling","tls":"","persist":false,"proxy":"","authType":"","x":1162.750244140625,"y":509.416748046875,"wires":[[]]},{"id":"1ad94994.df1cae","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"referenceID = flow.get(\"referenceID\");\npayload = {\n \"referenceID\" : referenceID,\n \"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":822.11669921875,"y":1280.916748046875,"wires":[["ef400437.5e9ac8"]]},{"id":"ef400437.5e9ac8","type":"http request","z":"249aeb13.444e84","name":"scheduling_refuseScheduling Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_refuseScheduling","tls":"","persist":false,"proxy":"","authType":"","x":1113.1168212890625,"y":1281.916748046875,"wires":[[]]},{"id":"a1fae2b2.1ba5d8","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a refuseScheduling to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":218.94998168945312,"y":1281,"wires":[["1ad94994.df1cae"]]},{"id":"93d90be7.333288","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_request Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_request","tls":"","persist":false,"proxy":"","authType":"basic","x":1118.3666687011719,"y":142.24996948242188,"wires":[[]]},{"id":"9806f44f.99d148","type":"comment","z":"7b0fa635.67ef5","name":"1. Scheduling Process","info":"","x":125.11666870117188,"y":73.11666870117188,"wires":[]},{"id":"263a31b6.930756","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_request","method":"put","upload":false,"swaggerDoc":"","x":164.11666870117188,"y":142.11666870117188,"wires":[["6669f6db.483d","b7656f7e.47eaa"]]},{"id":"6669f6db.483d","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.11666870117188,"y":177.11666870117188,"wires":[]},{"id":"8bcbad15.6f18b","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var id = msg.payload.referenceID || 0; //id is an optional parameter\nvar serviceDescriptions = msg.payload.serviceDescriptions\nvar start = msg.payload.schedulingStart\nvar end = msg.payload.schedulingEnd\nvar expiration = msg.payload.expiration\n\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.11669921875,"y":143.11666107177734,"wires":[["93d90be7.333288"]]},{"id":"b97afd77.1f1fc","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_schedulingPlan","method":"put","upload":false,"swaggerDoc":"","x":173.11666870117188,"y":329.11663818359375,"wires":[["6703c2bf.318abc","1d3de801.a9daa"]]},{"id":"6703c2bf.318abc","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.41665649414062,"y":362.1166687011719,"wires":[]},{"id":"64ba4993.89a87","type":"comment","z":"7b0fa635.67ef5","name":"1.2 Sending the Scheduling Plans to the VPP (VPP <-- Node-RED)","info":"","x":263.1166687011719,"y":221.11663818359375,"wires":[]},{"id":"9afb9c24.47be2","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_schedulingPlanInfos","method":"put","upload":false,"swaggerDoc":"","x":184,"y":255.2166748046875,"wires":[["596579dd.a4621","90cc8d6.837fa7"]]},{"id":"596579dd.a4621","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":177.11666870117188,"y":287.2166748046875,"wires":[]},{"id":"6926c4e6.6beeac","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n// providing variables for the UI:\n//flow.set(\"schedulingPlanInfos\",schedulingPlanInfos);\n//global.set(\"schedulingPlanInfos\",schedulingPlanInfos);\n///var schedulingPlanInfos = flow.get(\"schedulingPlanInfos\");\n//global.get(\"arrayString\").push(schedulingPlanInfos);\n\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":255.2166748046875,"wires":[["40217cd9.f4f25c"]]},{"id":"1d3de801.a9daa","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = flow.get('schedulingPlanInfos');\n//use filename if you want to save the file in a local folder (save to folder node)\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":624.9500732421875,"y":328.8166198730469,"wires":[[]]},{"id":"1eb27538.8fd263","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1078.2999877929688,"y":254.11666870117188,"wires":[[]]},{"id":"a8c8de28.e92298","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1067.2999877929688,"y":218.11666870117188,"wires":[]},{"id":"b93374a1.44b6d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.5667114257812,"y":329.1166687011719,"wires":[[]]},{"id":"5bc8f24a.c8071c","type":"comment","z":"7b0fa635.67ef5","name":"1.3 Accepting or Rejecting the Proposals (VPP --> Node-RED)","info":"","x":238.11666870117188,"y":473.11663818359375,"wires":[]},{"id":"84d76edd.8b01a","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_accept-proposal","method":"put","upload":false,"swaggerDoc":"","x":186.11666870117188,"y":507.21661376953125,"wires":[["70d6390a.c9915","260fa31f.9b694c"]]},{"id":"40a19a7.cbd8b64","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_reject-proposal","method":"put","upload":false,"swaggerDoc":"","x":186.11666870117188,"y":580.2166137695312,"wires":[["9b8a2c67.c398a8","7ae1d2c0.d88814"]]},{"id":"dfc6ced.16699b","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\nvar start = msg.payload.schedulingStart;\nvar end = msg.payload.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.1166381835938,"y":506.21661376953125,"wires":[["c7d830c5.e26b5"]]},{"id":"79d6989b.6a14f","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.1166687011719,"y":580.2166137695312,"wires":[["95950400.6683d"]]},{"id":"c6836fee.9343a8","type":"comment","z":"7b0fa635.67ef5","name":"1.4 Receiving Inform or Failure of TU (VPP <-- Node-RED)","info":"","x":228.11666870117188,"y":655.416748046875,"wires":[]},{"id":"89847d8.fd27c8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_failure","method":"put","upload":false,"swaggerDoc":"","x":137.11666870117188,"y":765.7166442871094,"wires":[["a26d953a.c69d4","7995e15c.5fec78"]]},{"id":"a26d953a.c69d4","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.41665649414062,"y":800.7166137695312,"wires":[]},{"id":"2a7b5b73.6f8b9c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_done","method":"put","upload":false,"swaggerDoc":"","x":129,"y":691.8167114257812,"wires":[["40cc27ff.3375d","f8dfe605.43a1d8"]]},{"id":"40cc27ff.3375d","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.11666870117188,"y":726.8167419433594,"wires":[]},{"id":"dc6fc640.e2eb68","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":691.8167419433594,"wires":[["cd761dcc.9ca9"]]},{"id":"c7d830c5.e26b5","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_accept-proposal Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_accept-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":1141,"y":504.99993896484375,"wires":[[]]},{"id":"95950400.6683d","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_reject-proposal Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_reject-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":1142,"y":579.9999389648438,"wires":[[]]},{"id":"3fb6d3ba.0b472c","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":21,"width":"6","height":"2","name":"Anzeige Scheduling Ergebnisse","label":"","format":"{{msg.payload}}","layout":"row-spread","x":494.4999694824219,"y":856,"wires":[]},{"id":"1e02a040.6bf358","type":"function","z":"16acb04.7bc525","name":"Load Values","func":"var schedulingPlanInfos = global.get(\"arrayString\");\nmsg.payload = schedulingPlanInfos;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":250,"y":857,"wires":[["3fb6d3ba.0b472c","b764fa4a.c1c19"]]},{"id":"c786beb3.858d1","type":"inject","z":"16acb04.7bc525","name":"","props":[{"p":"payload"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":93,"y":857,"wires":[["1e02a040.6bf358"]]},{"id":"b764fa4a.c1c19","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":401.1166687011719,"y":814.5999755859375,"wires":[]},{"id":"1e39238e.1fafc4","type":"function","z":"16acb04.7bc525","name":"setting global varibale","func":"if (msg.payload === true)\n{\nvar arrayString = [];\nglobal.set(\"arrayString\",arrayString);\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":801.8166809082031,"wires":[[]]},{"id":"64db74fd.341f8c","type":"function","z":"16acb04.7bc525","name":"scheduling_request","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\nvar start = msg.payload.schedulingStart;\nvar end = msg.payload.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":276.1166687011719,"y":904.7000122070312,"wires":[["5d013358.64ccbc"]]},{"id":"5d013358.64ccbc","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":492.6666259765625,"y":903.8333435058594,"wires":[["7d67a49f.7dc594"]]},{"id":"7921aafe.f33b6c","type":"function","z":"16acb04.7bc525","name":"scheduling_request","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":276.1166687011719,"y":953.7000122070312,"wires":[["70af2e92.5b099"]]},{"id":"70af2e92.5b099","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":494.11669921875,"y":952.7000122070312,"wires":[["692884a6.ef6204"]]},{"id":"7d67a49f.7dc594","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_accept-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":730,"y":900.4833374023438,"wires":[["9741f934.63f638"]]},{"id":"9741f934.63f638","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":957.4998779296875,"y":900.4833374023438,"wires":[["77f071ba.06b89"]]},{"id":"692884a6.ef6204","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_reject-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":731,"y":950.4833374023438,"wires":[["2a389800.ba028"]]},{"id":"2a389800.ba028","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":958.4998779296875,"y":950.4833374023438,"wires":[["227f2efc.6742b2"]]},{"id":"f4b1a57d.0bd458","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":20,"width":0,"height":0,"name":"","label":"Result of Scheduling Request","format":"{{msg.payload}}","layout":"row-spread","x":148.11666870117188,"y":811.61669921875,"wires":[]},{"id":"ebf558df.67ba8","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Auswahl des Agenten","tooltip":"","group":"df5c4bc4.8dc3","order":22,"width":0,"height":0,"passthru":true,"mode":"number","delay":300,"topic":"","x":134.11666870117188,"y":1014.61669921875,"wires":[["ce50615e.fe0e6"]]},{"id":"ce50615e.fe0e6","type":"function","z":"16acb04.7bc525","name":"","func":"var agenSelect = msg.payload;\nflow.set(\"agenSelect\", agenSelect);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":323.1166687011719,"y":1013.61669921875,"wires":[["5ecec4ee.e24454"]]},{"id":"3926ed26.649432","type":"ui_button","z":"16acb04.7bc525","name":"","group":"df5c4bc4.8dc3","order":23,"width":"3","height":"2","passthru":false,"label":"Accept-Proposal","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":116.11666870117188,"y":1056.61669921875,"wires":[["ca880339.f6a6e"]]},{"id":"1d776e78.00483a","type":"ui_button","z":"16acb04.7bc525","name":"","group":"df5c4bc4.8dc3","order":24,"width":"3","height":"2","passthru":false,"label":"Reject-Proposal","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":118.11666870117188,"y":1097.61669921875,"wires":[["86837948.82eb18"]]},{"id":"86837948.82eb18","type":"function","z":"16acb04.7bc525","name":"","func":"agentNumber = flow.get(\"agenSelect\");\nvar schedulingPlanReference = global.get(\"arrayString\");\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference[agentNumber]\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":309.9499816894531,"y":1100.0167236328125,"wires":[["7921aafe.f33b6c","8f187a2c.45855"]]},{"id":"ca880339.f6a6e","type":"function","z":"16acb04.7bc525","name":"","func":"agentNumber = flow.get(\"agenSelect\");\nvar schedulingPlanReference = global.get(\"arrayString\");\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference[agentNumber],\n \"schedulingStart\" : flow.get('ActivationDateStart')+ \" \" + flow.get('TimeStart'),\n \"schedulingEnd\" : flow.get('ActivationDateEnd')+ \" \" + flow.get('TimeEnd')\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":316.1166687011719,"y":1058.816650390625,"wires":[["64db74fd.341f8c","9cce43fd.5e57f"]]},{"id":"5ecec4ee.e24454","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":573.11669921875,"y":1019.7166748046875,"wires":[]},{"id":"9cce43fd.5e57f","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":564.11669921875,"y":1070.7166748046875,"wires":[]},{"id":"8f187a2c.45855","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":564.11669921875,"y":1118.7166748046875,"wires":[]},{"id":"1b446a2.65bb496","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_schedulingPlanUploaded","method":"put","upload":false,"swaggerDoc":"","x":223.11666870117188,"y":430.21669006347656,"wires":[["7cbd83d1.2f7874","28d49ae3.63e606"]]},{"id":"7cbd83d1.2f7874","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":353.1166687011719,"y":464.2166748046875,"wires":[]},{"id":"28d49ae3.63e606","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\" : referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":608.7501220703125,"y":429.5167236328125,"wires":[["9426cc1a.e712b"]]},{"id":"9426cc1a.e712b","type":"http request","z":"249aeb13.444e84","name":"scheduling_schedulingPlanUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlanUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1193.7501220703125,"y":429.5166931152344,"wires":[[]]},{"id":"daa7c664.10a1f","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"referenceID = flow.get(\"referenceID\");\npayload = {\n \"referenceID\" : referenceID,\n \"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":826.11669921875,"y":1235.816650390625,"wires":[["e2828bc6.3b171"]]},{"id":"e2828bc6.3b171","type":"http request","z":"249aeb13.444e84","name":"scheduling_schedulingPlanUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlanUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1141.1167907714844,"y":1235.816650390625,"wires":[[]]},{"id":"f670bd3e.6b5bb","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a schedulingPlanUploaded to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":237.11666870117188,"y":1238.7166748046875,"wires":[["daa7c664.10a1f"]]},{"id":"9fa3384b.12fc1","type":"function","z":"249aeb13.444e84","name":"****TESTING (getting the referenceID)*******","func":"var referenceID = msg.payload.referenceID;\nflow.set(\"referenceID\", referenceID);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":668.949951171875,"y":253.01666259765625,"wires":[[]]},{"id":"8680da8d.132168","type":"comment","z":"249aeb13.444e84","name":"1.3 Receiving Scheduling-Accept or Reject from Agent (Node-RED --> Planning)","info":"","x":297.1166687011719,"y":599.61669921875,"wires":[]},{"id":"34456b5f.587afc","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/scheduling_accepted","method":"put","upload":false,"swaggerDoc":"","x":152.11666870117188,"y":649.5166625976562,"wires":[["ab38be7d.ed14d","ba5ad7e0.c20ca8","8317a571.24764"]]},{"id":"ab38be7d.ed14d","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":221.11666870117188,"y":684.5166625976562,"wires":[]},{"id":"2738bc23.a3b2d4","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var schedulingStart = msg.payload.InterfacePayloadPlanning.schedulingStart.toString();\nvar schedulingEnd = msg.payload.InterfacePayloadPlanning.schedulingEnd.toString();\n\nvar referenceID = msg.payload.InterfacePayloadPlanning.referenceID.toString();\n\npayload = \n{\n\"schedulingStart\" : schedulingStart,\n\"schedulingEnd\" : schedulingEnd,\n\"referenceID\" : referenceID,\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":593.9500427246094,"y":681.2166595458984,"wires":[[]]},{"id":"ba5ad7e0.c20ca8","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":374.9500427246094,"y":680.4666595458984,"wires":[["2738bc23.a3b2d4"]]},{"id":"8317a571.24764","type":"function","z":"249aeb13.444e84","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":593.9500427246094,"y":648.8333282470703,"wires":[[]]},{"id":"e18df4c.0f67388","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/scheduling_rejected","method":"put","upload":false,"swaggerDoc":"","x":148.11666870117188,"y":742.5166625976562,"wires":[["a77ce3f6.1a748","6db9f40c.ba296c","f18c232e.652d58"]]},{"id":"a77ce3f6.1a748","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":209.11666870117188,"y":777.5166625976562,"wires":[]},{"id":"47502ea1.0cff","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var referenceID = msg.payload.InterfacePayloadPlanning.referenceID.toString();\n\npayload = {\n \"referenceID\" : referenceID\n }\n\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":592.9500732421875,"y":775.2166748046875,"wires":[[]]},{"id":"ec5bf90c.7feb6","type":"comment","z":"249aeb13.444e84","name":"Testing the Agent Interface via predefined XML data","info":"","x":209.13327026367188,"y":1443.2166748046875,"wires":[]},{"id":"4b57b51e.d46d24","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1099.566650390625,"y":638.61669921875,"wires":[["c313038c.fe74b"]]},{"id":"c313038c.fe74b","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1334.066650390625,"y":637.61669921875,"wires":[[]]},{"id":"e700545d.62911","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1090.566650390625,"y":596.61669921875,"wires":[]},{"id":"53c81336.ed4304","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1101.566650390625,"y":739.61669921875,"wires":[["49fe3ba7.566734"]]},{"id":"49fe3ba7.566734","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1336.066650390625,"y":738.61669921875,"wires":[[]]},{"id":"934496e7.c16c18","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a FailureScheduling to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":202.11660766601562,"y":1534.4166259765625,"wires":[["6907a050.482d08"]]},{"id":"6907a050.482d08","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"//msg.payload = msg.payload;\nreferenceID = flow.get(\"referenceID\");\npayload = {\n \"referenceID\" : referenceID,\n \"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":805.2833251953125,"y":1534.3333740234375,"wires":[["4f086a87.cb297c"]]},{"id":"4f086a87.cb297c","type":"http request","z":"249aeb13.444e84","name":"scheduling_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_failure","tls":"","persist":false,"proxy":"","authType":"","x":1061.2835083007812,"y":1535.3333740234375,"wires":[[]]},{"id":"fdc88bff.4a8d3","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a InformScheduling to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":197.11660766601562,"y":1481.4166259765625,"wires":[["6c2c422e.ad1cd4"]]},{"id":"6c2c422e.ad1cd4","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"//msg.payload = msg.payload;\nreferenceID = flow.get(\"referenceID\");\npayload = {\n \"referenceID\" : referenceID,\n \"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":800.2833251953125,"y":1481.3333740234375,"wires":[["6b6f654b.5e02e4"]]},{"id":"6b6f654b.5e02e4","type":"http request","z":"249aeb13.444e84","name":"scheduling_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_inform","tls":"","persist":false,"proxy":"","authType":"","x":1061.283447265625,"y":1480.3333740234375,"wires":[[]]},{"id":"2b3c2051.b748d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.7833251953125,"y":690.6166687011719,"wires":[[]]},{"id":"8fdfe174.ac4e58","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1079.0499267578125,"y":766.6166687011719,"wires":[[]]},{"id":"7364643d.31052c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.11669921875,"y":764.61669921875,"wires":[["3e3fd9bd.e7f1a6"]]},{"id":"752760e3.511c88","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_refuse","method":"put","upload":false,"swaggerDoc":"","x":142.85000610351562,"y":403.8500061035156,"wires":[["13af9462.45515c","a4ba88a2.2feec"]]},{"id":"13af9462.45515c","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":177.14999389648438,"y":438.85003662109375,"wires":[]},{"id":"316b4f43.5946a8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.683349609375,"y":403.54998779296875,"wires":[[]]},{"id":"865123ce.69afe8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.8499145507812,"y":402.8500061035156,"wires":[[]]},{"id":"6db9f40c.ba296c","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":375.1166687011719,"y":774.7166748046875,"wires":[["47502ea1.0cff"]]},{"id":"f18c232e.652d58","type":"function","z":"249aeb13.444e84","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":594.11669921875,"y":741.7166748046875,"wires":[[]]},{"id":"5ac94cf6.d176ac","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":597.8499755859375,"y":961.0501098632812,"wires":[["ed54c8b.1b9f0b8"]]},{"id":"ed54c8b.1b9f0b8","type":"http request","z":"249aeb13.444e84","name":"scheduling_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_failure","tls":"","persist":false,"proxy":"","authType":"","x":1124.8502197265625,"y":960.0503540039062,"wires":[[]]},{"id":"3b8bf6bc.be022a","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":596.8499755859375,"y":878.0500640869141,"wires":[["b0c03820.40b438"]]},{"id":"b0c03820.40b438","type":"http request","z":"249aeb13.444e84","name":"scheduling_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_inform","tls":"","persist":false,"proxy":"","authType":"","x":1124.85009765625,"y":875.0501098632812,"wires":[[]]},{"id":"ebe3936e.2d7208","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_inform","method":"put","upload":false,"swaggerDoc":"","x":187.85000610351562,"y":878.2498931884766,"wires":[["cdf0b2cf.5964e8","3b8bf6bc.be022a"]]},{"id":"2be9a3ba.f24bcc","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_failure","method":"put","upload":false,"swaggerDoc":"","x":184.85000610351562,"y":961.2499389648438,"wires":[["e4b173b5.8ff508","5ac94cf6.d176ac"]]},{"id":"e4b173b5.8ff508","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":246.85000610351562,"y":1000.2499847412109,"wires":[]},{"id":"cdf0b2cf.5964e8","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":247.14999389648438,"y":913.2499389648438,"wires":[]},{"id":"3d0294f1.345cec","type":"comment","z":"249aeb13.444e84","name":"1.4 Receiving Answers from Planning System (Node-RED <-- Planning)","info":"","x":261.1166687011719,"y":836.5666046142578,"wires":[]},{"id":"d822ac63.b430e8","type":"comment","z":"7b0fa635.67ef5","name":"2.1 Sending out a new Setpoint to TU (VPP --> Node-RED)","info":"","x":233.11669921875,"y":901.916748046875,"wires":[]},{"id":"1e3a2347.f610fd","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newSetpoint","method":"put","upload":false,"swaggerDoc":"","x":163.11669921875,"y":940.0165405273438,"wires":[["9947715.a48e99","eda31a89.b4951","91cb935e.4dddf"]]},{"id":"eda31a89.b4951","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.1166076660156,"y":939.0166625976562,"wires":[[]]},{"id":"4b13d705.4dca3","type":"http request","z":"7b0fa635.67ef5","name":"control_newSetpoint Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newSetpoint","tls":"","persist":false,"proxy":"","authType":"basic","x":1126.0000305175781,"y":939.7999877929688,"wires":[[]]},{"id":"4ebeb978.612f38","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"New setpoint (kW)","tooltip":"","group":"43be54a9.7cf664","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":116.11666870117188,"y":1288.11669921875,"wires":[["1e64eb7c.9c05f5"]]},{"id":"1e64eb7c.9c05f5","type":"function","z":"16acb04.7bc525","name":"","func":"var value = msg.payload;\nflow.set(\"activation_newSetpoint\",value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":322.1166687011719,"y":1291.11669921875,"wires":[[]]},{"id":"24c537cd.d2ec08","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":548.11669921875,"y":1327.0166015625,"wires":[["dc9ba1b2.d29fb"]]},{"id":"dc9ba1b2.d29fb","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newSetpoint","tls":"","persist":false,"proxy":"","authType":"basic","x":785.4500732421875,"y":1323.6665954589844,"wires":[["fdefe4e.1967098"]]},{"id":"fdefe4e.1967098","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1012.949951171875,"y":1323.6665954589844,"wires":[[]]},{"id":"3dc42559.4f579a","type":"comment","z":"16acb04.7bc525","name":"Node-RED --> VPP-Agent","info":"","x":805.2000732421875,"y":1285.5332946777344,"wires":[]},{"id":"5a4c63f9.04218c","type":"comment","z":"80f5f744.445108","name":"1.1 Receiving new setpoints or load profiles from agent (Node-RED --> TU)","info":"","x":288,"y":101,"wires":[]},{"id":"8a68fbfd.1c4f3","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/control_newSetpoint","method":"put","upload":false,"swaggerDoc":"","x":150,"y":141,"wires":[["4acccf45.36cfc8","c47d0fb5.97a21","b3cda314.7f7f4"]]},{"id":"4acccf45.36cfc8","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":211,"y":179,"wires":[]},{"id":"bf8eae57.5e5d68","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint[0];\nvar tuName = msg.payload.InterfacePayloadNewSetpoint.tuName.toString();\n\npayload = \n{\n\"newSetpoint\" : newSetpoint,\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":751.8333435058594,"y":175.6999969482422,"wires":[[]]},{"id":"4f953a80.1971fc","type":"comment","z":"80f5f744.445108","name":"Interface with data for the TU","info":"","x":759,"y":103,"wires":[]},{"id":"c47d0fb5.97a21","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":488.8334045410156,"y":175.95001220703125,"wires":[["bf8eae57.5e5d68"]]},{"id":"b3cda314.7f7f4","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750.8333740234375,"y":142.31666564941406,"wires":[[]]},{"id":"92b89e73.327e48","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1026,"y":104,"wires":[]},{"id":"50dd7e01.b20768","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":176,"y":599.0000305175781,"wires":[]},{"id":"1f782735.7721b1","type":"inject","z":"80f5f744.445108","name":"***test: inject a FAILURE ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":171,"y":677.0000305175781,"wires":[["adec5007.497f78"]]},{"id":"bbfcd06e.7ad9d8","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":677,"wires":[["39337a60.4c4296"]]},{"id":"39337a60.4c4296","type":"http request","z":"80f5f744.445108","name":"control_newSetpointFailed Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/control_newSetpointFailed","tls":"","persist":false,"proxy":"","authType":"basic","x":1119.699951171875,"y":677,"wires":[["b8b3657d.10a7a"]]},{"id":"b8b3657d.10a7a","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1407.199951171875,"y":677,"wires":[[]]},{"id":"5bc7e587.48e7f4","type":"inject","z":"80f5f744.445108","name":"***test: inject a DONE ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":163,"y":639.8500061035156,"wires":[["ccf09e07.25d6e8"]]},{"id":"515b794e.324","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":789.8499755859375,"y":639.8500061035156,"wires":[["b3a9bf70.fb5ec8"]]},{"id":"b3a9bf70.fb5ec8","type":"http request","z":"80f5f744.445108","name":"control_newSetpointDone Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/control_newSetpointDone","tls":"","persist":false,"proxy":"","authType":"basic","x":1109.550048828125,"y":639.8500061035156,"wires":[["7ee185a.84cc97c"]]},{"id":"7ee185a.84cc97c","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1410.050048828125,"y":638.8500061035156,"wires":[[]]},{"id":"adec5007.497f78","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":409.6166687011719,"y":676.5500183105469,"wires":[["bbfcd06e.7ad9d8"]]},{"id":"ccf09e07.25d6e8","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":409.8500061035156,"y":639.8500061035156,"wires":[["515b794e.324"]]},{"id":"882f25f.49a70d8","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\n400\nmachine32\n","x":1075.316650390625,"y":138.11666870117188,"wires":[]},{"id":"ac37e8b0.fdbc08","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \nnewSetpoint: \"400\", \ntuName: \"machine32\" \n}","x":1076.316650390625,"y":169.11666870117188,"wires":[]},{"id":"4bf7a435.05b3cc","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":789,"y":512.0000305175781,"wires":[["f1c7a8ce.5544f8"]]},{"id":"f1c7a8ce.5544f8","type":"http request","z":"80f5f744.445108","name":"control_newSetpointFailed Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/control_newSetpointFailed","tls":"","persist":false,"proxy":"","authType":"basic","x":1122.699951171875,"y":512.0000305175781,"wires":[["ad890f9d.f90e48"]]},{"id":"ad890f9d.f90e48","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1415.199951171875,"y":512.0000305175781,"wires":[[]]},{"id":"2472fef6.314632","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":789.8499755859375,"y":476.85003662109375,"wires":[["679f4808.89499"]]},{"id":"679f4808.89499","type":"http request","z":"80f5f744.445108","name":"control_newSetpointDone Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/control_newSetpointDone","tls":"","persist":false,"proxy":"","authType":"basic","x":1113.550048828125,"y":476.85003662109375,"wires":[["c911c33a.791d4"]]},{"id":"c911c33a.791d4","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1414.050048828125,"y":476.85003662109375,"wires":[[]]},{"id":"6d153d07.a27564","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1083,"y":431.00006103515625,"wires":[]},{"id":"8361a26b.d76578","type":"comment","z":"80f5f744.445108","name":"1. TU-Control Sequence","info":"","x":139,"y":68,"wires":[]},{"id":"7619e07a.81ef4","type":"comment","z":"80f5f744.445108","name":"1.2 Sending done or failire answer to agent (Node-RED <-- TU)","info":"","x":257,"y":406.0000305175781,"wires":[]},{"id":"4a27eee1.bddc48","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":534.9999694824219,"y":478.0000305175781,"wires":[]},{"id":"5c50f2e5.71e054","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":535,"y":515.0000305175781,"wires":[]},{"id":"428d2f71.9643b8","type":"comment","z":"80f5f744.445108","name":"2. Balancing Process","info":"","x":128.00001525878906,"y":799.0000610351562,"wires":[]},{"id":"379276f9.aa7f7a","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"TU name","tooltip":"","group":"43be54a9.7cf664","order":7,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":84.11666870117188,"y":1531.2166748046875,"wires":[["3732bad2.076cde"]]},{"id":"bdf2bbce.e66c28","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Balancing Start (Date)","group":"43be54a9.7cf664","order":8,"width":0,"height":0,"passthru":true,"topic":"","x":125.11666870117188,"y":1567.316650390625,"wires":[["6d5f4526.3b9cc4"]]},{"id":"11a148d9.ee7997","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Balancing Start (Time)","tooltip":"","group":"43be54a9.7cf664","order":9,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":125.11669921875,"y":1601.316650390625,"wires":[["c9eff026.71274"]]},{"id":"6d5f4526.3b9cc4","type":"function","z":"16acb04.7bc525","name":"","func":"var balancing_DateStart = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nbalancing_DateStart = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"balancing_DateStart\",balancing_DateStart);\nmsg.payload = balancing_DateStart;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":307.1166687011719,"y":1567.316650390625,"wires":[[]]},{"id":"c9eff026.71274","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"balancing_TimeStart\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":306.1166687011719,"y":1601.316650390625,"wires":[[]]},{"id":"ed57cae5.44387","type":"ui_button","z":"16acb04.7bc525","name":"","group":"43be54a9.7cf664","order":13,"width":0,"height":0,"passthru":false,"label":"Request Balancing","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":113.11666870117188,"y":1797.316650390625,"wires":[["394b318a.19604e"]]},{"id":"394b318a.19604e","type":"function","z":"16acb04.7bc525","name":"","func":"var balancingTUName = flow.get(\"balancing_tuName\");\nvar balancingUpdateRate = flow.get(\"balancing_updateRate\");\nvar balancingTimeStart = flow.get('balancing_TimeStart') || 0;\nvar balancingTimeEnd = flow.get('balancing_TimeEnd') || 0;\nvar balancingDateStart = flow.get('balancing_DateStart') || 0;\nvar balancingDateEnd = flow.get('balancing_DateEnd') || 0;\nvar balancingReferenceID = flow.get('balancing_referenceID') || 0;\n\nvar balancingStart = balancingDateStart +\" \"+ balancingTimeStart;\nvar balancingEnd = balancingDateEnd +\" \"+ balancingTimeEnd;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":315.7833557128906,"y":1796.5333251953125,"wires":[["1c07d8f7.f2fef7"]]},{"id":"b910345a.688388","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Balancing End (Date)","group":"43be54a9.7cf664","order":10,"width":0,"height":0,"passthru":true,"topic":"","x":122.11666870117188,"y":1639.316650390625,"wires":[["e0aabfe6.df1588"]]},{"id":"3c68e369.fc664c","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Balancing End (Time)","tooltip":"","group":"43be54a9.7cf664","order":11,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":122.11669921875,"y":1673.316650390625,"wires":[["6fdf83ad.6606a4"]]},{"id":"e0aabfe6.df1588","type":"function","z":"16acb04.7bc525","name":"","func":"var balancing_DateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nbalancing_DateEnd = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"balancing_DateEnd\",balancing_DateEnd);\nmsg.payload = balancing_DateEnd;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":304.1166687011719,"y":1639.316650390625,"wires":[["e7053618.ae2de"]]},{"id":"6fdf83ad.6606a4","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"balancing_TimeEnd\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":303.1166687011719,"y":1673.316650390625,"wires":[[]]},{"id":"79dc73a3.55042c","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"ReferenceID","tooltip":"","group":"43be54a9.7cf664","order":12,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":93.11666870117188,"y":1713.5167236328125,"wires":[["3405756d.f778e2"]]},{"id":"3405756d.f778e2","type":"function","z":"16acb04.7bc525","name":"","func":"var id = msg.payload;\nflow.set(\"balancing_referenceID\",id);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":306.23333740234375,"y":1714.11669921875,"wires":[[]]},{"id":"3732bad2.076cde","type":"function","z":"16acb04.7bc525","name":"","func":"var value = msg.payload;\nflow.set(\"balancing_tuName\",value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":309.1166687011719,"y":1531.4166259765625,"wires":[[]]},{"id":"f3918bf0.216788","type":"ui_text","z":"16acb04.7bc525","group":"43be54a9.7cf664","order":5,"width":0,"height":0,"name":"","label":"Balancing settings","format":"{{msg.payload}}","layout":"row-spread","x":116,"y":1452.2166748046875,"wires":[]},{"id":"1c07d8f7.f2fef7","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":534.11669921875,"y":1794.316650390625,"wires":[["42a6a26c.8b92fc","42b25325.3e3184"]]},{"id":"42a6a26c.8b92fc","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/balancing_subscribe","tls":"","persist":false,"proxy":"","authType":"basic","x":771.4500732421875,"y":1793.9666748046875,"wires":[["a80df5eb.c28df"]]},{"id":"a80df5eb.c28df","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":998.949951171875,"y":1790.9666442871094,"wires":[["4603b63a.963208"]]},{"id":"1f075e46.623182","type":"comment","z":"16acb04.7bc525","name":"Node-RED --> VPP-Agent","info":"","x":791.2000732421875,"y":1708.8333435058594,"wires":[]},{"id":"b5abb43c.0ee84","type":"comment","z":"7b0fa635.67ef5","name":"3.1 Requesting balancing (VPP --> Node-RED)","info":"","x":201.11671447753906,"y":1330.0166015625,"wires":[]},{"id":"8eaa7754.ddfe7","type":"http request","z":"7b0fa635.67ef5","name":"balancing_subscribe Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/balancing_subscribe","tls":"","persist":false,"proxy":"","authType":"basic","x":1128.4500885009766,"y":1366.8665771484375,"wires":[[]]},{"id":"89ee77c2.708c18","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var balancingTUName = msg.payload.balancingTUName;\nvar balancingUpdateRate = msg.payload.balancingUpdateRate;\nvar balancingStart = msg.payload.balancingStart;\nvar balancingEnd = msg.payload.balancingEnd;\nvar balancingReferenceID = msg.payload.balancingReferenceID;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":607.1167144775391,"y":1367.216552734375,"wires":[[]]},{"id":"8ea13f38.9cf77","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/balancing_subscribe","method":"put","upload":false,"swaggerDoc":"","x":172.11671447753906,"y":1367.216552734375,"wires":[["89ee77c2.708c18","ea219ae5.fee2b8","2e0ffecf.c10d12"]]},{"id":"42b25325.3e3184","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":844.9500732421875,"y":1604.7666015625,"wires":[]},{"id":"4603b63a.963208","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070.9500427246094,"y":1625.7666625976562,"wires":[]},{"id":"6d1b8efb.c9a35","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"UpdateRate (ms)","tooltip":"","group":"43be54a9.7cf664","order":12,"width":0,"height":0,"passthru":true,"mode":"number","delay":300,"topic":"","x":114.11666870117188,"y":1755.5167236328125,"wires":[["d35f9182.da209"]]},{"id":"d35f9182.da209","type":"function","z":"16acb04.7bc525","name":"","func":"var balancing_updateRate = msg.payload;\nflow.set(\"balancing_updateRate\", balancing_updateRate);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":318.1166687011719,"y":1755.5167236328125,"wires":[[]]},{"id":"e7053618.ae2de","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650.9499816894531,"y":1549.7666625976562,"wires":[]},{"id":"86bf663f.dc17e8","type":"comment","z":"80f5f744.445108","name":"2.1 Requesting from the VPP for balancing of the TU (Node-RED --> TU)","info":"","x":288.11668395996094,"y":830.61669921875,"wires":[]},{"id":"c8b0b0c0.33f61","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/balancing_request","method":"put","upload":false,"swaggerDoc":"","x":148.11669921875,"y":878.6167297363281,"wires":[["9f192355.4e774","633c4c86.b24cac","e4924964.725338"]]},{"id":"9f192355.4e774","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":210.11668395996094,"y":914.6167297363281,"wires":[]},{"id":"37d277dc.554f2","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var balancingStart = msg.payload.InterfacePayloadBalancing.balancingStart.toString();\nvar balancingEnd = msg.payload.InterfacePayloadBalancing.balancingEnd.toString();\nvar tuName = msg.payload.InterfacePayloadBalancing.tuName.toString();\n\npayload = \n{\n\"balancingStart\" : balancingStart,\n\"balancingEnd\" : balancingEnd,\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":583.9500427246094,"y":913.3167266845703,"wires":[[]]},{"id":"633c4c86.b24cac","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":366.9500732421875,"y":911.5667114257812,"wires":[["37d277dc.554f2"]]},{"id":"e4924964.725338","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":582.9500732421875,"y":879.9333953857422,"wires":[[]]},{"id":"c39badd0.c6566","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1031.11669921875,"y":832.61669921875,"wires":[]},{"id":"e696b414.59f738","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\n \n 2021-01-13 12:00:00\n \n \n 2021-01-13 13:00:00\n \n \n machine32\n \n\"","x":1080.433349609375,"y":878.7333984375,"wires":[]},{"id":"9f1c2dbb.fcded8","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \nbalancingStart: \"2021-01-13 12:00:00\",\nbalancingEnd: \"2021-01-13 13:00:00\",\ntuName: \"machine32\" \n}","x":1081.433349609375,"y":909.7333984375,"wires":[]},{"id":"578ea7ea.68352","type":"comment","z":"80f5f744.445108","name":"2.2 Sending answer to agent (Node-RED <-- TU)","info":"","x":204.11668395996094,"y":1007.7167358398438,"wires":[]},{"id":"2ec7e5e6.e9731a","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":837.11669921875,"y":1109.8166809082031,"wires":[["f607afe9.07a908"]]},{"id":"f607afe9.07a908","type":"http request","z":"80f5f744.445108","name":"balancing_refuse Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_refuse","tls":"","persist":false,"proxy":"","authType":"basic","x":1089.816650390625,"y":1109.8166809082031,"wires":[["d357eb16.264008"]]},{"id":"d357eb16.264008","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1358.316665649414,"y":1109.816650390625,"wires":[[]]},{"id":"f14a32c4.cd0018","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":837.9666748046875,"y":1074.6666870117188,"wires":[["904b5da0.c5cf5"]]},{"id":"904b5da0.c5cf5","type":"http request","z":"80f5f744.445108","name":"balancing_agree Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_agree","tls":"","persist":false,"proxy":"","authType":"basic","x":1088.666748046875,"y":1074.6666870117188,"wires":[["3a6acc8e.7e7814"]]},{"id":"3a6acc8e.7e7814","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1357.166763305664,"y":1074.6666564941406,"wires":[[]]},{"id":"d8450677.f5849","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":537.11669921875,"y":1076.8166809082031,"wires":[]},{"id":"6d46c543.c6ace4","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":537.11669921875,"y":1113.8166809082031,"wires":[]},{"id":"b3d1148e.e67978","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":166.42857360839844,"y":1152.6309242248535,"wires":[]},{"id":"a94bc934.79fc2","type":"inject","z":"80f5f744.445108","name":"***test: inject a Refuse ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":163.11668395996094,"y":1231.9167175292969,"wires":[["9e5d7a1d.fe835"]]},{"id":"9ba365f8.d5d2c8","type":"inject","z":"80f5f744.445108","name":"***test: inject a Agree***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":153.11668395996094,"y":1196.7667236328125,"wires":[["943b582.a467228"]]},{"id":"9e5d7a1d.fe835","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_MRL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":483.7333526611328,"y":1231.4668579101562,"wires":[["4dfba2d3.e68b5c"]]},{"id":"943b582.a467228","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_MRL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":483.96669006347656,"y":1195.766845703125,"wires":[["a1bcb739.dd70b"]]},{"id":"4dfba2d3.e68b5c","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":825.1167144775391,"y":1228.916748046875,"wires":[["8290c6a1.1eab8"]]},{"id":"8290c6a1.1eab8","type":"http request","z":"80f5f744.445108","name":"balancing_refuse Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_refuse","tls":"","persist":false,"proxy":"","authType":"basic","x":1085.816665649414,"y":1228.916748046875,"wires":[["8c237b53.418a2"]]},{"id":"a1bcb739.dd70b","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":825.9666900634766,"y":1193.7667541503906,"wires":[["2f62ef27.d23138"]]},{"id":"2f62ef27.d23138","type":"http request","z":"80f5f744.445108","name":"balancing_agree Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_agree","tls":"","persist":false,"proxy":"","authType":"basic","x":1083.666763305664,"y":1193.7667541503906,"wires":[["87adfb52.5f9a6","fa8b421b.543a28"]]},{"id":"8c237b53.418a2","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1352.699966430664,"y":1227.916748046875,"wires":[[]]},{"id":"87adfb52.5f9a6","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1351.550064086914,"y":1193.7667541503906,"wires":[[]]},{"id":"3d8a33c1.6fd7ac","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/control_failure","method":"put","upload":false,"swaggerDoc":"","x":122.11666870117188,"y":1197.11669921875,"wires":[["f7c3d01c.268b8","791a0152.12eef8"]]},{"id":"f7c3d01c.268b8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":178.41665649414062,"y":1231.1168212890625,"wires":[]},{"id":"d9489e48.16b4","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1074.0499572753906,"y":1199.0167846679688,"wires":[[]]},{"id":"191fee6d.4393e2","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.1166687011719,"y":1198.0167846679688,"wires":[[]]},{"id":"76051960.573808","type":"comment","z":"7b0fa635.67ef5","name":"2.2 Receiving Failure message (if failed) (VPP <-- Node-RED)","info":"","x":241.00003051757812,"y":1162,"wires":[]},{"id":"cfa47ae8.1f7db8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_agree","method":"put","upload":false,"swaggerDoc":"","x":130.0000457763672,"y":1470,"wires":[["ac75addb.af8b6","20950556.1415ea"]]},{"id":"ac75addb.af8b6","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.300048828125,"y":1505,"wires":[]},{"id":"4ef05b9f.399b04","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1074.9333038330078,"y":1472.9000549316406,"wires":[[]]},{"id":"a664297.b3e5c58","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610.0000152587891,"y":1470.9000244140625,"wires":[[]]},{"id":"4ca490c8.1561d","type":"comment","z":"7b0fa635.67ef5","name":"3.1 VPP <-- Node-RED: receiving agree or refuse message","info":"","x":230.0000457763672,"y":1435,"wires":[]},{"id":"20295959.21889e","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_refuse","method":"put","upload":false,"swaggerDoc":"","x":131.0000457763672,"y":1540,"wires":[["ea7915aa.5d8b8","9cc309a6.f888c"]]},{"id":"ea7915aa.5d8b8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.300048828125,"y":1577,"wires":[]},{"id":"2b12ad8c.bad76a","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1075.933364868164,"y":1541.9000549316406,"wires":[[]]},{"id":"e805ebda.c14dd8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000152587891,"y":1541.9000244140625,"wires":[[]]},{"id":"970aecc6.1192f8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_failure","method":"put","upload":false,"swaggerDoc":"","x":128.0000457763672,"y":1723,"wires":[["86b8f800.d93","47915bc6.0a05d4"]]},{"id":"86b8f800.d93","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":170.30003356933594,"y":1759.0000305175781,"wires":[]},{"id":"4d5c70a0.f49a6","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1069.933364868164,"y":1718.89990234375,"wires":[[]]},{"id":"a5b69353.5ca578","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000762939453,"y":1722.9000244140625,"wires":[[]]},{"id":"c89d360.a68b4c8","type":"comment","z":"7b0fa635.67ef5","name":"3.2 VPP <-- Node-RED: receiving balancing data or failure message","info":"","x":257.0000457763672,"y":1616,"wires":[]},{"id":"e852285b.0a9b58","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_inform","method":"put","upload":false,"swaggerDoc":"","x":128.0000457763672,"y":1651,"wires":[["5aec6876.b400b","d7277b7a.9617e"]]},{"id":"5aec6876.b400b","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":170.30003356933594,"y":1687.0000305175781,"wires":[]},{"id":"80d062f8.8bbd9","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1069.933364868164,"y":1644.9000244140625,"wires":[[]]},{"id":"dd27c947.5c265","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.BalancingSequenceInform.tuName[0];\nvar agentName = msg.payload.BalancingSequenceInform.agentName[0];\nvar feedIn = msg.payload.BalancingSequenceInform.tudataSet[0].feedIn[0];\nvar operatingPoint = msg.payload.BalancingSequenceInform.tudataSet[0].operatingPoint[0];\nvar leadingOperatingPoint = msg.payload.BalancingSequenceInform.tudataSet[0].leadingOperatingPoint[0];\nvar currentValueFR = msg.payload.BalancingSequenceInform.tudataSet[0].currentValueFR[0];\nvar assignedPool = msg.payload.BalancingSequenceInform.tudataSet[0].assignedPool[0];\nvar status = msg.payload.BalancingSequenceInform.tudataSet[0].status[0];\nvar frequency = msg.payload.BalancingSequenceInform.tudataSet[0].frequency[0];\n//var aFRRsetpoint = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRsetpoint[0];\nvar aFRRsetpointEcho = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRsetpointEcho[0];\nvar setpointFR = msg.payload.BalancingSequenceInform.tudataSet[0].setpointFR[0];\nvar aFRRGradientPOS = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRGradientPOS[0];\nvar aFRRGradientNEG = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRGradientNEG[0];\nvar capacityPOS = msg.payload.BalancingSequenceInform.tudataSet[0].capacityPOS[0];\nvar capacityNEG = msg.payload.BalancingSequenceInform.tudataSet[0].capacityNEG[0];\nvar holdingCapacityPOS = msg.payload.BalancingSequenceInform.tudataSet[0].holdingCapacityPOS[0];\nvar holdingCapacityNEG = msg.payload.BalancingSequenceInform.tudataSet[0].holdingCapacityNEG[0];\nvar controlBandPOS = msg.payload.BalancingSequenceInform.tudataSet[0].controlBandPOS[0];\nvar controlBandNEG = msg.payload.BalancingSequenceInform.tudataSet[0].controlBandNEG[0];\n\npayload = \n{\n \"tuName\": tuName, \n \"agentName\" : agentName,\n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n//\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n//Needed for UI Tests:\n//global.set(\"arrayStringBalancing\",payload);\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000762939453,"y":1650.9000244140625,"wires":[["d7e193fb.e97838"]]},{"id":"791a0152.12eef8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":449.95001220703125,"y":1198.4666137695312,"wires":[["191fee6d.4393e2"]]},{"id":"20950556.1415ea","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":444.11671447753906,"y":1470.5167236328125,"wires":[["a664297.b3e5c58"]]},{"id":"9cc309a6.f888c","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":442.11671447753906,"y":1541.7166748046875,"wires":[["e805ebda.c14dd8"]]},{"id":"d7277b7a.9617e","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":443.11669921875,"y":1650.7166748046875,"wires":[["dd27c947.5c265"]]},{"id":"47915bc6.0a05d4","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":443.11669921875,"y":1722.7166748046875,"wires":[["a5b69353.5ca578"]]},{"id":"955d08cb.ebe59","type":"comment","z":"7b0fa635.67ef5","name":"2. TU Control Sequence","info":"","x":124.00003051757812,"y":869.7166748046875,"wires":[]},{"id":"f8ced7f2.876ed8","type":"comment","z":"7b0fa635.67ef5","name":"3. TU Balancing","info":"","x":101.00004577636719,"y":1298.300048828125,"wires":[]},{"id":"bc50a512.0a6b58","type":"inject","z":"80f5f744.445108","name":"***test: inject a Failure ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170.00001525878906,"y":1524,"wires":[["d261524.3df47b"]]},{"id":"d261524.3df47b","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_MRL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":496.61668395996094,"y":1522.5501403808594,"wires":[["c84ee417.e90fc"]]},{"id":"c84ee417.e90fc","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":838.0000457763672,"y":1521.0000305175781,"wires":[["cadde0f0.d460e8"]]},{"id":"cadde0f0.d460e8","type":"http request","z":"80f5f744.445108","name":"balancing_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_failure","tls":"","persist":false,"proxy":"","authType":"basic","x":1098.6999969482422,"y":1521.0000305175781,"wires":[["8f369b5c.7d5fb"]]},{"id":"8f369b5c.7d5fb","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1360.5832977294922,"y":1518.0000305175781,"wires":[[]]},{"id":"2a6ce46f.8f169c","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":171.00001525878906,"y":1562,"wires":[["f6987ee6.262bd"]]},{"id":"f6987ee6.262bd","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n \"tuName\": \"TU_Company25\", \n\t\"feedIn\" : 10,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : 11,\t \t\t//Arbeitspunkt\n \"leadingOperatingPoint\" : 12,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : 13,\t\t\t//Regelleistungsistwert\n\t\"assignedPool\" : 14,\t\t\t//Poolzuordnung\n \"status\" : 15,\t\t\t\t\t//Status (Meldung)\n\t\"frequency\" : 16,\t\t\t\t//Frequenz\n\t\"aFRRsetpoint\" : 17,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : 200,\t\t//aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : 201,\t\t\t\t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : 202,\t\t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : 203,\t\t//aFRR-Gradient NEG\n\t\"capacityPOS\" : 204,\t\t\t//Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : 205,\t\t\t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : 206,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : 207,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : 208,\t\t\t//Regelband POS\n\t\"controlBandNEG\" : 209\t\t\t//Regelband NEG\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":495.61668395996094,"y":1562.5501403808594,"wires":[["98698d9e.fbff8"]]},{"id":"98698d9e.fbff8","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\nvar feedIn = msg.payload.feedIn || -99999;\nvar operatingPoint = msg.payload.operatingPoint || -99999;\nvar leadingOperatingPoint = msg.payload.leadingOperatingPoint || -99999;\nvar currentValueFR = msg.payload.currentValueFR || -99999;\nvar assignedPool = msg.payload.assignedPool || -99999;\nvar status = msg.payload.status || -99999;\nvar frequency = msg.payload.frequency || -99999;\nvar aFRRsetpoint = msg.payload.aFRRsetpoint || -99999;\nvar aFRRsetpointEcho = msg.payload.aFRRsetpointEcho || -99999;\nvar setpointFR = msg.payload.setpointFR || -99999;\nvar aFRRGradientPOS = msg.payload.aFRRGradientPOS || -99999;\nvar aFRRGradientNEG = msg.payload.aFRRGradientNEG || -99999;\nvar capacityPOS = msg.payload.capacityPOS || -99999;\nvar capacityNEG = msg.payload.capacityNEG || -99999;\nvar holdingCapacityPOS = msg.payload.holdingCapacityPOS || -99999;\nvar holdingCapacityNEG = msg.payload.holdingCapacityNEG || -99999;\nvar controlBandPOS = msg.payload.controlBandPOS || -99999;\nvar controlBandNEG = msg.payload.controlBandNEG || -99999;\n\npayload = \n{\n \"tuName\": tuName, \n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":837.0000457763672,"y":1561.0000305175781,"wires":[["f1fdd3de.0cd148"]]},{"id":"f1fdd3de.0cd148","type":"http request","z":"80f5f744.445108","name":"balancing_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_inform","tls":"","persist":false,"proxy":"","authType":"basic","x":1097.6999969482422,"y":1561.0000305175781,"wires":[["aae1ce40.ce7cc"]]},{"id":"aae1ce40.ce7cc","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1359.5832977294922,"y":1558.0000305175781,"wires":[[]]},{"id":"568f6a2a.1a021c","type":"comment","z":"80f5f744.445108","name":"2.3 Sending balancing values (Node-RED <-- TU)","info":"","x":220.8500213623047,"y":1309.25,"wires":[]},{"id":"16f5dabe.a8e825","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":547.8500518798828,"y":1407.25,"wires":[]},{"id":"61acfd8c.3ac704","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"tuName\": \"TUEmden0\", \n\t\"feedIn\" : 10,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : 11,\t \t\t//Arbeitspunkt\n \"leadingOperatingPoint\" : 12,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : 13,\t\t\t//Regelleistungsistwert\n\t\"assignedPool\" : 14,\t\t\t//Poolzuordnung\n \"status\" : 15,\t\t\t\t\t//Status (Meldung)\n\t\"frequency\" : 16,\t\t\t\t//Frequenz\n\t\"aFRRsetpoint\" : 17,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : 200,\t\t//aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : 201,\t\t\t\t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : 202,\t\t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : 203,\t\t//aFRR-Gradient NEG\n\t\"capacityPOS\" : 204,\t\t\t//Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : 205,\t\t\t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : 206,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : 207,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : 208,\t\t\t//Regelband POS\n\t\"controlBandNEG\" : 209\t\t\t//Regelband NEG\n}","x":547.8500518798828,"y":1444.25,"wires":[]},{"id":"c2e07ef4.6eecb","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":843.1167144775391,"y":1401.63330078125,"wires":[["29b72d02.3fab1a"]]},{"id":"29b72d02.3fab1a","type":"http request","z":"80f5f744.445108","name":"balancing_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_failure","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.816665649414,"y":1401.63330078125,"wires":[[]]},{"id":"edfc4902.2b5ee8","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\nvar feedIn = msg.payload.feedIn || -99999;\nvar operatingPoint = msg.payload.operatingPoint || -99999;\nvar leadingOperatingPoint = msg.payload.leadingOperatingPoint || -99999;\nvar currentValueFR = msg.payload.currentValueFR || -99999;\nvar assignedPool = msg.payload.assignedPool || -99999;\nvar status = msg.payload.status || -99999;\nvar frequency = msg.payload.frequency || -99999;\nvar aFRRsetpoint = msg.payload.aFRRsetpoint || -99999;\nvar aFRRsetpointEcho = msg.payload.aFRRsetpointEcho || -99999;\nvar setpointFR = msg.payload.setpointFR || -99999;\nvar aFRRGradientPOS = msg.payload.aFRRGradientPOS || -99999;\nvar aFRRGradientNEG = msg.payload.aFRRGradientNEG || -99999;\nvar capacityPOS = msg.payload.capacityPOS || -99999;\nvar capacityNEG = msg.payload.capacityNEG || -99999;\nvar holdingCapacityPOS = msg.payload.holdingCapacityPOS || -99999;\nvar holdingCapacityNEG = msg.payload.holdingCapacityNEG || -99999;\nvar controlBandPOS = msg.payload.controlBandPOS || -99999;\nvar controlBandNEG = msg.payload.controlBandNEG || -99999;\n\npayload = \n{\n \"tuName\": tuName, \n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":842.1167144775391,"y":1441.63330078125,"wires":[["46578b7e.066b1c"]]},{"id":"46578b7e.066b1c","type":"http request","z":"80f5f744.445108","name":"balancing_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_inform","tls":"","persist":false,"proxy":"","authType":"basic","x":1102.816665649414,"y":1441.63330078125,"wires":[[]]},{"id":"6a1a4b0d.273efc","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":176.11668395996094,"y":1490.2166748046875,"wires":[]},{"id":"40b404ed.66b1bc","type":"http request","z":"43429a7f.e2c06c","name":"accounting_energyConsumptionProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/ems-agent/accounting_energyConsumptionProfile","tls":"","persist":false,"proxy":"","authType":"","x":1146.7334594726562,"y":163.78346252441406,"wires":[[]]},{"id":"7f7a279b.c86d5","type":"http in","z":"43429a7f.e2c06c","name":"","url":"/ems-agent/accounting_energyConsumptionProfile","method":"put","upload":false,"swaggerDoc":"","x":225.73333740234375,"y":164.98329162597656,"wires":[["a3a68938.bc1e28","e3377e77.512f88"]]},{"id":"a3a68938.bc1e28","type":"http response","z":"43429a7f.e2c06c","name":"Response","statusCode":"","headers":{},"x":357.0333251953125,"y":200.98341369628906,"wires":[]},{"id":"be6ca6f2.a38be","type":"comment","z":"43429a7f.e2c06c","name":"1. Sending the Energy-Consumption-Profile to the VPP (Node-RED <-- EMS)","info":"","x":295,"y":123.30000305175781,"wires":[]},{"id":"e3377e77.512f88","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":739.0499877929688,"y":163.99993896484375,"wires":[["40b404ed.66b1bc"]]},{"id":"e3f11434.578bb8","type":"comment","z":"43429a7f.e2c06c","name":"Communication direction: Node-RED --> ERP","info":"","x":184,"y":482,"wires":[]},{"id":"69e6107c.a2eba8","type":"comment","z":"43429a7f.e2c06c","name":"Receiving Inform (ECP has been transmitted) from VPP","info":"","x":214.11666870117188,"y":518.1000366210938,"wires":[]},{"id":"bd74e65b.949068","type":"http in","z":"43429a7f.e2c06c","name":"","url":"/ems/accounting_ecpReceived","method":"put","upload":false,"swaggerDoc":"","x":159.11666870117188,"y":568,"wires":[["11d9009f.ace6cf","86669963.a95af8"]]},{"id":"11d9009f.ace6cf","type":"http response","z":"43429a7f.e2c06c","name":"Response","statusCode":"","headers":{},"x":178.11666870117188,"y":611,"wires":[]},{"id":"484fe684.a1dd98","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID[0];\n\nmsg.payload = {\n \"tuName\" : tuName,\n \"referenceID\" : referenceID\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":586.9500732421875,"y":567.7000122070312,"wires":[[]]},{"id":"86669963.a95af8","type":"xml","z":"43429a7f.e2c06c","name":"to JSON","property":"payload","attr":"","chr":"","x":412.9500427246094,"y":567.9500122070312,"wires":[["484fe684.a1dd98"]]},{"id":"c9bb9301.bf30e","type":"http request","z":"43429a7f.e2c06c","name":"Endpoint of EMS","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1046.566650390625,"y":568.1000366210938,"wires":[["79ecfcda.4492b4"]]},{"id":"79ecfcda.4492b4","type":"json","z":"43429a7f.e2c06c","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1283.066650390625,"y":568.1000366210938,"wires":[[]]},{"id":"31dcb7b2.6e9758","type":"comment","z":"43429a7f.e2c06c","name":"EMS Endpoint","info":"","x":1027.566650390625,"y":515.1000366210938,"wires":[]},{"id":"2af4749c.f71b94","type":"comment","z":"43429a7f.e2c06c","name":"***Value Simulation for this part***","info":"","x":158.11666870117188,"y":332.2166748046875,"wires":[]},{"id":"d56f925.00c6e7","type":"http request","z":"43429a7f.e2c06c","name":"accounting_energyConsumptionProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/ems-agent/accounting_energyConsumptionProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1177,"y":237,"wires":[[]]},{"id":"c5f76bb0.6a5048","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":741.11669921875,"y":373.89996337890625,"wires":[["147f9215.71b9ae"]]},{"id":"4a5db852.57fbc8","type":"inject","z":"43429a7f.e2c06c","name":"**TEST**Inject a predefined XML to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"a\":1}","payloadType":"str","x":199.11666870117188,"y":375.3999328613281,"wires":[["d08471fa.78907"]]},{"id":"d08471fa.78907","type":"template","z":"43429a7f.e2c06c","name":"**TEST**XML-Template","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"ENERGYCONSUMPTIONPROFILE\"\n \"TU_Company1_MRL\"\n \n \"6000\"\n \"22000\"\n \n","output":"str","x":508.1166687011719,"y":375.3999328613281,"wires":[["c5f76bb0.6a5048"]]},{"id":"9e508df5.6bc378","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"payload = {\"tuName\" : \"TU_Company1_MRL\",\n \"referenceID\" : \"testID123\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":742.11669921875,"y":414.4999084472656,"wires":[["4d8d2c86.75022c"]]},{"id":"38db7ae2.7bae2e","type":"inject","z":"43429a7f.e2c06c","name":"**TEST**Inject a schedulingPlanUploaded to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":230.11666870117188,"y":415.3999328613281,"wires":[["9e508df5.6bc378"]]},{"id":"6f7e558c.3ed5d4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/accounting_energyConsumptionProfileReference","method":"put","upload":false,"swaggerDoc":"","x":230.85003662109375,"y":1977.64990234375,"wires":[["b5c11512.7832a","24bcedde.901022"]]},{"id":"b5c11512.7832a","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.1500244140625,"y":2012.6499328613281,"wires":[]},{"id":"d32af972.122d08","type":"comment","z":"7b0fa635.67ef5","name":"4.1 VPP <-- Node-RED: sending the energy consumption profiles to the VPP ","info":"","x":289.85003662109375,"y":1861.64990234375,"wires":[]},{"id":"674a876.c3cc6f8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/accounting_energyConsumptionProfile","method":"put","upload":false,"swaggerDoc":"","x":200.73336791992188,"y":1904.7499389648438,"wires":[["ec1a4d89.414b4","deb11ce8.5d735"]]},{"id":"ec1a4d89.414b4","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":174.85003662109375,"y":1940.75,"wires":[]},{"id":"91a3c6e6.afba58","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n//code for UI Test:\n//global.set(\"arrayStringAccounting\",msg.payload);\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":719.8499755859375,"y":1976.75,"wires":[["4dfb481c.c9f398"]]},{"id":"deb11ce8.5d735","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = flow.get('energyConsumptionProfile');\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":719.6832275390625,"y":1904.349609375,"wires":[[]]},{"id":"9cee7dfa.9adaa8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1172.0333251953125,"y":1902.64990234375,"wires":[[]]},{"id":"df50ecce.f12f08","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1171.2999267578125,"y":1973.64990234375,"wires":[[]]},{"id":"99b82672.989498","type":"comment","z":"7b0fa635.67ef5","name":"4. Accounting","info":"","x":90.85003662109375,"y":1827.449951171875,"wires":[]},{"id":"24bcedde.901022","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":550.8499755859375,"y":1977.050048828125,"wires":[["91a3c6e6.afba58"]]},{"id":"a5c124b5.33e078","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.85009765625,"y":2076.8502197265625,"wires":[["c9286592.2b2a4"]]},{"id":"c9286592.2b2a4","type":"http request","z":"7b0fa635.67ef5","name":"accounting_ECPReceived Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/accounting_ECPReceived","tls":"","persist":false,"proxy":"","authType":"basic","x":1149.550048828125,"y":2079.8499755859375,"wires":[[]]},{"id":"cb798789.4f5418","type":"comment","z":"7b0fa635.67ef5","name":"4.2 Confirming the ECP has been received (VPP --> Node-RED)","info":"","x":252.85000610351562,"y":2047.4500732421875,"wires":[]},{"id":"4f37ff3d.8db8c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/accounting_ECPReceived","method":"put","upload":false,"swaggerDoc":"","x":184,"y":2082.0501708984375,"wires":[["35f8281d.faff2"]]},{"id":"3764e13.ec19a1e","type":"ui_text","z":"16acb04.7bc525","group":"43be54a9.7cf664","order":21,"width":"6","height":"5","name":"Anzeige Scheduling Ergebnisse","label":"Balancing data","format":"{{msg.payload}}","layout":"row-spread","x":492.4999694824219,"y":1904.8166809082031,"wires":[]},{"id":"c1ef54da.18aa6","type":"function","z":"16acb04.7bc525","name":"Load Values","func":"var schedulingPlanInfos = global.get(\"arrayStringBalancing\");\nmsg.payload = schedulingPlanInfos;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":248,"y":1905.8166809082031,"wires":[["3764e13.ec19a1e","97d03a0.a24ce48"]]},{"id":"b747d5fa.4ae4a","type":"inject","z":"16acb04.7bc525","name":"","props":[{"p":"payload"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":91,"y":1905.8166809082031,"wires":[["c1ef54da.18aa6"]]},{"id":"97d03a0.a24ce48","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":399.1166687011719,"y":1863.4166564941406,"wires":[]},{"id":"95bf969c.3b139","type":"ui_text","z":"16acb04.7bc525","group":"43be54a9.7cf664","order":14,"width":0,"height":0,"name":"","label":"BALANCING INFOS","format":"{{msg.payload}}","layout":"row-spread","x":121.94999694824219,"y":1856.183349609375,"wires":[]},{"id":"ef9cfcb0.2e2248","type":"ui_text","z":"16acb04.7bc525","group":"7b2edbef.0d9274","order":1,"width":"6","height":"1","name":"","label":"Accounting Information","format":"{{msg.payload}}","layout":"row-spread","x":120.94999694824219,"y":2026.183349609375,"wires":[]},{"id":"8850b9de.0e4a28","type":"ui_text","z":"16acb04.7bc525","group":"7b2edbef.0d9274","order":2,"width":"6","height":"5","name":"Anzeige Scheduling Ergebnisse","label":"Accounting received from","format":"{{msg.payload}}","layout":"row-spread","x":493.4999694824219,"y":2073.816650390625,"wires":[]},{"id":"46e9e591.14ce44","type":"function","z":"16acb04.7bc525","name":"Load Values","func":"var schedulingPlanInfos = global.get(\"arrayStringAccounting\");\nmsg.payload = schedulingPlanInfos;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":249,"y":2074.816650390625,"wires":[["8850b9de.0e4a28"]]},{"id":"cf952ad3.b0a178","type":"inject","z":"16acb04.7bc525","name":"","props":[{"p":"payload"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":92,"y":2074.816650390625,"wires":[["46e9e591.14ce44"]]},{"id":"df35595b.e56b6","type":"comment","z":"249aeb13.444e84","name":"1. Scheduling Process","info":"","x":127.11666870117188,"y":84.11666870117188,"wires":[]},{"id":"1fb1eb53.24102d","type":"comment","z":"249aeb13.444e84","name":"2. LoadTimeWindowsShare-Procoess","info":"","x":180.11666870117188,"y":1659.11669921875,"wires":[]},{"id":"413f2ae7.26e4fc","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/loadTimeWindows_request","method":"put","upload":false,"swaggerDoc":"","x":190.11666870117188,"y":1740.1168212890625,"wires":[["66472cd6.ad5154","e197e053.ee3818"]]},{"id":"66472cd6.ad5154","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":292.1166687011719,"y":1777.1168212890625,"wires":[]},{"id":"e197e053.ee3818","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.loadTimeWindowsReference;\n\n\npayload = \n{\"loadTimeWindowsReference\" : loadTimeWindowsReference};\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":751.7501220703125,"y":1740.4171142578125,"wires":[["cc4760ff.3755"]]},{"id":"cc4760ff.3755","type":"http request","z":"249aeb13.444e84","name":"loadTimeWindows_request Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/loadTimeWindows_request","tls":"","persist":false,"proxy":"","authType":"","x":1136.750244140625,"y":1738.4171142578125,"wires":[[]]},{"id":"e945b187.8d72b8","type":"comment","z":"249aeb13.444e84","name":"2.1 Requesting the VPP to share the LoadTimeWindows (Node-RED <-- Planning)","info":"","x":319.1166687011719,"y":1697.11669921875,"wires":[]},{"id":"cdcbddf3.477838","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"payload = {\"loadTimeWindowsReference\" : \"Tariff22\"};\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":727.7501220703125,"y":2025.51708984375,"wires":[["c8b63260.1661d"]]},{"id":"c8b63260.1661d","type":"http request","z":"249aeb13.444e84","name":"loadTimeWindows_request Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/loadTimeWindows_request","tls":"","persist":false,"proxy":"","authType":"","x":1013.7501831054688,"y":2025.51708984375,"wires":[[]]},{"id":"efb75177.c090c8","type":"comment","z":"249aeb13.444e84","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":160.11666870117188,"y":1992.31689453125,"wires":[]},{"id":"58c7c3e4.b58f74","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a Request LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":229.11666870117188,"y":2026.11669921875,"wires":[["cdcbddf3.477838"]]},{"id":"5ed850ef.02f9e","type":"comment","z":"249aeb13.444e84","name":"2.2 Receiving the LoadTimeWindows (Node-RED --> Planning)","info":"","x":254.11666870117188,"y":1839.14990234375,"wires":[]},{"id":"40e7819d.e116e8","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/loadTimeWindows_inform","method":"put","upload":false,"swaggerDoc":"","x":164.11666870117188,"y":1879.25,"wires":[["49b9d8dd.06b6e8","e0ec2ab8.7cb6d"]]},{"id":"49b9d8dd.06b6e8","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":244.11666870117188,"y":1918.25,"wires":[]},{"id":"bc5d7ca7.1db55","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\nvar windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\nvar windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\nvar windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\nvar windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\nmsg.payload = {\n \"loadTimeWindowsReference\" : loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" : windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":592.9500732421875,"y":1881.94970703125,"wires":[[]]},{"id":"e0ec2ab8.7cb6d","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":398.9500427246094,"y":1882.2000122070312,"wires":[["bc5d7ca7.1db55"]]},{"id":"92a4b154.fbd958","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1082.566650390625,"y":1879.3502197265625,"wires":[["13adb11f.037e3f"]]},{"id":"13adb11f.037e3f","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1311.066650390625,"y":1879.3502197265625,"wires":[[]]},{"id":"61077878.886ce","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1072.11669921875,"y":1839.2501220703125,"wires":[]},{"id":"2074a0d4.a445d8","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n loadTimeWindowsReference : \"Tariff22\",\n windowHighBegin : \"2020-02-18 05:00:00.0\",\n windowHighEnd : \"2020-02-18 07:00:00.0\",\n windowLowBegin : \"2020-08-18 05:00:00.0\",\n windowLowEnd : \"2020-08-18 07:00:00.0\"\n}","x":852.13330078125,"y":1882.3502197265625,"wires":[]},{"id":"6306d75c.a18c","type":"comment","z":"7b0fa635.67ef5","name":"5. (A) LoadTimeWindowsShare-Process via direct request","info":"","x":238.00003051757812,"y":2183,"wires":[]},{"id":"cc4d3e1a.b345c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/loadTimeWindows_inform","method":"put","upload":false,"swaggerDoc":"","x":186.00003051757812,"y":2357.0001220703125,"wires":[["1b94c58a.f73582","78732cad.49bf54"]]},{"id":"1b94c58a.f73582","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.00003051757812,"y":2393,"wires":[]},{"id":"78732cad.49bf54","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.loadTimeWindowsReference;\nvar windowHighBegin = msg.payload.windowHighBegin;\nvar windowHighEnd = msg.payload.windowHighEnd;\nvar windowLowBegin = msg.payload.windowLowBegin;\nvar windowLowEnd = msg.payload.windowLowEnd;\n\npayload = \n{\n \"loadTimeWindowsReference\": loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" :windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.6334838867188,"y":2356.30029296875,"wires":[["86fd511a.b8fda"]]},{"id":"86fd511a.b8fda","type":"http request","z":"7b0fa635.67ef5","name":"loadTimeWindows_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_inform","tls":"","persist":false,"proxy":"","authType":"","x":1154.633544921875,"y":2356.3004150390625,"wires":[[]]},{"id":"a8117b63.6a188","type":"comment","z":"7b0fa635.67ef5","name":"5.2 Requesting the VPP to share the LoadTimeWindows (Node-RED <-- VPP)","info":"","x":296.0000305175781,"y":2322,"wires":[]},{"id":"2318e0df.817d9","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n","x":458.00006103515625,"y":2389.10009765625,"wires":[]},{"id":"7803cad9.a821dc","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"payload = {\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.6334228515625,"y":2469.400390625,"wires":[["86fd511a.b8fda"]]},{"id":"34042585.8fcd3a","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":159.00003051757812,"y":2437.2001953125,"wires":[]},{"id":"f2935e79.b2095","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":215.00003051757812,"y":2471,"wires":[["7803cad9.a821dc"]]},{"id":"fa84c689.a05538","type":"comment","z":"7b0fa635.67ef5","name":"5.1 Receiving the LoadTimeWindows (VPP <-- Node-RED)","info":"","x":238,"y":2217.033203125,"wires":[]},{"id":"16e4330f.07cf35","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/loadTimeWindows_request","method":"put","upload":false,"swaggerDoc":"","x":167,"y":2253.1331787109375,"wires":[["d5253f40.a9b318","2fa571b6.1e4c56"]]},{"id":"d5253f40.a9b318","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":183,"y":2286.13330078125,"wires":[]},{"id":"2417057e.0beb4a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\n//var windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\n//var windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\n//var windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\n//var windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\nmsg.payload = {\n \"loadTimeWindowsReference\" : loadTimeWindowsReference,\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.8333740234375,"y":2255.8330078125,"wires":[[]]},{"id":"2fa571b6.1e4c56","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":459.8333740234375,"y":2253.083251953125,"wires":[["2417057e.0beb4a"]]},{"id":"ce44d654.b99c38","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1094.449951171875,"y":2249.2333984375,"wires":[[]]},{"id":"e3122478.73e4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n\"loadTimeWindowsReference\" : \"tariff22\" \n}","x":862.0166015625,"y":2251.2333984375,"wires":[]},{"id":"ccd7c37f.08a3b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/loadTimeWindows_broadcast","method":"put","upload":false,"swaggerDoc":"","x":199.00003051757812,"y":2578,"wires":[["b616ed4e.7387c8","2fa948eb.967e88"]]},{"id":"b616ed4e.7387c8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.00003051757812,"y":2614,"wires":[]},{"id":"ab393d18.32128","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\nvar windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\nvar windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\nvar windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\nvar windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\n\nmsg.payload = \n{\n \"loadTimeWindowsReference\": loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" :windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.6334228515625,"y":2578.30029296875,"wires":[["5e353c9b.dc1aa4"]]},{"id":"5e353c9b.dc1aa4","type":"http request","z":"7b0fa635.67ef5","name":"loadTimeWindows_broadcast Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_broadcast","tls":"","persist":false,"proxy":"","authType":"","x":1173.633544921875,"y":2577.30029296875,"wires":[[]]},{"id":"310fc528.3cb4ba","type":"comment","z":"7b0fa635.67ef5","name":"5.3 Broadcasting new LoadTimeWindows to everyone","info":"","x":228.00003051757812,"y":2542,"wires":[]},{"id":"66aacc19.37c1fc","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n","x":466.00006103515625,"y":2644.10009765625,"wires":[]},{"id":"a7d1eb4f.93483","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":161.00003051757812,"y":2658.7998046875,"wires":[]},{"id":"1d48cb30.f62b35","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":214.00003051757812,"y":2693.599609375,"wires":[["cbf0562.376d728"]]},{"id":"cbf0562.376d728","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"\npayload = {\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n\nmsg.payload = payload;\n// payload = {\"schedulingPlanUploaded\" : true}\n//msg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625,"y":2692,"wires":[["5e353c9b.dc1aa4"]]},{"id":"a2da4710.b0155","type":"comment","z":"249aeb13.444e84","name":"JADE Interface (TU-Agent)","info":"","x":1111.2667236328125,"y":313.56671142578125,"wires":[]},{"id":"90cc8d6.837fa7","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.1166687011719,"y":255.11666870117188,"wires":[["6926c4e6.6beeac"]]},{"id":"f8dfe605.43a1d8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":454.1166687011719,"y":691.7166442871094,"wires":[["dc6fc640.e2eb68"]]},{"id":"77f071ba.06b89","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1196.5333251953125,"y":872.7166748046875,"wires":[]},{"id":"227f2efc.6742b2","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1198.5333251953125,"y":933.7166748046875,"wires":[]},{"id":"f4c97494.1eb95","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** SCHEDULING ********************************************","info":"","x":335.1166687011719,"y":40.116668701171875,"wires":[]},{"id":"f6c4085c.daa378","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1117.1166687011719,"y":105.11666870117188,"wires":[]},{"id":"30d600ce.7d3488","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\",\n tuName: \"TUEmden0\"me :\"TUEmden0\"\n}","x":860.11669921875,"y":257.1166687011719,"wires":[]},{"id":"71f1dc5f.e63474","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n//the payload can be any form of XML the VPP needs for the planning of the TU\n//shown in String:\n\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","x":861.5,"y":330.2166748046875,"wires":[]},{"id":"f82b4e6a.fbb53","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\", \n tuName: \"noNameSet\" \n}","x":860.9833374023438,"y":405.2166748046875,"wires":[]},{"id":"70d6390a.c9915","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.11666870117188,"y":542.3166198730469,"wires":[]},{"id":"9b8a2c67.c398a8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.11666870117188,"y":617.3166198730469,"wires":[]},{"id":"884b52c2.6c38","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1110.683349609375,"y":478.31658935546875,"wires":[]},{"id":"e5128683.afd308","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1066.1500244140625,"y":654.6166687011719,"wires":[]},{"id":"32bf6866.c4a3d8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany0, RequestMRL041221\", \n tuName: \"TUEmden0\" \n}","x":855.11669921875,"y":690.5166320800781,"wires":[]},{"id":"1393cb24.6ed505","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\",\n tuName: \"TUEmden0\"\n}","x":855.11669921875,"y":767.5166320800781,"wires":[]},{"id":"7995e15c.5fec78","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":453.8500061035156,"y":764.0499572753906,"wires":[["7364643d.31052c"]]},{"id":"a4ba88a2.2feec","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.8500061035156,"y":403.8500061035156,"wires":[["316b4f43.5946a8"]]},{"id":"744ba7c7.f971d8","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** TU CONTROL********************************************","info":"","x":333.85003662109375,"y":836.449951171875,"wires":[]},{"id":"290e417.5fbacbe","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1115.8500061035156,"y":903.050048828125,"wires":[]},{"id":"81b26319.06a4d8","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1063.8500061035156,"y":1162.050048828125,"wires":[]},{"id":"5fa7843f.3791b4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TU-EMDEN-CompanyXY-ProcessZ\"\n}","x":847.8499755859375,"y":1198.449951171875,"wires":[]},{"id":"aef6a421.62cca","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** TU BALANCING********************************************","info":"","x":348.8500518798828,"y":1265.25,"wires":[]},{"id":"e78d2cfa.a3cc48","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** ACCOUNTING********************************************","info":"","x":335.85003662109375,"y":1794.64990234375,"wires":[]},{"id":"be2e3380.7b29b","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** LOADTIMEWINDOWS-SHARE********************************************","info":"","x":390.85003662109375,"y":2147.449951171875,"wires":[]},{"id":"a570ea95.370248","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"\n 2021-02-05 12:00:00\n 2021-02-05 13:00:00\n empty\n scheduling-1\n","x":845,"y":644,"wires":[]},{"id":"df9e8334.57c338","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"\n empty\n empty\n empty\n scheduling-1\n","x":849,"y":743,"wires":[]},{"id":"94b9338b.7d1b3","type":"comment","z":"249aeb13.444e84","name":"JADE Interface (TU-Agent)","info":"","x":1116,"y":837,"wires":[]},{"id":"c468ffae.355d2","type":"comment","z":"249aeb13.444e84","name":"JADE Interface (TU-Agent)","info":"","x":1096,"y":1698.199951171875,"wires":[]},{"id":"109b0bdd.a32c24","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"\n 2021-02-05 12:00:00\n 2021-02-05 13:00:00\n 2021-02-04 22:00:00\n scheduling-1\n\"","x":863,"y":163,"wires":[]},{"id":"70e7a78d.5095","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"{\n schedulingStart: \"2021-02-05 12:00:00\",\n schedulingEnd: \"2021-02-05 13:00:00\",\n referenceID: \"scheduling-1\"\n}","x":845,"y":681,"wires":[]},{"id":"1b39d02a.12026","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"{\n referenceID: \"scheduling-1\"\n}","x":849,"y":778,"wires":[]},{"id":"af8854ba.ca6638","type":"comment","z":"249aeb13.444e84","name":"****************************************** TESTING FOR THE SECTION ABOVE ********************************************","info":"","x":422.9999694824219,"y":1072,"wires":[]},{"id":"57d594c.9fa8a6c","type":"comment","z":"249aeb13.444e84","name":"****************************************** SCHEDULING ********************************************","info":"","x":335.8500061035156,"y":47.849998474121094,"wires":[]},{"id":"3ca33c8.d275fc4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newLoadProfile","method":"put","upload":false,"swaggerDoc":"","x":174.00003051757812,"y":1014,"wires":[["9fc17a13.197448","751aa5cc.975834"]]},{"id":"9fc17a13.197448","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.30001831054688,"y":1048,"wires":[]},{"id":"751aa5cc.975834","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":619.9334106445312,"y":1014.2999877929688,"wires":[["df2e2dca.4fd7f8"]]},{"id":"df2e2dca.4fd7f8","type":"http request","z":"7b0fa635.67ef5","name":"control_newLoadProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfile","tls":"","persist":false,"proxy":"","authType":"","x":1132.9333801269531,"y":1015.300048828125,"wires":[[]]},{"id":"c42d76ba.38d74","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newLoadProfileUploaded","method":"put","upload":false,"swaggerDoc":"","x":202.00003051757812,"y":1085.0999908447266,"wires":[["883818ec.815dd8","774c3cf3.b19f24","e02adc48.0aa598"]]},{"id":"883818ec.815dd8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":182.00003051757812,"y":1121.0999755859375,"wires":[]},{"id":"774c3cf3.b19f24","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.6334838867188,"y":1084.4000244140625,"wires":[[]]},{"id":"5ac310c4.37c028","type":"http request","z":"7b0fa635.67ef5","name":"control_newLoadProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1163.6334533691406,"y":1084.4000244140625,"wires":[[]]},{"id":"9947715.a48e99","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":181.85003662109375,"y":972.6500244140625,"wires":[]},{"id":"68e00a54.e43204","type":"comment","z":"80f5f744.445108","name":"****************************************** TU-CONTROL ********************************************","info":"","x":339,"y":35,"wires":[]},{"id":"c083fe0d.69ccf","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/control_newLoadProfile","method":"put","upload":false,"swaggerDoc":"","x":160,"y":320,"wires":[["84b9b749.bf19b8","f1cc29d.fbc5ad8"]]},{"id":"84b9b749.bf19b8","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":233.29998779296875,"y":356.0000305175781,"wires":[]},{"id":"c91382cd.11aa98","type":"file","z":"80f5f744.445108","name":"","filename":"saving file in local folder","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"utf8","x":758.8333740234375,"y":355.0666809082031,"wires":[[]]},{"id":"5ff2f1ae.11512","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/control_newLoadProfileInfo","method":"put","upload":false,"swaggerDoc":"","x":169.88333129882812,"y":241.10003662109375,"wires":[["eec7784c.31a188","e5ea65e5.15538"]]},{"id":"eec7784c.31a188","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":248,"y":277.10003662109375,"wires":[]},{"id":"65ecb925.7f478","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780.0000305175781,"y":241.10003662109375,"wires":[[]]},{"id":"f1cc29d.fbc5ad8","type":"function","z":"80f5f744.445108","name":"Setting file info","func":"var schedulingPlanInfos = flow.get('schedulingPlanInfos');\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":787.8334045410156,"y":319.6999816894531,"wires":[["c91382cd.11aa98"]]},{"id":"e5ea65e5.15538","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":492.0000305175781,"y":240.00003051757812,"wires":[["65ecb925.7f478"]]},{"id":"c338a7da.6d4338","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n tuName: \"TUEmden0\"me :\"TUEmden0\"\n}","x":1082,"y":242.00003051757812,"wires":[]},{"id":"d08e697e.54f19","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n//the payload can be any form of XML the VPP needs for the planning of the TU\n//shown in String:\n\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","x":1081.38330078125,"y":322.10003662109375,"wires":[]},{"id":"c6ebc9fd.03dff8","type":"ui_button","z":"16acb04.7bc525","name":"","group":"43be54a9.7cf664","order":4,"width":0,"height":0,"passthru":false,"label":"Set LoadProfile","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":110.11666870117188,"y":1375.316650390625,"wires":[["34e4a771.ad3a5","5701f34e.c7c964"]]},{"id":"34e4a771.ad3a5","type":"function","z":"16acb04.7bc525","name":"","func":"tuName = flow.get(\"activation_tuName\");\n\nmsg.payload = {\n \"tuName\" : tuName,\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":334.7833557128906,"y":1375.5333251953125,"wires":[["b16c69e0.7529d"]]},{"id":"a7ea75e5.0cc19","type":"function","z":"16acb04.7bc525","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":792.7833557128906,"y":1373.4168090820312,"wires":[["6fb387db.72c018"]]},{"id":"6fb387db.72c018","type":"http request","z":"16acb04.7bc525","name":"control_newLoadProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfile","tls":"","persist":false,"proxy":"","authType":"","x":1083.7833251953125,"y":1371.4168090820312,"wires":[["6e964072.6eb7a"]]},{"id":"b16c69e0.7529d","type":"function","z":"16acb04.7bc525","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":782.4835510253906,"y":1413.5169067382812,"wires":[["2feddf0f.90ed7"]]},{"id":"2feddf0f.90ed7","type":"http request","z":"16acb04.7bc525","name":"control_newLoadProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1104.4834289550781,"y":1421.5169067382812,"wires":[["c4db6b96.98d56"]]},{"id":"6e964072.6eb7a","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1353.6999206542969,"y":1414.7667846679688,"wires":[[]]},{"id":"c4db6b96.98d56","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1408.699951171875,"y":1465.7669067382812,"wires":[[]]},{"id":"5701f34e.c7c964","type":"template","z":"16acb04.7bc525","name":"**TEST**XML-Template","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","output":"str","x":551.6500244140625,"y":1371.4168090820312,"wires":[["a7ea75e5.0cc19"]]},{"id":"bc5e69ee.a039d","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1118.116683959961,"y":1333.5167541503906,"wires":[]},{"id":"28298197.9407e6","type":"comment","z":"80f5f744.445108","name":"****************************************** BALANCING ********************************************","info":"","x":347,"y":765.9166870117188,"wires":[]},{"id":"ab83d13f.f68bc","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1079.11669921875,"y":1033.9168090820312,"wires":[]},{"id":"e786333c.ba1708","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1088,"y":1357,"wires":[]},{"id":"b6852e5b.8ef9d8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":839.0000152587891,"y":1470,"wires":[]},{"id":"bb839fc9.df20b","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":842.0000152587891,"y":1545,"wires":[]},{"id":"b16096c5.f5f1c","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1065.000015258789,"y":1439,"wires":[]},{"id":"83f9a20e.e10d1","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1061.000015258789,"y":1612,"wires":[]},{"id":"21bc13db.66e90c","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\",\n agentName: \"AgentTUEmdenCompany0\",\n feedIn: \"0\",\n operatingPoint: \"0\",\n leadingOperatingPoint: \"0\",\n currentValueFR: \"0\",\n assignedPool: \"0\",\n status: \"0\",\n frequency: \"0\",\n aFRRsetpoint: \"0\",\n aFRRsetpointEcho: \"0\",\n setpointFR: \"0\",\n aFRRGradientPOS: \"0\",\n aFRRGradientNEG: \"0\",\n capacityPOS: \"0\",\n capacityNEG: \"0\",\n holdingCapacityPOS: \"0\",\n holdingCapacityNEG: \"0\",\n controlBandPOS: \"0\",\n controlBandNEG: \"0\"\n}","x":838.0000152587891,"y":1650,"wires":[]},{"id":"baf539b5.92c29","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":841.0000152587891,"y":1721,"wires":[]},{"id":"957356ca.3a5968","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1078.8499755859375,"y":595.4500427246094,"wires":[]},{"id":"c0d31191.ee4168","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":97.85000610351562,"y":439.85003662109375,"wires":[]},{"id":"cf542bea.43857","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":95.85000610351562,"y":1042.050048828125,"wires":[]},{"id":"262a2215.468c56","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":100.85000610351562,"y":1342.8499755859375,"wires":[]},{"id":"c4223ba8.e34ce8","type":"comment","z":"43429a7f.e2c06c","name":"****************************************** ACCOUNTING ********************************************","info":"","x":345.1166687011719,"y":63.116668701171875,"wires":[]},{"id":"a7508a94.8a597","type":"comment","z":"43429a7f.e2c06c","name":"JADE Interface (TU-Agent)","info":"","x":1066.11669921875,"y":125.11666870117188,"wires":[]},{"id":"cfe2e23e.f10f28","type":"http in","z":"43429a7f.e2c06c","name":"","url":"/ems-agent/accounting_energyConsumptionProfileUploaded","method":"put","upload":false,"swaggerDoc":"","x":267,"y":237,"wires":[["3e2f082a.ad5288","87c1c66d.7d4a78"]]},{"id":"3e2f082a.ad5288","type":"http response","z":"43429a7f.e2c06c","name":"Response","statusCode":"","headers":{},"x":358.29998779296875,"y":273.0001220703125,"wires":[]},{"id":"1bb4d454.ec426c","type":"comment","z":"43429a7f.e2c06c","name":"1. Accounting Sequence","info":"","x":135,"y":94,"wires":[]},{"id":"147f9215.71b9ae","type":"http request","z":"43429a7f.e2c06c","name":"accounting_energyConsumptionProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/ems-agent/accounting_energyConsumptionProfile","tls":"","persist":false,"proxy":"","authType":"","x":1145,"y":374,"wires":[[]]},{"id":"4d8d2c86.75022c","type":"http request","z":"43429a7f.e2c06c","name":"accounting_energyConsumptionProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/ems-agent/accounting_energyConsumptionProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1176.2666015625,"y":413.216552734375,"wires":[[]]},{"id":"ce4b8c56.91e29","type":"comment","z":"43429a7f.e2c06c","name":"JADE Interface (TU-Agent)","info":"","x":1066,"y":341,"wires":[]},{"id":"a0de7af.9868b88","type":"comment","z":"43429a7f.e2c06c","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany1\",\n referenceID: \"testID123\"\n}","x":818,"y":570,"wires":[]},{"id":"e1f777ff.26e368","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":955,"y":1904,"wires":[]},{"id":"5fa05d4b.ac739c","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany1\"\n}","x":955,"y":1974,"wires":[]},{"id":"da274a4e.455ba8","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1131,"y":2044.9998779296875,"wires":[]},{"id":"bcdb708d.0ff79","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1163,"y":1863,"wires":[]},{"id":"249d9f32.672f1","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1082.8499450683594,"y":2215.64990234375,"wires":[]},{"id":"6577eca6.5b9f7c","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1133.8499755859375,"y":2317.85009765625,"wires":[]},{"id":"595c6301.1677a4","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1133.8499755859375,"y":2539.050048828125,"wires":[]},{"id":"9136a9fc.811a88","type":"comment","z":"7b0fa635.67ef5","name":"5. (B) LoadTimeWindowsShare-Process via Broadcast","info":"","x":227.85000610351562,"y":2509.64990234375,"wires":[]},{"id":"51ce2ad8.df32c4","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"windowsHighBegin Time","tooltip":"","group":"21ffbe58.69dc12","order":1,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":133.61666870117188,"y":2252.6497802734375,"wires":[["abe58755.580bb8"]]},{"id":"50ede4f3.70bf14","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"windowsHighBegin Date","group":"21ffbe58.69dc12","order":2,"width":0,"height":0,"passthru":true,"topic":"","x":135.61666870117188,"y":2219.9498291015625,"wires":[["fa1ebf6b.9fb04"]]},{"id":"f11eb1fc.f3373","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"windowsHighEnd Time","tooltip":"","group":"21ffbe58.69dc12","order":3,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":131.85000610351562,"y":2326.7498779296875,"wires":[["33afa60.77a20da"]]},{"id":"66121574.674064","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"windowsHighEnd Date","group":"21ffbe58.69dc12","order":4,"width":0,"height":0,"passthru":true,"topic":"","x":133.85000610351562,"y":2294.0499267578125,"wires":[["262116de.388d7a"]]},{"id":"14208020.2e9ae","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Tariff Reference","tooltip":"","group":"21ffbe58.69dc12","order":9,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":103.61672973632812,"y":2176.6497802734375,"wires":[["19a16c2e.b5d904"]]},{"id":"fa1ebf6b.9fb04","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_HighDateBegin = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nloadTimeWindows_HighDateBegin = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"loadTimeWindows_HighDateBegin\",loadTimeWindows_HighDateBegin);\nmsg.payload = loadTimeWindows_HighDateBegin;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":395.8500061035156,"y":2220.550048828125,"wires":[[]]},{"id":"abe58755.580bb8","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"loadTimeWindows_HighTimeBegin\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":394.8500061035156,"y":2254.550048828125,"wires":[[]]},{"id":"262116de.388d7a","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_HighDateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nloadTimeWindows_HighDateEnd = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"loadTimeWindows_HighDateEnd\",loadTimeWindows_HighDateEnd);\nmsg.payload = loadTimeWindows_HighDateEnd;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":392.8500061035156,"y":2292.550048828125,"wires":[[]]},{"id":"33afa60.77a20da","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"loadTimeWindows_HighTimeEnd\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":391.8500061035156,"y":2326.550048828125,"wires":[[]]},{"id":"c040f140.150998","type":"ui_button","z":"16acb04.7bc525","name":"","group":"21ffbe58.69dc12","order":10,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":73.61666870117188,"y":2528.1495361328125,"wires":[["bb9759fa.6e5408"]]},{"id":"bb9759fa.6e5408","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_HighDateBegin = flow.get(\"loadTimeWindows_HighDateBegin\");\nvar loadTimeWindows_HighTimeBegin = flow.get(\"loadTimeWindows_HighTimeBegin\");\nvar loadTimeWindows_HighDateEnd = flow.get('loadTimeWindows_HighDateEnd') || 0;\nvar loadTimeWindows_HighTimeEnd = flow.get('loadTimeWindows_HighTimeEnd') || 0;\nvar loadTimeWindows_LowDateBegin = flow.get('loadTimeWindows_LowDateBegin') || 0;\nvar loadTimeWindows_LowTimeBegin = flow.get('loadTimeWindows_LowTimeBegin') || 0;\nvar loadTimeWindows_LowDateEnd = flow.get('loadTimeWindows_LowDateBegin') || 0;\nvar loadTimeWindows_LowTimeEnd = flow.get('loadTimeWindows_LowTimeBegin') || 0;\n\nvar loadTimeWindows_Tariff = flow.get('loadTimeWindows_Tariff') || 0;\n\nvar windowHighBegin = loadTimeWindows_HighDateBegin +\" \"+ loadTimeWindows_HighTimeBegin;\nvar windowHighEnd = loadTimeWindows_HighDateEnd +\" \"+ loadTimeWindows_HighTimeEnd;\nvar windowLowBegin = loadTimeWindows_LowDateBegin +\" \"+ loadTimeWindows_LowTimeBegin;\nvar windowLowEnd = loadTimeWindows_LowDateEnd +\" \"+ loadTimeWindows_LowTimeEnd;\n\nmsg.payload = {\n \"loadTimeWindowsReference\" : loadTimeWindows_Tariff,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" : windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":369.8500061035156,"y":2525.949462890625,"wires":[["8108f927.6cb018"]]},{"id":"ac6db43d.8c3e78","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"windowsLowBegin Time","tooltip":"","group":"21ffbe58.69dc12","order":5,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":128.85000610351562,"y":2408.749755859375,"wires":[["2c85f598.12dce2"]]},{"id":"9400a0cd.a7c99","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"windowsLowBegin Date","group":"21ffbe58.69dc12","order":6,"width":0,"height":0,"passthru":true,"topic":"","x":130.85000610351562,"y":2376.0498046875,"wires":[["e5347ebc.5e5fa"]]},{"id":"c66c8f9b.cbcb2","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"windowsLowEnd Time","tooltip":"","group":"21ffbe58.69dc12","order":7,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":127.08334350585938,"y":2482.849853515625,"wires":[["35053db4.310062"]]},{"id":"dc668a49.b5a2","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"windowsLowEnd Date","group":"21ffbe58.69dc12","order":8,"width":0,"height":0,"passthru":true,"topic":"","x":119.08334350585938,"y":2450.14990234375,"wires":[["24640d99.d193fa"]]},{"id":"e5347ebc.5e5fa","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_LowDateBegin = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nloadTimeWindows_LowDateBegin = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"loadTimeWindows_LowDateBegin\",loadTimeWindows_LowDateBegin);\nmsg.payload = loadTimeWindows_LowDateBegin;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":391.0833435058594,"y":2376.6500244140625,"wires":[[]]},{"id":"2c85f598.12dce2","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"loadTimeWindows_LowTimeBegin\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390.0833435058594,"y":2410.6500244140625,"wires":[[]]},{"id":"24640d99.d193fa","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_LowDateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nloadTimeWindows_LowDateEnd = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"loadTimeWindows_LowDateEnd\",loadTimeWindows_LowDateEnd);\nmsg.payload = loadTimeWindows_LowDateEnd;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":388.0833435058594,"y":2448.6500244140625,"wires":[[]]},{"id":"35053db4.310062","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"loadTimeWindows_LowTimeEnd\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":387.0833435058594,"y":2482.6500244140625,"wires":[[]]},{"id":"19a16c2e.b5d904","type":"function","z":"16acb04.7bc525","name":"","func":"var value = msg.payload;\nflow.set(\"loadTimeWindows_Tariff\",value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":372.8500061035156,"y":2176.349853515625,"wires":[[]]},{"id":"8108f927.6cb018","type":"function","z":"16acb04.7bc525","name":"Payload_handler","func":"msg.payload = msg.payload;\n// payload = {\"schedulingPlanUploaded\" : true}\n//msg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":606.8499755859375,"y":2579.550048828125,"wires":[["debe45a3.8888c8"]]},{"id":"debe45a3.8888c8","type":"http request","z":"16acb04.7bc525","name":"loadTimeWindows_Broadcast Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_broadcast","tls":"","persist":false,"proxy":"","authType":"","x":1057.85009765625,"y":2577.550048828125,"wires":[[]]},{"id":"87c1c66d.7d4a78","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n \"tuName\" : tuName,\n \"referenceID\" : referenceID\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":738.8499755859375,"y":239.85000610351562,"wires":[["d56f925.00c6e7"]]},{"id":"af3b68c1.5f3188","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/ams_agentBorn","method":"put","upload":false,"swaggerDoc":"","x":128.00006103515625,"y":4948.999755859375,"wires":[["44fcb56e.c4f32c","56dbcc04.daf3a4"]]},{"id":"44fcb56e.c4f32c","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.300048828125,"y":4983.999755859375,"wires":[]},{"id":"3bf9a243.4ec776","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/ams_agentDead","method":"put","upload":false,"swaggerDoc":"","x":131.88339233398438,"y":4876.099792480469,"wires":[["73401e22.77f56","79d99ed1.9c083"]]},{"id":"73401e22.77f56","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":176.00006103515625,"y":4912.099853515625,"wires":[]},{"id":"56dbcc04.daf3a4","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload;\n\n\nmsg.payload = {\n \"agentName\" : agentName\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622,"y":4948.099609375,"wires":[[]]},{"id":"9c3f5c88.7ba6d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.183349609375,"y":4877.999755859375,"wires":[[]]},{"id":"f18b5b1.c24fda8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1104.449951171875,"y":4946.999755859375,"wires":[[]]},{"id":"6b45ed15.a0c68c","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** PLATFORM INTERACTION ********************************************","info":"","x":368.00006103515625,"y":4841.999755859375,"wires":[]},{"id":"944b4993.56459","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1094.1500244140625,"y":4838.349853515625,"wires":[]},{"id":"79d99ed1.9c083","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload;\n\n\nmsg.payload = {\n \"agentName\" : agentName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.0000610351562,"y":4876.332763671875,"wires":[[]]},{"id":"4083bb5a.a2e824","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName : \"TUEmdenCompany0@192.168.178.29:1099/JADE\"\n}","x":886.0000610351562,"y":4880.332763671875,"wires":[]},{"id":"899f5199.edf59","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName : \"TUEmdenCompany0@192.168.178.29:1099/JADE\"\n}","x":887,"y":4947.332763671875,"wires":[]},{"id":"78a4d703.7ac96","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** SOL/SNL Specific Actions ****************************************","info":"","x":365.85003662109375,"y":2732.666748046875,"wires":[]},{"id":"6e63440c.80f084","type":"comment","z":"7b0fa635.67ef5","name":"6 Enable Frequency Relay","info":"","x":136.00003051757812,"y":2766.9334716796875,"wires":[]},{"id":"7a05001e.7ae57","type":"comment","z":"7b0fa635.67ef5","name":"6.1 Sending out a enable (VPP --> Node-RED)","info":"","x":196.11669921875,"y":2799.133544921875,"wires":[]},{"id":"4f5baa87.87b47c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_enable","method":"put","upload":false,"swaggerDoc":"","x":165.6667022705078,"y":2834.7665405273438,"wires":[["95544204.fb8228","f6d67de4.625868"]]},{"id":"e77e335e.80dd7","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.6666107177734,"y":2833.7666625976562,"wires":[["42326bd2.9c9cbc"]]},{"id":"42326bd2.9c9cbc","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_enable Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_enable","tls":"","persist":false,"proxy":"","authType":"basic","x":1128.550033569336,"y":2832.5499877929688,"wires":[[]]},{"id":"1296cf80.01fc19","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1128.4000396728516,"y":2800.800048828125,"wires":[]},{"id":"95544204.fb8228","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":185.4000244140625,"y":2870.39990234375,"wires":[]},{"id":"c0d73163.1b41b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_enableInform","method":"put","upload":false,"swaggerDoc":"","x":163.66668701171875,"y":3016.666748046875,"wires":[["723607cf.c0378","88745c93.d7579"]]},{"id":"723607cf.c0378","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":185.9666748046875,"y":3052.666778564453,"wires":[]},{"id":"e37305cc.be4d6","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1092.6000061035156,"y":3013.566650390625,"wires":[[]]},{"id":"56377bd6.c9661c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":619.6667175292969,"y":3016.5667724609375,"wires":[["eee9a163.5033f"]]},{"id":"93beaf79.d9a6f8","type":"comment","z":"7b0fa635.67ef5","name":"6.2 VPP <-- Node-RED: receiving inform or failure message","info":"","x":234.66668701171875,"y":2913.666748046875,"wires":[]},{"id":"2889cab3.5a210e","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_enableFailure","method":"put","upload":false,"swaggerDoc":"","x":163.66668701171875,"y":2948.666748046875,"wires":[["293e9824.2c7b38","ab516f10.e2ff2"]]},{"id":"293e9824.2c7b38","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":184.9666748046875,"y":2983.666778564453,"wires":[]},{"id":"36f13523.9e778a","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1093.6000061035156,"y":2948.5667724609375,"wires":[[]]},{"id":"55e19663.d0a4b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.6667022705078,"y":2950.56689453125,"wires":[[]]},{"id":"ab516f10.e2ff2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":455.7833557128906,"y":2950.3834228515625,"wires":[["55e19663.d0a4b8"]]},{"id":"88745c93.d7579","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":454.7833557128906,"y":3016.3834228515625,"wires":[["56377bd6.c9661c"]]},{"id":"64947add.24e6cc","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1082.6666564941406,"y":2914.666748046875,"wires":[]},{"id":"7170556a.39d5f4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":854.6666564941406,"y":2949.666748046875,"wires":[]},{"id":"a0703054.3e615","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":857.6666564941406,"y":3015.666748046875,"wires":[]},{"id":"92f6aa2f.0ab7d8","type":"comment","z":"7b0fa635.67ef5","name":"7 Disable Frequency Relay","info":"","x":132.6666717529297,"y":3165,"wires":[]},{"id":"93ceb3bf.84a8a8","type":"comment","z":"7b0fa635.67ef5","name":"7.1 Sending out a block (VPP --> Node-RED)","info":"","x":192.78334045410156,"y":3197.2000732421875,"wires":[]},{"id":"1818fccc.1ee26b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_block","method":"put","upload":false,"swaggerDoc":"","x":153.33334350585938,"y":3238.8330688476562,"wires":[["aba214be.89c8f8","94cef519.97372"]]},{"id":"e45695de.fec6e","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName \n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.333251953125,"y":3236.833251953125,"wires":[["1e2023e1.d79304"]]},{"id":"1e2023e1.d79304","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_block Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_block","tls":"","persist":false,"proxy":"","authType":"basic","x":1127.2166748046875,"y":3238.6165161132812,"wires":[[]]},{"id":"df02ea30.a2d72","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1136.066650390625,"y":3201.86669921875,"wires":[]},{"id":"aba214be.89c8f8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":182.06668090820312,"y":3273.466552734375,"wires":[]},{"id":"d2eaa357.46a8d8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_blockInform","method":"put","upload":false,"swaggerDoc":"","x":155.3333282470703,"y":3419.7333984375,"wires":[["83d97141.99723","38ea8d15.11fc02"]]},{"id":"83d97141.99723","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.63331604003906,"y":3455.7333068847656,"wires":[]},{"id":"5a50e889.de309","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1105.2666473388672,"y":3416.6331787109375,"wires":[[]]},{"id":"4dd33ee6.15d84","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.3333740234375,"y":3420.63330078125,"wires":[[]]},{"id":"f41cd723.6b3dc8","type":"comment","z":"7b0fa635.67ef5","name":"7.2 VPP <-- Node-RED: receiving inform or failure message","info":"","x":235.33331298828125,"y":3309.7333984375,"wires":[]},{"id":"35524bd0.0abffc","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_blockFailure","method":"put","upload":false,"swaggerDoc":"","x":156.3333282470703,"y":3346.7332763671875,"wires":[["aff9f121.472e78","3ce4ae57.fb27d2"]]},{"id":"aff9f121.472e78","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":178.63331604003906,"y":3382.7333068847656,"wires":[]},{"id":"52e937d1.43551","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.2666473388672,"y":3346.63330078125,"wires":[[]]},{"id":"d72acb58.fab4b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.3333740234375,"y":3346.63330078125,"wires":[[]]},{"id":"3ce4ae57.fb27d2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.45001220703125,"y":3347.449951171875,"wires":[["d72acb58.fab4b8"]]},{"id":"38ea8d15.11fc02","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.45001220703125,"y":3421.449951171875,"wires":[["4dd33ee6.15d84"]]},{"id":"48785394.616ecc","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1092.3332977294922,"y":3314.7332763671875,"wires":[]},{"id":"d44a10b9.1c33f8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":855.3332977294922,"y":3348.7332763671875,"wires":[]},{"id":"71e65eb1.558378","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":859.3332977294922,"y":3419.7332763671875,"wires":[]},{"id":"284c029d.54b0de","type":"comment","z":"7b0fa635.67ef5","name":"Receiving status (frequency relay has been triggered) message of frequency relay (VPP <-- Node-RED)","info":"","x":371.6666717529297,"y":3594,"wires":[]},{"id":"c4c6630c.4c84b8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_triggered","method":"put","upload":false,"swaggerDoc":"","x":144.6666717529297,"y":3636,"wires":[["cf71f945.763ba8","54c46f77.d4f258"]]},{"id":"cf71f945.763ba8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":176.96665954589844,"y":3672.000030517578,"wires":[]},{"id":"a18bfe9f.9ca51","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1113.5999908447266,"y":3632.9000244140625,"wires":[[]]},{"id":"20327dc0.4986ea","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.6667022705078,"y":3638.9000244140625,"wires":[[]]},{"id":"54c46f77.d4f258","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":464.7833251953125,"y":3638.716796875,"wires":[["20327dc0.4986ea"]]},{"id":"e4a4428.4f2944","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1103.6666259765625,"y":3598,"wires":[]},{"id":"310936d1.c4ce4a","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":898.6666412353516,"y":3638,"wires":[]},{"id":"aca7fd28.9f71d8","type":"comment","z":"7b0fa635.67ef5","name":"8 Frequency Relay Status","info":"","x":132.6666717529297,"y":3562,"wires":[]},{"id":"b3411deb.446a3","type":"comment","z":"7b0fa635.67ef5","name":"8.1 Sending out a confirm (VPP --> Node-RED)","info":"","x":202.6666717529297,"y":3706,"wires":[]},{"id":"a46c7074.46e768","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_confirm","method":"put","upload":false,"swaggerDoc":"","x":163.2166748046875,"y":3739.6329956054688,"wires":[["baf3a9e3.a7275","7cbf373d.7b5318"]]},{"id":"baf3a9e3.a7275","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.2165832519531,"y":3740.6331176757812,"wires":[["72490ce2.373bfc"]]},{"id":"72490ce2.373bfc","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_confirm","tls":"","persist":false,"proxy":"","authType":"basic","x":1152.0999755859375,"y":3739.41650390625,"wires":[[]]},{"id":"c8f076e5.44d15","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1152.949951171875,"y":3699.66650390625,"wires":[]},{"id":"7cbf373d.7b5318","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":183.95001220703125,"y":3776.2666015625,"wires":[]},{"id":"60c1b20f.79679c","type":"comment","z":"80f5f744.445108","name":"3.1 receiving enable request from VPP (Node-RED --> TU)","info":"","x":249.00001525878906,"y":1791.6666259765625,"wires":[]},{"id":"3ea18b05.484ecc","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/freqRelay_enable","method":"put","upload":false,"swaggerDoc":"","x":141.00001525878906,"y":1831.6666259765625,"wires":[["d6990dcd.cb3f78","2c4753ce.06151c","3648c3.2b7b1f3e"]]},{"id":"d6990dcd.cb3f78","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":222.00001525878906,"y":1869.6666259765625,"wires":[]},{"id":"15d44b75.34018d","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\n\npayload = \n{\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":762.8333587646484,"y":1866.3666229248047,"wires":[[]]},{"id":"ac225902.67632","type":"comment","z":"80f5f744.445108","name":"Interface with data for the TU","info":"","x":770.0000152587891,"y":1793.6666259765625,"wires":[]},{"id":"2c4753ce.06151c","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":499.8334197998047,"y":1866.6166381835938,"wires":[["15d44b75.34018d"]]},{"id":"3648c3.2b7b1f3e","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":761.8333892822266,"y":1832.9832916259766,"wires":[[]]},{"id":"f2498485.95cd88","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1039.000015258789,"y":1798.666618347168,"wires":[]},{"id":"cf6ea1ff.c31408","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\nnoNameSet\nTUEmdenCompany1\nnoIDSet\n\n","x":1091.316665649414,"y":1835.7832946777344,"wires":[]},{"id":"195627b4.87e95","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\"\n}","x":1092.316665649414,"y":1866.7832946777344,"wires":[]},{"id":"4b77b24f.aa9aec","type":"comment","z":"80f5f744.445108","name":"3. FrequencyRelay Enable","info":"","x":150.00001525878906,"y":1758.6666259765625,"wires":[]},{"id":"9aed5f97.2eeab","type":"comment","z":"80f5f744.445108","name":"****************************************** SOL/SNL Specific Actions ****************************************","info":"","x":376.66668701171875,"y":1722.6666259765625,"wires":[]},{"id":"5b6ca685.82efd8","type":"comment","z":"80f5f744.445108","name":"3.2 Sending answer to agent (Node-RED <-- TU)","info":"","x":205.85000610351562,"y":1944.050048828125,"wires":[]},{"id":"e5593e69.b49308","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":848.8500213623047,"y":2046.1499938964844,"wires":[["4d69c63a.5ad978"]]},{"id":"4d69c63a.5ad978","type":"http request","z":"80f5f744.445108","name":"freqRelay_enableFailure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_enableFailure","tls":"","persist":false,"proxy":"","authType":"basic","x":1121.5499725341797,"y":2046.1499938964844,"wires":[["9d23a7ba.79627"]]},{"id":"9d23a7ba.79627","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1370.0499877929688,"y":2046.1499633789062,"wires":[[]]},{"id":"ee857df4.178ba8","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":849.6999969482422,"y":2011,"wires":[["6e6f8142.342188"]]},{"id":"6e6f8142.342188","type":"http request","z":"80f5f744.445108","name":"freqRelay_enableInform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_enableInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1120.4000701904297,"y":2011,"wires":[["79ddae18.b246c"]]},{"id":"79ddae18.b246c","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1368.9000854492188,"y":2010.9999694824219,"wires":[[]]},{"id":"6edab03d.4f7dd8","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":548.8500213623047,"y":2013.1499938964844,"wires":[]},{"id":"f2819ad7.1e1b8","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":548.8500213623047,"y":2050.1499938964844,"wires":[]},{"id":"8a310c7f.fb5cd","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":185.85000610351562,"y":2093.2500610351562,"wires":[]},{"id":"4266eb72.ac6704","type":"inject","z":"80f5f744.445108","name":"***test: inject a Failure***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":174.85000610351562,"y":2168.250030517578,"wires":[["eb9333d2.6bb6b"]]},{"id":"fa25575d.351978","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":164.85000610351562,"y":2133.1000366210938,"wires":[["23d54b7b.e5d1fc"]]},{"id":"eb9333d2.6bb6b","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":495.4666748046875,"y":2167.8001708984375,"wires":[["62b99a1c.6cb1ec"]]},{"id":"23d54b7b.e5d1fc","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":495.70001220703125,"y":2132.1001586914062,"wires":[["54d448c4.ada908"]]},{"id":"62b99a1c.6cb1ec","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":836.8500366210938,"y":2165.2500610351562,"wires":[["c13bf153.1789f"]]},{"id":"c13bf153.1789f","type":"http request","z":"80f5f744.445108","name":"freqRelay_enableFailure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_enableFailure","tls":"","persist":false,"proxy":"","authType":"basic","x":1117.5499877929688,"y":2165.2500610351562,"wires":[["fad0983f.112d1"]]},{"id":"54d448c4.ada908","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":837.7000122070312,"y":2130.100067138672,"wires":[["3b472de5.7d7ba2"]]},{"id":"3b472de5.7d7ba2","type":"http request","z":"80f5f744.445108","name":"freqRelay_enableInform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_enableInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1115.4000854492188,"y":2130.100067138672,"wires":[["c3678f09.44669"]]},{"id":"fad0983f.112d1","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1423.433349609375,"y":2167.2498779296875,"wires":[[]]},{"id":"c3678f09.44669","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1422.283447265625,"y":2133.099884033203,"wires":[[]]},{"id":"26ef5e73.4b8efa","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1090.8500213623047,"y":1970.2501220703125,"wires":[]},{"id":"e1ca5f61.90a6e","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":107.58332824707031,"y":1978.3833618164062,"wires":[]},{"id":"55b8e11.1d77ea","type":"comment","z":"80f5f744.445108","name":"4.1 receiving enable request from VPP (Node-RED --> TU)","info":"","x":254.41668701171875,"y":2256.050048828125,"wires":[]},{"id":"d1b8a68c.b94a78","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/freqRelay_block","method":"put","upload":false,"swaggerDoc":"","x":156.41668701171875,"y":2296.050048828125,"wires":[["e4523927.178c","a0b3e390.33211","d97e60c3.90a338"]]},{"id":"e4523927.178c","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":237.41668701171875,"y":2334.050048828125,"wires":[]},{"id":"56719889.3efb7","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\n\npayload = \n{\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":778.2500305175781,"y":2330.750045776367,"wires":[[]]},{"id":"40e09086.746b18","type":"comment","z":"80f5f744.445108","name":"Interface with data for the TU","info":"","x":785.4166870117188,"y":2258.050048828125,"wires":[]},{"id":"a0b3e390.33211","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":515.2500915527344,"y":2331.0000610351562,"wires":[["56719889.3efb7"]]},{"id":"d97e60c3.90a338","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":777.2500610351562,"y":2297.366714477539,"wires":[[]]},{"id":"439f28e9.300b78","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1054.4166870117188,"y":2263.0500411987305,"wires":[]},{"id":"d0e98114.3fe08","type":"comment","z":"80f5f744.445108","name":"4. FrequencyRelay Block","info":"","x":165.41668701171875,"y":2223.050048828125,"wires":[]},{"id":"5e2ff05f.ef2e18","type":"comment","z":"80f5f744.445108","name":"4.2 Sending answer to agent (Node-RED <-- TU)","info":"","x":221.2666778564453,"y":2408.4334716796875,"wires":[]},{"id":"8c8170a.6dca31","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":864.2666931152344,"y":2510.533416748047,"wires":[["d8748aa7.c252e8"]]},{"id":"d8748aa7.c252e8","type":"http request","z":"80f5f744.445108","name":"freqRelay_blockFailure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_blockFailure","tls":"","persist":false,"proxy":"","authType":"basic","x":1136.9666442871094,"y":2510.533416748047,"wires":[["34e5807e.5a4e5"]]},{"id":"34e5807e.5a4e5","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1385.4666595458984,"y":2510.5333862304688,"wires":[[]]},{"id":"8a650862.1bb3c","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":865.1166687011719,"y":2475.3834228515625,"wires":[["81b3cd9a.9b02a8"]]},{"id":"81b3cd9a.9b02a8","type":"http request","z":"80f5f744.445108","name":"freqRelay_blockInform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_blockInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1125.8167419433594,"y":2475.3834228515625,"wires":[["c70b8a44.c699e8"]]},{"id":"c70b8a44.c699e8","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1384.3167572021484,"y":2475.3833923339844,"wires":[[]]},{"id":"f27e7b8c.3b9ef","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":564.2666931152344,"y":2477.533416748047,"wires":[]},{"id":"e19bb2c.12bdc5","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":564.2666931152344,"y":2514.533416748047,"wires":[]},{"id":"5f572083.d270e8","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":201.2666778564453,"y":2557.6334838867188,"wires":[]},{"id":"bcb72486.d2934","type":"inject","z":"80f5f744.445108","name":"***test: inject a Failure ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190.2666778564453,"y":2632.6334533691406,"wires":[["225a7e4e.12ac72"]]},{"id":"9f1e8120.4a6908","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180.2666778564453,"y":2597.4834594726562,"wires":[["f1784c25.0c5af"]]},{"id":"225a7e4e.12ac72","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510.8833465576172,"y":2632.18359375,"wires":[["a69122ff.bade6"]]},{"id":"f1784c25.0c5af","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":511.11668395996094,"y":2596.4835815429688,"wires":[["5a9e1921.d0da78"]]},{"id":"a69122ff.bade6","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":852.2667083740234,"y":2629.6334838867188,"wires":[["6c5c173c.aa5e48"]]},{"id":"5a9e1921.d0da78","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":853.1166839599609,"y":2594.4834899902344,"wires":[["b0bf528f.73ad68"]]},{"id":"50d30882.ff28c","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1395.8499755859375,"y":2626.6336669921875,"wires":[[]]},{"id":"8258434c.4443f8","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1394.7000732421875,"y":2592.483673095703,"wires":[[]]},{"id":"f2b05727.ed78e","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1106.2666931152344,"y":2434.633544921875,"wires":[]},{"id":"131f5d7b.fd9893","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":123,"y":2442.7667846679688,"wires":[]},{"id":"b0bf528f.73ad68","type":"http request","z":"80f5f744.445108","name":"freqRelay_blockInform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_blockInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1099.8499755859375,"y":2591.85009765625,"wires":[["8258434c.4443f8"]]},{"id":"6c5c173c.aa5e48","type":"http request","z":"80f5f744.445108","name":"freqRelay_blockFailure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_blockFailure","tls":"","persist":false,"proxy":"","authType":"basic","x":1110.9998779296875,"y":2627.0000915527344,"wires":[["50d30882.ff28c"]]},{"id":"575579a0.5b603","type":"comment","z":"80f5f744.445108","name":"5. FrequencyRelay Status","info":"","x":142.85000610351562,"y":2716.449951171875,"wires":[]},{"id":"3aac057.4e272fa","type":"comment","z":"80f5f744.445108","name":"5.2 Informing the VPP after triggering of the frequency relay (Node-RED <-- TU)","info":"","x":301.8500061035156,"y":2752.64990234375,"wires":[]},{"id":"41c718e.2326468","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":855.6999969482422,"y":2819.599853515625,"wires":[["97230a77.95b6a8"]]},{"id":"97230a77.95b6a8","type":"http request","z":"80f5f744.445108","name":"freqRelay_triggered Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_triggered","tls":"","persist":false,"proxy":"","authType":"basic","x":1116.4000701904297,"y":2819.599853515625,"wires":[["5d6fd9c1.5dc518"]]},{"id":"5d6fd9c1.5dc518","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1374.9000854492188,"y":2819.599822998047,"wires":[[]]},{"id":"81d82cc3.cc3d58","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":554.8500213623047,"y":2821.7498474121094,"wires":[]},{"id":"e34a7bf7.31c9e","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":187.8500518798828,"y":2874.8500061035156,"wires":[]},{"id":"5fae2fa6.e0f098","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1381.283447265625,"y":2909.7001953125,"wires":[[]]},{"id":"7fe351cb.b7771","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1096.8500213623047,"y":2778.8499755859375,"wires":[]},{"id":"4917c7fc.7537f","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":113.58332824707031,"y":2786.9832153320312,"wires":[]},{"id":"73ecaab6.9828d4","type":"http request","z":"80f5f744.445108","name":"freqRelay_triggered Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_triggered","tls":"","persist":false,"proxy":"","authType":"basic","x":1110.8499755859375,"y":2907.85009765625,"wires":[[]]},{"id":"9f2536b1.52932","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":181.85000610351562,"y":2910.25,"wires":[["913974b3.dea25"]]},{"id":"913974b3.dea25","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":502.4666748046875,"y":2909.8001403808594,"wires":[["7a2d8887.e8b2f"]]},{"id":"7a2d8887.e8b2f","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":843.8500366210938,"y":2907.250030517578,"wires":[["73ecaab6.9828d4"]]},{"id":"200f096b.979586","type":"comment","z":"80f5f744.445108","name":"5.2 receiving confirmation from VPP (Node-RED --> TU)","info":"","x":235.85000610351562,"y":2959.449951171875,"wires":[]},{"id":"dee2a284.bebab","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/freqRelay_confirm","method":"put","upload":false,"swaggerDoc":"","x":147.85000610351562,"y":2999.449951171875,"wires":[["12034ed3.5b55b1","c4dad680.4c11","79bde927.135d1"]]},{"id":"12034ed3.5b55b1","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":228.85000610351562,"y":3037.449951171875,"wires":[]},{"id":"f0d47a3c.b4fea","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\n\npayload = \n{\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":769.683349609375,"y":3034.149948120117,"wires":[[]]},{"id":"54fe9bf0.66d2b4","type":"comment","z":"80f5f744.445108","name":"Interface with data for the TU","info":"","x":776.8500061035156,"y":2961.449951171875,"wires":[]},{"id":"c4dad680.4c11","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":506.68341064453125,"y":3034.3999633789062,"wires":[["f0d47a3c.b4fea"]]},{"id":"79bde927.135d1","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":768.6833801269531,"y":3000.766616821289,"wires":[[]]},{"id":"76a67af7.f14914","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1045.8500061035156,"y":2966.4499435424805,"wires":[]},{"id":"f7efb8f6.caf74","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject an Enable***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":157.5499725341797,"y":3126.650146484375,"wires":[["a2591b2b.10ab48"]]},{"id":"a2591b2b.10ab48","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.5499877929688,"y":3125.650146484375,"wires":[["be5fd782.9d624"]]},{"id":"be5fd782.9d624","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_enable Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_enable","tls":"","persist":false,"proxy":"","authType":"basic","x":1133.6666259765625,"y":3124.666748046875,"wires":[[]]},{"id":"adc0e68e.0aea9","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Disable***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156.5499725341797,"y":3527.9833984375,"wires":[["d519a76.89906d8"]]},{"id":"d519a76.89906d8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.5499877929688,"y":3525.9833984375,"wires":[["485c3f9c.003658"]]},{"id":"485c3f9c.003658","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_block Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_block","tls":"","persist":false,"proxy":"","authType":"basic","x":1133.6666259765625,"y":3527,"wires":[[]]},{"id":"16fa85eb.ccbd72","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156.5499725341797,"y":3846.9833984375,"wires":[["315036ad.7555a2"]]},{"id":"315036ad.7555a2","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.5499877929688,"y":3843.9833984375,"wires":[["ecb04700.5c4358"]]},{"id":"ecb04700.5c4358","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_confirm","tls":"","persist":false,"proxy":"","authType":"basic","x":1154.6666259765625,"y":3845,"wires":[[]]},{"id":"ab3c26e5.58647","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":150.6666717529297,"y":3093,"wires":[]},{"id":"7d49616.f2ae5a","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":152.6666717529297,"y":3493,"wires":[]},{"id":"d946bc35.bce1c","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":152.6666717529297,"y":3814,"wires":[]},{"id":"221a66c2.132b82","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\nnoNameSet\nTUEmdenCompany1\nnoIDSet\n\n","x":1103.6666259765625,"y":2298.66650390625,"wires":[]},{"id":"c6b94bfd.5cc098","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\"\n}","x":1104.6666259765625,"y":2329.66650390625,"wires":[]},{"id":"23d28def.f11252","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\nnoNameSet\nTUEmdenCompany1\nnoIDSet\n\n","x":1095.6666870117188,"y":3007.666748046875,"wires":[]},{"id":"8facf539.a90ea","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\"\n}","x":1096.6666870117188,"y":3038.666748046875,"wires":[]},{"id":"91cb935e.4dddf","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":450.6166687011719,"y":969.1998901367188,"wires":[["3d2473f1.56f8d4"]]},{"id":"3d2473f1.56f8d4","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadNewSetpoint.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":667.8499755859375,"y":969.449951171875,"wires":[["4b13d705.4dca3"]]},{"id":"876022fe.30795","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var id = msg.payload.InterfacePayloadPlanning.referenceID || 0; //id is an optional parameter\nvar serviceDescriptions = msg.payload.InterfacePayloadPlanning.serviceDescriptions;\nvar start = msg.payload.InterfacePayloadPlanning.schedulingStart;\nvar end = msg.payload.InterfacePayloadPlanning.schedulingEnd;\nvar expiration = msg.payload.InterfacePayloadPlanning.expiration;\n\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":674.8499755859375,"y":174.85000610351562,"wires":[["93d90be7.333288"]]},{"id":"b7656f7e.47eaa","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.6166687011719,"y":174.80001831054688,"wires":[["876022fe.30795"]]},{"id":"b0d0b8cb.8966a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var balancingTUName = msg.payload.InterfacePayloadBalancing.balancingTUName;\nvar balancingUpdateRate = msg.payload.InterfacePayloadBalancing.balancingUpdateRate;\nvar balancingStart = msg.payload.InterfacePayloadBalancing.balancingStart;\nvar balancingEnd = msg.payload.InterfacePayloadBalancing.balancingEnd;\nvar balancingReferenceID = msg.payload.InterfacePayloadBalancing.balancingReferenceID;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":656.8499755859375,"y":1401.25,"wires":[["8eaa7754.ddfe7"]]},{"id":"ea219ae5.fee2b8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":441.61669921875,"y":1400.800048828125,"wires":[["b0d0b8cb.8966a"]]},{"id":"f6d67de4.625868","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":458.61669921875,"y":2870.199951171875,"wires":[["48f6c6c1.d178b8"]]},{"id":"48f6c6c1.d178b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.8499755859375,"y":2870.64990234375,"wires":[["42326bd2.9c9cbc"]]},{"id":"94cef519.97372","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":446.8499755859375,"y":3270.050048828125,"wires":[["4fa628f6.31a99"]]},{"id":"4fa628f6.31a99","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":613.0833129882812,"y":3269.5,"wires":[["1e2023e1.d79304"]]},{"id":"40217cd9.f4f25c","type":"http request","z":"7b0fa635.67ef5","name":"***Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_schedulingPlanInfos","tls":"","persist":false,"proxy":"","authType":"basic","x":1096.8499755859375,"y":286.8500061035156,"wires":[[]]},{"id":"843c0b65.fb9f38","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var schedulingPlanReference = msg.payload.InterfacePayloadAcceptReject.schedulingPlanReference;\nvar start = msg.payload.InterfacePayloadAcceptReject.schedulingStart;\nvar end = msg.payload.InterfacePayloadAcceptReject.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672.8499755859375,"y":539.8499450683594,"wires":[["c7d830c5.e26b5"]]},{"id":"260fa31f.9b694c","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.8499755859375,"y":539.8499450683594,"wires":[["843c0b65.fb9f38"]]},{"id":"7ae1d2c0.d88814","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":453,"y":617.9999694824219,"wires":[["bbdc19af.9137c8"]]},{"id":"bbdc19af.9137c8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var schedulingPlanReference = msg.payload.InterfacePayloadAcceptReject.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672,"y":617.9999694824219,"wires":[["95950400.6683d"]]},{"id":"cd761dcc.9ca9","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_done","tls":"","persist":false,"proxy":"","authType":"basic","x":1105,"y":727,"wires":[[]]},{"id":"3e3fd9bd.e7f1a6","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_failure","tls":"","persist":false,"proxy":"","authType":"basic","x":1106,"y":804,"wires":[[]]},{"id":"4dfb481c.c9f398","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/accounting_energyConsumptionProfileReference","tls":"","persist":false,"proxy":"","authType":"basic","x":1201,"y":2006,"wires":[[]]},{"id":"a6dc3532.1dbe8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":675,"y":2111.0001220703125,"wires":[["c9286592.2b2a4"]]},{"id":"35f8281d.faff2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":459.5,"y":2111.0001220703125,"wires":[["a6dc3532.1dbe8"]]},{"id":"d7e193fb.e97838","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/balancing_inform","tls":"","persist":false,"proxy":"","authType":"basic","x":1099.8499755859375,"y":1683.25,"wires":[[]]},{"id":"2e0ffecf.c10d12","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.85000610351562,"y":1401.050048828125,"wires":[]},{"id":"235cfdb7.737762","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":613.9999694824219,"y":2237.800048828125,"wires":[["de53aec2.048638"]]},{"id":"de53aec2.048638","type":"http request","z":"249aeb13.444e84","name":"cancelOperation_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/cancelOperation_inform","tls":"","persist":false,"proxy":"","authType":"","x":1162.0000915527344,"y":2234.800094604492,"wires":[[]]},{"id":"9cbde1b9.206c9","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":215,"y":2237.9998779296875,"wires":[["18a92b3a.ad498d","235cfdb7.737762"]]},{"id":"18a92b3a.ad498d","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":264.29998779296875,"y":2272.9999237060547,"wires":[]},{"id":"667fef95.0cf1a8","type":"comment","z":"249aeb13.444e84","name":"3.1 Receiving Cancel for a specific operation from the Planning System (Node-RED <-- Planning)","info":"","x":375.26666259765625,"y":2196.3165893554688,"wires":[]},{"id":"61181f57.397ed","type":"comment","z":"249aeb13.444e84","name":"JADE Interface (TU-Agent)","info":"","x":1133.1499938964844,"y":2196.749984741211,"wires":[]},{"id":"4d3b1d0d.db493c","type":"comment","z":"249aeb13.444e84","name":"3.2 Receiving confirmation of the operation cancel from VPP (Node-RED --> Planning)","info":"","x":347.8500061035156,"y":2338.800048828125,"wires":[]},{"id":"527b9970.65878","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":187.85000610351562,"y":2378.900146484375,"wires":[["8bcc2313.bf0208","684ff720.fcb33"]]},{"id":"8bcc2313.bf0208","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":267.8500061035156,"y":2417.900146484375,"wires":[]},{"id":"815de307.50e7a8","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":616.6834106445312,"y":2381.599853515625,"wires":[[]]},{"id":"684ff720.fcb33","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":422.6833801269531,"y":2381.8501586914062,"wires":[["815de307.50e7a8"]]},{"id":"61ef07c5.9031a8","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1106.2999877929688,"y":2379.0003662109375,"wires":[["6aafa77f.e1dd68"]]},{"id":"6aafa77f.e1dd68","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1334.7999877929688,"y":2379.0003662109375,"wires":[[]]},{"id":"3cdecb16.1d80dc","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1095.8500366210938,"y":2338.9002685546875,"wires":[]},{"id":"90e6f261.bdb36","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":875.8666381835938,"y":2382.0003662109375,"wires":[]},{"id":"57893cde.f4f19c","type":"comment","z":"249aeb13.444e84","name":"****************************************** Cancel Operation********************************************","info":"","x":359.8500061035156,"y":2161.64990234375,"wires":[]},{"id":"28c50d22.65ccf2","type":"comment","z":"249aeb13.444e84","name":"****************************************** Load Time Windows Sharing *******************************************","info":"","x":399.8500061035156,"y":1623.25,"wires":[]},{"id":"96c2fe94.ae4718","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":632.1499633789062,"y":4067.99951171875,"wires":[["dc4eee7e.3b4918"]]},{"id":"dc4eee7e.3b4918","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_confirm","tls":"","persist":false,"proxy":"","authType":"","x":1178.1500701904297,"y":4065.9996795654297,"wires":[[]]},{"id":"33943318.c6bb84","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":192.1499786376953,"y":4069.199462890625,"wires":[["97686248.818948","96c2fe94.ae4718"]]},{"id":"97686248.818948","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":191.449951171875,"y":4105.19970703125,"wires":[]},{"id":"c882b9f2.d08bc8","type":"comment","z":"7b0fa635.67ef5","name":"9.1 Receiving Cancel for a specific operation from the a TU Agent (VPP <-- Node-RED","info":"","x":327.41668701171875,"y":3918.5162963867188,"wires":[]},{"id":"4e15f456.b6abbc","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface ","info":"","x":1119.300048828125,"y":4031.94970703125,"wires":[]},{"id":"6cfc3a12.59fa14","type":"comment","z":"7b0fa635.67ef5","name":"9.2 Sending confirmation or failure of the operation cancel fto the Agent (VPP --> Node-RED)","info":"","x":352.0000457763672,"y":4030.999755859375,"wires":[]},{"id":"fa66d7ef.52b85","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":159.00003051757812,"y":3954.099853515625,"wires":[["9621885c.2b8fd","cb4b24d4.f26328"]]},{"id":"9621885c.2b8fd","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":189.00003051757812,"y":3991.099609375,"wires":[]},{"id":"828f9146.4055b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":631.8334350585938,"y":3956.7998046875,"wires":[[]]},{"id":"cb4b24d4.f26328","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":467.8333740234375,"y":3956.0498046875,"wires":[["828f9146.4055b8"]]},{"id":"e91f8f9f.389e4","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1120.449951171875,"y":3957.2001953125,"wires":[[]]},{"id":"ba51565a.3f2b2","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":901.0166625976562,"y":3958.2001953125,"wires":[]},{"id":"3d673ddb.39d542","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** CANCEL OPERATIONS ********************************************","info":"","x":369.0000305175781,"y":3883.849365234375,"wires":[]},{"id":"b416239b.85e8f","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":175,"y":4144.3330078125,"wires":[["ff7ef975.49eb7"]]},{"id":"ff7ef975.49eb7","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635,"y":4142.3330078125,"wires":[["dc4eee7e.3b4918"]]},{"id":"d48495e.197bc68","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":674,"y":2280.33349609375,"wires":[["de53aec2.048638"]]},{"id":"692320b2.9d48f","type":"inject","z":"249aeb13.444e84","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":499.5,"y":2284,"wires":[["d48495e.197bc68"]]},{"id":"f29bec6a.072428","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1112,"y":3924,"wires":[]},{"id":"2fa948eb.967e88","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":457,"y":2578,"wires":[["ab393d18.32128"]]},{"id":"eee9a163.5033f","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/freqRelay_enableInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1124,"y":3046,"wires":[[]]},{"id":"6b21aaab.122004","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":596.1499633789062,"y":4331.549865722656,"wires":[["7818ca27.11d844"]]},{"id":"7818ca27.11d844","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_inform","tls":"","persist":false,"proxy":"","authType":"","x":1169.1500854492188,"y":4328.549911499023,"wires":[[]]},{"id":"63a8858c.e815ac","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":185.14999389648438,"y":4331.749694824219,"wires":[["1eb5ad0b.ca6753","6b21aaab.122004"]]},{"id":"1eb5ad0b.ca6753","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":246.44998168945312,"y":4366.749740600586,"wires":[]},{"id":"f769df0d.b6d478","type":"comment","z":"7b0fa635.67ef5","name":"10.1 SendingCancel for a specific operation from the Planning System (Node-RED <-- VPP)","info":"","x":347.4166564941406,"y":4290.06640625,"wires":[]},{"id":"54bef9b7.22f4a","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (TU-Agent)","info":"","x":1140.2999877929688,"y":4290.499801635742,"wires":[]},{"id":"740a667.efc4218","type":"comment","z":"7b0fa635.67ef5","name":"10.2 Receiving confirmation of the operation cancel from VPP (Node-RED --> VPP)","info":"","x":320,"y":4404.549865722656,"wires":[]},{"id":"cc065227.539e38","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":170,"y":4444.649963378906,"wires":[["ab12692f.e971e","d2f788ea.0b714"]]},{"id":"ab12692f.e971e","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":250,"y":4480.649963378906,"wires":[]},{"id":"e5e9887c.34117","type":"function","z":"7b0fa635.67ef5","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":598.8334045410156,"y":4447.349670410156,"wires":[[]]},{"id":"d2f788ea.0b714","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":416.8334045410156,"y":4446.600158691406,"wires":[["e5e9887c.34117"]]},{"id":"59f8a81f.2df438","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":858.0166320800781,"y":4447.750183105469,"wires":[]},{"id":"3f8c6389.2b0a3c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":597.1500244140625,"y":4374.083068847656,"wires":[["7818ca27.11d844"]]},{"id":"d6ebc7b2.69d0e8","type":"inject","z":"7b0fa635.67ef5","name":"TESTING","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":425.6500244140625,"y":4374.750061035156,"wires":[["3f8c6389.2b0a3c"]]},{"id":"80ebddb3.ddc2d8","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650.1499328613281,"y":2695.1998901367188,"wires":[["f85f86ed.c3edf"]]},{"id":"f85f86ed.c3edf","type":"http request","z":"249aeb13.444e84","name":"cancelOperation_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/cancelOperation_confirm","tls":"","persist":false,"proxy":"","authType":"","x":1196.1500396728516,"y":2693.2000579833984,"wires":[[]]},{"id":"936fe352.6cbd9","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":210.1499481201172,"y":2696.3998413085938,"wires":[["1f2aab54.87dac5","80ebddb3.ddc2d8"]]},{"id":"1f2aab54.87dac5","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":209.44992065429688,"y":2732.4000854492188,"wires":[]},{"id":"20621d0a.70693a","type":"comment","z":"249aeb13.444e84","name":"4.1 Receiving Cancel for a specific operation from the a TU Agent (Planning <-- Node-RED","info":"","x":355.4166564941406,"y":2545.7166748046875,"wires":[]},{"id":"89ae9dc3.6d67a","type":"comment","z":"249aeb13.444e84","name":"JADE Interface ","info":"","x":1137.3000183105469,"y":2659.1500854492188,"wires":[]},{"id":"fcc75a10.4f76e","type":"comment","z":"249aeb13.444e84","name":"4.2 Sending confirmation or failure of the operation cancel fto the Agent (Planning --> Node-RED)","info":"","x":380.00001525878906,"y":2658.2001342773438,"wires":[]},{"id":"83de5054.6596c8","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":177,"y":2581.3002319335938,"wires":[["7412b3dc.1d6a24","b3c76a56.57f4b"]]},{"id":"7412b3dc.1d6a24","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":207,"y":2618.2999877929688,"wires":[]},{"id":"df1b2507.7760c","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":649.8334045410156,"y":2584.0001831054688,"wires":[[]]},{"id":"b3c76a56.57f4b","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":485.8333435058594,"y":2583.2501831054688,"wires":[["df1b2507.7760c"]]},{"id":"eb88c66a.ff742","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":919.0166320800781,"y":2585.4005737304688,"wires":[]},{"id":"cafe5ea2.a36c6","type":"inject","z":"249aeb13.444e84","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":192.99996948242188,"y":2771.5333862304688,"wires":[["53c8cfb8.181c38"]]},{"id":"53c8cfb8.181c38","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":652.9999694824219,"y":2769.5333862304688,"wires":[["f85f86ed.c3edf"]]},{"id":"39f96665.5775ba","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1160.8499755859375,"y":2585.1998901367188,"wires":[[]]},{"id":"d3a5bd47.fdad","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1150.8499755859375,"y":2552.1998901367188,"wires":[]},{"id":"67c2a9c4.56cb18","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1095.8499755859375,"y":4413.350158691406,"wires":[]},{"id":"3a9c14b7.0c7efc","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1106.8499755859375,"y":4448.350158691406,"wires":[[]]},{"id":"57672fe1.ccb3f","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/requestInfo","method":"put","upload":false,"swaggerDoc":"","x":134.39999389648438,"y":4627.7998046875,"wires":[["94f8f779.b06f3","8f46e25a.35aa98"]]},{"id":"94f8f779.b06f3","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":174.13331604003906,"y":4663.433166503906,"wires":[]},{"id":"8f46e25a.35aa98","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":475.3500213623047,"y":4627.233215332031,"wires":[["3480b47e.746164"]]},{"id":"3480b47e.746164","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":644.5832977294922,"y":4623.683166503906,"wires":[["d3b6b14d.ce424"]]},{"id":"d3b6b14d.ce424","type":"http request","z":"7b0fa635.67ef5","name":"requestInfos Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/requestInfo","tls":"","persist":false,"proxy":"","authType":"basic","x":1129.2832946777344,"y":4623.583435058594,"wires":[[]]},{"id":"5f8c1e4a.18edf8","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1149.13330078125,"y":4591.83349609375,"wires":[]},{"id":"a1a2f8e8.5bac18","type":"comment","z":"7b0fa635.67ef5","name":"**************** 11 Requesting Agent Info Sequence**************","info":"","x":234.84999084472656,"y":4592.166809082031,"wires":[]},{"id":"57caba26.33ccc4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/requestInfoData","method":"put","upload":false,"swaggerDoc":"","x":128.0833282470703,"y":4737.699844360352,"wires":[["328f222e.397cde","c6f2bf22.161a18"]]},{"id":"328f222e.397cde","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.1999969482422,"y":4773.699905395508,"wires":[]},{"id":"c6f2bf22.161a18","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var dataName = \"InfoSet\";\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+dataName+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":647.0331878662109,"y":4737.299514770508,"wires":[[]]},{"id":"7c93f50f.bf3064","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1114.383316040039,"y":4732.599990844727,"wires":[[]]},{"id":"471a1bed.8e1834","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":872.3499603271484,"y":4735.949905395508,"wires":[]},{"id":"5496c112.5cfeb","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/requestInfo","method":"get","upload":false,"swaggerDoc":"","x":121.19999694824219,"y":4805.599807739258,"wires":[["2eec3b94.8169c4"]]},{"id":"4e16df4.4683a2","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":805.1999969482422,"y":4805.599807739258,"wires":[]},{"id":"399a86d2.c4f45a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":638.1999969482422,"y":4806.599807739258,"wires":[["4e16df4.4683a2"]]},{"id":"2eec3b94.8169c4","type":"template","z":"7b0fa635.67ef5","name":"INSERT AGENT INFO HERE","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"AGENT\"\n \"ABC\"\n","output":"str","x":409.1999969482422,"y":4805.599807739258,"wires":[["399a86d2.c4f45a"]]},{"id":"5d75ab3d.a62f34","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject Request to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":155.6999969482422,"y":4701.599807739258,"wires":[["76629d87.7098fc"]]},{"id":"76629d87.7098fc","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"\nmsg.payload = {\n \"tuName\" : \"TU_Company1_MRL\"\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":648.1999969482422,"y":4703.599807739258,"wires":[["d3b6b14d.ce424"]]},{"id":"7ce87186.d7645","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n}","x":419.1999969482422,"y":4662.599807739258,"wires":[]},{"id":"77cda8f.02fb4d8","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/requestInfo","method":"get","upload":false,"swaggerDoc":"","x":144.66668701171875,"y":3120.666748046875,"wires":[["9a70f535.1872e8"]]},{"id":"6da8ac2d.0d6ddc","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":847.6666564941406,"y":3120.666748046875,"wires":[]},{"id":"402955e8.5b7c54","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660.6666564941406,"y":3120.666748046875,"wires":[["6da8ac2d.0d6ddc"]]},{"id":"3a82af35.2c6f98","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/requestInfo","method":"put","upload":false,"swaggerDoc":"","x":166.9833221435547,"y":2973.6666870117188,"wires":[["e5fdf7c5.69c0f","651709d2.673e68"]]},{"id":"e5fdf7c5.69c0f","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":206.71664428710938,"y":3009.300048828125,"wires":[]},{"id":"651709d2.673e68","type":"http request","z":"249aeb13.444e84","name":"requestInfos Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/requestInfo","tls":"","persist":false,"proxy":"","authType":"basic","x":1123.8666076660156,"y":2969.4501342773438,"wires":[[]]},{"id":"5f939e65.828db8","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/requestInfoData","method":"put","upload":false,"swaggerDoc":"","x":153.66665649414062,"y":3046.5667114257812,"wires":[["d14e94ad.dc6238","b6b23cbe.1271e8"]]},{"id":"d14e94ad.dc6238","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":197.7833251953125,"y":3082.5667724609375,"wires":[]},{"id":"b6b23cbe.1271e8","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var dataName = \"InfoSet\";\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+dataName+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":673.6164855957031,"y":3045.1663818359375,"wires":[[]]},{"id":"7b388800.375908","type":"http request","z":"249aeb13.444e84","name":"Endpoint of ERP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1117.9665832519531,"y":3044.4666748046875,"wires":[[]]},{"id":"64c26034.8e2f","type":"inject","z":"249aeb13.444e84","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":476.2833557128906,"y":3008.4666748046875,"wires":[["651709d2.673e68"]]},{"id":"e9908fb9.c8e238","type":"comment","z":"249aeb13.444e84","name":"**************** 5 Requesting Agent Info Sequence**************","info":"","x":262.6666564941406,"y":2936.666748046875,"wires":[]},{"id":"9a70f535.1872e8","type":"template","z":"249aeb13.444e84","name":"INSERT AGENT INFO HERE","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"AGENT\"\n \"ABC\"\n","output":"str","x":406.6666259765625,"y":3120.666748046875,"wires":[["402955e8.5b7c54"]]},{"id":"c638e3e.26af82","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\nno payload intended, automatically requests all available VPP Agents","x":519.6666564941406,"y":2976.666748046875,"wires":[]},{"id":"17f2a528.d6b0c3","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":898.6666564941406,"y":3046.666748046875,"wires":[]},{"id":"fa8b421b.543a28","type":"debug","z":"80f5f744.445108","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1282.8571210588727,"y":1142.285701206752,"wires":[]},{"id":"e6ddaf40.83549","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":648.1499633789062,"y":2811.6832885742188,"wires":[["8152d9b9.044e5"]]},{"id":"8152d9b9.044e5","type":"http request","z":"249aeb13.444e84","name":"cancelOperation_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/cancelOperation_failure","tls":"","persist":false,"proxy":"","authType":"","x":1194.1500701904297,"y":2809.6834564208984,"wires":[[]]},{"id":"fc89c9f6.f1417","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":198.1499786376953,"y":2812.8832397460938,"wires":[["da608014.6f2ae","e6ddaf40.83549"]]},{"id":"da608014.6f2ae","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":207.449951171875,"y":2848.8834838867188,"wires":[]},{"id":"e0d3fd20.7c9f98","type":"inject","z":"249aeb13.444e84","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":191,"y":2888.0167846679688,"wires":[["3c6c245e.62b624"]]},{"id":"3c6c245e.62b624","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":651,"y":2886.0167846679688,"wires":[["8152d9b9.044e5"]]},{"id":"e9328489.cd5e88","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635.1499633789062,"y":4178.25,"wires":[["dbe579fd.7dd56"]]},{"id":"dbe579fd.7dd56","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_failure","tls":"","persist":false,"proxy":"","authType":"","x":1181.1500701904297,"y":4175.25016784668,"wires":[[]]},{"id":"58dff453.340fe4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":185.1499786376953,"y":4178.449951171875,"wires":[["7f470248.3b44cc","e9328489.cd5e88"]]},{"id":"7f470248.3b44cc","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":194.449951171875,"y":4214.4501953125,"wires":[]},{"id":"ff6d0031.d35f","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Failure***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":178,"y":4253.58349609375,"wires":[["5a73f948.ba7458"]]},{"id":"5a73f948.ba7458","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":638,"y":4251.58349609375,"wires":[["dbe579fd.7dd56"]]},{"id":"eb721194.81a62","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":175.85000610351562,"y":2454.64990234375,"wires":[["67b5c44c.38bf84","be3d2d4e.feae58"]]},{"id":"67b5c44c.38bf84","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":265.8500061035156,"y":2493.64990234375,"wires":[]},{"id":"8ef401ff.50f15","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":614.6834106445312,"y":2457.349609375,"wires":[[]]},{"id":"be3d2d4e.feae58","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":420.6833801269531,"y":2457.5999145507812,"wires":[["8ef401ff.50f15"]]},{"id":"2d20f9df.46cb36","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1104.2999877929688,"y":2454.7501220703125,"wires":[["268060a5.7924f"]]},{"id":"268060a5.7924f","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1332.7999877929688,"y":2454.7501220703125,"wires":[[]]},{"id":"623e5a2.4d804a4","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":873.8666381835938,"y":2457.7501220703125,"wires":[]},{"id":"f8cf0271.5bfe9","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":171.6666717529297,"y":4517,"wires":[["c5b67811.cac2d8","47ff44dc.9beae4"]]},{"id":"c5b67811.cac2d8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":251.6666717529297,"y":4553,"wires":[]},{"id":"12f0d993.412706","type":"function","z":"7b0fa635.67ef5","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600.5000762939453,"y":4519.69970703125,"wires":[[]]},{"id":"47ff44dc.9beae4","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":418.5000762939453,"y":4518.9501953125,"wires":[["12f0d993.412706"]]},{"id":"fd3a8ab0.c1762","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":859.6833038330078,"y":4520.1002197265625,"wires":[]},{"id":"4311fce9.be3914","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1108.5166473388672,"y":4520.7001953125,"wires":[[]]},{"id":"18c87b11.b14c55","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadNewSetpoint.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672.6666870117188,"y":1121,"wires":[["5ac310c4.37c028"]]},{"id":"e02adc48.0aa598","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":455.4333801269531,"y":1120.7499389648438,"wires":[["18c87b11.b14c55"]]}] \ No newline at end of file +[{"id":"16acb04.7bc525","type":"tab","label":"VPP Dashboard","disabled":false,"info":""},{"id":"7b0fa635.67ef5","type":"tab","label":"VPP - VPP-Agent","disabled":false,"info":""},{"id":"249aeb13.444e84","type":"tab","label":"TU-Agent - Planning","disabled":false,"info":""},{"id":"80f5f744.445108","type":"tab","label":"TU-Agent - TU","disabled":false,"info":""},{"id":"43429a7f.e2c06c","type":"tab","label":"TU-Agent - EMS","disabled":false,"info":""},{"id":"99325b1f.e4e488","type":"soap-config","z":"80f5f744.445108","wsdl":"http://www.webservicex.net/geoipservice.asmx?wsdl","auth":"0","user":"","pass":"","key":"","cert":"","token":""},{"id":"500ae9ad.9ec368","type":"soap-config","z":"80f5f744.445108","wsdl":"http://www.webservicex.net/globalweather.asmx?WSDL","auth":"0","user":"","pass":"","cert":"","token":""},{"id":"268dcadf.8f2d9e","type":"soap-config","z":"80f5f744.445108","wsdl":"http://www.webservicex.net/geoipservice.asmx?wsdl","auth":"0","user":"","pass":"","key":"","cert":"","token":""},{"id":"7b2edbef.0d9274","type":"ui_group","z":"","name":"Accounting","tab":"f1c1dbec.dff76","order":1,"disp":true,"width":"6","collapse":false},{"id":"a1280549.92b49","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"7a0ced2c.74f9ec","type":"ui_tab","z":"","name":"Scheduling","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"df5c4bc4.8dc3","type":"ui_group","z":"","name":"Scheduling","tab":"7a0ced2c.74f9ec","order":1,"disp":true,"width":"6","collapse":false},{"id":"feeaec25.af6ba8","type":"ui_tab","z":"","name":"TU-Control","icon":"dashboard","order":2,"disabled":false,"hidden":false},{"id":"43be54a9.7cf664","type":"ui_group","z":"","name":"TU Control: New Setpoint","tab":"feeaec25.af6ba8","order":1,"disp":true,"width":"6","collapse":false},{"id":"9c1cc111.5b1678","type":"ui_group","z":"","name":"Device Status","tab":"29d4c607.37ee1a","order":1,"disp":true,"width":"6","collapse":false},{"id":"2f58a8ea.b6d678","type":"ui_group","z":"","name":"Device Management","tab":"29d4c607.37ee1a","order":4,"disp":true,"width":"6","collapse":false},{"id":"2b01bfb4.ee1ea8","type":"ui_group","z":"","name":"Control Output 1","tab":"29d4c607.37ee1a","order":2,"disp":true,"width":"6","collapse":false},{"id":"6fc5d75c.1627a8","type":"ui_group","z":"","name":"O1 - O4 Output States","tab":"29d4c607.37ee1a","order":3,"disp":true,"width":"6","collapse":false},{"id":"29d4c607.37ee1a","type":"ui_tab","z":"","name":"NETIO AN31 (REST XML)","icon":"dashboard","order":3,"disabled":false,"hidden":false},{"id":"470c886e.9dacf8","type":"ui_group","z":"","name":"Device Status","tab":"6bf1537b.697844","order":1,"disp":true,"width":"6","collapse":false},{"id":"820e4557.96e61","type":"ui_group","z":"","name":"Device Management","tab":"6bf1537b.697844","order":4,"disp":true,"width":"6","collapse":false},{"id":"45d5fa9.3621304","type":"ui_group","z":"","name":"Control Output 1","tab":"6bf1537b.697844","order":2,"disp":true,"width":"6","collapse":false},{"id":"dd943096.9b32e8","type":"ui_group","z":"","name":"O1 - O4 Output States","tab":"6bf1537b.697844","order":3,"disp":true,"width":"6","collapse":false},{"id":"6bf1537b.697844","type":"ui_tab","z":"","name":"NETIO AN31 (REST XML)","icon":"dashboard","order":4,"disabled":false,"hidden":false},{"id":"d7fd7295.17f8e","type":"ui_tab","z":"","name":"Post ANN time windows","icon":"dashboard","order":6,"disabled":false,"hidden":false},{"id":"21ffbe58.69dc12","type":"ui_group","z":"","name":"ANN","tab":"d7fd7295.17f8e","order":1,"disp":true,"width":"6","collapse":false},{"id":"f1c1dbec.dff76","type":"ui_tab","z":"","name":"Accounting","icon":"dashboard","order":5,"disabled":false,"hidden":false},{"id":"ddbdad88.35331","type":"comment","z":"249aeb13.444e84","name":"1.1 Receiving Load Schedule Plans from Agent (Node-RED --> Planning)","info":"","x":286.1166687011719,"y":118.11666870117188,"wires":[]},{"id":"41a78e3f.0db35","type":"ui_button","z":"16acb04.7bc525","name":"","group":"df5c4bc4.8dc3","order":19,"width":0,"height":0,"passthru":false,"label":"Start Scheduling","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":98.44998168945312,"y":737.9000549316406,"wires":[["cd908004.a44d9","1e39238e.1fafc4"]]},{"id":"c9c94f34.0da6b","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":469.4500427246094,"y":693.0834045410156,"wires":[]},{"id":"d0063b9.8688548","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Time Window Start","tooltip":"","group":"df5c4bc4.8dc3","order":10,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":114.45001220703125,"y":359.76666259765625,"wires":[["feec11e5.0a10a8"]]},{"id":"feec11e5.0a10a8","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeStart = date.toISOString().substr(11, 8);\n\nflow.set(\"TimeStart\",TimeStart);\nmsg.payload = TimeStart;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":306.4500427246094,"y":359.3500061035156,"wires":[[]]},{"id":"3cced0d4.8c003","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Time Window End","tooltip":"","group":"df5c4bc4.8dc3","order":13,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":113.11669921875,"y":477.1166687011719,"wires":[["9eb9496b.0381a8"]]},{"id":"9eb9496b.0381a8","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"TimeEnd\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":304.1166687011719,"y":477.1166687011719,"wires":[[]]},{"id":"cd908004.a44d9","type":"function","z":"16acb04.7bc525","name":"Load Values","func":"if (msg.payload === true)\n{\nvar start = flow.get('TimeStart') || 0;\nvar end = flow.get('TimeEnd') || 0;\nvar activationDateStart = flow.get('ActivationDateStart') || 0;\nvar activationDateEnd = flow.get('ActivationDateEnd') || 0;\nvar expirationTime = flow.get('ExpirationTime') || 0;\nvar expirationDate = flow.get('ExpirationDate') || 0;\nvar id = flow.get('ID') || 0;\n\n//\n/*\nvar prl = flow.get('PRL') || 0;\nvar srl = flow.get('SRL') || 0;\nvar mrl = flow.get('MRL') || 0;\nvar sol = flow.get('SOL') || 0;\nvar snl = flow.get('SNL') || 0;\nvar spot = flow.get('SPOT') || 0;\n//var ann = flow.get('ANN') || 0;\n*/\n\nif(flow.get('PRL') || 0){var prl = \"PRL,\";}else{var prl =\"\";}\nif(flow.get('SRL') || 0){var srl = \"SRL,\";}else{var srl =\"\";}\nif(flow.get('MRL') || 0){var mrl = \"MRL,\";}else{var mrl =\"\";}\nif(flow.get('SOL') || 0){var sol = \"SOL,\";}else{var sol =\"\";}\nif(flow.get('SNL') || 0){var snl = \"SNL,\";}else{var snl =\"\";}\nif(flow.get('SPOT') || 0){var spot = \"SPOT,\";}else{var spot =\"\";}\nif(flow.get('PRL') || flow.get('SRL') || flow.get('MRL') || flow.get('SOL') || flow.get('SNL') || flow.get('SPOT')){\n var serviceDescriptions = prl + srl + mrl + sol + snl + spot;\n}else{ var serviceDescriptions = \"empty\";}\n\n\n//serviceDescriptions = prl+\",\"+mrl+\",\"+srl+\",\"+sol+\",\"+snl+\",\"+spot;\n\n//adding the date to the start and stop time\nstart = activationDateStart +\" \"+ start;\nend = activationDateEnd +\" \"+ end;\nexpiration = expirationDate + \" \" + expirationTime;\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\nreturn msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":293.1166687011719,"y":738.1167297363281,"wires":[["c9c94f34.0da6b","52eb527f.939da4"]]},{"id":"72cf2e6d.fed82","type":"ui_button","z":"16acb04.7bc525","name":"","group":"43be54a9.7cf664","order":4,"width":0,"height":0,"passthru":false,"label":"Set NewSetpoint","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":116.11666870117188,"y":1329.1167602539062,"wires":[["e35e8cae.9eba68"]]},{"id":"d982ad23.33665","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"TU name","tooltip":"","group":"43be54a9.7cf664","order":2,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":87.78335571289062,"y":1252.3333435058594,"wires":[["4db62ce9.25f814"]]},{"id":"4db62ce9.25f814","type":"function","z":"16acb04.7bc525","name":"","func":"var value = msg.payload;\nflow.set(\"activation_tuName\",value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":325.7833557128906,"y":1257.3333129882812,"wires":[[]]},{"id":"e35e8cae.9eba68","type":"function","z":"16acb04.7bc525","name":"","func":"agentName = flow.get(\"activation_agentName\");\ntuName = flow.get(\"activation_tuName\");\nnewSetpoint = flow.get(\"activation_newSetpoint\");\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName,\n \"newSetpoint\" : newSetpoint\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330.7833557128906,"y":1329.3334350585938,"wires":[["24c537cd.d2ec08"]]},{"id":"4ad14c6b.d0f31c","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Date Start","group":"df5c4bc4.8dc3","order":9,"width":0,"height":0,"passthru":true,"topic":"","x":85.44998168945312,"y":326.2833557128906,"wires":[["6727a78c.b47a68"]]},{"id":"6727a78c.b47a68","type":"function","z":"16acb04.7bc525","name":"","func":"var activationDateStart = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nactivationDateStart = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"ActivationDateStart\",activationDateStart);\nmsg.payload = activationDateStart;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":305.1166687011719,"y":326.1166687011719,"wires":[[]]},{"id":"6de2332a.f321ac","type":"comment","z":"16acb04.7bc525","name":"Communication direction: VPP Dashboard --> VPP Agent (JADE)","info":"","x":250.11666870117188,"y":24.116668701171875,"wires":[]},{"id":"e73f5787.962e1","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_request","tls":"","persist":false,"proxy":"","authType":"basic","x":720.7000732421875,"y":738.2167053222656,"wires":[["3c93d809.3585a8"]]},{"id":"63b91130.ba5fb8","type":"comment","z":"16acb04.7bc525","name":"TU-Control","info":"","x":90,"y":1178.2166137695312,"wires":[]},{"id":"52eb527f.939da4","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":499.9999694824219,"y":738.2167358398438,"wires":[["e73f5787.962e1","fce616b8.13ea48"]]},{"id":"92e00400.afded8","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1106.199951171875,"y":736.2166748046875,"wires":[["9c44460d.9945a"]]},{"id":"27727eb3.d95cda","type":"function","z":"16acb04.7bc525","name":"","func":"var sol = msg.payload;\nflow.set(\"SOL\",sol);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":532.11669921875,"y":169.2166748046875,"wires":[[]]},{"id":"fce616b8.13ea48","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":703.11669921875,"y":693.1167297363281,"wires":[]},{"id":"3c93d809.3585a8","type":"debug","z":"16acb04.7bc525","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":904.11669921875,"y":690.1167297363281,"wires":[]},{"id":"9c44460d.9945a","type":"debug","z":"16acb04.7bc525","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":955.11669921875,"y":773.1167297363281,"wires":[]},{"id":"dbf8db70.6de598","type":"comment","z":"249aeb13.444e84","name":"1.2 Receiving Answers from ERP System (Node-RED <-- Planning)","info":"","x":264.0000305175781,"y":263.416748046875,"wires":[]},{"id":"1e4bd12e.c69e8f","type":"file in","z":"249aeb13.444e84","d":true,"name":"**TEST**Testfile from Desktop","filename":"C:\\Users\\Woltmann\\Desktop\\pom2.xml","format":"","chunk":false,"sendError":false,"encoding":"none","x":512.9999694824219,"y":1191.1667785644531,"wires":[["7a53b332.281004"]]},{"id":"b0d88e9c.b15188","type":"inject","z":"249aeb13.444e84","d":true,"name":"**TEST**Inject a XML File to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":186,"y":1191.266845703125,"wires":[["1e4bd12e.c69e8f"]]},{"id":"7a53b332.281004","type":"function","z":"249aeb13.444e84","d":true,"name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":819.666748046875,"y":1190.1835021972656,"wires":[["7c3fb223.5bd574"]]},{"id":"7c3fb223.5bd574","type":"http request","z":"249aeb13.444e84","d":true,"name":"scheduling_schedulingPlan Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlan","tls":"","persist":false,"proxy":"","authType":"","x":1106.11669921875,"y":1191.1667785644531,"wires":[[]]},{"id":"79ab94b3.c6415c","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_schedulingPlan","method":"put","upload":false,"swaggerDoc":"","x":195.11666870117188,"y":302.11669921875,"wires":[["b11283c4.3b27a8","c5c844c8.c4ab5"]]},{"id":"b11283c4.3b27a8","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":296.4166564941406,"y":337.11669921875,"wires":[]},{"id":"cf5fe0da.0f007","type":"comment","z":"249aeb13.444e84","name":"Testing Upload SchedulingPlans via predefined XML data","info":"","x":234.11666870117188,"y":1106.11669921875,"wires":[]},{"id":"fd764160.c2182","type":"comment","z":"7b0fa635.67ef5","name":"1.1 Start Scheduling Process (VPP --> Node-RED)","info":"","x":214.11666870117188,"y":105.11666870117188,"wires":[]},{"id":"7b1bd406.37964c","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":822.11669921875,"y":1143.2167053222656,"wires":[["d7b4a422.83f928"]]},{"id":"d7b4a422.83f928","type":"http request","z":"249aeb13.444e84","name":"scheduling_schedulingPlan Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlan","tls":"","persist":false,"proxy":"","authType":"","x":1105.11669921875,"y":1143.2167053222656,"wires":[[]]},{"id":"9db74b9a.6bbb08","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a predefined XML to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"a\":1}","payloadType":"str","x":209.11666870117188,"y":1145.7166748046875,"wires":[["fbcfe0dd.ec5ec8"]]},{"id":"4232d543.0180bc","type":"comment","z":"16acb04.7bc525","name":"Scheduling","info":"","x":96.11666870117188,"y":92.11666870117188,"wires":[]},{"id":"4e27e447.15d334","type":"comment","z":"16acb04.7bc525","name":"Accounting","info":"","x":85.11666870117188,"y":1987.5167236328125,"wires":[]},{"id":"26d9ad6d.480412","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Date End","group":"df5c4bc4.8dc3","order":12,"width":0,"height":0,"passthru":true,"topic":"","x":83.11666870117188,"y":443.1166687011719,"wires":[["8cbc4366.516118"]]},{"id":"8cbc4366.516118","type":"function","z":"16acb04.7bc525","name":"","func":"var activationDateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nactivationDateEnd = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"ActivationDateEnd\",activationDateEnd);\nmsg.payload = activationDateEnd;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":305.1166687011719,"y":443.1166687011719,"wires":[[]]},{"id":"27d52dd9.8301ea","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":8,"width":0,"height":0,"name":"","label":"Start time of the scheduling process","format":"{{msg.payload}}","layout":"row-spread","x":164.94992065429688,"y":289.98333740234375,"wires":[]},{"id":"93e6a31c.764bb8","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":11,"width":0,"height":0,"name":"","label":"End time of the scheduling process","format":"{{msg.payload}}","layout":"row-spread","x":164.11666870117188,"y":409.1166687011719,"wires":[]},{"id":"7a219d5f.e01bfc","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":1,"width":0,"height":0,"name":"","label":"Market related settings","format":"{{msg.payload}}","layout":"row-spread","x":125.11666870117188,"y":136.11666870117188,"wires":[]},{"id":"108db088.1c206f","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":14,"width":0,"height":0,"name":"","label":"Expiration date of the request","format":"{{msg.payload}}","layout":"row-spread","x":144,"y":521.2166748046875,"wires":[]},{"id":"b2983b1b.057ff8","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Time Offer-Expiration","tooltip":"","group":"df5c4bc4.8dc3","order":16,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":125.00003051757812,"y":590.2166748046875,"wires":[["81dcb187.886f88"]]},{"id":"81dcb187.886f88","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar expirationTime = date.toISOString().substr(11, 8);\n\n\nflow.set(\"ExpirationTime\",expirationTime);\nmsg.payload = expirationTime;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":306,"y":590.2166748046875,"wires":[[]]},{"id":"7d085799.3a5248","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Date Offer-Expiration","group":"df5c4bc4.8dc3","order":15,"width":0,"height":0,"passthru":true,"topic":"","x":125,"y":556.2166748046875,"wires":[["a5f0afb2.568f4"]]},{"id":"a5f0afb2.568f4","type":"function","z":"16acb04.7bc525","name":"","func":"var activationDateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nexpirationDate = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"ExpirationDate\",expirationDate);\nmsg.payload = expirationDate;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":307,"y":556.2166748046875,"wires":[[]]},{"id":"4671b29b.b70254","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":17,"width":0,"height":0,"name":"","label":"Induvidual ID of this action","format":"{{msg.payload}}","layout":"row-spread","x":141.00003051757812,"y":642.3166809082031,"wires":[]},{"id":"2e3b062d.92b7fa","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"ReferenceID","tooltip":"","group":"df5c4bc4.8dc3","order":18,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":88,"y":676.316650390625,"wires":[["e8a17baf.0c03a"]]},{"id":"e8a17baf.0c03a","type":"function","z":"16acb04.7bc525","name":"","func":"var id = msg.payload;\nflow.set(\"ID\",id);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":299.1166687011719,"y":676.9166259765625,"wires":[[]]},{"id":"36408f7b.a30e58","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"PRL","tooltip":"","group":"df5c4bc4.8dc3","order":2,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":73.94998168945312,"y":172.91665649414062,"wires":[["3aae9aed.d79c7e"]]},{"id":"fee49128.64cca","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"SRL","tooltip":"","group":"df5c4bc4.8dc3","order":3,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":73.11666870117188,"y":209.2166748046875,"wires":[["3d97a207.eed8ee"]]},{"id":"88ef07c4.0c1668","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"MRL","tooltip":"","group":"df5c4bc4.8dc3","order":4,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":71.11666870117188,"y":245.2166748046875,"wires":[["58eb5858.6814d8"]]},{"id":"df3b0df2.630578","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"SOL","tooltip":"","group":"df5c4bc4.8dc3","order":5,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":391.1166687011719,"y":169.2166748046875,"wires":[["27727eb3.d95cda"]]},{"id":"34f51174.4e5f46","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"SNL","tooltip":"","group":"df5c4bc4.8dc3","order":6,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":392.1166687011719,"y":206.2166748046875,"wires":[["561712ae.b576d4"]]},{"id":"4ca71186.c0e41","type":"ui_switch","z":"16acb04.7bc525","name":"","label":"FLEX","tooltip":"","group":"df5c4bc4.8dc3","order":7,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":394.1166687011719,"y":244.2166748046875,"wires":[["6896ff96.58183"]]},{"id":"3aae9aed.d79c7e","type":"function","z":"16acb04.7bc525","name":"","func":"var prl = msg.payload;\nflow.set(\"PRL\",prl);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":206.11666870117188,"y":170.11666870117188,"wires":[[]]},{"id":"3d97a207.eed8ee","type":"function","z":"16acb04.7bc525","name":"","func":"var srl = msg.payload;\nflow.set(\"SRL\",srl);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":205.11666870117188,"y":208.11666870117188,"wires":[[]]},{"id":"58eb5858.6814d8","type":"function","z":"16acb04.7bc525","name":"","func":"var mrl = msg.payload;\nflow.set(\"MRL\",mrl);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":206.11666870117188,"y":244.11666870117188,"wires":[[]]},{"id":"561712ae.b576d4","type":"function","z":"16acb04.7bc525","name":"","func":"var snl = msg.payload;\nflow.set(\"SNL\",snl);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":531.11669921875,"y":206.11666870117188,"wires":[[]]},{"id":"6896ff96.58183","type":"function","z":"16acb04.7bc525","name":"","func":"var spot = msg.payload;\nflow.set(\"FLEX\",spot);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":531.11669921875,"y":243.11666870117188,"wires":[[]]},{"id":"58365a3b.ebe174","type":"comment","z":"16acb04.7bc525","name":"ANN","info":"","x":78.11666870117188,"y":2119.916748046875,"wires":[]},{"id":"307fb841.f25fd","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/scheduling_startScheduling","method":"put","upload":false,"swaggerDoc":"","x":177.11666870117188,"y":160.11666870117188,"wires":[["7d3b5a3.f7c8524","b1d31393.b900a8","5659bae2.002f14"]]},{"id":"7d3b5a3.f7c8524","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":255.11666870117188,"y":198.11666870117188,"wires":[]},{"id":"3cc71fbb.5b725","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var schedulingStart = msg.payload.InterfacePayloadPlanning.schedulingStart.toString();\nvar schedulingEnd = msg.payload.InterfacePayloadPlanning.schedulingEnd.toString();\nvar expiration = msg.payload.InterfacePayloadPlanning.expiration.toString();\nvar referenceID = msg.payload.InterfacePayloadPlanning.referenceID.toString();\n\npayload = \n{\n\"schedulingStart\" : schedulingStart,\n\"schedulingEnd\" : schedulingEnd,\n\"expiration\" : expiration,\n\"referenceID\" : referenceID,\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":607.9500732421875,"y":201.81666564941406,"wires":[["9fa3384b.12fc1"]]},{"id":"22bb0d26.19069a","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"{\n schedulingStart: \"2021-02-05 12:00:00\",\n schedulingEnd: \"2021-02-05 13:00:00\",\n expiration: \"2021-02-04 22:00:00\",\n referenceID: \"scheduling-1\"\n}","x":865.11669921875,"y":203.11666870117188,"wires":[]},{"id":"b1d31393.b900a8","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":410.9500427246094,"y":202.06666564941406,"wires":[["3cc71fbb.5b725"]]},{"id":"5659bae2.002f14","type":"function","z":"249aeb13.444e84","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":608.9500427246094,"y":161.43333435058594,"wires":[[]]},{"id":"5352374.fea4ec8","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1111.11669921875,"y":157.11666870117188,"wires":[[]]},{"id":"2c343cfc.c7f644","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1092.11669921875,"y":123.11666870117188,"wires":[]},{"id":"fbcfe0dd.ec5ec8","type":"template","z":"249aeb13.444e84","name":"**TEST**XML-Template","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","output":"str","x":528.1166687011719,"y":1143.7166748046875,"wires":[["7b1bd406.37964c"]]},{"id":"39c59dca.e8a5ba","type":"http in","z":"249aeb13.444e84","d":true,"name":"","url":"/erp/schedulingPlan","method":"put","upload":false,"swaggerDoc":"","x":154.11666870117188,"y":1362.916748046875,"wires":[["3b6d7fe0.61c9d","683c651f.c51cec"]]},{"id":"3b6d7fe0.61c9d","type":"http response","z":"249aeb13.444e84","d":true,"name":"Response","statusCode":"","headers":{},"x":202.41665649414062,"y":1399.916748046875,"wires":[]},{"id":"683c651f.c51cec","type":"file","z":"249aeb13.444e84","d":true,"name":"","filename":"C:/Users/Woltmann/Desktop/newFile/ausNodeRed.xml","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"utf8","x":533.9500427246094,"y":1362.9834594726562,"wires":[[]]},{"id":"f9c4bd75.d2a9e8","type":"comment","z":"249aeb13.444e84","name":"Testing the Node-RED Interface by saving the Data to a file","info":"","x":234.11666870117188,"y":1326.916748046875,"wires":[]},{"id":"c5c844c8.c4ab5","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":612.050048828125,"y":302.41668701171875,"wires":[["3c0cfc8f.88b53c"]]},{"id":"3c0cfc8f.88b53c","type":"http request","z":"249aeb13.444e84","name":"scheduling_schedulingPlan Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlan","tls":"","persist":false,"proxy":"","authType":"","x":1164.050048828125,"y":300.41668701171875,"wires":[[]]},{"id":"6b7a1061.30328","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_refuseScheduling","method":"put","upload":false,"swaggerDoc":"","x":205.11666870117188,"y":464.11669921875,"wires":[["f58bb624.e61438","5c1a0033.a65fd"]]},{"id":"f58bb624.e61438","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":313.1166687011719,"y":502.11669921875,"wires":[]},{"id":"5c1a0033.a65fd","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610.7501220703125,"y":463.416748046875,"wires":[["5d9252e5.13e0b4"]]},{"id":"5d9252e5.13e0b4","type":"http request","z":"249aeb13.444e84","name":"scheduling_refuseScheduling Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_refuseScheduling","tls":"","persist":false,"proxy":"","authType":"","x":1164.750244140625,"y":461.416748046875,"wires":[[]]},{"id":"1ad94994.df1cae","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"referenceID = flow.get(\"referenceID\");\npayload = {\n \"referenceID\" : referenceID,\n \"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":822.11669921875,"y":1280.916748046875,"wires":[["ef400437.5e9ac8"]]},{"id":"ef400437.5e9ac8","type":"http request","z":"249aeb13.444e84","name":"scheduling_refuseScheduling Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_refuseScheduling","tls":"","persist":false,"proxy":"","authType":"","x":1113.1168212890625,"y":1281.916748046875,"wires":[[]]},{"id":"a1fae2b2.1ba5d8","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a refuseScheduling to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":218.94998168945312,"y":1281,"wires":[["1ad94994.df1cae"]]},{"id":"93d90be7.333288","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_request Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_request","tls":"","persist":false,"proxy":"","authType":"basic","x":1118.3666687011719,"y":142.24996948242188,"wires":[[]]},{"id":"9806f44f.99d148","type":"comment","z":"7b0fa635.67ef5","name":"1. Scheduling Process","info":"","x":125.11666870117188,"y":73.11666870117188,"wires":[]},{"id":"263a31b6.930756","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_request","method":"put","upload":false,"swaggerDoc":"","x":164.11666870117188,"y":142.11666870117188,"wires":[["6669f6db.483d","b7656f7e.47eaa"]]},{"id":"6669f6db.483d","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.11666870117188,"y":177.11666870117188,"wires":[]},{"id":"8bcbad15.6f18b","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var id = msg.payload.referenceID || 0; //id is an optional parameter\nvar serviceDescriptions = msg.payload.serviceDescriptions\nvar start = msg.payload.schedulingStart\nvar end = msg.payload.schedulingEnd\nvar expiration = msg.payload.expiration\n\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.11669921875,"y":143.11666107177734,"wires":[["93d90be7.333288"]]},{"id":"b97afd77.1f1fc","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_schedulingPlan","method":"put","upload":false,"swaggerDoc":"","x":173.11666870117188,"y":329.11663818359375,"wires":[["6703c2bf.318abc","1d3de801.a9daa"]]},{"id":"6703c2bf.318abc","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.41665649414062,"y":362.1166687011719,"wires":[]},{"id":"64ba4993.89a87","type":"comment","z":"7b0fa635.67ef5","name":"1.2 Sending the Scheduling Plans to the VPP (VPP <-- Node-RED)","info":"","x":263.1166687011719,"y":221.11663818359375,"wires":[]},{"id":"9afb9c24.47be2","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_schedulingPlanInfos","method":"put","upload":false,"swaggerDoc":"","x":184,"y":255.2166748046875,"wires":[["596579dd.a4621","90cc8d6.837fa7"]]},{"id":"596579dd.a4621","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":177.11666870117188,"y":287.2166748046875,"wires":[]},{"id":"6926c4e6.6beeac","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n// providing variables for the UI:\n//flow.set(\"schedulingPlanInfos\",schedulingPlanInfos);\n//global.set(\"schedulingPlanInfos\",schedulingPlanInfos);\n///var schedulingPlanInfos = flow.get(\"schedulingPlanInfos\");\n//global.get(\"arrayString\").push(schedulingPlanInfos);\n\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":255.2166748046875,"wires":[["40217cd9.f4f25c"]]},{"id":"1d3de801.a9daa","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = flow.get('schedulingPlanInfos');\n//use filename if you want to save the file in a local folder (save to folder node)\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":624.9500732421875,"y":328.8166198730469,"wires":[[]]},{"id":"1eb27538.8fd263","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1078.2999877929688,"y":254.11666870117188,"wires":[[]]},{"id":"a8c8de28.e92298","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1067.2999877929688,"y":218.11666870117188,"wires":[]},{"id":"b93374a1.44b6d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.5667114257812,"y":329.1166687011719,"wires":[[]]},{"id":"5bc8f24a.c8071c","type":"comment","z":"7b0fa635.67ef5","name":"1.3 Accepting or Rejecting the Proposals (VPP --> Node-RED)","info":"","x":238.11666870117188,"y":473.11663818359375,"wires":[]},{"id":"84d76edd.8b01a","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_accept-proposal","method":"put","upload":false,"swaggerDoc":"","x":186.11666870117188,"y":507.21661376953125,"wires":[["70d6390a.c9915","260fa31f.9b694c"]]},{"id":"40a19a7.cbd8b64","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/scheduling_reject-proposal","method":"put","upload":false,"swaggerDoc":"","x":186.11666870117188,"y":580.2166137695312,"wires":[["9b8a2c67.c398a8","7ae1d2c0.d88814"]]},{"id":"dfc6ced.16699b","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\nvar start = msg.payload.schedulingStart;\nvar end = msg.payload.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.1166381835938,"y":506.21661376953125,"wires":[["c7d830c5.e26b5"]]},{"id":"79d6989b.6a14f","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.1166687011719,"y":580.2166137695312,"wires":[["95950400.6683d"]]},{"id":"c6836fee.9343a8","type":"comment","z":"7b0fa635.67ef5","name":"1.4 Receiving Inform or Failure of TU (VPP <-- Node-RED)","info":"","x":228.11666870117188,"y":655.416748046875,"wires":[]},{"id":"89847d8.fd27c8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_failure","method":"put","upload":false,"swaggerDoc":"","x":137.11666870117188,"y":765.7166442871094,"wires":[["a26d953a.c69d4","7995e15c.5fec78"]]},{"id":"a26d953a.c69d4","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.41665649414062,"y":800.7166137695312,"wires":[]},{"id":"2a7b5b73.6f8b9c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_done","method":"put","upload":false,"swaggerDoc":"","x":129,"y":691.8167114257812,"wires":[["40cc27ff.3375d","f8dfe605.43a1d8"]]},{"id":"40cc27ff.3375d","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.11666870117188,"y":726.8167419433594,"wires":[]},{"id":"dc6fc640.e2eb68","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":691.8167419433594,"wires":[["cd761dcc.9ca9"]]},{"id":"c7d830c5.e26b5","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_accept-proposal Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_accept-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":1141,"y":504.99993896484375,"wires":[[]]},{"id":"95950400.6683d","type":"http request","z":"7b0fa635.67ef5","name":"scheduling_reject-proposal Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_reject-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":1142,"y":579.9999389648438,"wires":[[]]},{"id":"3fb6d3ba.0b472c","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":21,"width":"6","height":"2","name":"Anzeige Scheduling Ergebnisse","label":"","format":"{{msg.payload}}","layout":"row-spread","x":494.4999694824219,"y":856,"wires":[]},{"id":"1e02a040.6bf358","type":"function","z":"16acb04.7bc525","name":"Load Values","func":"var schedulingPlanInfos = global.get(\"arrayString\");\nmsg.payload = schedulingPlanInfos;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":250,"y":857,"wires":[["3fb6d3ba.0b472c","b764fa4a.c1c19"]]},{"id":"c786beb3.858d1","type":"inject","z":"16acb04.7bc525","name":"","props":[{"p":"payload"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":93,"y":857,"wires":[["1e02a040.6bf358"]]},{"id":"b764fa4a.c1c19","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":401.1166687011719,"y":814.5999755859375,"wires":[]},{"id":"1e39238e.1fafc4","type":"function","z":"16acb04.7bc525","name":"setting global varibale","func":"if (msg.payload === true)\n{\nvar arrayString = [];\nglobal.set(\"arrayString\",arrayString);\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.11669921875,"y":801.8166809082031,"wires":[[]]},{"id":"64db74fd.341f8c","type":"function","z":"16acb04.7bc525","name":"scheduling_request","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\nvar start = msg.payload.schedulingStart;\nvar end = msg.payload.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":276.1166687011719,"y":904.7000122070312,"wires":[["5d013358.64ccbc"]]},{"id":"5d013358.64ccbc","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":492.6666259765625,"y":903.8333435058594,"wires":[["7d67a49f.7dc594"]]},{"id":"7921aafe.f33b6c","type":"function","z":"16acb04.7bc525","name":"scheduling_request","func":"var schedulingPlanReference = msg.payload.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":276.1166687011719,"y":953.7000122070312,"wires":[["70af2e92.5b099"]]},{"id":"70af2e92.5b099","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":494.11669921875,"y":952.7000122070312,"wires":[["692884a6.ef6204"]]},{"id":"7d67a49f.7dc594","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_accept-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":730,"y":900.4833374023438,"wires":[["9741f934.63f638"]]},{"id":"9741f934.63f638","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":957.4998779296875,"y":900.4833374023438,"wires":[["77f071ba.06b89"]]},{"id":"692884a6.ef6204","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/scheduling_reject-proposal","tls":"","persist":false,"proxy":"","authType":"basic","x":731,"y":950.4833374023438,"wires":[["2a389800.ba028"]]},{"id":"2a389800.ba028","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":958.4998779296875,"y":950.4833374023438,"wires":[["227f2efc.6742b2"]]},{"id":"f4b1a57d.0bd458","type":"ui_text","z":"16acb04.7bc525","group":"df5c4bc4.8dc3","order":20,"width":0,"height":0,"name":"","label":"Result of Scheduling Request","format":"{{msg.payload}}","layout":"row-spread","x":148.11666870117188,"y":811.61669921875,"wires":[]},{"id":"ebf558df.67ba8","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Auswahl des Agenten","tooltip":"","group":"df5c4bc4.8dc3","order":22,"width":0,"height":0,"passthru":true,"mode":"number","delay":300,"topic":"","x":134.11666870117188,"y":1014.61669921875,"wires":[["ce50615e.fe0e6"]]},{"id":"ce50615e.fe0e6","type":"function","z":"16acb04.7bc525","name":"","func":"var agenSelect = msg.payload;\nflow.set(\"agenSelect\", agenSelect);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":323.1166687011719,"y":1013.61669921875,"wires":[["5ecec4ee.e24454"]]},{"id":"3926ed26.649432","type":"ui_button","z":"16acb04.7bc525","name":"","group":"df5c4bc4.8dc3","order":23,"width":"3","height":"2","passthru":false,"label":"Accept-Proposal","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":116.11666870117188,"y":1056.61669921875,"wires":[["ca880339.f6a6e"]]},{"id":"1d776e78.00483a","type":"ui_button","z":"16acb04.7bc525","name":"","group":"df5c4bc4.8dc3","order":24,"width":"3","height":"2","passthru":false,"label":"Reject-Proposal","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":118.11666870117188,"y":1097.61669921875,"wires":[["86837948.82eb18"]]},{"id":"86837948.82eb18","type":"function","z":"16acb04.7bc525","name":"","func":"agentNumber = flow.get(\"agenSelect\");\nvar schedulingPlanReference = global.get(\"arrayString\");\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference[agentNumber]\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":309.9499816894531,"y":1100.0167236328125,"wires":[["7921aafe.f33b6c","8f187a2c.45855"]]},{"id":"ca880339.f6a6e","type":"function","z":"16acb04.7bc525","name":"","func":"agentNumber = flow.get(\"agenSelect\");\nvar schedulingPlanReference = global.get(\"arrayString\");\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference[agentNumber],\n \"schedulingStart\" : flow.get('ActivationDateStart')+ \" \" + flow.get('TimeStart'),\n \"schedulingEnd\" : flow.get('ActivationDateEnd')+ \" \" + flow.get('TimeEnd')\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":316.1166687011719,"y":1058.816650390625,"wires":[["64db74fd.341f8c","9cce43fd.5e57f"]]},{"id":"5ecec4ee.e24454","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":573.11669921875,"y":1019.7166748046875,"wires":[]},{"id":"9cce43fd.5e57f","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":564.11669921875,"y":1070.7166748046875,"wires":[]},{"id":"8f187a2c.45855","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":564.11669921875,"y":1118.7166748046875,"wires":[]},{"id":"1b446a2.65bb496","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_schedulingPlanUploaded","method":"put","upload":false,"swaggerDoc":"","x":225.11666870117188,"y":382.21669006347656,"wires":[["7cbd83d1.2f7874","28d49ae3.63e606"]]},{"id":"7cbd83d1.2f7874","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":355.1166687011719,"y":416.2166748046875,"wires":[]},{"id":"28d49ae3.63e606","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\" : referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610.7501220703125,"y":381.5167236328125,"wires":[["9426cc1a.e712b"]]},{"id":"9426cc1a.e712b","type":"http request","z":"249aeb13.444e84","name":"scheduling_schedulingPlanUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlanUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1191.7501220703125,"y":382.5166931152344,"wires":[[]]},{"id":"daa7c664.10a1f","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"referenceID = flow.get(\"referenceID\");\npayload = {\n \"referenceID\" : referenceID,\n \"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":826.11669921875,"y":1235.816650390625,"wires":[["e2828bc6.3b171"]]},{"id":"e2828bc6.3b171","type":"http request","z":"249aeb13.444e84","name":"scheduling_schedulingPlanUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_schedulingPlanUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1141.1167907714844,"y":1235.816650390625,"wires":[[]]},{"id":"f670bd3e.6b5bb","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a schedulingPlanUploaded to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":237.11666870117188,"y":1238.7166748046875,"wires":[["daa7c664.10a1f"]]},{"id":"9fa3384b.12fc1","type":"function","z":"249aeb13.444e84","name":"****TESTING (getting the referenceID)*******","func":"var referenceID = msg.payload.referenceID;\nflow.set(\"referenceID\", referenceID);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1172.949951171875,"y":213.01666259765625,"wires":[[]]},{"id":"8680da8d.132168","type":"comment","z":"249aeb13.444e84","name":"1.3 Receiving Scheduling-Accept or Reject from Agent (Node-RED --> Planning)","info":"","x":302.1166687011719,"y":568.61669921875,"wires":[]},{"id":"34456b5f.587afc","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/scheduling_accepted","method":"put","upload":false,"swaggerDoc":"","x":157.11666870117188,"y":618.5166625976562,"wires":[["ab38be7d.ed14d","ba5ad7e0.c20ca8","8317a571.24764"]]},{"id":"ab38be7d.ed14d","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":226.11666870117188,"y":653.5166625976562,"wires":[]},{"id":"2738bc23.a3b2d4","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var schedulingStart = msg.payload.InterfacePayloadPlanning.schedulingStart.toString();\nvar schedulingEnd = msg.payload.InterfacePayloadPlanning.schedulingEnd.toString();\n\nvar referenceID = msg.payload.InterfacePayloadPlanning.referenceID.toString();\n\npayload = \n{\n\"schedulingStart\" : schedulingStart,\n\"schedulingEnd\" : schedulingEnd,\n\"referenceID\" : referenceID,\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":598.9500427246094,"y":650.2166595458984,"wires":[[]]},{"id":"ba5ad7e0.c20ca8","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":379.9500427246094,"y":649.4666595458984,"wires":[["2738bc23.a3b2d4"]]},{"id":"8317a571.24764","type":"function","z":"249aeb13.444e84","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":598.9500427246094,"y":617.8333282470703,"wires":[[]]},{"id":"e18df4c.0f67388","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/scheduling_rejected","method":"put","upload":false,"swaggerDoc":"","x":153.11666870117188,"y":711.5166625976562,"wires":[["a77ce3f6.1a748","6db9f40c.ba296c","f18c232e.652d58"]]},{"id":"a77ce3f6.1a748","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":214.11666870117188,"y":746.5166625976562,"wires":[]},{"id":"47502ea1.0cff","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var referenceID = msg.payload.InterfacePayloadPlanning.referenceID.toString();\n\npayload = {\n \"referenceID\" : referenceID\n }\n\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":597.9500732421875,"y":744.2166748046875,"wires":[[]]},{"id":"ec5bf90c.7feb6","type":"comment","z":"249aeb13.444e84","name":"Testing the Agent Interface via predefined XML data","info":"","x":209.13327026367188,"y":1443.2166748046875,"wires":[]},{"id":"4b57b51e.d46d24","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1104.566650390625,"y":607.61669921875,"wires":[["c313038c.fe74b"]]},{"id":"c313038c.fe74b","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1339.066650390625,"y":606.61669921875,"wires":[[]]},{"id":"e700545d.62911","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1095.566650390625,"y":565.61669921875,"wires":[]},{"id":"53c81336.ed4304","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1106.566650390625,"y":708.61669921875,"wires":[["49fe3ba7.566734"]]},{"id":"49fe3ba7.566734","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1341.066650390625,"y":707.61669921875,"wires":[[]]},{"id":"934496e7.c16c18","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a FailureScheduling to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":202.11660766601562,"y":1534.4166259765625,"wires":[["6907a050.482d08"]]},{"id":"6907a050.482d08","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"//msg.payload = msg.payload;\nreferenceID = flow.get(\"referenceID\");\npayload = {\n \"referenceID\" : referenceID,\n \"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":805.2833251953125,"y":1534.3333740234375,"wires":[["4f086a87.cb297c"]]},{"id":"4f086a87.cb297c","type":"http request","z":"249aeb13.444e84","name":"scheduling_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_failure","tls":"","persist":false,"proxy":"","authType":"","x":1061.2835083007812,"y":1535.3333740234375,"wires":[[]]},{"id":"fdc88bff.4a8d3","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a InformScheduling to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":197.11660766601562,"y":1481.4166259765625,"wires":[["6c2c422e.ad1cd4"]]},{"id":"6c2c422e.ad1cd4","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"//msg.payload = msg.payload;\nreferenceID = flow.get(\"referenceID\");\npayload = {\n \"referenceID\" : referenceID,\n \"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":800.2833251953125,"y":1481.3333740234375,"wires":[["6b6f654b.5e02e4"]]},{"id":"6b6f654b.5e02e4","type":"http request","z":"249aeb13.444e84","name":"scheduling_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_inform","tls":"","persist":false,"proxy":"","authType":"","x":1061.283447265625,"y":1480.3333740234375,"wires":[[]]},{"id":"2b3c2051.b748d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.7833251953125,"y":690.6166687011719,"wires":[[]]},{"id":"8fdfe174.ac4e58","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1079.0499267578125,"y":766.6166687011719,"wires":[[]]},{"id":"7364643d.31052c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.11669921875,"y":764.61669921875,"wires":[["3e3fd9bd.e7f1a6"]]},{"id":"752760e3.511c88","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/scheduling_refuse","method":"put","upload":false,"swaggerDoc":"","x":142.85000610351562,"y":403.8500061035156,"wires":[["13af9462.45515c","a4ba88a2.2feec"]]},{"id":"13af9462.45515c","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":177.14999389648438,"y":438.85003662109375,"wires":[]},{"id":"316b4f43.5946a8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = msg.payload.InterfacePayloadAgentReference.referenceID[0]; \nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanInfos,\n \"tuName\" : tuName\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.683349609375,"y":403.54998779296875,"wires":[[]]},{"id":"865123ce.69afe8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1076.8499145507812,"y":402.8500061035156,"wires":[[]]},{"id":"6db9f40c.ba296c","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":380.1166687011719,"y":743.7166748046875,"wires":[["47502ea1.0cff"]]},{"id":"f18c232e.652d58","type":"function","z":"249aeb13.444e84","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":599.11669921875,"y":710.7166748046875,"wires":[[]]},{"id":"5ac94cf6.d176ac","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":602.8499755859375,"y":930.0501098632812,"wires":[["ed54c8b.1b9f0b8"]]},{"id":"ed54c8b.1b9f0b8","type":"http request","z":"249aeb13.444e84","name":"scheduling_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_failure","tls":"","persist":false,"proxy":"","authType":"","x":1129.8502197265625,"y":929.0503540039062,"wires":[[]]},{"id":"3b8bf6bc.be022a","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":601.8499755859375,"y":847.0500640869141,"wires":[["b0c03820.40b438"]]},{"id":"b0c03820.40b438","type":"http request","z":"249aeb13.444e84","name":"scheduling_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/scheduling_inform","tls":"","persist":false,"proxy":"","authType":"","x":1129.85009765625,"y":844.0501098632812,"wires":[[]]},{"id":"ebe3936e.2d7208","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_inform","method":"put","upload":false,"swaggerDoc":"","x":192.85000610351562,"y":847.2498931884766,"wires":[["cdf0b2cf.5964e8","3b8bf6bc.be022a"]]},{"id":"2be9a3ba.f24bcc","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/scheduling_failure","method":"put","upload":false,"swaggerDoc":"","x":189.85000610351562,"y":930.2499389648438,"wires":[["e4b173b5.8ff508","5ac94cf6.d176ac"]]},{"id":"e4b173b5.8ff508","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":251.85000610351562,"y":969.2499847412109,"wires":[]},{"id":"cdf0b2cf.5964e8","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":252.14999389648438,"y":882.2499389648438,"wires":[]},{"id":"3d0294f1.345cec","type":"comment","z":"249aeb13.444e84","name":"1.4 Receiving Answers from Planning System (Node-RED <-- Planning)","info":"","x":266.1166687011719,"y":805.5666046142578,"wires":[]},{"id":"d822ac63.b430e8","type":"comment","z":"7b0fa635.67ef5","name":"2.1 Sending out a new Setpoint to TU (VPP --> Node-RED)","info":"","x":233.11669921875,"y":901.916748046875,"wires":[]},{"id":"1e3a2347.f610fd","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newSetpoint","method":"put","upload":false,"swaggerDoc":"","x":163.11669921875,"y":940.0165405273438,"wires":[["9947715.a48e99","eda31a89.b4951","91cb935e.4dddf"]]},{"id":"eda31a89.b4951","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.1166076660156,"y":939.0166625976562,"wires":[[]]},{"id":"4b13d705.4dca3","type":"http request","z":"7b0fa635.67ef5","name":"control_newSetpoint Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newSetpoint","tls":"","persist":false,"proxy":"","authType":"basic","x":1126.0000305175781,"y":939.7999877929688,"wires":[[]]},{"id":"4ebeb978.612f38","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"New setpoint (kW)","tooltip":"","group":"43be54a9.7cf664","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":116.11666870117188,"y":1288.11669921875,"wires":[["1e64eb7c.9c05f5"]]},{"id":"1e64eb7c.9c05f5","type":"function","z":"16acb04.7bc525","name":"","func":"var value = msg.payload;\nflow.set(\"activation_newSetpoint\",value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":322.1166687011719,"y":1291.11669921875,"wires":[[]]},{"id":"24c537cd.d2ec08","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":548.11669921875,"y":1327.0166015625,"wires":[["dc9ba1b2.d29fb"]]},{"id":"dc9ba1b2.d29fb","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newSetpoint","tls":"","persist":false,"proxy":"","authType":"basic","x":785.4500732421875,"y":1323.6665954589844,"wires":[["fdefe4e.1967098"]]},{"id":"fdefe4e.1967098","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1012.949951171875,"y":1323.6665954589844,"wires":[[]]},{"id":"3dc42559.4f579a","type":"comment","z":"16acb04.7bc525","name":"Node-RED --> VPP-Agent","info":"","x":805.2000732421875,"y":1285.5332946777344,"wires":[]},{"id":"5a4c63f9.04218c","type":"comment","z":"80f5f744.445108","name":"1.1 Receiving new setpoints or load profiles from agent (Node-RED --> TU)","info":"","x":288,"y":101,"wires":[]},{"id":"8a68fbfd.1c4f3","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/control_newSetpoint","method":"put","upload":false,"swaggerDoc":"","x":150,"y":141,"wires":[["4acccf45.36cfc8","c47d0fb5.97a21","b3cda314.7f7f4"]]},{"id":"4acccf45.36cfc8","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":211,"y":179,"wires":[]},{"id":"bf8eae57.5e5d68","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint[0];\nvar tuName = msg.payload.InterfacePayloadNewSetpoint.tuName.toString();\n\npayload = \n{\n\"newSetpoint\" : newSetpoint,\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":751.8333435058594,"y":175.6999969482422,"wires":[[]]},{"id":"4f953a80.1971fc","type":"comment","z":"80f5f744.445108","name":"Interface with data for the TU","info":"","x":759,"y":103,"wires":[]},{"id":"c47d0fb5.97a21","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":488.8334045410156,"y":175.95001220703125,"wires":[["bf8eae57.5e5d68"]]},{"id":"b3cda314.7f7f4","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750.8333740234375,"y":142.31666564941406,"wires":[[]]},{"id":"92b89e73.327e48","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1026,"y":104,"wires":[]},{"id":"50dd7e01.b20768","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":176,"y":599.0000305175781,"wires":[]},{"id":"1f782735.7721b1","type":"inject","z":"80f5f744.445108","name":"***test: inject a FAILURE ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":171,"y":677.0000305175781,"wires":[["adec5007.497f78"]]},{"id":"bbfcd06e.7ad9d8","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":677,"wires":[["39337a60.4c4296"]]},{"id":"39337a60.4c4296","type":"http request","z":"80f5f744.445108","name":"control_newSetpointFailed Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/control_newSetpointFailed","tls":"","persist":false,"proxy":"","authType":"basic","x":1119.699951171875,"y":677,"wires":[["b8b3657d.10a7a"]]},{"id":"b8b3657d.10a7a","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1407.199951171875,"y":677,"wires":[[]]},{"id":"5bc7e587.48e7f4","type":"inject","z":"80f5f744.445108","name":"***test: inject a DONE ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":163,"y":639.8500061035156,"wires":[["ccf09e07.25d6e8"]]},{"id":"515b794e.324","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":789.8499755859375,"y":639.8500061035156,"wires":[["b3a9bf70.fb5ec8"]]},{"id":"b3a9bf70.fb5ec8","type":"http request","z":"80f5f744.445108","name":"control_newSetpointDone Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/control_newSetpointDone","tls":"","persist":false,"proxy":"","authType":"basic","x":1109.550048828125,"y":639.8500061035156,"wires":[["7ee185a.84cc97c"]]},{"id":"7ee185a.84cc97c","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1410.050048828125,"y":638.8500061035156,"wires":[[]]},{"id":"adec5007.497f78","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":409.6166687011719,"y":676.5500183105469,"wires":[["bbfcd06e.7ad9d8"]]},{"id":"ccf09e07.25d6e8","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TUEmden0\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":409.8500061035156,"y":639.8500061035156,"wires":[["515b794e.324"]]},{"id":"882f25f.49a70d8","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\n400\nmachine32\n","x":1075.316650390625,"y":138.11666870117188,"wires":[]},{"id":"ac37e8b0.fdbc08","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \nnewSetpoint: \"400\", \ntuName: \"machine32\" \n}","x":1076.316650390625,"y":169.11666870117188,"wires":[]},{"id":"4bf7a435.05b3cc","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":789,"y":512.0000305175781,"wires":[["f1c7a8ce.5544f8"]]},{"id":"f1c7a8ce.5544f8","type":"http request","z":"80f5f744.445108","name":"control_newSetpointFailed Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/control_newSetpointFailed","tls":"","persist":false,"proxy":"","authType":"basic","x":1122.699951171875,"y":512.0000305175781,"wires":[[]]},{"id":"2472fef6.314632","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":789.8499755859375,"y":476.85003662109375,"wires":[["679f4808.89499"]]},{"id":"679f4808.89499","type":"http request","z":"80f5f744.445108","name":"control_newSetpointDone Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/control_newSetpointDone","tls":"","persist":false,"proxy":"","authType":"basic","x":1113.550048828125,"y":476.85003662109375,"wires":[[]]},{"id":"6d153d07.a27564","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1083,"y":431.00006103515625,"wires":[]},{"id":"8361a26b.d76578","type":"comment","z":"80f5f744.445108","name":"1. TU-Control Sequence","info":"","x":127,"y":69,"wires":[]},{"id":"7619e07a.81ef4","type":"comment","z":"80f5f744.445108","name":"1.2 Sending done or failire answer to agent (Node-RED <-- TU)","info":"","x":257,"y":406.0000305175781,"wires":[]},{"id":"4a27eee1.bddc48","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":534.9999694824219,"y":478.0000305175781,"wires":[]},{"id":"5c50f2e5.71e054","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":535,"y":515.0000305175781,"wires":[]},{"id":"428d2f71.9643b8","type":"comment","z":"80f5f744.445108","name":"2. Balancing Process","info":"","x":128.00001525878906,"y":799.0000610351562,"wires":[]},{"id":"379276f9.aa7f7a","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"TU name","tooltip":"","group":"43be54a9.7cf664","order":7,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":84.11666870117188,"y":1531.2166748046875,"wires":[["3732bad2.076cde"]]},{"id":"bdf2bbce.e66c28","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Balancing Start (Date)","group":"43be54a9.7cf664","order":8,"width":0,"height":0,"passthru":true,"topic":"","x":125.11666870117188,"y":1567.316650390625,"wires":[["6d5f4526.3b9cc4"]]},{"id":"11a148d9.ee7997","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Balancing Start (Time)","tooltip":"","group":"43be54a9.7cf664","order":9,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":125.11669921875,"y":1601.316650390625,"wires":[["c9eff026.71274"]]},{"id":"6d5f4526.3b9cc4","type":"function","z":"16acb04.7bc525","name":"","func":"var balancing_DateStart = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nbalancing_DateStart = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"balancing_DateStart\",balancing_DateStart);\nmsg.payload = balancing_DateStart;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":307.1166687011719,"y":1567.316650390625,"wires":[[]]},{"id":"c9eff026.71274","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"balancing_TimeStart\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":306.1166687011719,"y":1601.316650390625,"wires":[[]]},{"id":"ed57cae5.44387","type":"ui_button","z":"16acb04.7bc525","name":"","group":"43be54a9.7cf664","order":13,"width":0,"height":0,"passthru":false,"label":"Request Balancing","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":113.11666870117188,"y":1797.316650390625,"wires":[["394b318a.19604e"]]},{"id":"394b318a.19604e","type":"function","z":"16acb04.7bc525","name":"","func":"var balancingTUName = flow.get(\"balancing_tuName\");\nvar balancingUpdateRate = flow.get(\"balancing_updateRate\");\nvar balancingTimeStart = flow.get('balancing_TimeStart') || 0;\nvar balancingTimeEnd = flow.get('balancing_TimeEnd') || 0;\nvar balancingDateStart = flow.get('balancing_DateStart') || 0;\nvar balancingDateEnd = flow.get('balancing_DateEnd') || 0;\nvar balancingReferenceID = flow.get('balancing_referenceID') || 0;\n\nvar balancingStart = balancingDateStart +\" \"+ balancingTimeStart;\nvar balancingEnd = balancingDateEnd +\" \"+ balancingTimeEnd;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":315.7833557128906,"y":1796.5333251953125,"wires":[["1c07d8f7.f2fef7"]]},{"id":"b910345a.688388","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"Balancing End (Date)","group":"43be54a9.7cf664","order":10,"width":0,"height":0,"passthru":true,"topic":"","x":122.11666870117188,"y":1639.316650390625,"wires":[["e0aabfe6.df1588"]]},{"id":"3c68e369.fc664c","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Balancing End (Time)","tooltip":"","group":"43be54a9.7cf664","order":11,"width":0,"height":0,"passthru":true,"mode":"time","delay":"0","topic":"","x":122.11669921875,"y":1673.316650390625,"wires":[["6fdf83ad.6606a4"]]},{"id":"e0aabfe6.df1588","type":"function","z":"16acb04.7bc525","name":"","func":"var balancing_DateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nbalancing_DateEnd = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"balancing_DateEnd\",balancing_DateEnd);\nmsg.payload = balancing_DateEnd;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":304.1166687011719,"y":1639.316650390625,"wires":[["e7053618.ae2de"]]},{"id":"6fdf83ad.6606a4","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"balancing_TimeEnd\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":303.1166687011719,"y":1673.316650390625,"wires":[[]]},{"id":"79dc73a3.55042c","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"ReferenceID","tooltip":"","group":"43be54a9.7cf664","order":12,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":93.11666870117188,"y":1713.5167236328125,"wires":[["3405756d.f778e2"]]},{"id":"3405756d.f778e2","type":"function","z":"16acb04.7bc525","name":"","func":"var id = msg.payload;\nflow.set(\"balancing_referenceID\",id);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":306.23333740234375,"y":1714.11669921875,"wires":[[]]},{"id":"3732bad2.076cde","type":"function","z":"16acb04.7bc525","name":"","func":"var value = msg.payload;\nflow.set(\"balancing_tuName\",value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":309.1166687011719,"y":1531.4166259765625,"wires":[[]]},{"id":"f3918bf0.216788","type":"ui_text","z":"16acb04.7bc525","group":"43be54a9.7cf664","order":5,"width":0,"height":0,"name":"","label":"Balancing settings","format":"{{msg.payload}}","layout":"row-spread","x":116,"y":1452.2166748046875,"wires":[]},{"id":"1c07d8f7.f2fef7","type":"function","z":"16acb04.7bc525","name":"Prepare WS Invokation","func":"\nmsg.payload = msg.payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":534.11669921875,"y":1794.316650390625,"wires":[["42a6a26c.8b92fc","42b25325.3e3184"]]},{"id":"42a6a26c.8b92fc","type":"http request","z":"16acb04.7bc525","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/balancing_subscribe","tls":"","persist":false,"proxy":"","authType":"basic","x":771.4500732421875,"y":1793.9666748046875,"wires":[["a80df5eb.c28df"]]},{"id":"a80df5eb.c28df","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":998.949951171875,"y":1790.9666442871094,"wires":[["4603b63a.963208"]]},{"id":"1f075e46.623182","type":"comment","z":"16acb04.7bc525","name":"Node-RED --> VPP-Agent","info":"","x":791.2000732421875,"y":1708.8333435058594,"wires":[]},{"id":"b5abb43c.0ee84","type":"comment","z":"7b0fa635.67ef5","name":"3.1 Requesting balancing (VPP --> Node-RED)","info":"","x":201.11671447753906,"y":1330.0166015625,"wires":[]},{"id":"8eaa7754.ddfe7","type":"http request","z":"7b0fa635.67ef5","name":"balancing_subscribe Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/balancing_subscribe","tls":"","persist":false,"proxy":"","authType":"basic","x":1128.4500885009766,"y":1366.8665771484375,"wires":[[]]},{"id":"89ee77c2.708c18","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var balancingTUName = msg.payload.balancingTUName;\nvar balancingUpdateRate = msg.payload.balancingUpdateRate;\nvar balancingStart = msg.payload.balancingStart;\nvar balancingEnd = msg.payload.balancingEnd;\nvar balancingReferenceID = msg.payload.balancingReferenceID;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":607.1167144775391,"y":1367.216552734375,"wires":[[]]},{"id":"8ea13f38.9cf77","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/balancing_subscribe","method":"put","upload":false,"swaggerDoc":"","x":172.11671447753906,"y":1367.216552734375,"wires":[["89ee77c2.708c18","ea219ae5.fee2b8","2e0ffecf.c10d12"]]},{"id":"42b25325.3e3184","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":844.9500732421875,"y":1604.7666015625,"wires":[]},{"id":"4603b63a.963208","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070.9500427246094,"y":1625.7666625976562,"wires":[]},{"id":"6d1b8efb.c9a35","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"UpdateRate (ms)","tooltip":"","group":"43be54a9.7cf664","order":12,"width":0,"height":0,"passthru":true,"mode":"number","delay":300,"topic":"","x":114.11666870117188,"y":1755.5167236328125,"wires":[["d35f9182.da209"]]},{"id":"d35f9182.da209","type":"function","z":"16acb04.7bc525","name":"","func":"var balancing_updateRate = msg.payload;\nflow.set(\"balancing_updateRate\", balancing_updateRate);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":318.1166687011719,"y":1755.5167236328125,"wires":[[]]},{"id":"e7053618.ae2de","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650.9499816894531,"y":1549.7666625976562,"wires":[]},{"id":"86bf663f.dc17e8","type":"comment","z":"80f5f744.445108","name":"2.1 Requesting from the VPP for balancing of the TU (Node-RED --> TU)","info":"","x":288.11668395996094,"y":830.61669921875,"wires":[]},{"id":"c8b0b0c0.33f61","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/balancing_request","method":"put","upload":false,"swaggerDoc":"","x":148.11669921875,"y":878.6167297363281,"wires":[["9f192355.4e774","633c4c86.b24cac","e4924964.725338"]]},{"id":"9f192355.4e774","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":210.11668395996094,"y":914.6167297363281,"wires":[]},{"id":"37d277dc.554f2","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var balancingStart = msg.payload.InterfacePayloadBalancing.balancingStart.toString();\nvar balancingEnd = msg.payload.InterfacePayloadBalancing.balancingEnd.toString();\nvar tuName = msg.payload.InterfacePayloadBalancing.tuName.toString();\n\npayload = \n{\n\"balancingStart\" : balancingStart,\n\"balancingEnd\" : balancingEnd,\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":583.9500427246094,"y":913.3167266845703,"wires":[[]]},{"id":"633c4c86.b24cac","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":366.9500732421875,"y":911.5667114257812,"wires":[["37d277dc.554f2"]]},{"id":"e4924964.725338","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":582.9500732421875,"y":879.9333953857422,"wires":[[]]},{"id":"c39badd0.c6566","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1031.11669921875,"y":832.61669921875,"wires":[]},{"id":"e696b414.59f738","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\n \n 2021-01-13 12:00:00\n \n \n 2021-01-13 13:00:00\n \n \n machine32\n \n\"","x":1080.433349609375,"y":878.7333984375,"wires":[]},{"id":"9f1c2dbb.fcded8","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \nbalancingStart: \"2021-01-13 12:00:00\",\nbalancingEnd: \"2021-01-13 13:00:00\",\ntuName: \"machine32\" \n}","x":1081.433349609375,"y":909.7333984375,"wires":[]},{"id":"578ea7ea.68352","type":"comment","z":"80f5f744.445108","name":"2.2 Sending answer to agent (Node-RED <-- TU)","info":"","x":204.11668395996094,"y":1007.7167358398438,"wires":[]},{"id":"2ec7e5e6.e9731a","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":837.11669921875,"y":1109.8166809082031,"wires":[["f607afe9.07a908"]]},{"id":"f607afe9.07a908","type":"http request","z":"80f5f744.445108","name":"balancing_refuse Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_refuse","tls":"","persist":false,"proxy":"","authType":"basic","x":1089.816650390625,"y":1109.8166809082031,"wires":[[]]},{"id":"f14a32c4.cd0018","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":837.9666748046875,"y":1074.6666870117188,"wires":[["904b5da0.c5cf5"]]},{"id":"904b5da0.c5cf5","type":"http request","z":"80f5f744.445108","name":"balancing_agree Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_agree","tls":"","persist":false,"proxy":"","authType":"basic","x":1088.666748046875,"y":1074.6666870117188,"wires":[[]]},{"id":"d8450677.f5849","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":537.11669921875,"y":1076.8166809082031,"wires":[]},{"id":"6d46c543.c6ace4","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":537.11669921875,"y":1113.8166809082031,"wires":[]},{"id":"b3d1148e.e67978","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":166.42857360839844,"y":1152.6309242248535,"wires":[]},{"id":"a94bc934.79fc2","type":"inject","z":"80f5f744.445108","name":"***test: inject a Refuse ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":163.11668395996094,"y":1231.9167175292969,"wires":[["9e5d7a1d.fe835"]]},{"id":"9ba365f8.d5d2c8","type":"inject","z":"80f5f744.445108","name":"***test: inject a Agree***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":153.11668395996094,"y":1196.7667236328125,"wires":[["943b582.a467228"]]},{"id":"9e5d7a1d.fe835","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_MRL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":483.7333526611328,"y":1231.4668579101562,"wires":[["4dfba2d3.e68b5c"]]},{"id":"943b582.a467228","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SRL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":483.96669006347656,"y":1195.766845703125,"wires":[["a1bcb739.dd70b"]]},{"id":"4dfba2d3.e68b5c","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":825.1167144775391,"y":1228.916748046875,"wires":[["8290c6a1.1eab8"]]},{"id":"8290c6a1.1eab8","type":"http request","z":"80f5f744.445108","name":"balancing_refuse Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_refuse","tls":"","persist":false,"proxy":"","authType":"basic","x":1085.816665649414,"y":1228.916748046875,"wires":[["8c237b53.418a2"]]},{"id":"a1bcb739.dd70b","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":825.9666900634766,"y":1193.7667541503906,"wires":[["2f62ef27.d23138"]]},{"id":"2f62ef27.d23138","type":"http request","z":"80f5f744.445108","name":"balancing_agree Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_agree","tls":"","persist":false,"proxy":"","authType":"basic","x":1083.666763305664,"y":1193.7667541503906,"wires":[["87adfb52.5f9a6","fa8b421b.543a28"]]},{"id":"8c237b53.418a2","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1352.699966430664,"y":1227.916748046875,"wires":[[]]},{"id":"87adfb52.5f9a6","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1351.550064086914,"y":1193.7667541503906,"wires":[[]]},{"id":"3d8a33c1.6fd7ac","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/control_failure","method":"put","upload":false,"swaggerDoc":"","x":122.11666870117188,"y":1197.11669921875,"wires":[["f7c3d01c.268b8","791a0152.12eef8"]]},{"id":"f7c3d01c.268b8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":178.41665649414062,"y":1231.1168212890625,"wires":[]},{"id":"d9489e48.16b4","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1074.0499572753906,"y":1199.0167846679688,"wires":[[]]},{"id":"191fee6d.4393e2","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.1166687011719,"y":1198.0167846679688,"wires":[[]]},{"id":"76051960.573808","type":"comment","z":"7b0fa635.67ef5","name":"2.2 Receiving Failure message (if failed) (VPP <-- Node-RED)","info":"","x":241.00003051757812,"y":1162,"wires":[]},{"id":"cfa47ae8.1f7db8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_agree","method":"put","upload":false,"swaggerDoc":"","x":130.0000457763672,"y":1470,"wires":[["ac75addb.af8b6","20950556.1415ea"]]},{"id":"ac75addb.af8b6","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.300048828125,"y":1505,"wires":[]},{"id":"4ef05b9f.399b04","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1074.9333038330078,"y":1472.9000549316406,"wires":[[]]},{"id":"a664297.b3e5c58","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610.0000152587891,"y":1470.9000244140625,"wires":[[]]},{"id":"4ca490c8.1561d","type":"comment","z":"7b0fa635.67ef5","name":"3.1 VPP <-- Node-RED: receiving agree or refuse message","info":"","x":230.0000457763672,"y":1435,"wires":[]},{"id":"20295959.21889e","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_refuse","method":"put","upload":false,"swaggerDoc":"","x":131.0000457763672,"y":1540,"wires":[["ea7915aa.5d8b8","9cc309a6.f888c"]]},{"id":"ea7915aa.5d8b8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":173.300048828125,"y":1577,"wires":[]},{"id":"2b12ad8c.bad76a","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1075.933364868164,"y":1541.9000549316406,"wires":[[]]},{"id":"e805ebda.c14dd8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000152587891,"y":1541.9000244140625,"wires":[[]]},{"id":"970aecc6.1192f8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_failure","method":"put","upload":false,"swaggerDoc":"","x":128.0000457763672,"y":1723,"wires":[["86b8f800.d93","47915bc6.0a05d4"]]},{"id":"86b8f800.d93","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":170.30003356933594,"y":1759.0000305175781,"wires":[]},{"id":"4d5c70a0.f49a6","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1069.933364868164,"y":1718.89990234375,"wires":[[]]},{"id":"a5b69353.5ca578","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000762939453,"y":1722.9000244140625,"wires":[[]]},{"id":"c89d360.a68b4c8","type":"comment","z":"7b0fa635.67ef5","name":"3.2 VPP <-- Node-RED: receiving balancing data or failure message","info":"","x":257.0000457763672,"y":1616,"wires":[]},{"id":"e852285b.0a9b58","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/balancing_inform","method":"put","upload":false,"swaggerDoc":"","x":128.0000457763672,"y":1651,"wires":[["5aec6876.b400b","d7277b7a.9617e"]]},{"id":"5aec6876.b400b","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":170.30003356933594,"y":1687.0000305175781,"wires":[]},{"id":"80d062f8.8bbd9","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1069.933364868164,"y":1644.9000244140625,"wires":[[]]},{"id":"dd27c947.5c265","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.BalancingSequenceInform.tuName[0];\nvar agentName = msg.payload.BalancingSequenceInform.agentName[0];\nvar feedIn = msg.payload.BalancingSequenceInform.tudataSet[0].feedIn[0];\nvar operatingPoint = msg.payload.BalancingSequenceInform.tudataSet[0].operatingPoint[0];\nvar leadingOperatingPoint = msg.payload.BalancingSequenceInform.tudataSet[0].leadingOperatingPoint[0];\nvar currentValueFR = msg.payload.BalancingSequenceInform.tudataSet[0].currentValueFR[0];\nvar assignedPool = msg.payload.BalancingSequenceInform.tudataSet[0].assignedPool[0];\nvar status = msg.payload.BalancingSequenceInform.tudataSet[0].status[0];\nvar frequency = msg.payload.BalancingSequenceInform.tudataSet[0].frequency[0];\nvar aFRRsetpoint = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRsetpoint[0];\nvar aFRRsetpointEcho = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRsetpointEcho[0];\nvar setpointFR = msg.payload.BalancingSequenceInform.tudataSet[0].setpointFR[0];\nvar aFRRGradientPOS = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRGradientPOS[0];\nvar aFRRGradientNEG = msg.payload.BalancingSequenceInform.tudataSet[0].aFRRGradientNEG[0];\nvar capacityPOS = msg.payload.BalancingSequenceInform.tudataSet[0].capacityPOS[0];\nvar capacityNEG = msg.payload.BalancingSequenceInform.tudataSet[0].capacityNEG[0];\nvar holdingCapacityPOS = msg.payload.BalancingSequenceInform.tudataSet[0].holdingCapacityPOS[0];\nvar holdingCapacityNEG = msg.payload.BalancingSequenceInform.tudataSet[0].holdingCapacityNEG[0];\nvar controlBandPOS = msg.payload.BalancingSequenceInform.tudataSet[0].controlBandPOS[0];\nvar controlBandNEG = msg.payload.BalancingSequenceInform.tudataSet[0].controlBandNEG[0];\n\npayload = \n{\n \"tuName\": tuName, \n \"agentName\" : agentName,\n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n//Needed for UI Tests:\n//global.set(\"arrayStringBalancing\",payload);\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":609.0000762939453,"y":1650.9000244140625,"wires":[["d7e193fb.e97838"]]},{"id":"791a0152.12eef8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":449.95001220703125,"y":1198.4666137695312,"wires":[["191fee6d.4393e2"]]},{"id":"20950556.1415ea","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":444.11671447753906,"y":1470.5167236328125,"wires":[["a664297.b3e5c58"]]},{"id":"9cc309a6.f888c","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":442.11671447753906,"y":1541.7166748046875,"wires":[["e805ebda.c14dd8"]]},{"id":"d7277b7a.9617e","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":443.11669921875,"y":1650.7166748046875,"wires":[["dd27c947.5c265"]]},{"id":"47915bc6.0a05d4","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":443.11669921875,"y":1722.7166748046875,"wires":[["a5b69353.5ca578"]]},{"id":"955d08cb.ebe59","type":"comment","z":"7b0fa635.67ef5","name":"2. TU Control Sequence","info":"","x":124.00003051757812,"y":869.7166748046875,"wires":[]},{"id":"f8ced7f2.876ed8","type":"comment","z":"7b0fa635.67ef5","name":"3. TU Balancing","info":"","x":101.00004577636719,"y":1298.300048828125,"wires":[]},{"id":"bc50a512.0a6b58","type":"inject","z":"80f5f744.445108","name":"***test: inject a Failure ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":164.00001525878906,"y":1576,"wires":[["d261524.3df47b"]]},{"id":"d261524.3df47b","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_MRL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490.61668395996094,"y":1574.5501403808594,"wires":[["c84ee417.e90fc"]]},{"id":"c84ee417.e90fc","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":832.0000457763672,"y":1573.0000305175781,"wires":[["cadde0f0.d460e8"]]},{"id":"cadde0f0.d460e8","type":"http request","z":"80f5f744.445108","name":"balancing_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_failure","tls":"","persist":false,"proxy":"","authType":"basic","x":1092.6999969482422,"y":1573.0000305175781,"wires":[["8f369b5c.7d5fb"]]},{"id":"8f369b5c.7d5fb","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1354.5832977294922,"y":1570.0000305175781,"wires":[[]]},{"id":"2a6ce46f.8f169c","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":165.00001525878906,"y":1614,"wires":[["f6987ee6.262bd"]]},{"id":"f6987ee6.262bd","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n \"tuName\": \"TU_Company1_SRL\", \n\t\"feedIn\" : 10,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : 11,\t \t\t//Arbeitspunkt\n \"leadingOperatingPoint\" : 12,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : 13,\t\t\t//Regelleistungsistwert\n\t\"assignedPool\" : 14,\t\t\t//Poolzuordnung\n \"status\" : 15,\t\t\t\t\t//Status (Meldung)\n\t\"frequency\" : 16,\t\t\t\t//Frequenz\n\t\"aFRRsetpoint\" : 17,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : 200,\t\t//aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : 201,\t\t\t\t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : 202,\t\t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : 203,\t\t//aFRR-Gradient NEG\n\t\"capacityPOS\" : 204,\t\t\t//Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : 205,\t\t\t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : 206,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : 207,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : 208,\t\t\t//Regelband POS\n\t\"controlBandNEG\" : 209\t\t\t//Regelband NEG\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":489.61668395996094,"y":1614.5501403808594,"wires":[["98698d9e.fbff8"]]},{"id":"98698d9e.fbff8","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\nvar feedIn = msg.payload.feedIn || -99999;\nvar operatingPoint = msg.payload.operatingPoint || -99999;\nvar leadingOperatingPoint = msg.payload.leadingOperatingPoint || -99999;\nvar currentValueFR = msg.payload.currentValueFR || -99999;\nvar assignedPool = msg.payload.assignedPool || -99999;\nvar status = msg.payload.status || -99999;\nvar frequency = msg.payload.frequency || -99999;\nvar aFRRsetpoint = msg.payload.aFRRsetpoint || -99999;\nvar aFRRsetpointEcho = msg.payload.aFRRsetpointEcho || -99999;\nvar setpointFR = msg.payload.setpointFR || -99999;\nvar aFRRGradientPOS = msg.payload.aFRRGradientPOS || -99999;\nvar aFRRGradientNEG = msg.payload.aFRRGradientNEG || -99999;\nvar capacityPOS = msg.payload.capacityPOS || -99999;\nvar capacityNEG = msg.payload.capacityNEG || -99999;\nvar holdingCapacityPOS = msg.payload.holdingCapacityPOS || -99999;\nvar holdingCapacityNEG = msg.payload.holdingCapacityNEG || -99999;\nvar controlBandPOS = msg.payload.controlBandPOS || -99999;\nvar controlBandNEG = msg.payload.controlBandNEG || -99999;\n\npayload = \n{\n \"tuName\": tuName, \n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":831.0000457763672,"y":1613.0000305175781,"wires":[["f1fdd3de.0cd148"]]},{"id":"f1fdd3de.0cd148","type":"http request","z":"80f5f744.445108","name":"balancing_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_inform","tls":"","persist":false,"proxy":"","authType":"basic","x":1091.6999969482422,"y":1613.0000305175781,"wires":[["aae1ce40.ce7cc"]]},{"id":"aae1ce40.ce7cc","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1353.5832977294922,"y":1610.0000305175781,"wires":[[]]},{"id":"568f6a2a.1a021c","type":"comment","z":"80f5f744.445108","name":"2.3 Sending balancing values (Node-RED <-- TU)","info":"","x":220.8500213623047,"y":1309.25,"wires":[]},{"id":"16f5dabe.a8e825","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":547.8500518798828,"y":1407.25,"wires":[]},{"id":"61acfd8c.3ac704","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"tuName\": \"TUEmden0\", \n\t\"feedIn\" : 10,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : 11,\t \t\t//Arbeitspunkt\n \"leadingOperatingPoint\" : 12,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : 13,\t\t\t//Regelleistungsistwert\n\t\"assignedPool\" : 14,\t\t\t//Poolzuordnung\n \"status\" : 15,\t\t\t\t\t//Status (Meldung)\n\t\"frequency\" : 16,\t\t\t\t//Frequenz\n\t\"aFRRsetpoint\" : 17,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : 200,\t\t//aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : 201,\t\t\t\t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : 202,\t\t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : 203,\t\t//aFRR-Gradient NEG\n\t\"capacityPOS\" : 204,\t\t\t//Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : 205,\t\t\t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : 206,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : 207,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : 208,\t\t\t//Regelband POS\n\t\"controlBandNEG\" : 209\t\t\t//Regelband NEG\n}","x":547.8500518798828,"y":1444.25,"wires":[]},{"id":"c2e07ef4.6eecb","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":843.1167144775391,"y":1401.63330078125,"wires":[["29b72d02.3fab1a"]]},{"id":"29b72d02.3fab1a","type":"http request","z":"80f5f744.445108","name":"balancing_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_failure","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.816665649414,"y":1401.63330078125,"wires":[[]]},{"id":"edfc4902.2b5ee8","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\nvar feedIn = msg.payload.feedIn || -99999;\nvar operatingPoint = msg.payload.operatingPoint || -99999;\nvar leadingOperatingPoint = msg.payload.leadingOperatingPoint || -99999;\nvar currentValueFR = msg.payload.currentValueFR || -99999;\nvar assignedPool = msg.payload.assignedPool || -99999;\nvar status = msg.payload.status || -99999;\nvar frequency = msg.payload.frequency || -99999;\nvar aFRRsetpoint = msg.payload.aFRRsetpoint || -99999;\nvar aFRRsetpointEcho = msg.payload.aFRRsetpointEcho || -99999;\nvar setpointFR = msg.payload.setpointFR || -99999;\nvar aFRRGradientPOS = msg.payload.aFRRGradientPOS || -99999;\nvar aFRRGradientNEG = msg.payload.aFRRGradientNEG || -99999;\nvar capacityPOS = msg.payload.capacityPOS || -99999;\nvar capacityNEG = msg.payload.capacityNEG || -99999;\nvar holdingCapacityPOS = msg.payload.holdingCapacityPOS || -99999;\nvar holdingCapacityNEG = msg.payload.holdingCapacityNEG || -99999;\nvar controlBandPOS = msg.payload.controlBandPOS || -99999;\nvar controlBandNEG = msg.payload.controlBandNEG || -99999;\n\npayload = \n{\n \"tuName\": tuName, \n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":842.1167144775391,"y":1441.63330078125,"wires":[["46578b7e.066b1c"]]},{"id":"46578b7e.066b1c","type":"http request","z":"80f5f744.445108","name":"balancing_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_inform","tls":"","persist":false,"proxy":"","authType":"basic","x":1102.816665649414,"y":1441.63330078125,"wires":[[]]},{"id":"6a1a4b0d.273efc","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":170.11668395996094,"y":1542.2166748046875,"wires":[]},{"id":"40b404ed.66b1bc","type":"http request","z":"43429a7f.e2c06c","name":"accounting_energyConsumptionProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/ems-agent/accounting_energyConsumptionProfile","tls":"","persist":false,"proxy":"","authType":"","x":1146.7334594726562,"y":163.78346252441406,"wires":[[]]},{"id":"7f7a279b.c86d5","type":"http in","z":"43429a7f.e2c06c","name":"","url":"/ems-agent/accounting_energyConsumptionProfile","method":"put","upload":false,"swaggerDoc":"","x":225.73333740234375,"y":164.98329162597656,"wires":[["a3a68938.bc1e28","e3377e77.512f88"]]},{"id":"a3a68938.bc1e28","type":"http response","z":"43429a7f.e2c06c","name":"Response","statusCode":"","headers":{},"x":357.0333251953125,"y":200.98341369628906,"wires":[]},{"id":"be6ca6f2.a38be","type":"comment","z":"43429a7f.e2c06c","name":"1. Sending the Energy-Consumption-Profile to the VPP (Node-RED <-- EMS)","info":"","x":295,"y":123.30000305175781,"wires":[]},{"id":"e3377e77.512f88","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":739.0499877929688,"y":163.99993896484375,"wires":[["40b404ed.66b1bc"]]},{"id":"e3f11434.578bb8","type":"comment","z":"43429a7f.e2c06c","name":"Communication direction: Node-RED --> ERP","info":"","x":184,"y":482,"wires":[]},{"id":"69e6107c.a2eba8","type":"comment","z":"43429a7f.e2c06c","name":"Receiving Inform (ECP has been transmitted) from VPP","info":"","x":214.11666870117188,"y":518.1000366210938,"wires":[]},{"id":"bd74e65b.949068","type":"http in","z":"43429a7f.e2c06c","name":"","url":"/ems/accounting_ecpReceived","method":"put","upload":false,"swaggerDoc":"","x":159.11666870117188,"y":568,"wires":[["11d9009f.ace6cf","86669963.a95af8"]]},{"id":"11d9009f.ace6cf","type":"http response","z":"43429a7f.e2c06c","name":"Response","statusCode":"","headers":{},"x":178.11666870117188,"y":611,"wires":[]},{"id":"484fe684.a1dd98","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID[0];\n\nmsg.payload = {\n \"tuName\" : tuName,\n \"referenceID\" : referenceID\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":586.9500732421875,"y":567.7000122070312,"wires":[[]]},{"id":"86669963.a95af8","type":"xml","z":"43429a7f.e2c06c","name":"to JSON","property":"payload","attr":"","chr":"","x":412.9500427246094,"y":567.9500122070312,"wires":[["484fe684.a1dd98"]]},{"id":"c9bb9301.bf30e","type":"http request","z":"43429a7f.e2c06c","name":"Endpoint of EMS","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1046.566650390625,"y":568.1000366210938,"wires":[["79ecfcda.4492b4"]]},{"id":"79ecfcda.4492b4","type":"json","z":"43429a7f.e2c06c","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1283.066650390625,"y":568.1000366210938,"wires":[[]]},{"id":"31dcb7b2.6e9758","type":"comment","z":"43429a7f.e2c06c","name":"EMS Endpoint","info":"","x":1027.566650390625,"y":515.1000366210938,"wires":[]},{"id":"2af4749c.f71b94","type":"comment","z":"43429a7f.e2c06c","name":"***Value Simulation for this part***","info":"","x":158.11666870117188,"y":332.2166748046875,"wires":[]},{"id":"d56f925.00c6e7","type":"http request","z":"43429a7f.e2c06c","name":"accounting_energyConsumptionProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/ems-agent/accounting_energyConsumptionProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1177,"y":237,"wires":[[]]},{"id":"c5f76bb0.6a5048","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":741.11669921875,"y":373.89996337890625,"wires":[["147f9215.71b9ae"]]},{"id":"4a5db852.57fbc8","type":"inject","z":"43429a7f.e2c06c","name":"**TEST**Inject a predefined XML to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"a\":1}","payloadType":"str","x":199.11666870117188,"y":375.3999328613281,"wires":[["d08471fa.78907"]]},{"id":"d08471fa.78907","type":"template","z":"43429a7f.e2c06c","name":"**TEST**XML-Template","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"ENERGYCONSUMPTIONPROFILE\"\n \"TU_Company1_MRL\"\n \n \"6000\"\n \"22000\"\n \n","output":"str","x":508.1166687011719,"y":375.3999328613281,"wires":[["c5f76bb0.6a5048"]]},{"id":"9e508df5.6bc378","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"payload = {\"tuName\" : \"TU_Company1_MRL\",\n \"referenceID\" : \"testID123\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":742.11669921875,"y":414.4999084472656,"wires":[["4d8d2c86.75022c"]]},{"id":"38db7ae2.7bae2e","type":"inject","z":"43429a7f.e2c06c","name":"**TEST**Inject a schedulingPlanUploaded to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":230.11666870117188,"y":415.3999328613281,"wires":[["9e508df5.6bc378"]]},{"id":"6f7e558c.3ed5d4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/accounting_energyConsumptionProfileReference","method":"put","upload":false,"swaggerDoc":"","x":230.85003662109375,"y":1977.64990234375,"wires":[["b5c11512.7832a","24bcedde.901022"]]},{"id":"b5c11512.7832a","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.1500244140625,"y":2012.6499328613281,"wires":[]},{"id":"d32af972.122d08","type":"comment","z":"7b0fa635.67ef5","name":"4.1 VPP <-- Node-RED: sending the energy consumption profiles to the VPP ","info":"","x":289.85003662109375,"y":1861.64990234375,"wires":[]},{"id":"674a876.c3cc6f8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/accounting_energyConsumptionProfile","method":"put","upload":false,"swaggerDoc":"","x":200.73336791992188,"y":1904.7499389648438,"wires":[["ec1a4d89.414b4","deb11ce8.5d735"]]},{"id":"ec1a4d89.414b4","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":174.85003662109375,"y":1940.75,"wires":[]},{"id":"91a3c6e6.afba58","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n//code for UI Test:\n//global.set(\"arrayStringAccounting\",msg.payload);\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":718.4214401245117,"y":1976.7499885559082,"wires":[["4dfb481c.c9f398"]]},{"id":"deb11ce8.5d735","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var schedulingPlanInfos = flow.get('energyConsumptionProfile');\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":719.6832275390625,"y":1904.349609375,"wires":[[]]},{"id":"9cee7dfa.9adaa8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1172.0333251953125,"y":1902.64990234375,"wires":[[]]},{"id":"df50ecce.f12f08","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1171.2999267578125,"y":1973.64990234375,"wires":[[]]},{"id":"99b82672.989498","type":"comment","z":"7b0fa635.67ef5","name":"4. Accounting","info":"","x":90.85003662109375,"y":1827.449951171875,"wires":[]},{"id":"24bcedde.901022","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":550.8499755859375,"y":1977.050048828125,"wires":[["91a3c6e6.afba58"]]},{"id":"a5c124b5.33e078","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.85009765625,"y":2076.8502197265625,"wires":[["c9286592.2b2a4"]]},{"id":"c9286592.2b2a4","type":"http request","z":"7b0fa635.67ef5","name":"accounting_ECPReceived Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/accounting_ECPReceived","tls":"","persist":false,"proxy":"","authType":"basic","x":1149.550048828125,"y":2079.8499755859375,"wires":[[]]},{"id":"cb798789.4f5418","type":"comment","z":"7b0fa635.67ef5","name":"4.2 Confirming the ECP has been received (VPP --> Node-RED)","info":"","x":252.85000610351562,"y":2047.4500732421875,"wires":[]},{"id":"4f37ff3d.8db8c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/accounting_ECPReceived","method":"put","upload":false,"swaggerDoc":"","x":184,"y":2082.0501708984375,"wires":[["35f8281d.faff2","9395992a.39d0e8"]]},{"id":"3764e13.ec19a1e","type":"ui_text","z":"16acb04.7bc525","group":"43be54a9.7cf664","order":21,"width":"6","height":"5","name":"Anzeige Scheduling Ergebnisse","label":"Balancing data","format":"{{msg.payload}}","layout":"row-spread","x":492.4999694824219,"y":1904.8166809082031,"wires":[]},{"id":"c1ef54da.18aa6","type":"function","z":"16acb04.7bc525","name":"Load Values","func":"var schedulingPlanInfos = global.get(\"arrayStringBalancing\");\nmsg.payload = schedulingPlanInfos;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":248,"y":1905.8166809082031,"wires":[["3764e13.ec19a1e","97d03a0.a24ce48"]]},{"id":"b747d5fa.4ae4a","type":"inject","z":"16acb04.7bc525","name":"","props":[{"p":"payload"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":91,"y":1905.8166809082031,"wires":[["c1ef54da.18aa6"]]},{"id":"97d03a0.a24ce48","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":399.1166687011719,"y":1863.4166564941406,"wires":[]},{"id":"95bf969c.3b139","type":"ui_text","z":"16acb04.7bc525","group":"43be54a9.7cf664","order":14,"width":0,"height":0,"name":"","label":"BALANCING INFOS","format":"{{msg.payload}}","layout":"row-spread","x":121.94999694824219,"y":1856.183349609375,"wires":[]},{"id":"ef9cfcb0.2e2248","type":"ui_text","z":"16acb04.7bc525","group":"7b2edbef.0d9274","order":1,"width":"6","height":"1","name":"","label":"Accounting Information","format":"{{msg.payload}}","layout":"row-spread","x":120.94999694824219,"y":2026.183349609375,"wires":[]},{"id":"8850b9de.0e4a28","type":"ui_text","z":"16acb04.7bc525","group":"7b2edbef.0d9274","order":2,"width":"6","height":"5","name":"Anzeige Scheduling Ergebnisse","label":"Accounting received from","format":"{{msg.payload}}","layout":"row-spread","x":493.4999694824219,"y":2073.816650390625,"wires":[]},{"id":"46e9e591.14ce44","type":"function","z":"16acb04.7bc525","name":"Load Values","func":"var schedulingPlanInfos = global.get(\"arrayStringAccounting\");\nmsg.payload = schedulingPlanInfos;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":249,"y":2074.816650390625,"wires":[["8850b9de.0e4a28"]]},{"id":"cf952ad3.b0a178","type":"inject","z":"16acb04.7bc525","name":"","props":[{"p":"payload"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":92,"y":2074.816650390625,"wires":[["46e9e591.14ce44"]]},{"id":"df35595b.e56b6","type":"comment","z":"249aeb13.444e84","name":"1. Scheduling Process","info":"","x":127.11666870117188,"y":84.11666870117188,"wires":[]},{"id":"1fb1eb53.24102d","type":"comment","z":"249aeb13.444e84","name":"2. LoadTimeWindowsShare-Procoess","info":"","x":180.11666870117188,"y":1659.11669921875,"wires":[]},{"id":"413f2ae7.26e4fc","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/loadTimeWindows_request","method":"put","upload":false,"swaggerDoc":"","x":190.11666870117188,"y":1740.1168212890625,"wires":[["66472cd6.ad5154","e197e053.ee3818"]]},{"id":"66472cd6.ad5154","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":292.1166687011719,"y":1777.1168212890625,"wires":[]},{"id":"e197e053.ee3818","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.loadTimeWindowsReference;\n\n\npayload = \n{\"loadTimeWindowsReference\" : loadTimeWindowsReference};\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":751.7501220703125,"y":1740.4171142578125,"wires":[["cc4760ff.3755"]]},{"id":"cc4760ff.3755","type":"http request","z":"249aeb13.444e84","name":"loadTimeWindows_request Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/loadTimeWindows_request","tls":"","persist":false,"proxy":"","authType":"","x":1136.750244140625,"y":1738.4171142578125,"wires":[[]]},{"id":"e945b187.8d72b8","type":"comment","z":"249aeb13.444e84","name":"2.1 Requesting the VPP to share the LoadTimeWindows (Node-RED <-- Planning)","info":"","x":319.1166687011719,"y":1697.11669921875,"wires":[]},{"id":"cdcbddf3.477838","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"payload = {\"loadTimeWindowsReference\" : \"Tariff22\"};\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":727.7501220703125,"y":2025.51708984375,"wires":[["c8b63260.1661d"]]},{"id":"c8b63260.1661d","type":"http request","z":"249aeb13.444e84","name":"loadTimeWindows_request Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/loadTimeWindows_request","tls":"","persist":false,"proxy":"","authType":"","x":1013.7501831054688,"y":2025.51708984375,"wires":[[]]},{"id":"efb75177.c090c8","type":"comment","z":"249aeb13.444e84","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":160.11666870117188,"y":1992.31689453125,"wires":[]},{"id":"58c7c3e4.b58f74","type":"inject","z":"249aeb13.444e84","name":"**TEST**Inject a Request LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":229.11666870117188,"y":2026.11669921875,"wires":[["cdcbddf3.477838"]]},{"id":"5ed850ef.02f9e","type":"comment","z":"249aeb13.444e84","name":"2.2 Receiving the LoadTimeWindows (Node-RED --> Planning)","info":"","x":254.11666870117188,"y":1839.14990234375,"wires":[]},{"id":"40e7819d.e116e8","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/loadTimeWindows_inform","method":"put","upload":false,"swaggerDoc":"","x":164.11666870117188,"y":1879.25,"wires":[["49b9d8dd.06b6e8","e0ec2ab8.7cb6d"]]},{"id":"49b9d8dd.06b6e8","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":244.11666870117188,"y":1918.25,"wires":[]},{"id":"bc5d7ca7.1db55","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\nvar windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\nvar windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\nvar windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\nvar windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\nmsg.payload = {\n \"loadTimeWindowsReference\" : loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" : windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":592.9500732421875,"y":1881.94970703125,"wires":[[]]},{"id":"e0ec2ab8.7cb6d","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":398.9500427246094,"y":1882.2000122070312,"wires":[["bc5d7ca7.1db55"]]},{"id":"92a4b154.fbd958","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1082.566650390625,"y":1879.3502197265625,"wires":[["13adb11f.037e3f"]]},{"id":"13adb11f.037e3f","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1311.066650390625,"y":1879.3502197265625,"wires":[[]]},{"id":"61077878.886ce","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1072.11669921875,"y":1839.2501220703125,"wires":[]},{"id":"2074a0d4.a445d8","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n loadTimeWindowsReference : \"Tariff22\",\n windowHighBegin : \"2020-02-18 05:00:00.0\",\n windowHighEnd : \"2020-02-18 07:00:00.0\",\n windowLowBegin : \"2020-08-18 05:00:00.0\",\n windowLowEnd : \"2020-08-18 07:00:00.0\"\n}","x":852.13330078125,"y":1882.3502197265625,"wires":[]},{"id":"6306d75c.a18c","type":"comment","z":"7b0fa635.67ef5","name":"5. (A) LoadTimeWindowsShare-Process via direct request","info":"","x":238.00003051757812,"y":2183,"wires":[]},{"id":"cc4d3e1a.b345c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/loadTimeWindows_inform","method":"put","upload":false,"swaggerDoc":"","x":186.00003051757812,"y":2357.0001220703125,"wires":[["1b94c58a.f73582","78732cad.49bf54"]]},{"id":"1b94c58a.f73582","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.00003051757812,"y":2393,"wires":[]},{"id":"78732cad.49bf54","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.loadTimeWindowsReference;\nvar windowHighBegin = msg.payload.windowHighBegin;\nvar windowHighEnd = msg.payload.windowHighEnd;\nvar windowLowBegin = msg.payload.windowLowBegin;\nvar windowLowEnd = msg.payload.windowLowEnd;\n\npayload = \n{\n \"loadTimeWindowsReference\": loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" :windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.6334838867188,"y":2356.30029296875,"wires":[["86fd511a.b8fda"]]},{"id":"86fd511a.b8fda","type":"http request","z":"7b0fa635.67ef5","name":"loadTimeWindows_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_inform","tls":"","persist":false,"proxy":"","authType":"","x":1154.633544921875,"y":2356.3004150390625,"wires":[[]]},{"id":"a8117b63.6a188","type":"comment","z":"7b0fa635.67ef5","name":"5.2 Requesting the VPP to share the LoadTimeWindows (Node-RED <-- VPP)","info":"","x":296.0000305175781,"y":2322,"wires":[]},{"id":"2318e0df.817d9","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n","x":458.00006103515625,"y":2389.10009765625,"wires":[]},{"id":"7803cad9.a821dc","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"payload = {\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.6334228515625,"y":2469.400390625,"wires":[["86fd511a.b8fda"]]},{"id":"34042585.8fcd3a","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":159.00003051757812,"y":2437.2001953125,"wires":[]},{"id":"f2935e79.b2095","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":215.00003051757812,"y":2471,"wires":[["7803cad9.a821dc"]]},{"id":"fa84c689.a05538","type":"comment","z":"7b0fa635.67ef5","name":"5.1 Receiving the LoadTimeWindows (VPP <-- Node-RED)","info":"","x":238,"y":2217.033203125,"wires":[]},{"id":"16e4330f.07cf35","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/loadTimeWindows_request","method":"put","upload":false,"swaggerDoc":"","x":167,"y":2253.1331787109375,"wires":[["d5253f40.a9b318","2fa571b6.1e4c56"]]},{"id":"d5253f40.a9b318","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":183,"y":2286.13330078125,"wires":[]},{"id":"2417057e.0beb4a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\n//var windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\n//var windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\n//var windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\n//var windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\nmsg.payload = {\n \"loadTimeWindowsReference\" : loadTimeWindowsReference,\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":617.8333740234375,"y":2255.8330078125,"wires":[[]]},{"id":"2fa571b6.1e4c56","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":459.8333740234375,"y":2253.083251953125,"wires":[["2417057e.0beb4a"]]},{"id":"ce44d654.b99c38","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1094.449951171875,"y":2249.2333984375,"wires":[[]]},{"id":"e3122478.73e4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n\"loadTimeWindowsReference\" : \"tariff22\" \n}","x":862.0166015625,"y":2251.2333984375,"wires":[]},{"id":"ccd7c37f.08a3b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/loadTimeWindows_broadcast","method":"put","upload":false,"swaggerDoc":"","x":199.00003051757812,"y":2578,"wires":[["b616ed4e.7387c8","2fa948eb.967e88"]]},{"id":"b616ed4e.7387c8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.00003051757812,"y":2614,"wires":[]},{"id":"ab393d18.32128","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var loadTimeWindowsReference = msg.payload.InterfacePayloadLoadTimeWindows.loadTimeWindowsReference[0];\nvar windowHighBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowHighBegin[0];\nvar windowHighEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowHighEnd[0];\nvar windowLowBegin = msg.payload.InterfacePayloadLoadTimeWindows.windowLowBegin[0];\nvar windowLowEnd = msg.payload.InterfacePayloadLoadTimeWindows.windowLowEnd[0];\n\n\nmsg.payload = \n{\n \"loadTimeWindowsReference\": loadTimeWindowsReference,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" :windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.6334228515625,"y":2578.30029296875,"wires":[["5e353c9b.dc1aa4"]]},{"id":"5e353c9b.dc1aa4","type":"http request","z":"7b0fa635.67ef5","name":"loadTimeWindows_broadcast Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_broadcast","tls":"","persist":false,"proxy":"","authType":"","x":1173.633544921875,"y":2577.30029296875,"wires":[[]]},{"id":"310fc528.3cb4ba","type":"comment","z":"7b0fa635.67ef5","name":"5.3 Broadcasting new LoadTimeWindows to everyone","info":"","x":228.00003051757812,"y":2542,"wires":[]},{"id":"66aacc19.37c1fc","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n","x":466.00006103515625,"y":2644.10009765625,"wires":[]},{"id":"a7d1eb4f.93483","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":161.00003051757812,"y":2658.7998046875,"wires":[]},{"id":"1d48cb30.f62b35","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject LoadTimeWindows to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":214.00003051757812,"y":2693.599609375,"wires":[["cbf0562.376d728"]]},{"id":"cbf0562.376d728","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"\npayload = {\n \"loadTimeWindowsReference\" : \"Tariff22\",\n \"windowHighBegin\" : \"2020-02-18 05:00:00.0\",\n \"windowHighEnd\" : \"2020-02-18 07:00:00.0\",\n \"windowLowBegin\" : \"2020-08-18 05:00:00.0\",\n \"windowLowEnd\" : \"2020-08-18 07:00:00.0\"\n}\n\nmsg.payload = payload;\n// payload = {\"schedulingPlanUploaded\" : true}\n//msg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625,"y":2692,"wires":[["5e353c9b.dc1aa4"]]},{"id":"a2da4710.b0155","type":"comment","z":"249aeb13.444e84","name":"JADE Interface (TU-Agent)","info":"","x":1113.2667236328125,"y":265.56671142578125,"wires":[]},{"id":"90cc8d6.837fa7","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.1166687011719,"y":255.11666870117188,"wires":[["6926c4e6.6beeac"]]},{"id":"f8dfe605.43a1d8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":454.1166687011719,"y":691.7166442871094,"wires":[["dc6fc640.e2eb68"]]},{"id":"77f071ba.06b89","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1196.5333251953125,"y":872.7166748046875,"wires":[]},{"id":"227f2efc.6742b2","type":"debug","z":"16acb04.7bc525","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1198.5333251953125,"y":933.7166748046875,"wires":[]},{"id":"f4c97494.1eb95","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** SCHEDULING ********************************************","info":"","x":335.1166687011719,"y":40.116668701171875,"wires":[]},{"id":"f6c4085c.daa378","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1117.1166687011719,"y":105.11666870117188,"wires":[]},{"id":"30d600ce.7d3488","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\",\n tuName: \"TUEmden0\"me :\"TUEmden0\"\n}","x":860.11669921875,"y":257.1166687011719,"wires":[]},{"id":"71f1dc5f.e63474","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n//the payload can be any form of XML the VPP needs for the planning of the TU\n//shown in String:\n\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","x":861.5,"y":330.2166748046875,"wires":[]},{"id":"f82b4e6a.fbb53","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\", \n tuName: \"noNameSet\" \n}","x":860.9833374023438,"y":405.2166748046875,"wires":[]},{"id":"70d6390a.c9915","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.11666870117188,"y":542.3166198730469,"wires":[]},{"id":"9b8a2c67.c398a8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.11666870117188,"y":617.3166198730469,"wires":[]},{"id":"884b52c2.6c38","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1110.683349609375,"y":478.31658935546875,"wires":[]},{"id":"e5128683.afd308","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1066.1500244140625,"y":654.6166687011719,"wires":[]},{"id":"32bf6866.c4a3d8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany0, RequestMRL041221\", \n tuName: \"TUEmden0\" \n}","x":855.11669921875,"y":690.5166320800781,"wires":[]},{"id":"1393cb24.6ed505","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n schedulingPlanReference: \"TUEmdenCompany1, RequestMRL041221\",\n tuName: \"TUEmden0\"\n}","x":855.11669921875,"y":767.5166320800781,"wires":[]},{"id":"7995e15c.5fec78","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":453.8500061035156,"y":764.0499572753906,"wires":[["7364643d.31052c"]]},{"id":"a4ba88a2.2feec","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":451.8500061035156,"y":403.8500061035156,"wires":[["316b4f43.5946a8"]]},{"id":"744ba7c7.f971d8","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** TU CONTROL********************************************","info":"","x":333.85003662109375,"y":836.449951171875,"wires":[]},{"id":"290e417.5fbacbe","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1115.8500061035156,"y":903.050048828125,"wires":[]},{"id":"81b26319.06a4d8","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1063.8500061035156,"y":1162.050048828125,"wires":[]},{"id":"5fa7843f.3791b4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TU-EMDEN-CompanyXY-ProcessZ\"\n}","x":847.8499755859375,"y":1198.449951171875,"wires":[]},{"id":"aef6a421.62cca","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** TU BALANCING********************************************","info":"","x":348.8500518798828,"y":1265.25,"wires":[]},{"id":"e78d2cfa.a3cc48","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** ACCOUNTING********************************************","info":"","x":335.85003662109375,"y":1794.64990234375,"wires":[]},{"id":"be2e3380.7b29b","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** LOADTIMEWINDOWS-SHARE********************************************","info":"","x":390.85003662109375,"y":2147.449951171875,"wires":[]},{"id":"a570ea95.370248","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"\n 2021-02-05 12:00:00\n 2021-02-05 13:00:00\n empty\n scheduling-1\n","x":850,"y":613,"wires":[]},{"id":"df9e8334.57c338","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"\n empty\n empty\n empty\n scheduling-1\n","x":854,"y":712,"wires":[]},{"id":"94b9338b.7d1b3","type":"comment","z":"249aeb13.444e84","name":"JADE Interface (TU-Agent)","info":"","x":1121,"y":806,"wires":[]},{"id":"c468ffae.355d2","type":"comment","z":"249aeb13.444e84","name":"JADE Interface (TU-Agent)","info":"","x":1096,"y":1698.199951171875,"wires":[]},{"id":"109b0bdd.a32c24","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"\n 2021-02-05 12:00:00\n 2021-02-05 13:00:00\n 2021-02-04 22:00:00\n scheduling-1\n\"","x":863,"y":163,"wires":[]},{"id":"70e7a78d.5095","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"{\n schedulingStart: \"2021-02-05 12:00:00\",\n schedulingEnd: \"2021-02-05 13:00:00\",\n referenceID: \"scheduling-1\"\n}","x":850,"y":650,"wires":[]},{"id":"1b39d02a.12026","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"{\n referenceID: \"scheduling-1\"\n}","x":854,"y":747,"wires":[]},{"id":"af8854ba.ca6638","type":"comment","z":"249aeb13.444e84","name":"****************************************** TESTING FOR THE SECTION ABOVE ********************************************","info":"","x":422.9999694824219,"y":1072,"wires":[]},{"id":"57d594c.9fa8a6c","type":"comment","z":"249aeb13.444e84","name":"****************************************** SCHEDULING ********************************************","info":"","x":335.8500061035156,"y":47.849998474121094,"wires":[]},{"id":"3ca33c8.d275fc4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newLoadProfile","method":"put","upload":false,"swaggerDoc":"","x":174.00003051757812,"y":1014,"wires":[["9fc17a13.197448","751aa5cc.975834"]]},{"id":"9fc17a13.197448","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186.30001831054688,"y":1048,"wires":[]},{"id":"751aa5cc.975834","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":619.9334106445312,"y":1014.2999877929688,"wires":[["df2e2dca.4fd7f8"]]},{"id":"df2e2dca.4fd7f8","type":"http request","z":"7b0fa635.67ef5","name":"control_newLoadProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfile","tls":"","persist":false,"proxy":"","authType":"","x":1132.9333801269531,"y":1015.300048828125,"wires":[[]]},{"id":"c42d76ba.38d74","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/control_newLoadProfileUploaded","method":"put","upload":false,"swaggerDoc":"","x":202.00003051757812,"y":1085.0999908447266,"wires":[["883818ec.815dd8","774c3cf3.b19f24","e02adc48.0aa598"]]},{"id":"883818ec.815dd8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":182.00003051757812,"y":1121.0999755859375,"wires":[]},{"id":"774c3cf3.b19f24","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.6334838867188,"y":1084.4000244140625,"wires":[[]]},{"id":"5ac310c4.37c028","type":"http request","z":"7b0fa635.67ef5","name":"control_newLoadProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1163.6334533691406,"y":1084.4000244140625,"wires":[[]]},{"id":"9947715.a48e99","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":181.85003662109375,"y":972.6500244140625,"wires":[]},{"id":"68e00a54.e43204","type":"comment","z":"80f5f744.445108","name":"****************************************** TU-CONTROL ********************************************","info":"","x":307,"y":37,"wires":[]},{"id":"c083fe0d.69ccf","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/control_newLoadProfile","method":"put","upload":false,"swaggerDoc":"","x":160,"y":320,"wires":[["84b9b749.bf19b8","f1cc29d.fbc5ad8"]]},{"id":"84b9b749.bf19b8","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":233.29998779296875,"y":356.0000305175781,"wires":[]},{"id":"c91382cd.11aa98","type":"file","z":"80f5f744.445108","name":"","filename":"saving file in local folder","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"utf8","x":758.8333740234375,"y":355.0666809082031,"wires":[[]]},{"id":"5ff2f1ae.11512","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/control_newLoadProfileInfo","method":"put","upload":false,"swaggerDoc":"","x":169.88333129882812,"y":241.10003662109375,"wires":[["eec7784c.31a188","e5ea65e5.15538"]]},{"id":"eec7784c.31a188","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":248,"y":277.10003662109375,"wires":[]},{"id":"65ecb925.7f478","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780.0000305175781,"y":241.10003662109375,"wires":[[]]},{"id":"f1cc29d.fbc5ad8","type":"function","z":"80f5f744.445108","name":"Setting file info","func":"var schedulingPlanInfos = flow.get('schedulingPlanInfos');\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+schedulingPlanInfos+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":787.8334045410156,"y":319.6999816894531,"wires":[["c91382cd.11aa98"]]},{"id":"e5ea65e5.15538","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":492.0000305175781,"y":240.00003051757812,"wires":[["65ecb925.7f478"]]},{"id":"c338a7da.6d4338","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n tuName: \"TUEmden0\"me :\"TUEmden0\"\n}","x":1082,"y":242.00003051757812,"wires":[]},{"id":"d08e697e.54f19","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n//the payload can be any form of XML the VPP needs for the planning of the TU\n//shown in String:\n\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","x":1081.38330078125,"y":322.10003662109375,"wires":[]},{"id":"c6ebc9fd.03dff8","type":"ui_button","z":"16acb04.7bc525","name":"","group":"43be54a9.7cf664","order":4,"width":0,"height":0,"passthru":false,"label":"Set LoadProfile","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":110.11666870117188,"y":1375.316650390625,"wires":[["34e4a771.ad3a5","5701f34e.c7c964"]]},{"id":"34e4a771.ad3a5","type":"function","z":"16acb04.7bc525","name":"","func":"tuName = flow.get(\"activation_tuName\");\n\nmsg.payload = {\n \"tuName\" : tuName,\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":334.7833557128906,"y":1375.5333251953125,"wires":[["b16c69e0.7529d"]]},{"id":"a7ea75e5.0cc19","type":"function","z":"16acb04.7bc525","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n\n//msg.payload = 'foobardoit';\n//msg.headers = {};\n//msg.headers['content-type'] = 'application/xml';","outputs":1,"noerr":0,"initialize":"","finalize":"","x":792.7833557128906,"y":1373.4168090820312,"wires":[["6fb387db.72c018"]]},{"id":"6fb387db.72c018","type":"http request","z":"16acb04.7bc525","name":"control_newLoadProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfile","tls":"","persist":false,"proxy":"","authType":"","x":1083.7833251953125,"y":1371.4168090820312,"wires":[["6e964072.6eb7a"]]},{"id":"b16c69e0.7529d","type":"function","z":"16acb04.7bc525","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":782.4835510253906,"y":1413.5169067382812,"wires":[["2feddf0f.90ed7"]]},{"id":"2feddf0f.90ed7","type":"http request","z":"16acb04.7bc525","name":"control_newLoadProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/control_newLoadProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1104.4834289550781,"y":1421.5169067382812,"wires":[["c4db6b96.98d56"]]},{"id":"6e964072.6eb7a","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1353.6999206542969,"y":1414.7667846679688,"wires":[[]]},{"id":"c4db6b96.98d56","type":"json","z":"16acb04.7bc525","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1408.699951171875,"y":1465.7669067382812,"wires":[[]]},{"id":"5701f34e.c7c964","type":"template","z":"16acb04.7bc525","name":"**TEST**XML-Template","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"SchedulingData\"\n \"testTUHSEMD\"\n \n \"2020-02-18 05:00:00.0\"\n \"2020-02-18 07:00:00.0\"\n \n \n \"6000\"\n \"22000\"\n \n","output":"str","x":551.6500244140625,"y":1371.4168090820312,"wires":[["a7ea75e5.0cc19"]]},{"id":"bc5e69ee.a039d","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1118.116683959961,"y":1333.5167541503906,"wires":[]},{"id":"28298197.9407e6","type":"comment","z":"80f5f744.445108","name":"****************************************** BALANCING ********************************************","info":"","x":347,"y":765.9166870117188,"wires":[]},{"id":"ab83d13f.f68bc","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1079.11669921875,"y":1033.9168090820312,"wires":[]},{"id":"e786333c.ba1708","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1088,"y":1357,"wires":[]},{"id":"b6852e5b.8ef9d8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":839.0000152587891,"y":1470,"wires":[]},{"id":"bb839fc9.df20b","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":842.0000152587891,"y":1545,"wires":[]},{"id":"b16096c5.f5f1c","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1065.000015258789,"y":1439,"wires":[]},{"id":"83f9a20e.e10d1","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1061.000015258789,"y":1612,"wires":[]},{"id":"21bc13db.66e90c","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\",\n agentName: \"AgentTUEmdenCompany0\",\n feedIn: \"0\",\n operatingPoint: \"0\",\n leadingOperatingPoint: \"0\",\n currentValueFR: \"0\",\n assignedPool: \"0\",\n status: \"0\",\n frequency: \"0\",\n aFRRsetpoint: \"0\",\n aFRRsetpointEcho: \"0\",\n setpointFR: \"0\",\n aFRRGradientPOS: \"0\",\n aFRRGradientNEG: \"0\",\n capacityPOS: \"0\",\n capacityNEG: \"0\",\n holdingCapacityPOS: \"0\",\n holdingCapacityNEG: \"0\",\n controlBandPOS: \"0\",\n controlBandNEG: \"0\"\n}","x":838.0000152587891,"y":1650,"wires":[]},{"id":"baf539b5.92c29","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":841.0000152587891,"y":1721,"wires":[]},{"id":"957356ca.3a5968","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1078.8499755859375,"y":595.4500427246094,"wires":[]},{"id":"c0d31191.ee4168","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":97.85000610351562,"y":439.85003662109375,"wires":[]},{"id":"cf542bea.43857","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":95.85000610351562,"y":1042.050048828125,"wires":[]},{"id":"262a2215.468c56","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":100.85000610351562,"y":1342.8499755859375,"wires":[]},{"id":"c4223ba8.e34ce8","type":"comment","z":"43429a7f.e2c06c","name":"****************************************** ACCOUNTING ********************************************","info":"","x":345.1166687011719,"y":63.116668701171875,"wires":[]},{"id":"a7508a94.8a597","type":"comment","z":"43429a7f.e2c06c","name":"JADE Interface (TU-Agent)","info":"","x":1066.11669921875,"y":125.11666870117188,"wires":[]},{"id":"cfe2e23e.f10f28","type":"http in","z":"43429a7f.e2c06c","name":"","url":"/ems-agent/accounting_energyConsumptionProfileUploaded","method":"put","upload":false,"swaggerDoc":"","x":267,"y":237,"wires":[["3e2f082a.ad5288","87c1c66d.7d4a78"]]},{"id":"3e2f082a.ad5288","type":"http response","z":"43429a7f.e2c06c","name":"Response","statusCode":"","headers":{},"x":358.29998779296875,"y":273.0001220703125,"wires":[]},{"id":"1bb4d454.ec426c","type":"comment","z":"43429a7f.e2c06c","name":"1. Accounting Sequence","info":"","x":135,"y":94,"wires":[]},{"id":"147f9215.71b9ae","type":"http request","z":"43429a7f.e2c06c","name":"accounting_energyConsumptionProfile Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/ems-agent/accounting_energyConsumptionProfile","tls":"","persist":false,"proxy":"","authType":"","x":1145,"y":374,"wires":[[]]},{"id":"4d8d2c86.75022c","type":"http request","z":"43429a7f.e2c06c","name":"accounting_energyConsumptionProfileUploaded Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/ems-agent/accounting_energyConsumptionProfileUploaded","tls":"","persist":false,"proxy":"","authType":"","x":1176.2666015625,"y":413.216552734375,"wires":[[]]},{"id":"ce4b8c56.91e29","type":"comment","z":"43429a7f.e2c06c","name":"JADE Interface (TU-Agent)","info":"","x":1066,"y":341,"wires":[]},{"id":"a0de7af.9868b88","type":"comment","z":"43429a7f.e2c06c","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany1\",\n referenceID: \"testID123\"\n}","x":818,"y":570,"wires":[]},{"id":"e1f777ff.26e368","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":955,"y":1904,"wires":[]},{"id":"5fa05d4b.ac739c","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany1\"\n}","x":955,"y":1974,"wires":[]},{"id":"da274a4e.455ba8","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1131,"y":2044.9998779296875,"wires":[]},{"id":"bcdb708d.0ff79","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1163,"y":1863,"wires":[]},{"id":"249d9f32.672f1","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1082.8499450683594,"y":2215.64990234375,"wires":[]},{"id":"6577eca6.5b9f7c","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1133.8499755859375,"y":2317.85009765625,"wires":[]},{"id":"595c6301.1677a4","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1133.8499755859375,"y":2539.050048828125,"wires":[]},{"id":"9136a9fc.811a88","type":"comment","z":"7b0fa635.67ef5","name":"5. (B) LoadTimeWindowsShare-Process via Broadcast","info":"","x":227.85000610351562,"y":2509.64990234375,"wires":[]},{"id":"51ce2ad8.df32c4","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"windowsHighBegin Time","tooltip":"","group":"21ffbe58.69dc12","order":1,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":133.61666870117188,"y":2252.6497802734375,"wires":[["abe58755.580bb8"]]},{"id":"50ede4f3.70bf14","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"windowsHighBegin Date","group":"21ffbe58.69dc12","order":2,"width":0,"height":0,"passthru":true,"topic":"","x":135.61666870117188,"y":2219.9498291015625,"wires":[["fa1ebf6b.9fb04"]]},{"id":"f11eb1fc.f3373","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"windowsHighEnd Time","tooltip":"","group":"21ffbe58.69dc12","order":3,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":131.85000610351562,"y":2326.7498779296875,"wires":[["33afa60.77a20da"]]},{"id":"66121574.674064","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"windowsHighEnd Date","group":"21ffbe58.69dc12","order":4,"width":0,"height":0,"passthru":true,"topic":"","x":133.85000610351562,"y":2294.0499267578125,"wires":[["262116de.388d7a"]]},{"id":"14208020.2e9ae","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"Tariff Reference","tooltip":"","group":"21ffbe58.69dc12","order":9,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":103.61672973632812,"y":2176.6497802734375,"wires":[["19a16c2e.b5d904"]]},{"id":"fa1ebf6b.9fb04","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_HighDateBegin = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nloadTimeWindows_HighDateBegin = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"loadTimeWindows_HighDateBegin\",loadTimeWindows_HighDateBegin);\nmsg.payload = loadTimeWindows_HighDateBegin;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":395.8500061035156,"y":2220.550048828125,"wires":[[]]},{"id":"abe58755.580bb8","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"loadTimeWindows_HighTimeBegin\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":394.8500061035156,"y":2254.550048828125,"wires":[[]]},{"id":"262116de.388d7a","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_HighDateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nloadTimeWindows_HighDateEnd = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"loadTimeWindows_HighDateEnd\",loadTimeWindows_HighDateEnd);\nmsg.payload = loadTimeWindows_HighDateEnd;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":392.8500061035156,"y":2292.550048828125,"wires":[[]]},{"id":"33afa60.77a20da","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"loadTimeWindows_HighTimeEnd\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":391.8500061035156,"y":2326.550048828125,"wires":[[]]},{"id":"c040f140.150998","type":"ui_button","z":"16acb04.7bc525","name":"","group":"21ffbe58.69dc12","order":10,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":73.61666870117188,"y":2528.1495361328125,"wires":[["bb9759fa.6e5408"]]},{"id":"bb9759fa.6e5408","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_HighDateBegin = flow.get(\"loadTimeWindows_HighDateBegin\");\nvar loadTimeWindows_HighTimeBegin = flow.get(\"loadTimeWindows_HighTimeBegin\");\nvar loadTimeWindows_HighDateEnd = flow.get('loadTimeWindows_HighDateEnd') || 0;\nvar loadTimeWindows_HighTimeEnd = flow.get('loadTimeWindows_HighTimeEnd') || 0;\nvar loadTimeWindows_LowDateBegin = flow.get('loadTimeWindows_LowDateBegin') || 0;\nvar loadTimeWindows_LowTimeBegin = flow.get('loadTimeWindows_LowTimeBegin') || 0;\nvar loadTimeWindows_LowDateEnd = flow.get('loadTimeWindows_LowDateBegin') || 0;\nvar loadTimeWindows_LowTimeEnd = flow.get('loadTimeWindows_LowTimeBegin') || 0;\n\nvar loadTimeWindows_Tariff = flow.get('loadTimeWindows_Tariff') || 0;\n\nvar windowHighBegin = loadTimeWindows_HighDateBegin +\" \"+ loadTimeWindows_HighTimeBegin;\nvar windowHighEnd = loadTimeWindows_HighDateEnd +\" \"+ loadTimeWindows_HighTimeEnd;\nvar windowLowBegin = loadTimeWindows_LowDateBegin +\" \"+ loadTimeWindows_LowTimeBegin;\nvar windowLowEnd = loadTimeWindows_LowDateEnd +\" \"+ loadTimeWindows_LowTimeEnd;\n\nmsg.payload = {\n \"loadTimeWindowsReference\" : loadTimeWindows_Tariff,\n \"windowHighBegin\" : windowHighBegin,\n \"windowHighEnd\" : windowHighEnd,\n \"windowLowBegin\" : windowLowBegin,\n \"windowLowEnd\" : windowLowEnd\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":369.8500061035156,"y":2525.949462890625,"wires":[["8108f927.6cb018"]]},{"id":"ac6db43d.8c3e78","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"windowsLowBegin Time","tooltip":"","group":"21ffbe58.69dc12","order":5,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":128.85000610351562,"y":2408.749755859375,"wires":[["2c85f598.12dce2"]]},{"id":"9400a0cd.a7c99","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"windowsLowBegin Date","group":"21ffbe58.69dc12","order":6,"width":0,"height":0,"passthru":true,"topic":"","x":130.85000610351562,"y":2376.0498046875,"wires":[["e5347ebc.5e5fa"]]},{"id":"c66c8f9b.cbcb2","type":"ui_text_input","z":"16acb04.7bc525","name":"","label":"windowsLowEnd Time","tooltip":"","group":"21ffbe58.69dc12","order":7,"width":0,"height":0,"passthru":true,"mode":"time","delay":300,"topic":"","x":127.08334350585938,"y":2482.849853515625,"wires":[["35053db4.310062"]]},{"id":"dc668a49.b5a2","type":"ui_date_picker","z":"16acb04.7bc525","name":"","label":"windowsLowEnd Date","group":"21ffbe58.69dc12","order":8,"width":0,"height":0,"passthru":true,"topic":"","x":119.08334350585938,"y":2450.14990234375,"wires":[["24640d99.d193fa"]]},{"id":"e5347ebc.5e5fa","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_LowDateBegin = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nloadTimeWindows_LowDateBegin = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"loadTimeWindows_LowDateBegin\",loadTimeWindows_LowDateBegin);\nmsg.payload = loadTimeWindows_LowDateBegin;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":391.0833435058594,"y":2376.6500244140625,"wires":[[]]},{"id":"2c85f598.12dce2","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"loadTimeWindows_LowTimeBegin\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390.0833435058594,"y":2410.6500244140625,"wires":[[]]},{"id":"24640d99.d193fa","type":"function","z":"16acb04.7bc525","name":"","func":"var loadTimeWindows_LowDateEnd = \"no_Date_set\";\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month;\nvar year = d.getFullYear();\n\n//formatting the activation Date String and adding leading zeros to small numbers\nloadTimeWindows_LowDateEnd = year + '-' + ('0' + (monthformat+1)).slice(-2) + '-' + ('0' + day).slice(-2);\n\n//assigning value to the flow-variable\nflow.set(\"loadTimeWindows_LowDateEnd\",loadTimeWindows_LowDateEnd);\nmsg.payload = loadTimeWindows_LowDateEnd;\nreturn msg;\n\n\n/*\nvar d = new Date(msg.payload);\nvar str = d.toDateString; //Wed Oct 23 2019\nmsg.payload = str;\nreturn msg;\n*/\n\n/* oder\nvar d = new Date(msg.payload);\nvar day = d.getDate();\nvar month = d.getMonth();\nvar monthformat = month + 1;\nvar year = d.getFullYear();\nmsg.payload = day +\"-\"+ monthformat +\"-\"+ year;\nreturn msg;\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":388.0833435058594,"y":2448.6500244140625,"wires":[[]]},{"id":"35053db4.310062","type":"function","z":"16acb04.7bc525","name":"","func":"var date = new Date(0);\ndate.setSeconds(msg.payload/1000); // specify value for SECONDS here\nvar TimeEnd = date.toISOString().substr(11, 8);\n\n\nflow.set(\"loadTimeWindows_LowTimeEnd\",TimeEnd);\nmsg.payload = TimeEnd;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":387.0833435058594,"y":2482.6500244140625,"wires":[[]]},{"id":"19a16c2e.b5d904","type":"function","z":"16acb04.7bc525","name":"","func":"var value = msg.payload;\nflow.set(\"loadTimeWindows_Tariff\",value);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":372.8500061035156,"y":2176.349853515625,"wires":[[]]},{"id":"8108f927.6cb018","type":"function","z":"16acb04.7bc525","name":"Payload_handler","func":"msg.payload = msg.payload;\n// payload = {\"schedulingPlanUploaded\" : true}\n//msg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":606.8499755859375,"y":2579.550048828125,"wires":[["debe45a3.8888c8"]]},{"id":"debe45a3.8888c8","type":"http request","z":"16acb04.7bc525","name":"loadTimeWindows_Broadcast Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/loadTimeWindows_broadcast","tls":"","persist":false,"proxy":"","authType":"","x":1057.85009765625,"y":2577.550048828125,"wires":[[]]},{"id":"87c1c66d.7d4a78","type":"function","z":"43429a7f.e2c06c","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n \"tuName\" : tuName,\n \"referenceID\" : referenceID\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":738.8499755859375,"y":239.85000610351562,"wires":[["d56f925.00c6e7"]]},{"id":"af3b68c1.5f3188","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/ams_agentBorn","method":"put","upload":false,"swaggerDoc":"","x":128.00006103515625,"y":4948.999755859375,"wires":[["44fcb56e.c4f32c","56dbcc04.daf3a4"]]},{"id":"44fcb56e.c4f32c","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":175.300048828125,"y":4983.999755859375,"wires":[]},{"id":"3bf9a243.4ec776","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/ams_agentDead","method":"put","upload":false,"swaggerDoc":"","x":131.88339233398438,"y":4876.099792480469,"wires":[["73401e22.77f56","79d99ed1.9c083"]]},{"id":"73401e22.77f56","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":176.00006103515625,"y":4912.099853515625,"wires":[]},{"id":"56dbcc04.daf3a4","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload;\n\n\nmsg.payload = {\n \"agentName\" : agentName\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622,"y":4948.099609375,"wires":[[]]},{"id":"9c3f5c88.7ba6d8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.183349609375,"y":4877.999755859375,"wires":[[]]},{"id":"f18b5b1.c24fda8","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1104.449951171875,"y":4946.999755859375,"wires":[[]]},{"id":"6b45ed15.a0c68c","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** PLATFORM INTERACTION ********************************************","info":"","x":368.00006103515625,"y":4841.999755859375,"wires":[]},{"id":"944b4993.56459","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1094.1500244140625,"y":4838.349853515625,"wires":[]},{"id":"79d99ed1.9c083","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload;\n\n\nmsg.payload = {\n \"agentName\" : agentName\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.0000610351562,"y":4876.332763671875,"wires":[[]]},{"id":"4083bb5a.a2e824","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName : \"TUEmdenCompany0@192.168.178.29:1099/JADE\"\n}","x":886.0000610351562,"y":4880.332763671875,"wires":[]},{"id":"899f5199.edf59","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName : \"TUEmdenCompany0@192.168.178.29:1099/JADE\"\n}","x":887,"y":4947.332763671875,"wires":[]},{"id":"78a4d703.7ac96","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** SOL/SNL Specific Actions ****************************************","info":"","x":365.85003662109375,"y":2732.666748046875,"wires":[]},{"id":"6e63440c.80f084","type":"comment","z":"7b0fa635.67ef5","name":"6 Enable Frequency Relay","info":"","x":136.00003051757812,"y":2766.9334716796875,"wires":[]},{"id":"7a05001e.7ae57","type":"comment","z":"7b0fa635.67ef5","name":"6.1 Sending out a enable (VPP --> Node-RED)","info":"","x":196.11669921875,"y":2799.133544921875,"wires":[]},{"id":"4f5baa87.87b47c","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_enable","method":"put","upload":false,"swaggerDoc":"","x":165.6667022705078,"y":2834.7665405273438,"wires":[["95544204.fb8228","f6d67de4.625868"]]},{"id":"e77e335e.80dd7","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":623.6666107177734,"y":2833.7666625976562,"wires":[["42326bd2.9c9cbc"]]},{"id":"42326bd2.9c9cbc","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_enable Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_enable","tls":"","persist":false,"proxy":"","authType":"basic","x":1128.550033569336,"y":2832.5499877929688,"wires":[[]]},{"id":"1296cf80.01fc19","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1128.4000396728516,"y":2800.800048828125,"wires":[]},{"id":"95544204.fb8228","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":185.4000244140625,"y":2870.39990234375,"wires":[]},{"id":"c0d73163.1b41b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_enableInform","method":"put","upload":false,"swaggerDoc":"","x":163.66668701171875,"y":3016.666748046875,"wires":[["723607cf.c0378","88745c93.d7579"]]},{"id":"723607cf.c0378","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":185.9666748046875,"y":3052.666778564453,"wires":[]},{"id":"e37305cc.be4d6","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1092.6000061035156,"y":3013.566650390625,"wires":[[]]},{"id":"56377bd6.c9661c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":619.6667175292969,"y":3016.5667724609375,"wires":[["eee9a163.5033f"]]},{"id":"93beaf79.d9a6f8","type":"comment","z":"7b0fa635.67ef5","name":"6.2 VPP <-- Node-RED: receiving inform or failure message","info":"","x":234.66668701171875,"y":2913.666748046875,"wires":[]},{"id":"2889cab3.5a210e","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_enableFailure","method":"put","upload":false,"swaggerDoc":"","x":163.66668701171875,"y":2948.666748046875,"wires":[["293e9824.2c7b38","ab516f10.e2ff2"]]},{"id":"293e9824.2c7b38","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":184.9666748046875,"y":2983.666778564453,"wires":[]},{"id":"36f13523.9e778a","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1093.6000061035156,"y":2948.5667724609375,"wires":[[]]},{"id":"55e19663.d0a4b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620.6667022705078,"y":2950.56689453125,"wires":[[]]},{"id":"ab516f10.e2ff2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":455.7833557128906,"y":2950.3834228515625,"wires":[["55e19663.d0a4b8"]]},{"id":"88745c93.d7579","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":454.7833557128906,"y":3016.3834228515625,"wires":[["56377bd6.c9661c"]]},{"id":"64947add.24e6cc","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1082.6666564941406,"y":2914.666748046875,"wires":[]},{"id":"7170556a.39d5f4","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":854.6666564941406,"y":2949.666748046875,"wires":[]},{"id":"a0703054.3e615","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":857.6666564941406,"y":3015.666748046875,"wires":[]},{"id":"92f6aa2f.0ab7d8","type":"comment","z":"7b0fa635.67ef5","name":"7 Disable Frequency Relay","info":"","x":132.6666717529297,"y":3165,"wires":[]},{"id":"93ceb3bf.84a8a8","type":"comment","z":"7b0fa635.67ef5","name":"7.1 Sending out a block (VPP --> Node-RED)","info":"","x":192.78334045410156,"y":3197.2000732421875,"wires":[]},{"id":"1818fccc.1ee26b","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_block","method":"put","upload":false,"swaggerDoc":"","x":153.33334350585938,"y":3238.8330688476562,"wires":[["aba214be.89c8f8","94cef519.97372"]]},{"id":"e45695de.fec6e","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName \n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.333251953125,"y":3236.833251953125,"wires":[["1e2023e1.d79304"]]},{"id":"1e2023e1.d79304","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_block Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_block","tls":"","persist":false,"proxy":"","authType":"basic","x":1127.2166748046875,"y":3238.6165161132812,"wires":[[]]},{"id":"df02ea30.a2d72","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1136.066650390625,"y":3201.86669921875,"wires":[]},{"id":"aba214be.89c8f8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":182.06668090820312,"y":3273.466552734375,"wires":[]},{"id":"d2eaa357.46a8d8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_blockInform","method":"put","upload":false,"swaggerDoc":"","x":155.3333282470703,"y":3419.7333984375,"wires":[["83d97141.99723","38ea8d15.11fc02"]]},{"id":"83d97141.99723","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.63331604003906,"y":3455.7333068847656,"wires":[]},{"id":"5a50e889.de309","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1105.2666473388672,"y":3416.6331787109375,"wires":[[]]},{"id":"4dd33ee6.15d84","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.3333740234375,"y":3420.63330078125,"wires":[[]]},{"id":"f41cd723.6b3dc8","type":"comment","z":"7b0fa635.67ef5","name":"7.2 VPP <-- Node-RED: receiving inform or failure message","info":"","x":235.33331298828125,"y":3309.7333984375,"wires":[]},{"id":"35524bd0.0abffc","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_blockFailure","method":"put","upload":false,"swaggerDoc":"","x":156.3333282470703,"y":3346.7332763671875,"wires":[["aff9f121.472e78","3ce4ae57.fb27d2"]]},{"id":"aff9f121.472e78","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":178.63331604003906,"y":3382.7333068847656,"wires":[]},{"id":"52e937d1.43551","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1103.2666473388672,"y":3346.63330078125,"wires":[[]]},{"id":"d72acb58.fab4b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.3333740234375,"y":3346.63330078125,"wires":[[]]},{"id":"3ce4ae57.fb27d2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.45001220703125,"y":3347.449951171875,"wires":[["d72acb58.fab4b8"]]},{"id":"38ea8d15.11fc02","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.45001220703125,"y":3421.449951171875,"wires":[["4dd33ee6.15d84"]]},{"id":"48785394.616ecc","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1092.3332977294922,"y":3314.7332763671875,"wires":[]},{"id":"d44a10b9.1c33f8","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":855.3332977294922,"y":3348.7332763671875,"wires":[]},{"id":"71e65eb1.558378","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":859.3332977294922,"y":3419.7332763671875,"wires":[]},{"id":"284c029d.54b0de","type":"comment","z":"7b0fa635.67ef5","name":"Receiving status (frequency relay has been triggered) message of frequency relay (VPP <-- Node-RED)","info":"","x":371.6666717529297,"y":3594,"wires":[]},{"id":"c4c6630c.4c84b8","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/freqRelay_triggered","method":"put","upload":false,"swaggerDoc":"","x":144.6666717529297,"y":3636,"wires":[["cf71f945.763ba8","54c46f77.d4f258"]]},{"id":"cf71f945.763ba8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":176.96665954589844,"y":3672.000030517578,"wires":[]},{"id":"a18bfe9f.9ca51","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1113.5999908447266,"y":3632.9000244140625,"wires":[[]]},{"id":"20327dc0.4986ea","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var agentName = msg.payload.InterfacePayloadAgentReference.agentName[0];\nvar tuName = msg.payload.InterfacePayloadAgentReference.tuName[0];\n\nmsg.payload = {\n \"agentName\" : agentName,\n \"tuName\" : tuName\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.6667022705078,"y":3638.9000244140625,"wires":[[]]},{"id":"54c46f77.d4f258","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":464.7833251953125,"y":3638.716796875,"wires":[["20327dc0.4986ea"]]},{"id":"e4a4428.4f2944","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1103.6666259765625,"y":3598,"wires":[]},{"id":"310936d1.c4ce4a","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n agentName: \"AgentTUEmdenCompany0\",\n tuName: \"TUEmdenCompany0\"\n}","x":898.6666412353516,"y":3638,"wires":[]},{"id":"aca7fd28.9f71d8","type":"comment","z":"7b0fa635.67ef5","name":"8 Frequency Relay Status","info":"","x":132.6666717529297,"y":3562,"wires":[]},{"id":"b3411deb.446a3","type":"comment","z":"7b0fa635.67ef5","name":"8.1 Sending out a confirm (VPP --> Node-RED)","info":"","x":202.6666717529297,"y":3706,"wires":[]},{"id":"a46c7074.46e768","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/freqRelay_confirm","method":"put","upload":false,"swaggerDoc":"","x":163.2166748046875,"y":3739.6329956054688,"wires":[["baf3a9e3.a7275","7cbf373d.7b5318"]]},{"id":"baf3a9e3.a7275","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.2165832519531,"y":3740.6331176757812,"wires":[["72490ce2.373bfc"]]},{"id":"72490ce2.373bfc","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_confirm","tls":"","persist":false,"proxy":"","authType":"basic","x":1152.0999755859375,"y":3739.41650390625,"wires":[[]]},{"id":"c8f076e5.44d15","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1152.949951171875,"y":3699.66650390625,"wires":[]},{"id":"7cbf373d.7b5318","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":183.95001220703125,"y":3776.2666015625,"wires":[]},{"id":"60c1b20f.79679c","type":"comment","z":"80f5f744.445108","name":"3.1 receiving enable request from VPP (Node-RED --> TU)","info":"","x":249.00001525878906,"y":1791.6666259765625,"wires":[]},{"id":"3ea18b05.484ecc","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/freqRelay_enable","method":"put","upload":false,"swaggerDoc":"","x":141.00001525878906,"y":1831.6666259765625,"wires":[["d6990dcd.cb3f78","2c4753ce.06151c","3648c3.2b7b1f3e"]]},{"id":"d6990dcd.cb3f78","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":222.00001525878906,"y":1869.6666259765625,"wires":[]},{"id":"15d44b75.34018d","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\n\npayload = \n{\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":762.8333587646484,"y":1866.3666229248047,"wires":[[]]},{"id":"ac225902.67632","type":"comment","z":"80f5f744.445108","name":"Interface with data for the TU","info":"","x":770.0000152587891,"y":1793.6666259765625,"wires":[]},{"id":"2c4753ce.06151c","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":499.8334197998047,"y":1866.6166381835938,"wires":[["15d44b75.34018d"]]},{"id":"3648c3.2b7b1f3e","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":761.8333892822266,"y":1832.9832916259766,"wires":[[]]},{"id":"f2498485.95cd88","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1039.000015258789,"y":1798.666618347168,"wires":[]},{"id":"cf6ea1ff.c31408","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\nnoNameSet\nTUEmdenCompany1\nnoIDSet\n\n","x":1091.316665649414,"y":1835.7832946777344,"wires":[]},{"id":"195627b4.87e95","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\"\n}","x":1092.316665649414,"y":1866.7832946777344,"wires":[]},{"id":"4b77b24f.aa9aec","type":"comment","z":"80f5f744.445108","name":"3. FrequencyRelay Enable","info":"","x":150.00001525878906,"y":1758.6666259765625,"wires":[]},{"id":"9aed5f97.2eeab","type":"comment","z":"80f5f744.445108","name":"****************************************** SOL/SNL Specific Actions ****************************************","info":"","x":376.66668701171875,"y":1722.6666259765625,"wires":[]},{"id":"5b6ca685.82efd8","type":"comment","z":"80f5f744.445108","name":"3.2 Sending answer to agent (Node-RED <-- TU)","info":"","x":205.85000610351562,"y":1944.050048828125,"wires":[]},{"id":"e5593e69.b49308","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":848.8500213623047,"y":2046.1499938964844,"wires":[["4d69c63a.5ad978"]]},{"id":"4d69c63a.5ad978","type":"http request","z":"80f5f744.445108","name":"freqRelay_enableFailure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_enableFailure","tls":"","persist":false,"proxy":"","authType":"basic","x":1121.5499725341797,"y":2046.1499938964844,"wires":[[]]},{"id":"ee857df4.178ba8","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":849.6999969482422,"y":2011,"wires":[["6e6f8142.342188"]]},{"id":"6e6f8142.342188","type":"http request","z":"80f5f744.445108","name":"freqRelay_enableInform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_enableInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1120.4000701904297,"y":2011,"wires":[[]]},{"id":"6edab03d.4f7dd8","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":548.8500213623047,"y":2013.1499938964844,"wires":[]},{"id":"f2819ad7.1e1b8","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":548.8500213623047,"y":2050.1499938964844,"wires":[]},{"id":"8a310c7f.fb5cd","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":185.85000610351562,"y":2093.2500610351562,"wires":[]},{"id":"4266eb72.ac6704","type":"inject","z":"80f5f744.445108","name":"***test: inject a Failure***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":174.85000610351562,"y":2168.250030517578,"wires":[["eb9333d2.6bb6b"]]},{"id":"fa25575d.351978","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":164.85000610351562,"y":2133.1000366210938,"wires":[["23d54b7b.e5d1fc"]]},{"id":"eb9333d2.6bb6b","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":495.4666748046875,"y":2167.8001708984375,"wires":[["62b99a1c.6cb1ec"]]},{"id":"23d54b7b.e5d1fc","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":495.70001220703125,"y":2132.1001586914062,"wires":[["54d448c4.ada908"]]},{"id":"62b99a1c.6cb1ec","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":836.8500366210938,"y":2165.2500610351562,"wires":[["c13bf153.1789f"]]},{"id":"c13bf153.1789f","type":"http request","z":"80f5f744.445108","name":"freqRelay_enableFailure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_enableFailure","tls":"","persist":false,"proxy":"","authType":"basic","x":1117.5499877929688,"y":2165.2500610351562,"wires":[["fad0983f.112d1"]]},{"id":"54d448c4.ada908","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":837.7000122070312,"y":2130.100067138672,"wires":[["3b472de5.7d7ba2"]]},{"id":"3b472de5.7d7ba2","type":"http request","z":"80f5f744.445108","name":"freqRelay_enableInform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_enableInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1115.4000854492188,"y":2130.100067138672,"wires":[["c3678f09.44669"]]},{"id":"fad0983f.112d1","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1423.433349609375,"y":2167.2498779296875,"wires":[[]]},{"id":"c3678f09.44669","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1422.283447265625,"y":2133.099884033203,"wires":[[]]},{"id":"26ef5e73.4b8efa","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1090.8500213623047,"y":1970.2501220703125,"wires":[]},{"id":"e1ca5f61.90a6e","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":107.58332824707031,"y":1978.3833618164062,"wires":[]},{"id":"55b8e11.1d77ea","type":"comment","z":"80f5f744.445108","name":"4.1 receiving enable request from VPP (Node-RED --> TU)","info":"","x":254.41668701171875,"y":2256.050048828125,"wires":[]},{"id":"d1b8a68c.b94a78","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/freqRelay_block","method":"put","upload":false,"swaggerDoc":"","x":156.41668701171875,"y":2296.050048828125,"wires":[["e4523927.178c","a0b3e390.33211","d97e60c3.90a338"]]},{"id":"e4523927.178c","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":237.41668701171875,"y":2334.050048828125,"wires":[]},{"id":"56719889.3efb7","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\n\npayload = \n{\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":778.2500305175781,"y":2330.750045776367,"wires":[[]]},{"id":"40e09086.746b18","type":"comment","z":"80f5f744.445108","name":"Interface with data for the TU","info":"","x":785.4166870117188,"y":2258.050048828125,"wires":[]},{"id":"a0b3e390.33211","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":515.2500915527344,"y":2331.0000610351562,"wires":[["56719889.3efb7"]]},{"id":"d97e60c3.90a338","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":777.2500610351562,"y":2297.366714477539,"wires":[[]]},{"id":"439f28e9.300b78","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1054.4166870117188,"y":2263.0500411987305,"wires":[]},{"id":"d0e98114.3fe08","type":"comment","z":"80f5f744.445108","name":"4. FrequencyRelay Block","info":"","x":165.41668701171875,"y":2223.050048828125,"wires":[]},{"id":"5e2ff05f.ef2e18","type":"comment","z":"80f5f744.445108","name":"4.2 Sending answer to agent (Node-RED <-- TU)","info":"","x":221.2666778564453,"y":2408.4334716796875,"wires":[]},{"id":"8c8170a.6dca31","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":864.2666931152344,"y":2510.533416748047,"wires":[["d8748aa7.c252e8"]]},{"id":"d8748aa7.c252e8","type":"http request","z":"80f5f744.445108","name":"freqRelay_blockFailure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_blockFailure","tls":"","persist":false,"proxy":"","authType":"basic","x":1136.9666442871094,"y":2510.533416748047,"wires":[[]]},{"id":"8a650862.1bb3c","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":865.1166687011719,"y":2475.3834228515625,"wires":[["81b3cd9a.9b02a8"]]},{"id":"81b3cd9a.9b02a8","type":"http request","z":"80f5f744.445108","name":"freqRelay_blockInform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_blockInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1125.8167419433594,"y":2475.3834228515625,"wires":[[]]},{"id":"f27e7b8c.3b9ef","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":564.2666931152344,"y":2477.533416748047,"wires":[]},{"id":"e19bb2c.12bdc5","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":564.2666931152344,"y":2514.533416748047,"wires":[]},{"id":"5f572083.d270e8","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":201.2666778564453,"y":2557.6334838867188,"wires":[]},{"id":"bcb72486.d2934","type":"inject","z":"80f5f744.445108","name":"***test: inject a Failure ***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190.2666778564453,"y":2632.6334533691406,"wires":[["225a7e4e.12ac72"]]},{"id":"9f1e8120.4a6908","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180.2666778564453,"y":2597.4834594726562,"wires":[["f1784c25.0c5af"]]},{"id":"225a7e4e.12ac72","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510.8833465576172,"y":2632.18359375,"wires":[["a69122ff.bade6"]]},{"id":"f1784c25.0c5af","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":511.11668395996094,"y":2596.4835815429688,"wires":[["5a9e1921.d0da78"]]},{"id":"a69122ff.bade6","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":852.2667083740234,"y":2629.6334838867188,"wires":[["6c5c173c.aa5e48"]]},{"id":"5a9e1921.d0da78","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":853.1166839599609,"y":2594.4834899902344,"wires":[["b0bf528f.73ad68"]]},{"id":"50d30882.ff28c","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1395.8499755859375,"y":2626.6336669921875,"wires":[[]]},{"id":"8258434c.4443f8","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1394.7000732421875,"y":2592.483673095703,"wires":[[]]},{"id":"f2b05727.ed78e","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1106.2666931152344,"y":2434.633544921875,"wires":[]},{"id":"131f5d7b.fd9893","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":123,"y":2442.7667846679688,"wires":[]},{"id":"b0bf528f.73ad68","type":"http request","z":"80f5f744.445108","name":"freqRelay_blockInform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_blockInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1099.8499755859375,"y":2591.85009765625,"wires":[["8258434c.4443f8"]]},{"id":"6c5c173c.aa5e48","type":"http request","z":"80f5f744.445108","name":"freqRelay_blockFailure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_blockFailure","tls":"","persist":false,"proxy":"","authType":"basic","x":1110.9998779296875,"y":2627.0000915527344,"wires":[["50d30882.ff28c"]]},{"id":"575579a0.5b603","type":"comment","z":"80f5f744.445108","name":"5. FrequencyRelay Status","info":"","x":142.85000610351562,"y":2716.449951171875,"wires":[]},{"id":"3aac057.4e272fa","type":"comment","z":"80f5f744.445108","name":"5.2 Informing the VPP after triggering of the frequency relay (Node-RED <-- TU)","info":"","x":301.8500061035156,"y":2752.64990234375,"wires":[]},{"id":"41c718e.2326468","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":855.6999969482422,"y":2819.599853515625,"wires":[["97230a77.95b6a8"]]},{"id":"97230a77.95b6a8","type":"http request","z":"80f5f744.445108","name":"freqRelay_triggered Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_triggered","tls":"","persist":false,"proxy":"","authType":"basic","x":1116.4000701904297,"y":2819.599853515625,"wires":[[]]},{"id":"81d82cc3.cc3d58","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \ntuName: \"TUEmden0\" \n}","x":554.8500213623047,"y":2821.7498474121094,"wires":[]},{"id":"e34a7bf7.31c9e","type":"comment","z":"80f5f744.445108","name":"***Value Simulation for this part***","info":"","x":187.8500518798828,"y":2874.8500061035156,"wires":[]},{"id":"5fae2fa6.e0f098","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1381.283447265625,"y":2909.7001953125,"wires":[[]]},{"id":"7fe351cb.b7771","type":"comment","z":"80f5f744.445108","name":"JADE Interface (TU-Agent)","info":"","x":1096.8500213623047,"y":2778.8499755859375,"wires":[]},{"id":"4917c7fc.7537f","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":113.58332824707031,"y":2786.9832153320312,"wires":[]},{"id":"73ecaab6.9828d4","type":"http request","z":"80f5f744.445108","name":"freqRelay_triggered Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/freqRelay_triggered","tls":"","persist":false,"proxy":"","authType":"basic","x":1110.8499755859375,"y":2907.85009765625,"wires":[[]]},{"id":"9f2536b1.52932","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":181.85000610351562,"y":2910.25,"wires":[["913974b3.dea25"]]},{"id":"913974b3.dea25","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n\"tuName\": \"TU_Company1_SNL\"\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":502.4666748046875,"y":2909.8001403808594,"wires":[["7a2d8887.e8b2f"]]},{"id":"7a2d8887.e8b2f","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":843.8500366210938,"y":2907.250030517578,"wires":[["73ecaab6.9828d4"]]},{"id":"200f096b.979586","type":"comment","z":"80f5f744.445108","name":"5.2 receiving confirmation from VPP (Node-RED --> TU)","info":"","x":235.85000610351562,"y":2959.449951171875,"wires":[]},{"id":"dee2a284.bebab","type":"http in","z":"80f5f744.445108","name":"","url":"/plc/freqRelay_confirm","method":"put","upload":false,"swaggerDoc":"","x":147.85000610351562,"y":2999.449951171875,"wires":[["12034ed3.5b55b1","c4dad680.4c11","79bde927.135d1"]]},{"id":"12034ed3.5b55b1","type":"http response","z":"80f5f744.445108","name":"Response","statusCode":"","headers":{},"x":228.85000610351562,"y":3037.449951171875,"wires":[]},{"id":"f0d47a3c.b4fea","type":"function","z":"80f5f744.445108","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\n\npayload = \n{\n\"tuName\" : tuName\n}\nmsg.payload = payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":769.683349609375,"y":3034.149948120117,"wires":[[]]},{"id":"54fe9bf0.66d2b4","type":"comment","z":"80f5f744.445108","name":"Interface with data for the TU","info":"","x":776.8500061035156,"y":2961.449951171875,"wires":[]},{"id":"c4dad680.4c11","type":"xml","z":"80f5f744.445108","name":"to JSON","property":"payload","attr":"","chr":"","x":506.68341064453125,"y":3034.3999633789062,"wires":[["f0d47a3c.b4fea"]]},{"id":"79bde927.135d1","type":"function","z":"80f5f744.445108","name":"Data from XML Interface","func":"msg.payload = msg.payload;\n\n/* HTTP Header:\nif you have binary (non-alphanumeric) data \n(or a significantly sized payload) to transmit, \nuse multipart/form-data. Otherwise, use \napplication/x-www-form-urlencoded.\n*/\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":768.6833801269531,"y":3000.766616821289,"wires":[[]]},{"id":"76a67af7.f14914","type":"comment","z":"80f5f744.445108","name":"TU Interface","info":"","x":1045.8500061035156,"y":2966.4499435424805,"wires":[]},{"id":"f7efb8f6.caf74","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject an Enable***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":157.5499725341797,"y":3126.650146484375,"wires":[["a2591b2b.10ab48"]]},{"id":"a2591b2b.10ab48","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615.5499877929688,"y":3125.650146484375,"wires":[["be5fd782.9d624"]]},{"id":"be5fd782.9d624","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_enable Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_enable","tls":"","persist":false,"proxy":"","authType":"basic","x":1133.6666259765625,"y":3124.666748046875,"wires":[[]]},{"id":"adc0e68e.0aea9","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Disable***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156.5499725341797,"y":3527.9833984375,"wires":[["d519a76.89906d8"]]},{"id":"d519a76.89906d8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":618.5499877929688,"y":3525.9833984375,"wires":[["485c3f9c.003658"]]},{"id":"485c3f9c.003658","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_block Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_block","tls":"","persist":false,"proxy":"","authType":"basic","x":1133.6666259765625,"y":3527,"wires":[[]]},{"id":"16fa85eb.ccbd72","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156.5499725341797,"y":3846.9833984375,"wires":[["315036ad.7555a2"]]},{"id":"315036ad.7555a2","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = \"TU_Company1_SNL\";\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":625.5499877929688,"y":3843.9833984375,"wires":[["ecb04700.5c4358"]]},{"id":"ecb04700.5c4358","type":"http request","z":"7b0fa635.67ef5","name":"freqRelay_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/freqRelay_confirm","tls":"","persist":false,"proxy":"","authType":"basic","x":1154.6666259765625,"y":3845,"wires":[[]]},{"id":"ab3c26e5.58647","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":150.6666717529297,"y":3093,"wires":[]},{"id":"7d49616.f2ae5a","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":152.6666717529297,"y":3493,"wires":[]},{"id":"d946bc35.bce1c","type":"comment","z":"7b0fa635.67ef5","name":"********** TESTING *************","info":"//*****Example payload description *****//\n{ \nreference: \"tariff22\" \n}","x":152.6666717529297,"y":3814,"wires":[]},{"id":"221a66c2.132b82","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\nnoNameSet\nTUEmdenCompany1\nnoIDSet\n\n","x":1103.6666259765625,"y":2298.66650390625,"wires":[]},{"id":"c6b94bfd.5cc098","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\"\n}","x":1104.6666259765625,"y":2329.66650390625,"wires":[]},{"id":"23d28def.f11252","type":"comment","z":"80f5f744.445108","name":"Payload description (String)","info":"//*****Example payload description *****//\n\nnoNameSet\nTUEmdenCompany1\nnoIDSet\n\n","x":1095.6666870117188,"y":3007.666748046875,"wires":[]},{"id":"8facf539.a90ea","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName: \"TUEmdenCompany0\"\n}","x":1096.6666870117188,"y":3038.666748046875,"wires":[]},{"id":"91cb935e.4dddf","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":450.6166687011719,"y":969.1998901367188,"wires":[["3d2473f1.56f8d4"]]},{"id":"3d2473f1.56f8d4","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadNewSetpoint.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":667.8499755859375,"y":969.449951171875,"wires":[["4b13d705.4dca3"]]},{"id":"876022fe.30795","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var id = msg.payload.InterfacePayloadPlanning.referenceID || 0; //id is an optional parameter\nvar serviceDescriptions = msg.payload.InterfacePayloadPlanning.serviceDescriptions;\nvar start = msg.payload.InterfacePayloadPlanning.schedulingStart;\nvar end = msg.payload.InterfacePayloadPlanning.schedulingEnd;\nvar expiration = msg.payload.InterfacePayloadPlanning.expiration;\n\n\nmsg.payload = {\n \"referenceID\" : id,\n \"serviceDescriptions\" : serviceDescriptions,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n \"expiration\" : expiration\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":673.8499755859375,"y":175.85000610351562,"wires":[["93d90be7.333288"]]},{"id":"b7656f7e.47eaa","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":444.61669921875,"y":176.80001831054688,"wires":[["876022fe.30795"]]},{"id":"b0d0b8cb.8966a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var balancingTUName = msg.payload.InterfacePayloadBalancing.balancingTUName;\nvar balancingUpdateRate = msg.payload.InterfacePayloadBalancing.balancingUpdateRate;\nvar balancingStart = msg.payload.InterfacePayloadBalancing.balancingStart;\nvar balancingEnd = msg.payload.InterfacePayloadBalancing.balancingEnd;\nvar balancingReferenceID = msg.payload.InterfacePayloadBalancing.balancingReferenceID;\n\nmsg.payload = {\n \"balancingTUName\" : balancingTUName,\n \"balancingStart\" : balancingStart,\n \"balancingEnd\" : balancingEnd,\n \"balancingUpdateRate\" : balancingUpdateRate,\n \"balancingReferenceID\" : balancingReferenceID\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":656.8499755859375,"y":1401.25,"wires":[["8eaa7754.ddfe7"]]},{"id":"ea219ae5.fee2b8","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":441.61669921875,"y":1400.800048828125,"wires":[["b0d0b8cb.8966a"]]},{"id":"f6d67de4.625868","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":458.61669921875,"y":2870.199951171875,"wires":[["48f6c6c1.d178b8"]]},{"id":"48f6c6c1.d178b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":622.8499755859375,"y":2870.64990234375,"wires":[["42326bd2.9c9cbc"]]},{"id":"94cef519.97372","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":446.8499755859375,"y":3270.050048828125,"wires":[["4fa628f6.31a99"]]},{"id":"4fa628f6.31a99","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":613.0833129882812,"y":3269.5,"wires":[["1e2023e1.d79304"]]},{"id":"40217cd9.f4f25c","type":"http request","z":"7b0fa635.67ef5","name":"***Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_schedulingPlanInfos","tls":"","persist":false,"proxy":"","authType":"basic","x":1096.8499755859375,"y":288.8500061035156,"wires":[[]]},{"id":"843c0b65.fb9f38","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var schedulingPlanReference = msg.payload.InterfacePayloadAcceptReject.schedulingPlanReference;\nvar start = msg.payload.InterfacePayloadAcceptReject.schedulingStart;\nvar end = msg.payload.InterfacePayloadAcceptReject.schedulingEnd;\n\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n \"schedulingStart\" : start, \n \"schedulingEnd\" : end, \n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672.8499755859375,"y":539.8499450683594,"wires":[["c7d830c5.e26b5"]]},{"id":"260fa31f.9b694c","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":452.8499755859375,"y":539.8499450683594,"wires":[["843c0b65.fb9f38"]]},{"id":"7ae1d2c0.d88814","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":453,"y":617.9999694824219,"wires":[["bbdc19af.9137c8"]]},{"id":"bbdc19af.9137c8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var schedulingPlanReference = msg.payload.InterfacePayloadAcceptReject.schedulingPlanReference;\n\nmsg.payload = {\n \"schedulingPlanReference\" : schedulingPlanReference,\n}\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672,"y":617.9999694824219,"wires":[["95950400.6683d"]]},{"id":"cd761dcc.9ca9","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_done","tls":"","persist":false,"proxy":"","authType":"basic","x":1105,"y":727,"wires":[[]]},{"id":"3e3fd9bd.e7f1a6","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/scheduling_failure","tls":"","persist":false,"proxy":"","authType":"basic","x":1106,"y":804,"wires":[[]]},{"id":"4dfb481c.c9f398","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/accounting_energyConsumptionProfileReference","tls":"","persist":false,"proxy":"","authType":"basic","x":1201,"y":2006,"wires":[[]]},{"id":"a6dc3532.1dbe8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName;\n\npayload = \n{\n\"tuName\": tuName\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":675,"y":2111.0001220703125,"wires":[["c9286592.2b2a4"]]},{"id":"35f8281d.faff2","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":459.5,"y":2111.0001220703125,"wires":[["a6dc3532.1dbe8"]]},{"id":"d7e193fb.e97838","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/balancing_inform","tls":"","persist":false,"proxy":"","authType":"basic","x":1099.8499755859375,"y":1683.25,"wires":[[]]},{"id":"2e0ffecf.c10d12","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":179.85000610351562,"y":1401.050048828125,"wires":[]},{"id":"235cfdb7.737762","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":613.9999694824219,"y":2237.800048828125,"wires":[["de53aec2.048638"]]},{"id":"de53aec2.048638","type":"http request","z":"249aeb13.444e84","name":"cancelOperation_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/cancelOperation_inform","tls":"","persist":false,"proxy":"","authType":"","x":1162.0000915527344,"y":2234.800094604492,"wires":[[]]},{"id":"9cbde1b9.206c9","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":215,"y":2237.9998779296875,"wires":[["18a92b3a.ad498d","235cfdb7.737762"]]},{"id":"18a92b3a.ad498d","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":264.29998779296875,"y":2272.9999237060547,"wires":[]},{"id":"667fef95.0cf1a8","type":"comment","z":"249aeb13.444e84","name":"3.1 Receiving Cancel for a specific operation from the Planning System (Node-RED <-- Planning)","info":"","x":375.26666259765625,"y":2196.3165893554688,"wires":[]},{"id":"61181f57.397ed","type":"comment","z":"249aeb13.444e84","name":"JADE Interface (TU-Agent)","info":"","x":1133.1499938964844,"y":2196.749984741211,"wires":[]},{"id":"4d3b1d0d.db493c","type":"comment","z":"249aeb13.444e84","name":"3.2 Receiving confirmation of the operation cancel from VPP (Node-RED --> Planning)","info":"","x":347.8500061035156,"y":2338.800048828125,"wires":[]},{"id":"527b9970.65878","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":187.85000610351562,"y":2378.900146484375,"wires":[["8bcc2313.bf0208","684ff720.fcb33"]]},{"id":"8bcc2313.bf0208","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":267.8500061035156,"y":2417.900146484375,"wires":[]},{"id":"815de307.50e7a8","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":616.6834106445312,"y":2381.599853515625,"wires":[[]]},{"id":"684ff720.fcb33","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":422.6833801269531,"y":2381.8501586914062,"wires":[["815de307.50e7a8"]]},{"id":"61ef07c5.9031a8","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1106.2999877929688,"y":2379.0003662109375,"wires":[["6aafa77f.e1dd68"]]},{"id":"6aafa77f.e1dd68","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1334.7999877929688,"y":2379.0003662109375,"wires":[[]]},{"id":"3cdecb16.1d80dc","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1095.8500366210938,"y":2338.9002685546875,"wires":[]},{"id":"90e6f261.bdb36","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":875.8666381835938,"y":2382.0003662109375,"wires":[]},{"id":"57893cde.f4f19c","type":"comment","z":"249aeb13.444e84","name":"****************************************** Cancel Operation********************************************","info":"","x":359.8500061035156,"y":2161.64990234375,"wires":[]},{"id":"28c50d22.65ccf2","type":"comment","z":"249aeb13.444e84","name":"****************************************** Load Time Windows Sharing *******************************************","info":"","x":399.8500061035156,"y":1623.25,"wires":[]},{"id":"96c2fe94.ae4718","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":632.1499633789062,"y":4067.99951171875,"wires":[["dc4eee7e.3b4918"]]},{"id":"dc4eee7e.3b4918","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_confirm","tls":"","persist":false,"proxy":"","authType":"","x":1178.1500701904297,"y":4065.9996795654297,"wires":[[]]},{"id":"33943318.c6bb84","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":192.1499786376953,"y":4069.199462890625,"wires":[["97686248.818948","96c2fe94.ae4718"]]},{"id":"97686248.818948","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":191.449951171875,"y":4105.19970703125,"wires":[]},{"id":"c882b9f2.d08bc8","type":"comment","z":"7b0fa635.67ef5","name":"9.1 Receiving Cancel for a specific operation from the a TU Agent (VPP <-- Node-RED","info":"","x":327.41668701171875,"y":3918.5162963867188,"wires":[]},{"id":"4e15f456.b6abbc","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface ","info":"","x":1119.300048828125,"y":4031.94970703125,"wires":[]},{"id":"6cfc3a12.59fa14","type":"comment","z":"7b0fa635.67ef5","name":"9.2 Sending confirmation or failure of the operation cancel fto the Agent (VPP --> Node-RED)","info":"","x":352.0000457763672,"y":4030.999755859375,"wires":[]},{"id":"fa66d7ef.52b85","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":159.00003051757812,"y":3954.099853515625,"wires":[["9621885c.2b8fd","cb4b24d4.f26328"]]},{"id":"9621885c.2b8fd","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":189.00003051757812,"y":3991.099609375,"wires":[]},{"id":"828f9146.4055b8","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":631.8334350585938,"y":3956.7998046875,"wires":[[]]},{"id":"cb4b24d4.f26328","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":467.8333740234375,"y":3956.0498046875,"wires":[["828f9146.4055b8"]]},{"id":"e91f8f9f.389e4","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1120.449951171875,"y":3957.2001953125,"wires":[[]]},{"id":"ba51565a.3f2b2","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":901.0166625976562,"y":3958.2001953125,"wires":[]},{"id":"3d673ddb.39d542","type":"comment","z":"7b0fa635.67ef5","name":"****************************************** CANCEL OPERATIONS ********************************************","info":"","x":369.0000305175781,"y":3883.849365234375,"wires":[]},{"id":"b416239b.85e8f","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":175,"y":4144.3330078125,"wires":[["ff7ef975.49eb7"]]},{"id":"ff7ef975.49eb7","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635,"y":4142.3330078125,"wires":[["dc4eee7e.3b4918"]]},{"id":"d48495e.197bc68","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":674,"y":2280.33349609375,"wires":[["de53aec2.048638"]]},{"id":"692320b2.9d48f","type":"inject","z":"249aeb13.444e84","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":499.5,"y":2284,"wires":[["d48495e.197bc68"]]},{"id":"f29bec6a.072428","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1112,"y":3924,"wires":[]},{"id":"2fa948eb.967e88","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":457,"y":2578,"wires":[["ab393d18.32128"]]},{"id":"eee9a163.5033f","type":"http request","z":"7b0fa635.67ef5","name":"***For Simulation Setup***","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8082/vpp/freqRelay_enableInform","tls":"","persist":false,"proxy":"","authType":"basic","x":1124,"y":3046,"wires":[[]]},{"id":"6b21aaab.122004","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":596.1499633789062,"y":4331.549865722656,"wires":[["7818ca27.11d844"]]},{"id":"7818ca27.11d844","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_inform Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_inform","tls":"","persist":false,"proxy":"","authType":"","x":1169.1500854492188,"y":4328.549911499023,"wires":[[]]},{"id":"63a8858c.e815ac","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":185.14999389648438,"y":4331.749694824219,"wires":[["1eb5ad0b.ca6753","6b21aaab.122004"]]},{"id":"1eb5ad0b.ca6753","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":246.44998168945312,"y":4366.749740600586,"wires":[]},{"id":"f769df0d.b6d478","type":"comment","z":"7b0fa635.67ef5","name":"10.1 SendingCancel for a specific operation from the Planning System (Node-RED <-- VPP)","info":"","x":347.4166564941406,"y":4290.06640625,"wires":[]},{"id":"54bef9b7.22f4a","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (TU-Agent)","info":"","x":1140.2999877929688,"y":4290.499801635742,"wires":[]},{"id":"740a667.efc4218","type":"comment","z":"7b0fa635.67ef5","name":"10.2 Receiving confirmation of the operation cancel from VPP (Node-RED --> VPP)","info":"","x":320,"y":4404.549865722656,"wires":[]},{"id":"cc065227.539e38","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":170,"y":4444.649963378906,"wires":[["ab12692f.e971e","d2f788ea.0b714"]]},{"id":"ab12692f.e971e","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":250,"y":4480.649963378906,"wires":[]},{"id":"e5e9887c.34117","type":"function","z":"7b0fa635.67ef5","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":598.8334045410156,"y":4447.349670410156,"wires":[[]]},{"id":"d2f788ea.0b714","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":416.8334045410156,"y":4446.600158691406,"wires":[["e5e9887c.34117"]]},{"id":"59f8a81f.2df438","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":858.0166320800781,"y":4447.750183105469,"wires":[]},{"id":"3f8c6389.2b0a3c","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":597.1500244140625,"y":4374.083068847656,"wires":[["7818ca27.11d844"]]},{"id":"d6ebc7b2.69d0e8","type":"inject","z":"7b0fa635.67ef5","name":"TESTING","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":425.6500244140625,"y":4374.750061035156,"wires":[["3f8c6389.2b0a3c"]]},{"id":"80ebddb3.ddc2d8","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650.1499328613281,"y":2695.1998901367188,"wires":[["f85f86ed.c3edf"]]},{"id":"f85f86ed.c3edf","type":"http request","z":"249aeb13.444e84","name":"cancelOperation_confirm Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/cancelOperation_confirm","tls":"","persist":false,"proxy":"","authType":"","x":1196.1500396728516,"y":2693.2000579833984,"wires":[[]]},{"id":"936fe352.6cbd9","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/cancelOperation_confirm","method":"put","upload":false,"swaggerDoc":"","x":210.1499481201172,"y":2696.3998413085938,"wires":[["1f2aab54.87dac5","80ebddb3.ddc2d8"]]},{"id":"1f2aab54.87dac5","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":209.44992065429688,"y":2732.4000854492188,"wires":[]},{"id":"20621d0a.70693a","type":"comment","z":"249aeb13.444e84","name":"4.1 Receiving Cancel for a specific operation from the a TU Agent (Planning <-- Node-RED","info":"","x":355.4166564941406,"y":2545.7166748046875,"wires":[]},{"id":"89ae9dc3.6d67a","type":"comment","z":"249aeb13.444e84","name":"JADE Interface ","info":"","x":1137.3000183105469,"y":2659.1500854492188,"wires":[]},{"id":"fcc75a10.4f76e","type":"comment","z":"249aeb13.444e84","name":"4.2 Sending confirmation or failure of the operation cancel fto the Agent (Planning --> Node-RED)","info":"","x":380.00001525878906,"y":2658.2001342773438,"wires":[]},{"id":"83de5054.6596c8","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/cancelOperation_inform","method":"put","upload":false,"swaggerDoc":"","x":177,"y":2581.3002319335938,"wires":[["7412b3dc.1d6a24","b3c76a56.57f4b"]]},{"id":"7412b3dc.1d6a24","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":207,"y":2618.2999877929688,"wires":[]},{"id":"df1b2507.7760c","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":649.8334045410156,"y":2584.0001831054688,"wires":[[]]},{"id":"b3c76a56.57f4b","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":485.8333435058594,"y":2583.2501831054688,"wires":[["df1b2507.7760c"]]},{"id":"eb88c66a.ff742","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":919.0166320800781,"y":2585.4005737304688,"wires":[]},{"id":"cafe5ea2.a36c6","type":"inject","z":"249aeb13.444e84","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":192.99996948242188,"y":2771.5333862304688,"wires":[["53c8cfb8.181c38"]]},{"id":"53c8cfb8.181c38","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":652.9999694824219,"y":2769.5333862304688,"wires":[["f85f86ed.c3edf"]]},{"id":"39f96665.5775ba","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1160.8499755859375,"y":2585.1998901367188,"wires":[[]]},{"id":"d3a5bd47.fdad","type":"comment","z":"249aeb13.444e84","name":"Planning Interface","info":"","x":1150.8499755859375,"y":2552.1998901367188,"wires":[]},{"id":"67c2a9c4.56cb18","type":"comment","z":"7b0fa635.67ef5","name":"VPP Interface","info":"","x":1095.8499755859375,"y":4413.350158691406,"wires":[]},{"id":"3a9c14b7.0c7efc","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1106.8499755859375,"y":4448.350158691406,"wires":[[]]},{"id":"57672fe1.ccb3f","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/requestInfo","method":"put","upload":false,"swaggerDoc":"","x":134.39999389648438,"y":4627.7998046875,"wires":[["94f8f779.b06f3","8f46e25a.35aa98"]]},{"id":"94f8f779.b06f3","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":174.13331604003906,"y":4663.433166503906,"wires":[]},{"id":"8f46e25a.35aa98","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":475.3500213623047,"y":4627.233215332031,"wires":[["3480b47e.746164"]]},{"id":"3480b47e.746164","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName || \"noNameSet\";\n\n\n\nmsg.payload = {\n \"tuName\" : tuName\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":644.5832977294922,"y":4623.683166503906,"wires":[["d3b6b14d.ce424"]]},{"id":"d3b6b14d.ce424","type":"http request","z":"7b0fa635.67ef5","name":"requestInfos Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/requestInfo","tls":"","persist":false,"proxy":"","authType":"basic","x":1129.2832946777344,"y":4623.583435058594,"wires":[[]]},{"id":"5f8c1e4a.18edf8","type":"comment","z":"7b0fa635.67ef5","name":"JADE Interface (VPP-Agent)","info":"","x":1149.13330078125,"y":4591.83349609375,"wires":[]},{"id":"a1a2f8e8.5bac18","type":"comment","z":"7b0fa635.67ef5","name":"**************** 11 Requesting Agent Info Sequence**************","info":"","x":234.84999084472656,"y":4592.166809082031,"wires":[]},{"id":"57caba26.33ccc4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/requestInfoData","method":"put","upload":false,"swaggerDoc":"","x":128.0833282470703,"y":4737.699844360352,"wires":[["328f222e.397cde","c6f2bf22.161a18"]]},{"id":"328f222e.397cde","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":172.1999969482422,"y":4773.699905395508,"wires":[]},{"id":"c6f2bf22.161a18","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var dataName = \"InfoSet\";\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+dataName+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":647.0331878662109,"y":4737.299514770508,"wires":[[]]},{"id":"7c93f50f.bf3064","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1114.383316040039,"y":4732.599990844727,"wires":[[]]},{"id":"471a1bed.8e1834","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":872.3499603271484,"y":4735.949905395508,"wires":[]},{"id":"5496c112.5cfeb","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/requestInfo","method":"get","upload":false,"swaggerDoc":"","x":121.19999694824219,"y":4805.599807739258,"wires":[["2eec3b94.8169c4"]]},{"id":"4e16df4.4683a2","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":805.1999969482422,"y":4805.599807739258,"wires":[]},{"id":"399a86d2.c4f45a","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":638.1999969482422,"y":4806.599807739258,"wires":[["4e16df4.4683a2"]]},{"id":"2eec3b94.8169c4","type":"template","z":"7b0fa635.67ef5","name":"INSERT AGENT INFO HERE","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"AGENT\"\n \"ABC\"\n","output":"str","x":409.1999969482422,"y":4805.599807739258,"wires":[["399a86d2.c4f45a"]]},{"id":"5d75ab3d.a62f34","type":"inject","z":"7b0fa635.67ef5","name":"**TEST**Inject Request to Agent","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":155.6999969482422,"y":4701.599807739258,"wires":[["76629d87.7098fc"]]},{"id":"76629d87.7098fc","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"\nmsg.payload = {\n \"tuName\" : \"TU_Company1_MRL\"\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":648.1999969482422,"y":4703.599807739258,"wires":[["d3b6b14d.ce424"]]},{"id":"7ce87186.d7645","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n}","x":419.1999969482422,"y":4662.599807739258,"wires":[]},{"id":"77cda8f.02fb4d8","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/requestInfo","method":"get","upload":false,"swaggerDoc":"","x":144.66668701171875,"y":3120.666748046875,"wires":[["9a70f535.1872e8"]]},{"id":"6da8ac2d.0d6ddc","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":847.6666564941406,"y":3120.666748046875,"wires":[]},{"id":"402955e8.5b7c54","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"msg.payload = msg.payload;\nmsg.headers = {'content-type':'application/octet-stream'};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660.6666564941406,"y":3120.666748046875,"wires":[["6da8ac2d.0d6ddc"]]},{"id":"3a82af35.2c6f98","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/requestInfo","method":"put","upload":false,"swaggerDoc":"","x":166.9833221435547,"y":2973.6666870117188,"wires":[["e5fdf7c5.69c0f","651709d2.673e68"]]},{"id":"e5fdf7c5.69c0f","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":206.71664428710938,"y":3009.300048828125,"wires":[]},{"id":"651709d2.673e68","type":"http request","z":"249aeb13.444e84","name":"requestInfos Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/requestInfo","tls":"","persist":false,"proxy":"","authType":"basic","x":1123.8666076660156,"y":2969.4501342773438,"wires":[[]]},{"id":"5f939e65.828db8","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/requestInfoData","method":"put","upload":false,"swaggerDoc":"","x":153.66665649414062,"y":3046.5667114257812,"wires":[["d14e94ad.dc6238","b6b23cbe.1271e8"]]},{"id":"d14e94ad.dc6238","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":197.7833251953125,"y":3082.5667724609375,"wires":[]},{"id":"b6b23cbe.1271e8","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var dataName = \"InfoSet\";\n//filename needed for \"file node\", if you want to locally save the file\nmsg.filename = 'C:/Users/Woltmann/Desktop/VPP_Folder/'+dataName+'.xml';\nmsg.payload = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":673.6164855957031,"y":3045.1663818359375,"wires":[[]]},{"id":"7b388800.375908","type":"http request","z":"249aeb13.444e84","name":"Endpoint of ERP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1117.9665832519531,"y":3044.4666748046875,"wires":[[]]},{"id":"64c26034.8e2f","type":"inject","z":"249aeb13.444e84","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":476.2833557128906,"y":3008.4666748046875,"wires":[["651709d2.673e68"]]},{"id":"e9908fb9.c8e238","type":"comment","z":"249aeb13.444e84","name":"**************** 5 Requesting Agent Info Sequence**************","info":"","x":262.6666564941406,"y":2936.666748046875,"wires":[]},{"id":"9a70f535.1872e8","type":"template","z":"249aeb13.444e84","name":"INSERT AGENT INFO HERE","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\n \"AGENT\"\n \"ABC\"\n","output":"str","x":406.6666259765625,"y":3120.666748046875,"wires":[["402955e8.5b7c54"]]},{"id":"c638e3e.26af82","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\nno payload intended, automatically requests all available VPP Agents","x":519.6666564941406,"y":2976.666748046875,"wires":[]},{"id":"17f2a528.d6b0c3","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n\n \"ENERGYCONSUMPTIONPROFILE\"\n \"testTUHSEMD\"\n \n \"6000\"\n \"22000\"\n \n","x":898.6666564941406,"y":3046.666748046875,"wires":[]},{"id":"fa8b421b.543a28","type":"debug","z":"80f5f744.445108","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1282.8571210588727,"y":1142.285701206752,"wires":[]},{"id":"e6ddaf40.83549","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":648.1499633789062,"y":2811.6832885742188,"wires":[["8152d9b9.044e5"]]},{"id":"8152d9b9.044e5","type":"http request","z":"249aeb13.444e84","name":"cancelOperation_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/erp-agent/cancelOperation_failure","tls":"","persist":false,"proxy":"","authType":"","x":1194.1500701904297,"y":2809.6834564208984,"wires":[[]]},{"id":"fc89c9f6.f1417","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp-agent/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":198.1499786376953,"y":2812.8832397460938,"wires":[["da608014.6f2ae","e6ddaf40.83549"]]},{"id":"da608014.6f2ae","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":207.449951171875,"y":2848.8834838867188,"wires":[]},{"id":"e0d3fd20.7c9f98","type":"inject","z":"249aeb13.444e84","name":"***test: inject a Confirm***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":191,"y":2888.0167846679688,"wires":[["3c6c245e.62b624"]]},{"id":"3c6c245e.62b624","type":"function","z":"249aeb13.444e84","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":651,"y":2886.0167846679688,"wires":[["8152d9b9.044e5"]]},{"id":"e9328489.cd5e88","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": tuName,\n\"referenceID\": referenceID\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635.1499633789062,"y":4178.25,"wires":[["dbe579fd.7dd56"]]},{"id":"dbe579fd.7dd56","type":"http request","z":"7b0fa635.67ef5","name":"cancelOperation_failure Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/vpp-agent/cancelOperation_failure","tls":"","persist":false,"proxy":"","authType":"","x":1181.1500701904297,"y":4175.25016784668,"wires":[[]]},{"id":"58dff453.340fe4","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp-agent/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":185.1499786376953,"y":4178.449951171875,"wires":[["7f470248.3b44cc","e9328489.cd5e88"]]},{"id":"7f470248.3b44cc","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":194.449951171875,"y":4214.4501953125,"wires":[]},{"id":"ff6d0031.d35f","type":"inject","z":"7b0fa635.67ef5","name":"***test: inject a Failure***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":178,"y":4253.58349609375,"wires":[["5a73f948.ba7458"]]},{"id":"5a73f948.ba7458","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler","func":"var tuName = msg.payload.tuName || \"noNameSet\";\nvar referenceID = msg.payload.referenceID;\n\npayload = \n{\n\"tuName\": \"TU_Company1_MRL\",\n\"referenceID\": \"abortSchedulingRef344\"\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":638,"y":4251.58349609375,"wires":[["dbe579fd.7dd56"]]},{"id":"eb721194.81a62","type":"http in","z":"249aeb13.444e84","name":"","url":"/erp/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":175.85000610351562,"y":2454.64990234375,"wires":[["67b5c44c.38bf84","be3d2d4e.feae58"]]},{"id":"67b5c44c.38bf84","type":"http response","z":"249aeb13.444e84","name":"Response","statusCode":"","headers":{},"x":265.8500061035156,"y":2493.64990234375,"wires":[]},{"id":"8ef401ff.50f15","type":"function","z":"249aeb13.444e84","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":614.6834106445312,"y":2457.349609375,"wires":[[]]},{"id":"be3d2d4e.feae58","type":"xml","z":"249aeb13.444e84","name":"to JSON","property":"payload","attr":"","chr":"","x":420.6833801269531,"y":2457.5999145507812,"wires":[["8ef401ff.50f15"]]},{"id":"2d20f9df.46cb36","type":"http request","z":"249aeb13.444e84","name":"Endpoint of Planning","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1104.2999877929688,"y":2454.7501220703125,"wires":[["268060a5.7924f"]]},{"id":"268060a5.7924f","type":"json","z":"249aeb13.444e84","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1332.7999877929688,"y":2454.7501220703125,"wires":[[]]},{"id":"623e5a2.4d804a4","type":"comment","z":"249aeb13.444e84","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":873.8666381835938,"y":2457.7501220703125,"wires":[]},{"id":"f8cf0271.5bfe9","type":"http in","z":"7b0fa635.67ef5","name":"","url":"/vpp/cancelOperation_failure","method":"put","upload":false,"swaggerDoc":"","x":171.6666717529297,"y":4517,"wires":[["c5b67811.cac2d8","47ff44dc.9beae4"]]},{"id":"c5b67811.cac2d8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":251.6666717529297,"y":4553,"wires":[]},{"id":"12f0d993.412706","type":"function","z":"7b0fa635.67ef5","name":"Data from JSON Interface","func":"var tuName = msg.payload.InterfacePayloadAgentReference.tuName.toString();\nvar referenceID = msg.payload.InterfacePayloadAgentReference.referenceID.toString();\n\npayload = \n{\n\"tuName\" : tuName,\n\"referenceID\" : referenceID\n}\nmsg.payload = payload;\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600.5000762939453,"y":4519.69970703125,"wires":[[]]},{"id":"47ff44dc.9beae4","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":418.5000762939453,"y":4518.9501953125,"wires":[["12f0d993.412706"]]},{"id":"fd3a8ab0.c1762","type":"comment","z":"7b0fa635.67ef5","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{ \n tuName : \"TuCompanyEmden01\",\n referenceID : \"schedulingOperation344Cancelled\"\n}","x":859.6833038330078,"y":4520.1002197265625,"wires":[]},{"id":"4311fce9.be3914","type":"http request","z":"7b0fa635.67ef5","name":"Endpoint of VPP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1108.5166473388672,"y":4520.7001953125,"wires":[[]]},{"id":"18c87b11.b14c55","type":"function","z":"7b0fa635.67ef5","name":"Payload_handler (for Simulation)","func":"var tuName = msg.payload.InterfacePayloadNewSetpoint.tuName || \"noNameSet\";\nvar newSetpoint = msg.payload.InterfacePayloadNewSetpoint.newSetpoint;\n\n\nmsg.payload = {\n \"tuName\" : tuName, \n \"newSetpoint\" : newSetpoint\n}\n\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":672.6666870117188,"y":1121,"wires":[["5ac310c4.37c028"]]},{"id":"e02adc48.0aa598","type":"xml","z":"7b0fa635.67ef5","name":"to JSON","property":"payload","attr":"","chr":"","x":455.4333801269531,"y":1120.7499389648438,"wires":[["18c87b11.b14c55"]]},{"id":"7e484566.6e03ec","type":"comment","z":"80f5f744.445108","name":"Payload description (JSON)","info":"//*****Example payload description *****//\n{\n \"tuName\": \"TUEmden0\", \n\t\"feedIn\" : 10,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : 11,\t \t\t//Arbeitspunkt\n \"leadingOperatingPoint\" : 12,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : 13,\t\t\t//Regelleistungsistwert\n\t\"assignedPool\" : 14,\t\t\t//Poolzuordnung\n \"status\" : 15,\t\t\t\t\t//Status (Meldung)\n\t\"frequency\" : 16,\t\t\t\t//Frequenz\n\t\"aFRRsetpoint\" : 17,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : 200,\t\t//aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : 201,\t\t\t\t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : 202,\t\t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : 203,\t\t//aFRR-Gradient NEG\n\t\"capacityPOS\" : 204,\t\t\t//Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : 205,\t\t\t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : 206,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : 207,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : 208,\t\t\t//Regelband POS\n\t\"controlBandNEG\" : 209\t\t\t//Regelband NEG\n}","x":547,"y":1484,"wires":[]},{"id":"184602af.0f7ce5","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\nvar feedIn = msg.payload.feedIn || -99999;\nvar operatingPoint = msg.payload.operatingPoint || -99999;\nvar leadingOperatingPoint = msg.payload.leadingOperatingPoint || -99999;\nvar currentValueFR = msg.payload.currentValueFR || -99999;\nvar assignedPool = msg.payload.assignedPool || -99999;\nvar status = msg.payload.status || -99999;\nvar frequency = msg.payload.frequency || -99999;\nvar aFRRsetpoint = msg.payload.aFRRsetpoint || -99999;\nvar aFRRsetpointEcho = msg.payload.aFRRsetpointEcho || -99999;\nvar setpointFR = msg.payload.setpointFR || -99999;\nvar aFRRGradientPOS = msg.payload.aFRRGradientPOS || -99999;\nvar aFRRGradientNEG = msg.payload.aFRRGradientNEG || -99999;\nvar capacityPOS = msg.payload.capacityPOS || -99999;\nvar capacityNEG = msg.payload.capacityNEG || -99999;\nvar holdingCapacityPOS = msg.payload.holdingCapacityPOS || -99999;\nvar holdingCapacityNEG = msg.payload.holdingCapacityNEG || -99999;\nvar controlBandPOS = msg.payload.controlBandPOS || -99999;\nvar controlBandNEG = msg.payload.controlBandNEG || -99999;\n\npayload = \n{\n \"tuName\": tuName, \n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":841.2666625976562,"y":1481.38330078125,"wires":[["ea5229b7.676798"]]},{"id":"ea5229b7.676798","type":"http request","z":"80f5f744.445108","name":"balancing_informInstant Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_informInstant","tls":"","persist":false,"proxy":"","authType":"basic","x":1124.966552734375,"y":1482.38330078125,"wires":[[]]},{"id":"c6678f2f.a5878","type":"inject","z":"80f5f744.445108","name":"***test: inject a Inform***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":161,"y":1653,"wires":[["4e6b7e8d.43208"]]},{"id":"4e6b7e8d.43208","type":"function","z":"80f5f744.445108","name":"setting example values","func":"payload = \n{\n \"tuName\": \"TU_Company1_SRL\", \n\t\"feedIn\" : 10,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : 11,\t \t\t//Arbeitspunkt\n \"leadingOperatingPoint\" : 12,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : 13,\t\t\t//Regelleistungsistwert\n\t\"assignedPool\" : 14,\t\t\t//Poolzuordnung\n \"status\" : 15,\t\t\t\t\t//Status (Meldung)\n\t\"frequency\" : 16,\t\t\t\t//Frequenz\n\t\"aFRRsetpoint\" : 17,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : 200,\t\t//aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : 201,\t\t\t\t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : 202,\t\t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : 203,\t\t//aFRR-Gradient NEG\n\t\"capacityPOS\" : 204,\t\t\t//Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : 205,\t\t\t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : 206,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : 207,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : 208,\t\t\t//Regelband POS\n\t\"controlBandNEG\" : 209\t\t\t//Regelband NEG\n}\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":485.6166687011719,"y":1653.5501403808594,"wires":[["c0c8e88.4a83b18"]]},{"id":"c0c8e88.4a83b18","type":"function","z":"80f5f744.445108","name":"Payload_handler","func":"var tuName = msg.payload.tuName;\nvar feedIn = msg.payload.feedIn || -99999;\nvar operatingPoint = msg.payload.operatingPoint || -99999;\nvar leadingOperatingPoint = msg.payload.leadingOperatingPoint || -99999;\nvar currentValueFR = msg.payload.currentValueFR || -99999;\nvar assignedPool = msg.payload.assignedPool || -99999;\nvar status = msg.payload.status || -99999;\nvar frequency = msg.payload.frequency || -99999;\nvar aFRRsetpoint = msg.payload.aFRRsetpoint || -99999;\nvar aFRRsetpointEcho = msg.payload.aFRRsetpointEcho || -99999;\nvar setpointFR = msg.payload.setpointFR || -99999;\nvar aFRRGradientPOS = msg.payload.aFRRGradientPOS || -99999;\nvar aFRRGradientNEG = msg.payload.aFRRGradientNEG || -99999;\nvar capacityPOS = msg.payload.capacityPOS || -99999;\nvar capacityNEG = msg.payload.capacityNEG || -99999;\nvar holdingCapacityPOS = msg.payload.holdingCapacityPOS || -99999;\nvar holdingCapacityNEG = msg.payload.holdingCapacityNEG || -99999;\nvar controlBandPOS = msg.payload.controlBandPOS || -99999;\nvar controlBandNEG = msg.payload.controlBandNEG || -99999;\n\npayload = \n{\n \"tuName\": tuName, \n\t\"feedIn\" : feedIn,\t\t\t\t //Einspeisung\n\t\"operatingPoint\" : operatingPoint,\t \t\t //Arbeitspunkt\n \"leadingOperatingPoint\" : leadingOperatingPoint,\t//vorauseilender Arbeitspunkt\n \"currentValueFR\" : currentValueFR,\t\t\t //Regelleistungsistwert\n\t\"assignedPool\" : assignedPool,\t\t\t //Poolzuordnung\n \"status\" : status,\t\t\t\t\t //Status (Meldung)\n\t\"frequency\" : frequency,\t\t\t\t //Frequenz\n\t\"aFRRsetpoint\" : aFRRsetpoint,\t\t //aFRR-Soll (ÃœNB -> POOL)\n\t\"aFRRsetpointEcho\" : aFRRsetpointEcho,\t\t //aFRR-Soll-Echo (Pool -> ÃœNB)\n\t\"setpointFR\" : setpointFR,\t\t\t \t//Regelleistungs-Soll\n\t\"aFRRGradientPOS\" : aFRRGradientPOS,\t \t//aFRR-Gradient POS\n\t\"aFRRGradientNEG\" : aFRRGradientNEG,\t\t //aFRR-Gradient NEG\n\t\"capacityPOS\" : capacityPOS,\t\t\t //Arbeitsvermögen POS (bei begrenztem Energiespeicher)\n\t\"capacityNEG\" : capacityNEG,\t\t \t//Arbeitsvermögen NEG (bei begrenzten Energiespeicher)\n\t\"holdingCapacityPOS\" : holdingCapacityPOS,\t\t//Aktuelle Vorhalteleistung POS\n\t\"holdingCapacityNEG\" : holdingCapacityNEG,\t\t//Aktuelle Vorhalteleistung NEG\n\t\"controlBandPOS\" : controlBandPOS,\t\t\t //Regelband POS\n\t\"controlBandNEG\" : controlBandNEG\t\t\t //Regelband NEG\n}\n\nmsg.payload = payload;\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":827.0000305175781,"y":1652.0000305175781,"wires":[["483d7d5b.db2f4c"]]},{"id":"28e7dd65.70f9d2","type":"json","z":"80f5f744.445108","name":"Javascript - JSON Convert","property":"payload","action":"","pretty":false,"x":1398.583251953125,"y":1649,"wires":[[]]},{"id":"483d7d5b.db2f4c","type":"http request","z":"80f5f744.445108","name":"balancing_informInstant Endpoint","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://localhost:8080/tu-agent/balancing_informInstant","tls":"","persist":false,"proxy":"","authType":"basic","x":1109,"y":1652,"wires":[["28e7dd65.70f9d2"]]},{"id":"9395992a.39d0e8","type":"http response","z":"7b0fa635.67ef5","name":"Response","statusCode":"","headers":{},"x":186,"y":2118.8573122024536,"wires":[]}] \ No newline at end of file From 6d034168f315f8ac40471bc298252c096f6941f6 Mon Sep 17 00:00:00 2001 From: Stefan Woltmann <56683670+IngStefan@users.noreply.github.com> Date: Sun, 27 Jun 2021 12:44:13 +0200 Subject: [PATCH 5/5] Bugfixes and minor changes --- .../java/mas/JADE_VPP/ContainerManager.java | 8 +- .../java/mas/JADE_VPP/ProducingRest_TU.java | 47 +- .../java/mas/JADE_VPP/ProducingRest_VPP.java | 1 + .../src/main/java/mas/JADE_VPP/Startup.java | 220 +- .../src/main/java/mas/JADE_VPP/TU_Agent.java | 1720 ++++++++++++++ .../main/java/mas/JADE_VPP/TuVariables.java | 1 + .../src/main/java/mas/JADE_VPP/VPP_Agent.java | 2087 +++++++++++++++++ .../ontology/CancelOperationCancel.java | 31 + .../JADE_VPP/ontology/VPP_DR_Ontology.java | 30 +- 9 files changed, 4015 insertions(+), 130 deletions(-) create mode 100644 JADE_VPP/src/main/java/mas/JADE_VPP/TU_Agent.java create mode 100644 JADE_VPP/src/main/java/mas/JADE_VPP/VPP_Agent.java create mode 100644 JADE_VPP/src/main/java/mas/JADE_VPP/ontology/CancelOperationCancel.java diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/ContainerManager.java b/JADE_VPP/src/main/java/mas/JADE_VPP/ContainerManager.java index 8d1f03a..8d32f1a 100644 --- a/JADE_VPP/src/main/java/mas/JADE_VPP/ContainerManager.java +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/ContainerManager.java @@ -29,20 +29,20 @@ private void init(){ jade.core.Runtime runtime = jade.core.Runtime.instance(); //runtime.setCloseVM(true); - ////***** for MAIN CONTAINER (VPP) ************ + //************ For creation as Main Container (VPP) ************ //Creates a profile for the start of the Main Container (for VPP Agent) Profile p = new jade.core.ProfileImpl(); p.setParameter(jade.core.Profile.CONTAINER_NAME, "VPP"); p.setParameter(jade.core.Profile.MAIN_HOST, "localhost"); - p.setParameter(jade.core.Profile.GUI, "true"); //starts the JADE user interface + p.setParameter(jade.core.Profile.GUI, "true"); //enables JADE UI containerController = runtime.createMainContainer(p); - ////***** for Agent CONTAINER (TU) ************ + //************ For creation as Agent Container (TU) ************ //Alternative profile to join a Main Container (for TU-Agents) // Profile p = new jade.core.ProfileImpl(); // p.setParameter(jade.core.Profile.CONTAINER_NAME, "TU_Company3"); -// p.setParameter(jade.core.Profile.MAIN_HOST, "192.168.152.233"); // IP of the Main Host the TUs should connect to +// p.setParameter(jade.core.Profile.MAIN_HOST, "192.168.152.233"); // IP-Address of MainContainer // containerController = runtime.createAgentContainer(p); } diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/ProducingRest_TU.java b/JADE_VPP/src/main/java/mas/JADE_VPP/ProducingRest_TU.java index eedea1c..ee5ff25 100644 --- a/JADE_VPP/src/main/java/mas/JADE_VPP/ProducingRest_TU.java +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/ProducingRest_TU.java @@ -125,7 +125,6 @@ public String operationCancelFail( //**************************** INTERFACE TO NODE-RED (TU) ******************************* - //************************ TU Control ************************** @RequestMapping (method=RequestMethod.PUT, value = "/tu-agent/control_newSetpointFailed") @@ -164,6 +163,52 @@ public InterfacePayloadBalancing newBalancingRefuse(@RequestParam(name = "tuName return payload; } + @RequestMapping (method=RequestMethod.PUT, value = "/tu-agent/balancing_informInstant") + public InterfacePayloadBalancing newBalancingInformInstant( + @RequestParam(name = "tuName") String _tuName, + @RequestParam(name = "feedIn") int _feedIn, + @RequestParam(name = "operatingPoint") int _operatingPoint, + @RequestParam(name = "leadingOperatingPoint") int _leadingOperatingPoint, + @RequestParam(name = "currentValueFR") int _currentValueFR, + @RequestParam(name = "assignedPool") int _assignedPool, + @RequestParam(name = "status") int _status, + @RequestParam(name = "frequency") int _frequency, + @RequestParam(name = "aFRRsetpoint") int _aFRRsetpoint, + @RequestParam(name = "aFRRsetpointEcho") int _aFRRsetpointEcho, + @RequestParam(name = "setpointFR") int _setpointFR, + @RequestParam(name = "aFRRGradientPOS") int _aFRRGradientPOS, + @RequestParam(name = "aFRRGradientNEG") int _aFRRGradientNEG, + @RequestParam(name = "capacityPOS") int _capacityPOS, + @RequestParam(name = "capacityNEG") int _capacityNEG, + @RequestParam(name = "holdingCapacityPOS") int _holdingCapacityPOS, + @RequestParam(name = "holdingCapacityNEG") int _holdingCapacityNEG, + @RequestParam(name = "controlBandPOS") int _controlBandPOS, + @RequestParam(name = "controlBandNEG") int _controlBandNEG) { + InterfacePayloadBalancing payload = new InterfacePayloadBalancing(_tuName); + TuVariables.balancingTuName = _tuName; + TuVariables.feedIn = _feedIn; //Einspeisung + TuVariables.operatingPoint = _operatingPoint; //Arbeitspunkt + TuVariables.leadingOperatingPoint = _leadingOperatingPoint; //vorauseilender Arbeitspunkt + TuVariables.currentValueFR = _currentValueFR; //Regelleistungsistwert + TuVariables.assignedPool = _assignedPool; //Poolzuordnung + TuVariables.status = _status; //Status (Meldung) + TuVariables.frequency = _frequency; //Frequenz + TuVariables.aFRRsetpoint = _aFRRsetpoint; //aFRR-Soll (ÃœNB -> POOL) + TuVariables.aFRRsetpointEcho = _aFRRsetpointEcho; //aFRR-Soll-Echo (Pool -> ÃœNB) + TuVariables.setpointFR = _setpointFR; //Regelleistungs-Soll + TuVariables.aFRRGradientPOS = _aFRRGradientPOS; //aFRR-Gradient POS + TuVariables.aFRRGradientNEG = _aFRRGradientNEG; //aFRR-Gradient NEG + TuVariables.capacityPOS = _capacityPOS; //Arbeitsvermögen POS (bei begrenztem Energiespeicher) + TuVariables.capacityNEG = _capacityNEG; //Arbeitsvermögen NEG (bei begrenzten Energiespeicher) + TuVariables.holdingCapacityPOS = _holdingCapacityPOS; //Aktuelle Vorhalteleistung POS + TuVariables.holdingCapacityNEG = _holdingCapacityNEG; //Aktuelle Vorhalteleistung NEG + TuVariables.controlBandPOS = _controlBandPOS; //Regelband POS + TuVariables.controlBandNEG = _controlBandNEG; //Regelband NEG + TuVariables.balancingInformInstantTrigger = true; + return payload; + } + + @RequestMapping (method=RequestMethod.PUT, value = "/tu-agent/balancing_inform") public InterfacePayloadBalancing newBalancingInform( @RequestParam(name = "tuName") String _tuName, diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/ProducingRest_VPP.java b/JADE_VPP/src/main/java/mas/JADE_VPP/ProducingRest_VPP.java index 467b600..dbb49e9 100644 --- a/JADE_VPP/src/main/java/mas/JADE_VPP/ProducingRest_VPP.java +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/ProducingRest_VPP.java @@ -16,6 +16,7 @@ @RestController public class ProducingRest_VPP { + //**************************** INTERFACE TO NODE-RED (VPP) ******************************* //********************** Scheduling ********************** @RequestMapping (method=RequestMethod.PUT, value = "/vpp-agent/scheduling_request") diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/Startup.java b/JADE_VPP/src/main/java/mas/JADE_VPP/Startup.java index 19bb197..5f4d17d 100644 --- a/JADE_VPP/src/main/java/mas/JADE_VPP/Startup.java +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/Startup.java @@ -27,122 +27,122 @@ public static void main(String[] args) //******* start the platform (changes to the container can be made in the "ContainerManager" class) try { - //******* starting the VPP agent of the platform (1st parameter: AgentName, 2nd parameter: class name) - ContainerManager.getInstance().instantiateAgent("VPP_Aggregator_1", "mas.JADE_VPP.VPP"); - //******* starting an agent with additional arguments as 3rd parameter - //Object[] agentArgs = {500, 511, 399, 555, 1500, 1600, 200, 900, 65, 1233, 426, 468, 934}; // - //ContainerManager.getInstance().instantiateAgent("VPP2", "mas.JADE_VPP.VPP", agentArgs); + //Creation of an agent at startup: + //ContainerManager.getInstance().instantiateAgent(, , ); + ContainerManager.getInstance().instantiateAgent("VPP_Aggregator_1", "mas.JADE_VPP.VPP_Agent"); + +// ContainerManager.getInstance().instantiateAgent("TU_Company1_PRL", "mas.JADE_VPP.TU_Agent", new String[]{"PRL"}); +// ContainerManager.getInstance().instantiateAgent("TU_Company1_SRL", "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); -// //******* starting TU Agents (1st parameter: AgentName, 2nd parameter: class name, 3rd parameter: service description in comma separation) /* - ContainerManager.getInstance().instantiateAgent("TU_Company1_PRL", "mas.JADE_VPP.TU", new String[]{"PRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company2_PRL", "mas.JADE_VPP.TU", new String[]{"PRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_PRL", "mas.JADE_VPP.TU", new String[]{"PRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company1_SRL", "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company2_SRL", "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_SRL", "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company2_SRL(BACKUP)", "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_SRL(BACKUP)", "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company4_SRL", "mas.JADE_VPP.TU", new String[]{"SRL,FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company5_SRL", "mas.JADE_VPP.TU", new String[]{"SRL,FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company1_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company2_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company4_MRL", "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_A", "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_B", "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_C", "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company6_SOL", "mas.JADE_VPP.TU", new String[]{"SOL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company7_SOL", "mas.JADE_VPP.TU", new String[]{"SOL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company8_SOL", "mas.JADE_VPP.TU", new String[]{"SOL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company9_SOL", "mas.JADE_VPP.TU", new String[]{"SOL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company10_SNL", "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company11_SNL", "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company12_SNL", "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company13_SNL", "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company14_SNL", "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company15_SNL", "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_pla", "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_act", "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_acc", "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_pla", "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_act", "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_acc", "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_pla", "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_act", "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_acc", "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_pla", "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_act", "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_acc", "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_pla", "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_act", "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_acc", "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company21_FLEX", "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company22_FLEX", "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company23_FLEX", "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company24_FLEX", "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company25_FLEX", "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company26_FLEX", "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company27_FLEX", "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company28_FLEX", "mas.JADE_VPP.TU", new String[]{"ANN"}); - ContainerManager.getInstance().instantiateAgent("TU_Company29_FLEX", "mas.JADE_VPP.TU", new String[]{"ANN"}); - ContainerManager.getInstance().instantiateAgent("TU_Company30_FLEX", "mas.JADE_VPP.TU", new String[]{"ANN"}); + ContainerManager.getInstance().instantiateAgent("TU_Company1_PRL", "mas.JADE_VPP.TU_Agent", new String[]{"PRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company2_PRL", "mas.JADE_VPP.TU_Agent", new String[]{"PRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company3_PRL", "mas.JADE_VPP.TU_Agent", new String[]{"PRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company1_SRL", "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company2_SRL", "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company3_SRL", "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company2_SRL(BACKUP)", "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company3_SRL(BACKUP)", "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company4_SRL", "mas.JADE_VPP.TU_Agent", new String[]{"SRL,FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company5_SRL", "mas.JADE_VPP.TU_Agent", new String[]{"SRL,FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company1_MRL", "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company2_MRL", "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL", "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company4_MRL", "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_A", "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_B", "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_C", "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company6_SOL", "mas.JADE_VPP.TU_Agent", new String[]{"SOL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company7_SOL", "mas.JADE_VPP.TU_Agent", new String[]{"SOL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company8_SOL", "mas.JADE_VPP.TU_Agent", new String[]{"SOL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company9_SOL", "mas.JADE_VPP.TU_Agent", new String[]{"SOL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company10_SNL", "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company11_SNL", "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company12_SNL", "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company13_SNL", "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company14_SNL", "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company15_SNL", "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_pla", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_act", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_acc", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_pla", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_act", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_acc", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_pla", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_act", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_acc", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_pla", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_act", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_acc", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_pla", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_act", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_acc", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company21_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company22_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company23_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company24_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company25_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company26_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company27_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company28_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"ANN"}); + ContainerManager.getInstance().instantiateAgent("TU_Company29_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"ANN"}); + ContainerManager.getInstance().instantiateAgent("TU_Company30_FLEX", "mas.JADE_VPP.TU_Agent", new String[]{"ANN"}); //**** Adding additional Agents with a multiplier for(int i = 0 ; i < factor ; i++){ - ContainerManager.getInstance().instantiateAgent("TU_Company1_PRL+"+i, "mas.JADE_VPP.TU", new String[]{"PRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company2_PRL+"+i, "mas.JADE_VPP.TU", new String[]{"PRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_PRL+"+i, "mas.JADE_VPP.TU", new String[]{"PRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company1_SRL+"+i, "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company2_SRL+"+i, "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_SRL+"+i, "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company2_SRL(BACKUP)+"+i, "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_SRL(BACKUP)+"+i, "mas.JADE_VPP.TU", new String[]{"SRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company4_SRL,FLEX+"+i, "mas.JADE_VPP.TU", new String[]{"SRL,FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company5_SRL,MRL+"+i, "mas.JADE_VPP.TU", new String[]{"SRL,MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company1_MRL+"+i, "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company2_MRL+"+i, "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL+"+i, "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company4_MRL+"+i, "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_A+"+i, "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_B+"+i, "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_C+"+i, "mas.JADE_VPP.TU", new String[]{"MRL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company6_SOL+"+i, "mas.JADE_VPP.TU", new String[]{"SOL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company7_SOL+"+i, "mas.JADE_VPP.TU", new String[]{"SOL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company8_SOL+"+i, "mas.JADE_VPP.TU", new String[]{"SOL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company9_SOL+"+i, "mas.JADE_VPP.TU", new String[]{"SOL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company10_SNL+"+i, "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company11_SNL+"+i, "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company12_SNL+"+i, "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company13_SNL+"+i, "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company14_SNL+"+i, "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company15_SNL+"+i, "mas.JADE_VPP.TU", new String[]{"SNL"}); - ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_pla+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_act+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_acc+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_pla+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_act+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_acc+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_pla+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_act+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_acc+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_pla+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_act+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_acc+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_pla+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_pla"}); - ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_act+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_act"}); - ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_acc+"+i, "mas.JADE_VPP.TU", new String[]{"FLEX_acc"}); - ContainerManager.getInstance().instantiateAgent("TU_Company21_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company22_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company23_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company24_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company25_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company26_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company27_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"FLEX"}); - ContainerManager.getInstance().instantiateAgent("TU_Company28_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"ANN"}); - ContainerManager.getInstance().instantiateAgent("TU_Company29_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"ANN"}); - ContainerManager.getInstance().instantiateAgent("TU_Company30_FLEX"+i, "mas.JADE_VPP.TU", new String[]{"ANN"}); + ContainerManager.getInstance().instantiateAgent("TU_Company1_PRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"PRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company2_PRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"PRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company3_PRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"PRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company1_SRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company2_SRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company3_SRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company2_SRL(BACKUP)+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company3_SRL(BACKUP)+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company4_SRL,FLEX+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SRL,FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company5_SRL,MRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SRL,MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company1_MRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company2_MRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company3_MRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company4_MRL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_A+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_B+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company5_MRL_C+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"MRL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company6_SOL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SOL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company7_SOL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SOL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company8_SOL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SOL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company9_SOL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SOL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company10_SNL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company11_SNL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company12_SNL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company13_SNL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company14_SNL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company15_SNL+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"SNL"}); + ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_pla+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_act+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company16_FLEX_acc+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_pla+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_act+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company17_FLEX_acc+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_pla+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_act+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company18_FLEX_acc+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_pla+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_act+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company19_FLEX_acc+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_pla+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_pla"}); + ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_act+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_act"}); + ContainerManager.getInstance().instantiateAgent("TU_Company20_FLEX_acc+"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX_acc"}); + ContainerManager.getInstance().instantiateAgent("TU_Company21_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company22_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company23_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company24_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company25_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company26_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company27_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"FLEX"}); + ContainerManager.getInstance().instantiateAgent("TU_Company28_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"ANN"}); + ContainerManager.getInstance().instantiateAgent("TU_Company29_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"ANN"}); + ContainerManager.getInstance().instantiateAgent("TU_Company30_FLEX"+i, "mas.JADE_VPP.TU_Agent", new String[]{"ANN"}); } */ diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/TU_Agent.java b/JADE_VPP/src/main/java/mas/JADE_VPP/TU_Agent.java new file mode 100644 index 0000000..8f8c891 --- /dev/null +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/TU_Agent.java @@ -0,0 +1,1720 @@ +package mas.JADE_VPP; + + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.TimeZone; +import java.util.Timer; +import java.util.TimerTask; + +import jade.content.ContentElement; +import jade.content.ContentElementList; +import jade.content.ContentManager; +import jade.content.Predicate; +import jade.content.lang.Codec; +import jade.content.lang.Codec.CodecException; +import jade.content.lang.sl.SLCodec; +import jade.content.onto.Ontology; +import jade.content.onto.OntologyException; +import jade.content.onto.basic.Action; + +import jade.core.AID; +import jade.core.Agent; +import jade.core.behaviours.Behaviour; +import jade.core.behaviours.CyclicBehaviour; +import jade.core.behaviours.OneShotBehaviour; +import jade.core.behaviours.ThreadedBehaviourFactory; + +import jade.domain.DFService; +import jade.domain.FIPAException; +import jade.domain.FIPAAgentManagement.DFAgentDescription; +import jade.domain.FIPAAgentManagement.ServiceDescription; + +import java.lang.Object; +import jade.lang.acl.ACLMessage; +import jade.lang.acl.MessageTemplate; +import mas.JADE_VPP.ontology.*; + +public class TU_Agent extends Agent { + private static final long serialVersionUID = 1L; + private ServiceDescription sd; + private Codec codec = new SLCodec(); + //private Codec codec2 = new LEAPCodec(); //required for data transfer via bytesequences (i.e. Scheduling Plans), can also be done with SL Codec + private Ontology ontology = VPP_DR_Ontology.getInstance(); + private ThreadedBehaviourFactory tbf = new ThreadedBehaviourFactory(); //tbf is needed for extra thread generation, which is needed to prevent a cpu usage of 100% + + //*********** Agent startup *********** + protected void setup(){ + ArrayList sdList = new ArrayList(); + //Setting Language and Ontology + //getContentManager().registerLanguage(codec2); + getContentManager().registerLanguage(codec); + getContentManager().registerOntology(ontology); + //****Getting Arguments from the Startup.class**** + Object[] args = getArguments(); + //the local name is user-set and given at the startup + String arguments = String.valueOf(args[0]); //get the arguments given from the Startup.java + arguments = arguments.replaceAll("\\s+",""); //remove all whitespaces + System.out.println("********* TU-Agent online: " + getAID().getName()+ " with Service Descriptions: " +String.valueOf(args[0])+ " *********"); + + if (args != null && args.length > 0) + { + List serviceDescriptionList = new ArrayList(); + serviceDescriptionList = Arrays.asList(arguments.split(",")); + for (int i = 0; i < serviceDescriptionList.size(); i++){ + sdList.add(serviceDescriptionList.get(i)); + } + //register / publishing own service + DFAgentDescription dfd = new DFAgentDescription(); + dfd.setName(getAID()); + dfd.addLanguages(codec.getName()); + //dfd.addLanguages(codec2.getName()); + dfd.addOntologies(ontology.getName()); + sd = new ServiceDescription(); + for(int i = 0; i switch to the next case + if(TuVariables.schedulingTrigger && (TuVariables.referenceID.equals(conversationID))){ + validOffer = true; + tuName = TuVariables.schedulingTUName; + TuVariables.schedulingTrigger = false; + step = 2; + }else if ((TuVariables.refuseSchedulingTrigger && (TuVariables.referenceID.equals(conversationID))) || dateNow.after(date)){ + validOffer = false; + TuVariables.refuseSchedulingTrigger = false; + step = 2; + } + + break; + case 2: + //******* sending an answer to the VPP according to the reaction of the ERP system ********** + try{ + if(validOffer) { + //Sending a Propose-Answer + ACLMessage reply = msg.createReply(); //create a new ACLMessage that is a reply to this message. In particular, it sets the following parameters of the new message: receiver, language, ontology, protocol, conversation-id, in-reply-to, reply-with + reply.setLanguage(codec.getName()); + reply.setPerformative(ACLMessage.PROPOSE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CFPSchedulingSequencePropose newSchedulingSequencePropose = new CFPSchedulingSequencePropose(); + newSchedulingSequencePropose.setSchedulingPlan(TuVariables.schedulingPlan); + newSchedulingSequencePropose.setAgentName(myAgent.getLocalName()); + newSchedulingSequencePropose.setTuName(tuName); + cel.add(newSchedulingSequencePropose); + cm.fillContent(reply, cel); + myAgent.send(reply); + } + if(!validOffer) { + //Sending a REFUSE-Answer + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.REFUSE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CFPSchedulingSequenceRefuse newSchedulingSequenceRefuse = new CFPSchedulingSequenceRefuse(); + newSchedulingSequenceRefuse.setAgentName(myAgent.getLocalName()); + newSchedulingSequenceRefuse.setTuName(tuName); + cel.add(newSchedulingSequenceRefuse); + cm.fillContent(reply, cel); + myAgent.send(reply); + step = 99; + } + } + catch (CodecException ce) { + ce.printStackTrace(); + } + catch (OntologyException oe) { + oe.printStackTrace(); + } + validOffer = false; + step = 3; + break; + //********** Receiving answers from VPP-Agent and informing the Planning-System ********** + case 3: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.or( + MessageTemplate.MatchPerformative(ACLMessage.ACCEPT_PROPOSAL), + MessageTemplate.MatchPerformative(ACLMessage.REJECT_PROPOSAL))))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.ACCEPT_PROPOSAL) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* ACCEPT Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + //***************** CFPSchedulingSequence Accept ******************* + if(_pc instanceof CFPSchedulingSequenceAccept){ + timeBegin = ((CFPSchedulingSequenceAccept) _pc).getSchedulingStart(); + timeEnd = ((CFPSchedulingSequenceAccept) _pc).getSchedulingEnd(); + //********** Inform the ERP-System about the results********** + //******* the sending the new SchedulingPlan to the Planning System ******** + putInstance = new ConsumingRest_TU(); + payload = new InterfacePayloadPlanning(timeBegin, timeEnd, conversationID); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SCHEDULINGACCEPTED, payload); + step = 4; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else if (msg.getPerformative() == ACLMessage.REJECT_PROPOSAL) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* REJECT Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + //***************** CFPSchedulingSequence Reject ******************* + if(_pc instanceof CFPSchedulingSequenceReject){ + //********** Inform the Planning-System about the results********** + //******* the sending the reject info to the Planning System ******** + putInstance = new ConsumingRest_TU(); + payload = new InterfacePayloadPlanning(conversationID); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SCHEDULINGREJECTED, payload); + step = 99; + } + }catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + }else { + block(); + } + break; + //********** Receiving Info from Planning-System about the results********** + case 4: + dateNow = new Date(); + if(TuVariables.schedulingInformTrigger && (TuVariables.referenceID.equals(conversationID))){ + TuVariables.schedulingInformTrigger = false; + validOffer = true; + tuName = TuVariables.schedulingTUName; + step = 5; + }else if ((TuVariables.schedulingFailureTrigger && (TuVariables.referenceID.equals(conversationID))) || dateNow.after(dateTimeBegin)){ + TuVariables.schedulingFailureTrigger = false; + validOffer = false; + tuName = TuVariables.schedulingTUName; + step = 5; + } + break; + //********** Confirm the VPP-Agent about the results from the ERP-System********** + case 5: + try{ + if(validOffer) { + //Sending a INFORM-Done-Answer + ACLMessage reply = msg.createReply(); //create a new ACLMessage that is a reply to this message. In particular, it sets the following parameters of the new message: receiver, language, ontology, protocol, conversation-id, in-reply-to, reply-with + reply.setLanguage(codec.getName()); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CFPSchedulingSequenceDone newSchedulingSequenceDone = new CFPSchedulingSequenceDone(); + newSchedulingSequenceDone.setAgentName(myAgent.getLocalName()); + newSchedulingSequenceDone.setTuName(tuName); + cel.add(newSchedulingSequenceDone); + cm.fillContent(reply, cel); + myAgent.send(reply); + step = 99; + } + else{ + //Sending a FAILURE-Answer + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.FAILURE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CFPSchedulingSequenceFailure newSchedulingSequenceFailure = new CFPSchedulingSequenceFailure(); + newSchedulingSequenceFailure.setAgentName(myAgent.getLocalName()); + newSchedulingSequenceFailure.setTuName(tuName); + cel.add(newSchedulingSequenceFailure); + cm.fillContent(reply, cel); + myAgent.send(reply); + step = 99; + } + } + catch (CodecException ce) { + ce.printStackTrace(); + } + catch (OntologyException oe) { + oe.printStackTrace(); + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + public boolean done(){ + return step == 100; + } + } + + //********************** 2. TU Control Sequence ********************** + private class ControlSequencePerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; //step counter for state machine + private boolean newSetpointVersion = false; + private ACLMessage msg; + private String tuName; + private byte[] newLoadProfile; + private int newSetpoint; + + private ControlSequencePerformer(ACLMessage _msg, String _tuName, int _newSetpoint) { + msg = _msg; + tuName = _tuName; + newSetpoint = _newSetpoint; + newSetpointVersion = true; + } + + private ControlSequencePerformer(ACLMessage _msg, String _tuName, byte[] _newLoadProfile) { + msg = _msg; + tuName = _tuName; + newLoadProfile = _newLoadProfile; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending newSetpoint to TU *******"); + } + + public void action(){ + switch(step){ + case 0: + //******* sending the new control information to the TU system ******* + if(newSetpointVersion) { + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + InterfacePayloadNewSetpoint payload = new InterfacePayloadNewSetpoint(newSetpoint, tuName); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SETPOINT, payload); + }else { + ConsumingRest_TU putInstanceOne = new ConsumingRest_TU(); + InterfacePayloadAgentReference payloadOne = new InterfacePayloadAgentReference(getAID().getLocalName(), tuName); + putInstanceOne.putNodeRed(Addresses.URL_NODERED, PutVariable.LOADPROFILEINFO, payloadOne); + ConsumingRest_TU putInstanceTwo = new ConsumingRest_TU(); + putInstanceTwo.putNodeRed(Addresses.URL_NODERED, PutVariable.LOADPROFILE, newLoadProfile); + } + step = 1; + break; + case 1: + if(TuVariables.requestDoneTrigger) { + TuVariables.requestDoneTrigger = false; + step = 99; + }else if(TuVariables.requestFailureTrigger) { + TuVariables.requestFailureTrigger = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Setting newSetpoint failed *******"); + tuName=TuVariables.tuName; + //Sending a FAILURE-Answer + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.FAILURE); + reply.setConversationId("tuControlSequenceFailed"); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + TUControlSequenceFailure newTUControlSequenceFailure = new TUControlSequenceFailure(); + newTUControlSequenceFailure.setTuName(tuName); + newTUControlSequenceFailure.setAgentName(getAID().getLocalName()); + //newTUControlSequenceFailure.setTuControlSequenceFailed("tuControlSequenceFailed"); + cel.add(newTUControlSequenceFailure); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException e) { + e.printStackTrace(); + } catch (OntologyException e) { + e.printStackTrace(); + } + step = 99; + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + + public boolean done(){ + return step == 100; + } + + } + + //********************** 3. TU Balancing Sequence ********************** + private class BalancingSequencePerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; + private int updateRate = 0; + private String balancingStart; + private String balancingEnd; + private String tuName = "noNameSet"; + private Date balancingStartDate; + private Date balancingEndDate; + private ACLMessage msg; + private Timer timer = new Timer(); //timer need to start the balancing updating process + + public BalancingSequencePerformer(ACLMessage _msg) { + msg = _msg; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* BalancingRequestBehaviour started ********"); + try { + ContentElement ce; + Action _ac; + ce = getContentManager().extractContent(msg); + _ac = (Action) ce; + BalancingSequenceSubscribe _bss = (BalancingSequenceSubscribe)_ac.getAction(); + balancingStart = _bss.getBalancingStart(); + balancingEnd = _bss.getBalancingEnd(); + tuName = _bss.getTuName(); + updateRate = _bss.getUpdateRate(); + } catch (CodecException | OntologyException e) { + step = 99; + e.printStackTrace(); + } + try { + //setting the expiration time for the request of the VPP + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN); + formatter.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); + //also setting the balancingEnd date for the proper was of ending this sequence + balancingEndDate = formatter.parse(balancingEnd); + balancingStartDate = formatter.parse(balancingStart); + } catch (ParseException e) { + step = 99; + e.printStackTrace(); + } + } + + public void action(){ + + + switch(step){ + case 0: + //******* sending the balancing request information to the TU system ******* + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + InterfacePayloadBalancing payload = new InterfacePayloadBalancing(balancingStart, balancingEnd, tuName); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.BALANCING, payload); + step = 1; + break; + case 1: + //getting the current expiration time and date so the TU can send a refuse message if the deadline is done + Date dateNow = new Date(); + if(TuVariables.balancingAgreeTrigger && tuName.equals(TuVariables.balancingTuName)) { + TuVariables.balancingAgreeTrigger = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Balancing Request accepted *******"); + //Sending an AGREE-Answer to the VPP + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.AGREE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + BalancingSequenceAgree newBalancingSequenceAgree = new BalancingSequenceAgree(); + newBalancingSequenceAgree.setTuName(TuVariables.balancingTuName); + newBalancingSequenceAgree.setAgentName(getAID().getLocalName()); + cel.add(newBalancingSequenceAgree); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + step = 99; + } + step = 2; + }else if(TuVariables.balancingRefuseTrigger && tuName.equals(TuVariables.balancingTuName) || dateNow.after(balancingEndDate)) { + TuVariables.balancingRefuseTrigger = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Balancing Request Failed *******"); + //Sending a REFUSE-Answer to the VPP + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.REFUSE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + BalancingSequenceRefuse newBalancingSequenceRefuse = new BalancingSequenceRefuse(); + newBalancingSequenceRefuse.setTuName(TuVariables.balancingTuName); + newBalancingSequenceRefuse.setAgentName(getAID().getLocalName()); + cel.add(newBalancingSequenceRefuse); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + step = 99; + } + break; + case 2: + Date dateNow2 = new Date(); + //start a separate performer that replies every n second to the VPP + if (dateNow2.after(balancingStartDate)){ + step = 3; + timer.schedule(new balancingUpdatePerformer(msg.shallowClone()), 0, updateRate); + } + break; + + case 3: + if(TuVariables.balancingInformTrigger && tuName.equals(TuVariables.balancingTuName)) { + TuVariables.balancingInformTrigger = false; + }else if(TuVariables.balancingInformInstantTrigger && tuName.equals(TuVariables.balancingTuName)) { + TuVariables.balancingInformInstantTrigger = false; + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + BalancingSequenceInform newBalancingSequenceInform = new BalancingSequenceInform(); + //giving the data to the newTUDataSet + TUDataSet newTUDataSet = new TUDataSet(TuVariables.feedIn, TuVariables.operatingPoint, + TuVariables.leadingOperatingPoint, TuVariables.currentValueFR, TuVariables.assignedPool, + TuVariables.status, TuVariables.frequency, TuVariables.aFRRsetpoint, TuVariables.aFRRsetpointEcho, + TuVariables.setpointFR, TuVariables.aFRRGradientPOS, TuVariables.aFRRGradientNEG, + TuVariables.capacityPOS, TuVariables.capacityNEG, TuVariables.holdingCapacityPOS, + TuVariables.holdingCapacityNEG, TuVariables.controlBandPOS, TuVariables.controlBandNEG); + newBalancingSequenceInform.setTUDataSet(newTUDataSet); + newBalancingSequenceInform.setTuName(TuVariables.balancingTuName); + newBalancingSequenceInform.setAgentName(getAID().getLocalName()); + cel.add(newBalancingSequenceInform); + cm.fillContent(reply, cel); + myAgent.send(reply); + System.out.println(getAgent().getAID().getLocalName()+"******* Spontaneous Inform sent *******"); + TuVariables.resetBalancing(); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + else if(TuVariables.balancingFailureTrigger && tuName.equals(TuVariables.balancingTuName)) { + TuVariables.balancingFailureTrigger = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Balancing Request Failed *******"); + //Sending a FAILURE-Answer + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.FAILURE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + BalancingSequenceFailure newBalancingSequenceFailure = new BalancingSequenceFailure(); + newBalancingSequenceFailure.setTuName(TuVariables.balancingTuName); + newBalancingSequenceFailure.setAgentName(getAID().getLocalName()); + cel.add(newBalancingSequenceFailure); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + step = 99; + } + //End the balancing after the balancing end Time + Date _dateNow = new Date(); + if (_dateNow.after(balancingEndDate)){ + step = 99; + } + break; + case 99: + TuVariables.resetScheduling(); + reset(); + timer.cancel(); //stopping the updating behaviour + step = 100; + break; + default: + step = 99; + } + } + public boolean done(){ + return step == 100; + } + + private class balancingUpdatePerformer extends TimerTask { + private ACLMessage msg; + + balancingUpdatePerformer(ACLMessage _msg){ + msg = _msg; + } + public void run() { + //Sending a INFORM-Answer + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + BalancingSequenceInform newBalancingSequenceInform = new BalancingSequenceInform(); + //giving the data to the newTUDataSet + if(tuName.equals(TuVariables.balancingTuName)) { + TUDataSet newTUDataSet = new TUDataSet(TuVariables.feedIn, TuVariables.operatingPoint, + TuVariables.leadingOperatingPoint, TuVariables.currentValueFR, TuVariables.assignedPool, + TuVariables.status, TuVariables.frequency, TuVariables.aFRRsetpoint, TuVariables.aFRRsetpointEcho, + TuVariables.setpointFR, TuVariables.aFRRGradientPOS, TuVariables.aFRRGradientNEG, + TuVariables.capacityPOS, TuVariables.capacityNEG, TuVariables.holdingCapacityPOS, + TuVariables.holdingCapacityNEG, TuVariables.controlBandPOS, TuVariables.controlBandNEG); + newBalancingSequenceInform.setTUDataSet(newTUDataSet); + newBalancingSequenceInform.setTuName(TuVariables.balancingTuName); + newBalancingSequenceInform.setAgentName(getAID().getLocalName()); + cel.add(newBalancingSequenceInform); + cm.fillContent(reply, cel); + myAgent.send(reply); + System.out.println(getAgent().getAID().getLocalName()+"******* Inform sent *******"); + TuVariables.resetBalancing(); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + } + } + + //********************** 4. Accounting Sequence ********************** + private class AccountingSequencePerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String agentName = "noNameSet"; + private String referenceID = "noIDSet"; + private String conversationID; + private byte[] energyConsumptionProfile; + private ArrayList vppAgents = new ArrayList(); + + AccountingSequencePerformer(byte[] _energyConsumptionProfile, String _tuName, String _referenceID){ + energyConsumptionProfile = _energyConsumptionProfile; + tuName = _tuName; + referenceID = _referenceID; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* AccountingSequenceBehaviour started ********"); + agentName = getAID().getLocalName(); + Date dateNow = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN); + formatter.format(dateNow); + conversationID = "accountingInform"; + } + + public void action(){ + switch(step){ + // sending the energy consumption profile to the VPP + case 0: + System.out.println(this.getAgent().getAID().getLocalName()+"******* AccountingSequencePerformer started ********"); + //searching for the complete AID of the referenced agent + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setType("VPP"); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + for(int j = 0; j < result.length; j++){ + vppAgents.add(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(vppAgents.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + case 1: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out INFORM (energy consumption profiles) to VPP *******"); + ACLMessage msg = new ACLMessage(ACLMessage.INFORM); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < vppAgents.size(); j++){ + receiver = vppAgents.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + AccountingSequenceInform newAccountingSequenceInform = new AccountingSequenceInform(); + newAccountingSequenceInform.setAgentName(agentName); + newAccountingSequenceInform.setTuName(tuName); + newAccountingSequenceInform.setEnergyConsumptionProfile(energyConsumptionProfile); + cel.add(newAccountingSequenceInform); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID), + MessageTemplate.MatchLanguage(codec.getName()))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof AccountingSequenceInformReceived){ + //********** Inform the EMS-System about the results********** + AccountingSequenceInformReceived _asir = (AccountingSequenceInformReceived)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(referenceID, getAID().getLocalName(),_asir.getTuName() ); + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.ACCOUNTINGECPRECEIVED, payload); + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else if(msg.getPerformative() == ACLMessage.FAILURE) { + step = 99; + }else { + step = 99; + } + }else { + block(); + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + public boolean done(){ + return step == 100; + } + } + + //********************** 5.LoadTimeWindows Request Sequence ********************** + private class LoadTimeWindowsRequestPerformer extends OneShotBehaviour{ + private static final long serialVersionUID = 1L; + private String loadTimeWindowsReference; + + LoadTimeWindowsRequestPerformer( String _loadTimeWindowsReference){ + loadTimeWindowsReference = _loadTimeWindowsReference; + } + + public void action() { + ArrayList vppAgents = new ArrayList(); + System.out.println(this.getAgent().getAID().getLocalName()+"******* loadTimeWindowsSequence started ********"); + //searching for the complete AID of the referenced agent + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setType("VPP"); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + for(int j = 0; j < result.length; j++){ + vppAgents.add(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(vppAgents.size()>0) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out Request (load time windows) to VPP *******"); + ACLMessage msg = new ACLMessage(ACLMessage.REQUEST); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId("loadTimeWindows"); + AID receiver = new AID(); + for(int j = 0; j < vppAgents.size(); j++){ + receiver = vppAgents.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + LoadTimeWindowsShareRequest newLoadTimeWindowsShareRequest = new LoadTimeWindowsShareRequest(); + newLoadTimeWindowsShareRequest.setLoadTimeWindowsReference(loadTimeWindowsReference); + Action act = new Action(); + act.setAction(newLoadTimeWindowsShareRequest); + act.setActor(new AID("*", AID.ISGUID)); + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + } + }else { + System.out.println("No VPP Agent can be found"); + } + } + } + + //********************** 6.A Frequency Relay Enable Sequence ********************** + private class FREnablePerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; //step counter for state machine + private ACLMessage msg; + private String tuName = "NoNameSet"; + + private FREnablePerformer(ACLMessage _msg, String _tuName) { + msg = _msg; + tuName = _tuName; + } + + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending Enable Frequency Relay to TU *******"); + } + + public void action(){ + + switch(step){ + case 0: + //******* sending the request to the TU system ******* + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(tuName); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.FRENABLEREQUEST, payload); + step = 1; + break; + case 1: + try { + if(TuVariables.freqRelayEnableInformTrigger) { + TuVariables.freqRelayEnableInformTrigger = false; + tuName=TuVariables.freqRelayEnableTUName; + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + FreqRelayEnableInform newFreqRelayEnableInform = new FreqRelayEnableInform(); + newFreqRelayEnableInform.setTuName(tuName); + newFreqRelayEnableInform.setAgentName(getAID().getLocalName()); + cel.add(newFreqRelayEnableInform); + cm.fillContent(reply, cel); + myAgent.send(reply); + step = 99; + }else if(TuVariables.freqRelayEnableFailureTrigger) { + TuVariables.freqRelayEnableFailureTrigger = false; + tuName=TuVariables.freqRelayEnableTUName; + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.FAILURE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + FreqRelayEnableFailure newFreqRelayEnableFailure = new FreqRelayEnableFailure(); + newFreqRelayEnableFailure.setTuName(tuName); + newFreqRelayEnableFailure.setAgentName(getAID().getLocalName()); + cel.add(newFreqRelayEnableFailure); + cm.fillContent(reply, cel); + myAgent.send(reply); + step = 99; + } + } + catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + public boolean done(){ + return step == 100; + } + } + + //********************** 6.B Frequency Relay Block Sequence ********************** + private class FRBlockPerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; + private ACLMessage msg; + private String tuName = "NoNameSet"; + + + private FRBlockPerformer(ACLMessage _msg, String _tuName) { + msg = _msg; + tuName = _tuName; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending Block Frequency Relay to TU *******"); + } + + public void action(){ + switch(step){ + case 0: + //******* sending the request to the TU system ******* + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(tuName); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.FRBLOCKREQUEST, payload); + step = 1; + break; + case 1: + try { + if(TuVariables.freqRelayDisableInformTrigger) { + TuVariables.freqRelayDisableInformTrigger = false; + tuName=TuVariables.freqRelayDisableTUName; + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + FreqRelayBlockInform newFreqRelayBlockInform = new FreqRelayBlockInform(); + newFreqRelayBlockInform.setTuName(tuName); + newFreqRelayBlockInform.setAgentName(getAID().getLocalName()); + cel.add(newFreqRelayBlockInform); + cm.fillContent(reply, cel); + myAgent.send(reply); + step = 99; + }else if(TuVariables.freqRelayDisableFailureTrigger) { + TuVariables.freqRelayDisableFailureTrigger = false; + tuName=TuVariables.freqRelayDisableTUName; + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.FAILURE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + FreqRelayBlockFailure newFreqRelayBlockFailure = new FreqRelayBlockFailure(); + newFreqRelayBlockFailure.setTuName(tuName); + newFreqRelayBlockFailure.setAgentName(getAID().getLocalName()); + cel.add(newFreqRelayBlockFailure); + cm.fillContent(reply, cel); + myAgent.send(reply); + step = 99; + } + } + catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + public boolean done(){ + return step == 100; + } + } + + //********************** 6.C Frequency Relay Triggered Sequence ********************** + private class FRTriggeredPerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String agentName = "noNameSet"; + private String conversationID = "frequencyRelayTriggered"; + private ArrayList vppAgents = new ArrayList(); + + FRTriggeredPerformer(String _tuName){ + tuName = _tuName; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* Frequency Relay Triggered Behaviour started ********"); + agentName = getAID().getLocalName(); + } + + public void action(){ + switch(step){ + case 0: + //searching for the complete AID of the referenced agent + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setType("VPP"); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + for(int j = 0; j < result.length; j++){ + vppAgents.add(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(vppAgents.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + case 1: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out INFORM (Frequency Relay Triggered) to VPP *******"); + ACLMessage msg = new ACLMessage(ACLMessage.INFORM); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < vppAgents.size(); j++){ + receiver = vppAgents.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + FreqRelayStatusInform newFreqRelayStatusInform = new FreqRelayStatusInform(); + newFreqRelayStatusInform.setAgentName(agentName); + newFreqRelayStatusInform.setTuName(tuName); + cel.add(newFreqRelayStatusInform); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID), + MessageTemplate.MatchLanguage(codec.getName()))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof FreqRelayStatusConfirm){ + //********** Inform the EMS-System about the results********** + FreqRelayStatusConfirm _frsc = (FreqRelayStatusConfirm)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_frsc.getTuName()); + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.FRCONFIRM, payload); + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else { + step = 99; + } + }else { + block(); + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + public boolean done(){ + return step == 100; + } + } + + //********************** 7.A Send CancelOperation Sequence ********************** + private class SendCancelOperationPerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String agentName = "noNameSet"; + private String operationReference = "noIDSet"; + private String conversationID; + private ArrayList vppAgents = new ArrayList(); + + SendCancelOperationPerformer(String _tuName, String _operationReference){ + tuName = _tuName; + operationReference = _operationReference; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* OperationCancelBehaviour started ********"); + agentName = getAID().getLocalName(); + conversationID = "cancelOperation"; + } + + public void action(){ + switch(step){ + case 0: + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setType("VPP"); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + for(int j = 0; j < result.length; j++){ + vppAgents.add(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(vppAgents.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + case 1: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out CANCEL (cancel operation) to VPP *******"); + + ACLMessage msg = new ACLMessage(ACLMessage.CANCEL); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < vppAgents.size(); j++){ + receiver = vppAgents.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CancelOperationCancel newCancelOperationInform = new CancelOperationCancel(); + newCancelOperationInform.setAgentName(agentName); + newCancelOperationInform.setTuName(tuName); + newCancelOperationInform.setOperationReference(operationReference); + cel.add(newCancelOperationInform); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID), + MessageTemplate.MatchLanguage(codec.getName()))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof CancelOperationConfirm){ + //********** Inform the Planning-System about the results********** + CancelOperationConfirm _asir = (CancelOperationConfirm)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_asir.getOperationReference(), getAID().getLocalName(),_asir.getTuName() ); + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.CANCELOPERATIONCONFIRM, payload); + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else if(msg.getPerformative() == ACLMessage.FAILURE) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* FAILURE Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof CancelOperationFailure){ + //********** Inform the Planning-System about the results********** + CancelOperationFailure _asir = (CancelOperationFailure)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_asir.getOperationReference(), getAID().getLocalName(),_asir.getTuName() ); + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.CANCELOPERATIONFAILED, payload); + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else { + step = 99; + } + }else { + block(); + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + public boolean done(){ + return step == 100; + } + + } + + //********************** 7.B Receive CancelOperation Sequence ********************** + private class ReceiveCancelOperationPerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String agentName = "noNameSet"; + private String operationReference = "noReferenceSet"; + private ACLMessage msg; + + ReceiveCancelOperationPerformer(ACLMessage _msg) { + msg = _msg; + } + + public void onStart(){ + try { + ContentElement ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + CancelOperationCancel _coi = (CancelOperationCancel)_pc; + tuName = _coi.getTuName(); + agentName = _coi.getAgentName(); + operationReference = _coi.getOperationReference(); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + + public void action() { + switch (step) { + case 0: + ConsumingRest_TU putInstance = new ConsumingRest_TU(); + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(operationReference, agentName,tuName); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.CANCELOPERATION, payload); + step = 1; + break; + case 1: + if(TuVariables.receiveCancelOperationTrigger && operationReference.equals(TuVariables.receiveCancelOperationReference)) { + TuVariables.receiveCancelOperationTrigger = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new INFORM to TU: " + tuName +" *******"); + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CancelOperationConfirm newCancelOperationInformReceived = new CancelOperationConfirm(); + newCancelOperationInformReceived.setTuName(tuName); + newCancelOperationInformReceived.setOperationReference(operationReference); + cel.add(newCancelOperationInformReceived); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + step = 99; + }else if(TuVariables.receiveCancelOperationTriggerFail && operationReference.equals(TuVariables.receiveCancelOperationReference)) { + TuVariables.receiveCancelOperationTriggerFail = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new INFORM to TU: " + tuName +" *******"); + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.FAILURE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CancelOperationFailure newCancelOperationInformReceived = new CancelOperationFailure(); + newCancelOperationInformReceived.setTuName(tuName); + newCancelOperationInformReceived.setOperationReference(operationReference); + cel.add(newCancelOperationInformReceived); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + step = 99; + } + break; + case 99: //final case, here reset() must be called. A reset() in done() would result in a reset() call every cycle, because done() gets called every cycle + reset(); //any Behaviour object that has been executed once, must be reset by calling its reset() method before it can be executed again. + step = 100; + break; + default: + step = 99; + } + } + + public boolean done() { + return step == 100; + } + } + + //********************** 8.A RequestInfos Sequence ********************** + private class RequestInfoPerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "VPPAgent"; + private String conversationID; + private byte[] infoSet; + private ArrayList vppAgents = new ArrayList(); + private Date expireDate; + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* RequestInfosBehaviour started ********"); + Date dateStart = new Date(); + long t; + t = dateStart.getTime(); + expireDate=new Date(t + (5 * 60000)); //5min added + conversationID = "requestInfoOperation"; + } + + public void action(){ + switch(step){ + case 0: + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setType("VPP"); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + for(int j = 0; j < result.length; j++){ + vppAgents.add(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(vppAgents.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + case 1: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out REQUEST (Request Infos) to VPP *******"); + + ACLMessage msg = new ACLMessage(ACLMessage.REQUEST); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < vppAgents.size(); j++){ + receiver = vppAgents.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + RequestInfoRequest newRequestInfoRequest = new RequestInfoRequest(); + newRequestInfoRequest.setTuName(tuName); + newRequestInfoRequest.setTuName(getAID().getLocalName()); + Action act = new Action(); + act.setAction(newRequestInfoRequest); //Adding the Action the Agent has to perform + act.setActor(new AID("*", AID.ISGUID)); //Adding an dummy Agent, because the actor field is mandatory (source: http://jade.tilab.com/pipermail/jade-develop/2010q4/016200.html) + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID), + MessageTemplate.MatchLanguage(codec.getName()))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof RequestInfoInform){ + //********** Inform the VPP-System about the results********** + RequestInfoInform _rii = (RequestInfoInform)_pc; + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + infoSet = _rii.getInfoSet(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.REQUESTINFOINFORM, infoSet); + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else if(msg.getPerformative() == ACLMessage.FAILURE) { + step = 99; + }else{ + step = 99; + } + }else { + Date dateNow = new Date(); + if(dateNow.after(expireDate)) { + step = 99; + } + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + public boolean done() { + return step == 100; + } + } + + //********************** 8.B RequestInfosResponse Sequence ********************** + private class RequestInfoResponsePerformer extends OneShotBehaviour{ + private static final long serialVersionUID = 1L; + private String tuName = "noNameSet"; + private byte[] infoSet; + private ACLMessage msg; + + RequestInfoResponsePerformer(ACLMessage _msg) { + msg = _msg; + } + + public void onStart(){ + try { + ContentElement ce = getContentManager().extractContent(msg); + Action _ac = (Action) ce; + if(_ac.getAction() instanceof RequestInfoRequest){ + RequestInfoRequest _rir = (RequestInfoRequest)_ac.getAction(); + tuName = _rir.getTuName(); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + + public void action() { + ConsumingRest_TU getInstance = new ConsumingRest_TU(); + infoSet = getInstance.getNodeRed(Addresses.URL_NODERED, PutVariable.REQUESTINFO); + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new RequestInfo *******"); + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + RequestInfoInform newRequestInfoInform = new RequestInfoInform(); + newRequestInfoInform.setTuName(tuName); + newRequestInfoInform.setAgentName(getAID().getLocalName()); + newRequestInfoInform.setInfoSet(infoSet); + cel.add(newRequestInfoInform); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + + } + +} + + \ No newline at end of file diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/TuVariables.java b/JADE_VPP/src/main/java/mas/JADE_VPP/TuVariables.java index 100b8e2..24a2a8f 100644 --- a/JADE_VPP/src/main/java/mas/JADE_VPP/TuVariables.java +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/TuVariables.java @@ -28,6 +28,7 @@ public class TuVariables { public static boolean balancingRefuseTrigger = false; public static boolean balancingAgreeTrigger = false; public static boolean balancingInformTrigger = false; + public static boolean balancingInformInstantTrigger = false; public static boolean balancingFailureTrigger = false; public static String balancingTuName = "noName"; public static int feedIn; //Einspeisung diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/VPP_Agent.java b/JADE_VPP/src/main/java/mas/JADE_VPP/VPP_Agent.java new file mode 100644 index 0000000..ae646fb --- /dev/null +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/VPP_Agent.java @@ -0,0 +1,2087 @@ +package mas.JADE_VPP; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; +import java.util.TreeMap; +import jade.content.ContentElement; +import jade.content.ContentElementList; +import jade.content.ContentManager; +import jade.content.Predicate; +import jade.content.lang.Codec; +import jade.content.lang.Codec.CodecException; +import jade.content.lang.sl.SLCodec; +import jade.content.onto.Ontology; +import jade.content.onto.OntologyException; +import jade.content.onto.basic.Action; +import jade.core.AID; +import jade.core.Agent; +import jade.core.behaviours.Behaviour; +import jade.core.behaviours.CyclicBehaviour; +import jade.core.behaviours.OneShotBehaviour; +import jade.core.behaviours.ThreadedBehaviourFactory; +import jade.domain.DFService; +import jade.domain.FIPAException; +import jade.domain.FIPAAgentManagement.DFAgentDescription; +import jade.domain.FIPAAgentManagement.ServiceDescription; +import jade.domain.introspection.BornAgent; +import jade.domain.introspection.DeadAgent; +import jade.domain.introspection.Event; +import jade.domain.introspection.IntrospectionVocabulary; +import jade.domain.introspection.AMSSubscriber; +import jade.lang.acl.ACLMessage; +import jade.lang.acl.MessageTemplate; +import mas.JADE_VPP.ontology.*; + +public class VPP_Agent extends Agent{ + private static final long serialVersionUID = 1L; + private static long idCounter = 0; //ID Counter for the messages (64 bit from: -9 223 372 036 854 775 808 to: +9 223 372 036 854 775 807) + private ServiceDescription sd; + private Codec codec = new SLCodec(); + private Ontology ontology = VPP_DR_Ontology.getInstance(); + private HashMap idPairsScheduling = new HashMap(); + private HashMap idPairsBalancing = new HashMap(); + private ThreadedBehaviourFactory tbf = new ThreadedBehaviourFactory(); //tbf is needed for extra thread generation, which is needed to prevent a cpu usage of 100% + + //*********** Agent startup *********** + protected void setup() { + //Printout a Welcome Message + System.out.println("********* VPP-Agent online: " + getAID().getLocalName()+ " *********"); + //register agent with its content manager to be able to use the ontology and content language + getContentManager().registerLanguage(codec); + getContentManager().registerOntology(ontology); + //setting up and register / publish own service + DFAgentDescription dfd = new DFAgentDescription(); + dfd.setName(getAID()); + dfd.addLanguages(codec.getName()); + dfd.addOntologies(ontology.getName()); + sd = new ServiceDescription(); + sd.setName(getAID().getLocalName()); + sd.setType("VPP"); + dfd.addServices(sd); + try{ + DFService.register(this, dfd); + } + catch(FIPAException fe){ + fe.printStackTrace(); + } + //receiving arguments from the Startup.java +// Object[] args = getArguments(); +// if (args != null && args.length > 0){ +// int randomNum = ThreadLocalRandom.current().nextInt(0, 13 + 1); +// requestedEnergy = (Integer) args[randomNum]; +// System.out.println("Requested Energy is "+requestedEnergy); +// } +// else{ +// System.out.println("VPP Agent shutting down"); +// doDelete(); +// } + + //start the agent behaviours + addBehaviour(new VPPManager()); + addBehaviour(tbf.wrap(new VPPInputListener())); //tbf.wrap starts an extra task for the behaviour added (so this task can go into wait later on) + //subscribe to AMS Platform Events + addBehaviour(new myAMSSubscriber()); + + } + + //*********** Agent shutdown *********** + protected void takdeDown(){ + System.out.println("VPP Agent " +getAID().getName() +"terminating."); + tbf.interrupt(); + try { + DFService.deregister(this); + } + catch (FIPAException fe) { + fe.printStackTrace(); + } + } + + //********************** 0. AMS Subscriber ********************** + //informs the VPP about new agents and agents that are leaving the platform + private class myAMSSubscriber extends AMSSubscriber{ + private static final long serialVersionUID = 1L; + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected void installHandlers(Map handlers) { + //creating event handler for born agents + EventHandler creationsHandler = new EventHandler() { + private static final long serialVersionUID = 1L; + public void handle(Event ev) { + BornAgent ba = (BornAgent) ev; + System.out.println("Born agent "+ba.getAgent().getName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.AGENTBORN,ba.getAgent().getName()); + } + }; + handlers.put(IntrospectionVocabulary.BORNAGENT, creationsHandler); + //creating event handler for dead agents + EventHandler terminationsHandler = new EventHandler() { + private static final long serialVersionUID = 1L; + public void handle(Event ev) { + DeadAgent da = (DeadAgent) ev; + System.out.println("Dead agent "+da.getAgent().getName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.AGENTDEAD,da.getAgent().getName()); + } + }; + handlers.put(IntrospectionVocabulary.DEADAGENT, terminationsHandler); + } + } + + //********************** 0. VPP Manager (Main behaviour) ********************** + //Manages incoming agent messages + private class VPPManager extends CyclicBehaviour{ + private static final long serialVersionUID = 1L; + public void action(){ + //******************* Collecting Messages from other Agents ************ + //******** Handling unknown messages: **************** + MessageTemplate mt = MessageTemplate.not(MessageTemplate.or(MessageTemplate.MatchOntology(ontology.getName()), + MessageTemplate.MatchOntology("JADE-Introspection"))); //filter for messages that dont use the VPP_DR_Ontology + ACLMessage msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ //if a proper message can be found + //********** every Message that does not use the VPP_DR_Ontology can not be understood ******** + System.out.println(this.getAgent().getAID().getLocalName()+"******* Message Received that cannot be understood *******"); + System.out.println(msg.getConversationId()); + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.NOT_UNDERSTOOD); + myAgent.send(reply); + } + //******** Handling messages of the TU control sequence ************ + mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId("tuControlSequenceFailed"),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()), MessageTemplate.MatchPerformative(ACLMessage.FAILURE)))); + msg = receive(mt); + if (msg != null){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* FAILURE Message Received *******"); + try { + ContentElement ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof TUControlSequenceFailure){ + TUControlSequenceFailure _csf = (TUControlSequenceFailure)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_csf.getAgentName(),_csf.getTuName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.CONTROLFAILURE, payload); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + //******** Handling messages of the Accounting sequence ************ + mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId("accountingInform"), + MessageTemplate.MatchPerformative(ACLMessage.INFORM)))); + msg = receive(mt); + if (msg != null){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* Accounting Sequence: INFORM Message Received *******"); + try { + ContentElement ce; + Predicate _pc; + ce = getContentManager().extractContent(msg); + _pc = (Predicate) ce; + if(_pc instanceof AccountingSequenceInform){ + addBehaviour(new AccountingSequencePerformer(msg.shallowClone())); + } + + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + //******** Handling messages of the loadTimeWindows Sharing ************ + mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId("loadTimeWindows"), + MessageTemplate.MatchPerformative(ACLMessage.REQUEST)))); + msg = receive(mt); + if (msg != null){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* LoadTimeWindows Sharing: REQUEST Message Received *******"); + try { + ContentElement ce = getContentManager().extractContent(msg); + Action _ac = (Action) ce; + if(_ac.getAction() instanceof LoadTimeWindowsShareRequest){ + addBehaviour(new LoadTimeWindowsRequestPerformer(msg.shallowClone())); + } + }catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + //******** Handling messages of the RequestInfo Requests ************ + mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId("requestInfoOperation"), + MessageTemplate.MatchPerformative(ACLMessage.REQUEST)))); + msg = receive(mt); + if (msg != null){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* RequestInfo Request : REQUEST Message Received *******"); + try { + ContentElement ce = getContentManager().extractContent(msg); + Action _ac = (Action) ce; + if(_ac.getAction() instanceof RequestInfoRequest){ + addBehaviour(new RequestInfoResponsePerformer(msg.shallowClone())); + } + }catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + //******** Handling messages of the Frequency Relay Status sequence ************ + mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId("frequencyRelayTriggered"), + MessageTemplate.MatchPerformative(ACLMessage.INFORM)))); + msg = receive(mt); + if (msg != null){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* Frequency Relay Status: INFORM Message Received *******"); + try { + ContentElement ce; + Predicate _pc; + ce = getContentManager().extractContent(msg); + _pc = (Predicate) ce; + if(_pc instanceof FreqRelayStatusInform){ + FreqRelayStatusInform _frsi = (FreqRelayStatusInform)_pc; + addBehaviour(new FRStatusPerformer(msg.shallowClone(),_frsi.getTuName(), _frsi.getAgentName())); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + //******** Handling messages of the CancelOperation sequence ************ + mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId("cancelOperation"), + MessageTemplate.MatchPerformative(ACLMessage.CANCEL)))); + msg = receive(mt); + if (msg != null){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* Cancel-Operation Sequence: CANCEL Message Received *******"); + try { + ContentElement ce; + Predicate _pc; + ce = getContentManager().extractContent(msg); + _pc = (Predicate) ce; + if(_pc instanceof CancelOperationCancel){ + addBehaviour(new ReceiveCancelOperationPerformer(msg.shallowClone())); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else { + //******** going into Block (suspends the behaviour till a new message appears) for every other type of message ************ + block(); + } + } + } + + //********************** 0. VPP Input Listener ********************** + //Manages incoming Webservice requests from the ProducingRest_VPP class + private class VPPInputListener extends CyclicBehaviour{ + //this input listener is called as an threaded behaviour so the extra thread can go into wait and resume if the rest ws notifies via the LOCK + //it processes the Node-RED inputs and this threaded approach is needed to prevent an increased CPU usage + private static final long serialVersionUID = 1L; + + public void action() { + synchronized(VppVariables.LOCK){ + try { + VppVariables.LOCK.wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + //******************* Starting the Scheduling Sequence (generic behaviour) *************** + if (VppVariables.schedulingRequestTrigger == true) { + VppVariables.schedulingRequestTrigger = false; + myAgent.addBehaviour(new SchedulingSequencePerformer(VppVariables.schedulingStart,VppVariables.schedulingEnd, + VppVariables.expiration, VppVariables.referenceID, VppVariables.serviceDescriptions)); + VppVariables.resetScheduling(); + } + + //******************* Starting the TU Control Sequence (one shot behaviour) *************** + if (VppVariables.newSetpointTrigger) { + VppVariables.newSetpointTrigger = false; + myAgent.addBehaviour(new ControlSequencePerformer(VppVariables.newSetpoint,VppVariables.tuName)); + VppVariables.resetNewSetpoint(); + } + + if (VppVariables.newLoadProfileTriggerUpdated) { + VppVariables.newLoadProfileTriggerUpdated = false; + myAgent.addBehaviour(new ControlSequencePerformer(VppVariables.newLoadProfile,VppVariables.tuName)); + VppVariables.resetNewLoadProfile(); + } + + //******************* Starting Balancing Sequence (generic behaviour) *************** + if (VppVariables.balancingTrigger) { + VppVariables.balancingTrigger = false; + myAgent.addBehaviour(new BalancingSequencePerformer(VppVariables.balancingStart,VppVariables.balancingEnd, + VppVariables.balancingTUName, VppVariables.balancingUpdateRate, VppVariables.balancingReferenceID)); + VppVariables.resetBalancing(); + } + + //******************* Starting loadTimeWindowsBroadcast Sequence (one shot behaviour) *************** + if (VppVariables.loadTimeWindowsBroadcastTrigger) { + VppVariables.loadTimeWindowsBroadcastTrigger = false; + myAgent.addBehaviour(new LoadTimeWindowsBroadcastPerformer( + VppVariables.loadTimeWindowsReference,VppVariables.windowHighBegin, + VppVariables.windowHighEnd ,VppVariables.windowLowBegin ,VppVariables.windowLowEnd )); + VppVariables.resetloadTimeWindows(); + } + + //******************* Starting Frequency Relay Enable Sequence (generic behaviour) *************** + if (VppVariables.freqRelayEnableTrigger) { + VppVariables.freqRelayEnableTrigger = false; + myAgent.addBehaviour(new FREnablePerformer(VppVariables.freqRelayEnableTUName)); + VppVariables.resetfreqRelayEnable(); + } + + //******************* Starting Frequency Relay Block Sequence (generic behaviour) *************** + if (VppVariables.freqRelayDisableTrigger) { + VppVariables.freqRelayDisableTrigger = false; + myAgent.addBehaviour(new FRBlockPerformer(VppVariables.freqRelayDisableTUName)); + VppVariables.resetfreqRelayEnable(); + } + //******************* Starting the operationCancel Sequence (generic behaviour) *************** + if (VppVariables.sendCancelOperationTrigger) { + VppVariables.sendCancelOperationTrigger = false; + myAgent.addBehaviour(new SendCancelOperationPerformer(VppVariables.sendCancelOperationTuName, VppVariables.sendCancelOperationReference)); + } + //******************* Starting the RequestInfos Sequence (generic behaviour) *************** + if (VppVariables.requestInfosTrigger) { + VppVariables.requestInfosTrigger = false; + myAgent.addBehaviour(new RequestInfoPerformer(VppVariables.requestInfosTuName)); + } + } + } + } + + //********************** 1. Scheduling Sequence ********************** + private class SchedulingSequencePerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private int agentAmount = 0; + private int responseCounter = 0; + private int receivedMessages = 0; + private String schedulingStart; + private String schedulingEnd; + private String expiration; + private String referenceID; + private String conversationID = "empty"; + private Date date; //offer expiration date + private ArrayList loadAgentList = new ArrayList(); + private TreeMap agentIDOfferList = new TreeMap(); + private ArrayList sdList = new ArrayList (); + private ArrayList agentList = new ArrayList(); + + + //constructor that prepares the schedulingSequencePerformer + public SchedulingSequencePerformer(String _schedulingStart, String _schedulingEnd, + String _expiration, String _referenceID, String _serviceDescriptions) { + schedulingStart = _schedulingStart; + schedulingEnd = _schedulingEnd; + expiration = _expiration; + referenceID = _referenceID; + _serviceDescriptions = _serviceDescriptions.replaceAll("\\s+",""); //remove all whitespaces + List serviceDescriptionList = new ArrayList(); + serviceDescriptionList = Arrays.asList(_serviceDescriptions.split(",")); + for (int i = 0; i < serviceDescriptionList.size(); i++){ + sdList.add(serviceDescriptionList.get(i)); + } + } + + public void onStart(){ + idCounter++; + conversationID = ("scheduling-"+idCounter); + System.out.println(this.getAgent().getAID().getLocalName()+"******* SchedulingSequencePerformer started ********"); + //before executing the scheduling sequence, checking the if the service descriptions have been set, if not: abort + String empty = "empty"; + if(sdList.get(0).equals(empty)){ + System.out.println("********** No ServiceDescription set, abort SchedulingSequence. ************"); + step=99; + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN); + formatter.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); + try { + date = formatter.parse(expiration); + } catch (ParseException e) { + e.printStackTrace(); + } + } + + public void action(){ + switch(step){ + case 0: + //********** searching the DF for the suitable Agents ********** + //pairing the referenceID from the VPP to the conversationID given by the AgentSystem + idPairsScheduling.put(referenceID, conversationID); + //setting up the service description that will be searched + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; //contains the service description list that the schedulingSequence uses + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + DFAgentDescription sdSearchTemplate_pla = new DFAgentDescription() ; + sdSearchTemplate_pla.addLanguages(codec.getName()); + sdSearchTemplate_pla.addOntologies(ontology.getName()); + System.out.println(this.getAgent().getAID().getLocalName()+"******* Will search for: ********"); + for(int i = 0; i < sdList.size(); i++){ + ServiceDescription sd = new ServiceDescription(); + sd.setType(sdList.get(i)); + System.out.println("****** Service Description: "+sd.getType()+" ********"); + sdSearchTemplate.addServices(sd); + //adding the planning specific services (for the agents that exclusively plan) + ServiceDescription sd_pla = new ServiceDescription(); + sd_pla.setType(sdList.get(i)+"_pla"); + sdSearchTemplate_pla.addServices(sd_pla); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + System.out.println("******* Found the following load agents: ********"); + //loadAgent = new AID[result.length]; + for(int j = 0; j < result.length; j++){ + //loadAgent[j] = result[j].getName(); + loadAgentList.add(result[j].getName()); + System.out.println("******* "+result[j].getName()+" ********"); + } + //doing the same search but now with the planning specific services + DFAgentDescription[] result_pla = DFService.search(myAgent, sdSearchTemplate_pla); + for(int j = 0; j < result_pla.length; j++){ + loadAgentList.add(result_pla[j].getName()); + System.out.println("******* "+result_pla[j].getName()+" ********"); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + sdSearchTemplate_pla.clearAllServices(); + } + if(loadAgentList.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found with that service description"); + step = 99; + } + step = 1; + break; + case 1: + //********** sending out the CFP message to the agents that can provide the service + ACLMessage msg = new ACLMessage(ACLMessage.CFP); + agentAmount = loadAgentList.size(); + for(int i = 0; i < loadAgentList.size(); i++){ + msg.addReceiver(loadAgentList.get(i)); + } + loadAgentList.clear(); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + msg.setReplyByDate(date); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CFPSchedulingSequence newSchedulingSequence = new CFPSchedulingSequence(); + newSchedulingSequence.setTimeBegin(schedulingStart); + newSchedulingSequence.setTimeEnd(schedulingEnd); + Action act = new Action(); + act.setAction(newSchedulingSequence); //Adding the Action the Agent has to perform + act.setActor(new AID("*", AID.ISGUID)); //Adding an dummy Agent, because the actor field is mandatory (source: http://jade.tilab.com/pipermail/jade-develop/2010q4/016200.html) + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + } + catch (OntologyException oe){ + oe.printStackTrace(); + } + catch (CodecException ce){ + ce.printStackTrace(); + } + step = 2; + break; + case 2: + //************* collecting responses from the TUs **************** + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.or( + MessageTemplate.MatchPerformative(ACLMessage.PROPOSE), + MessageTemplate.MatchPerformative(ACLMessage.REFUSE))))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + receivedMessages++; + int substep = msg.getPerformative(); + ContentElement ce = null; + InterfacePayloadAgentReference payload; + switch(substep){ + case (ACLMessage.PROPOSE): + System.out.println(this.getAgent().getAID().getLocalName()+"******* PROPOSE Message Received from "+msg.getSender().getLocalName()+" *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof CFPSchedulingSequencePropose){ + CFPSchedulingSequencePropose _cfpp = (CFPSchedulingSequencePropose)_pc; + agentIDOfferList.put((msg.getSender().getLocalName()+", "+referenceID), msg.getSender()); + payload = new InterfacePayloadAgentReference(msg.getSender().getLocalName()+", "+referenceID,_cfpp.getAgentName(), _cfpp.getTuName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SCHEDULINGPLANINFOS, payload); + // Saving / sending the propose with the scheduling plan to the VPP + byte[] buffer; + buffer = _cfpp.getSchedulingPlan(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SCHEDULINGPLAN, buffer); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + step = 99; + } + break; + case (ACLMessage.REFUSE): + System.out.println(this.getAgent().getAID().getLocalName()+"******* REFUSE Message Received from "+msg.getSender().getLocalName()+" *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof CFPSchedulingSequenceRefuse){ + CFPSchedulingSequenceRefuse _cfpr = (CFPSchedulingSequenceRefuse)_pc; + payload = new InterfacePayloadAgentReference(msg.getSender().getLocalName()+", "+referenceID,_cfpr.getAgentName(), _cfpr.getTuName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SCHEDULINGREFUSE, payload); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + step = 99; + } + break; + default: + System.out.println(this.getAgent().getAID().getName()+"******* nothing *******"); + } + if(receivedMessages >= agentAmount ) { + step = 3; + receivedMessages = 0; + agentAmount = 0; + } + } else { + //checking if the expiration time for the offer transfer is over, then move to the next step + Date dateNow = new Date(); + long t= date.getTime(); + Date afterAddingOneMin=new Date(t + (1 * 60000)); + if(dateNow.after(afterAddingOneMin)) { + if(receivedMessages == 0) { + step = 99; + }else { + step = 3; + } + receivedMessages = 0; + agentAmount = 0; + } + block(); //behaviour is ‘blocked’ so that the agent no longer schedules it for execution. + } + break; + case 3: + //************* sending out new accept- and reject-proposals **************** + //************* accept-proposals ************** + boolean atLeastOneAccepted = false; + if(VppVariables.schedulingAcceptTrigger){ + VppVariables.schedulingAcceptTrigger = false; + atLeastOneAccepted = true; + //checking if the answer from the VPP is referencing to one of these conversations + if(agentIDOfferList.containsKey(VppVariables.schedulingPlanReference)) { + if(!agentList.contains(VppVariables.schedulingPlanReference)) { + responseCounter++; + agentList.add(VppVariables.schedulingPlanReference); + } + System.out.println(this.getAgent().getAID().getLocalName()+"******* "+VppVariables.schedulingPlanReference+" accepted *******"); + //*********** Sending accept-proposal to the corresponding agent *********** + msg = new ACLMessage(ACLMessage.ACCEPT_PROPOSAL); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + receiver = agentIDOfferList.get(VppVariables.schedulingPlanReference); + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CFPSchedulingSequenceAccept newSchedulingSequenceAccept = new CFPSchedulingSequenceAccept(); + newSchedulingSequenceAccept.setSchedulingStart(VppVariables.schedulingStart); + newSchedulingSequenceAccept.setSchedulingEnd(VppVariables.schedulingEnd); + cel.add(newSchedulingSequenceAccept); + cm.fillContent(msg, cel); + myAgent.send(msg); + agentAmount++; //increase the agent amount counter to wait for the correct amount of agents that responds later + msg.reset(); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + }//************* reject-proposals ************** + else if (VppVariables.schedulingRejectTrigger) { + VppVariables.schedulingRejectTrigger = false; + if(agentIDOfferList.containsKey(VppVariables.schedulingPlanReference)) { + if(!agentList.contains(VppVariables.schedulingPlanReference)) { + responseCounter++; + agentList.add(VppVariables.schedulingPlanReference); + } + System.out.println(this.getAgent().getAID().getLocalName()+"******* "+VppVariables.schedulingPlanReference+" rejected *******"); + //*********** Sending reject-proposal to the corresponding agent *********** + msg = new ACLMessage(ACLMessage.REJECT_PROPOSAL); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + receiver = agentIDOfferList.get(VppVariables.schedulingPlanReference); + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CFPSchedulingSequenceReject newSchedulingSequenceReject = new CFPSchedulingSequenceReject(); + cel.add(newSchedulingSequenceReject); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + } + //if all answers have been sent, change to the next state + if((responseCounter >= agentIDOfferList.size())) { + if(!atLeastOneAccepted) { //if no agent has been accepted, end the behaviour + step = 99; + }else { + step = 4; + } + } + break; + case 4: + //************* collecting responses from the TUs **************** + mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()), MessageTemplate.or( + MessageTemplate.MatchPerformative(ACLMessage.INFORM), + MessageTemplate.MatchPerformative(ACLMessage.FAILURE))))); + + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + int substep = msg.getPerformative(); + ContentElement ce = null; + InterfacePayloadAgentReference payload; + switch(substep){ + case (ACLMessage.INFORM): + receivedMessages++; + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message received from: "+msg.getSender().getLocalName()+ " *******"); + try { + //msg.getConversationId(); + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof CFPSchedulingSequenceDone){ + CFPSchedulingSequenceDone _cfpd = (CFPSchedulingSequenceDone)_pc; + payload = new InterfacePayloadAgentReference(msg.getSender().getLocalName()+", "+referenceID,_cfpd.getAgentName(), _cfpd.getTuName()); + //********** Inform the VPP-System about the results********** + //******* sending the INFROM info to the VPP ******** + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SCHEDULINGDONE, payload); + }else { + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + step = 99; + } + break; + case (ACLMessage.FAILURE): + receivedMessages++; + System.out.println(this.getAgent().getAID().getLocalName()+"******* FAILURE Message received from: "+msg.getSender().getLocalName()+ " *******"); + try { + //msg.getConversationId(); + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof CFPSchedulingSequenceFailure){ + CFPSchedulingSequenceFailure _cfpf = (CFPSchedulingSequenceFailure)_pc; + //********** Inform the VPP-System about the results********** + //******* sending the FAILURE info to the VPP ******** + payload = new InterfacePayloadAgentReference(msg.getSender().getLocalName()+", "+referenceID,_cfpf.getAgentName(), _cfpf.getTuName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.SCHEDULINGFAILURE, payload); + }else { + step = 99; + } + }catch (CodecException | OntologyException e) { + e.printStackTrace(); + step = 99; + } + break; + default: + System.out.println(this.getAgent().getAID().getLocalName()+"******* nothing *******"); + } + }else { + block(); + } + if(receivedMessages >= agentAmount) { + step = 99; + } + break; + case 99: //final case, here reset() must be called. A reset() in done() would result in a reset() call every cycle, because done() gets called every cycle + reset(); //any Behaviour object that has been executed once, must be reset by calling its reset() method before it can be executed again. + step = 100; + break; + default: + step = 99; + } + } + + public boolean done() { + return step == 100; //the agent behaviour action stops if step == 10 + } + } + + //********************** 2. TU Control Sequence ********************** + private class ControlSequencePerformer extends OneShotBehaviour{ + private static final long serialVersionUID = 1L; + private boolean newSetpointVersion = false; + private int newSetpoint = 0; + private String tuName = "noNameSet"; + private String conversationID = "noID"; + private ArrayList agentIdentifiers = new ArrayList(); + private byte[] newLoadProfile; + + public ControlSequencePerformer(int _newSetpoint, String _tuName) { + tuName = _tuName; + newSetpoint = _newSetpoint; + newSetpointVersion = true; + } + + public ControlSequencePerformer(byte[] _newLoadProfile, String _tuName) { + tuName = _tuName; + newLoadProfile = _newLoadProfile; + } + + public void onStart(){ + idCounter++; + conversationID = ("loadControl-"+idCounter); + System.out.println(this.getAgent().getAID().getLocalName()+"******* TUControlSequencePerformer started ********"); + } + + public void action() { + //********** searching the DF for the Agent ********** + //searching for the complete AID of the referenced agent + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + System.out.println("Tu Control Performer started, will search for "+tuName); + ServiceDescription sd = new ServiceDescription(); + sd.setName(tuName); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + System.out.println("Found the following load agents: "); + //loadAgent = new AID[result.length]; + for(int j = 0; j < result.length; j++){ + //loadAgent[j] = result[j].getName(); + agentIdentifiers.add(result[j].getName()); + System.out.println(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(agentIdentifiers.size()==0) { + sd.setName(tuName+"_act"); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + System.out.println("Found the following load agents: "); + //loadAgent = new AID[result.length]; + for(int j = 0; j < result.length; j++){ + //loadAgent[j] = result[j].getName(); + agentIdentifiers.add(result[j].getName()); + System.out.println(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + } + if(agentIdentifiers.size()>0) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new Setpoint to TU: " + tuName +". NewSetpoint:"+newSetpoint+" *******"); + //*********** Sending Request to the corresponding agent *********** + ACLMessage msg = new ACLMessage(ACLMessage.REQUEST); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < agentIdentifiers.size(); j++){ + receiver = agentIdentifiers.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + if(newSetpointVersion) { + TUControlSequenceRequestSetpoint newLoadControlRequestNewSetpoint = new TUControlSequenceRequestSetpoint(); + newLoadControlRequestNewSetpoint.setNewSetpoint(newSetpoint); + newLoadControlRequestNewSetpoint.setTuName(tuName); + Action act = new Action(); + act.setAction(newLoadControlRequestNewSetpoint); //Adding the Action the Agent has to perform + act.setActor(new AID("*", AID.ISGUID)); //Adding an dummy Agent, because the actor field is mandatory (source: http://jade.tilab.com/pipermail/jade-develop/2010q4/016200.html) + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + }else { + TUControlSequenceRequestLoadProfile newLoadControlRequestLoadProfile = new TUControlSequenceRequestLoadProfile(); + newLoadControlRequestLoadProfile.setNewLoadProfile(newLoadProfile); + newLoadControlRequestLoadProfile.setTuName(tuName); + Action act = new Action(); + act.setAction(newLoadControlRequestLoadProfile); //Adding the Action the Agent has to perform + act.setActor(new AID("*", AID.ISGUID)); //Adding an dummy Agent, because the actor field is mandatory (source: http://jade.tilab.com/pipermail/jade-develop/2010q4/016200.html) + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + } + + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + } + }else { + System.out.println("No Agent can be found under that name"); + } + } + } + + //********************** 3. TU Balancing Sequence ********************** + private class BalancingSequencePerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private int updateRate = 1; + private String balancingStart; + private String balancingEnd; + private String tuName = "noNameSet"; + private String conversationID = "noID"; + private String referenceID = "noID"; + private Date balancingEndDate; + private ArrayList agentIdentifiers = new ArrayList(); + + public BalancingSequencePerformer(String _balancingStart, String _balancingEnd, + String _tuName, int _updateRate, String _referenceID) { + balancingStart = _balancingStart; + balancingEnd = _balancingEnd; + tuName = _tuName; + updateRate = _updateRate; + referenceID = _referenceID; + } + + public void onStart(){ + idCounter++; + conversationID = ("Balancing-"+idCounter); + + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN); + formatter.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); + balancingEndDate = formatter.parse(balancingEnd); + } catch (ParseException e) { + + e.printStackTrace(); + } + System.out.println(this.getAgent().getAID().getLocalName()+"******* BalancingSequencePerformer started ********"); + } + + public void action() { + Date dateNow = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN); + formatter.format(dateNow); + + switch(step){ + //********** searching the DF for the Agent ********** + case 0: + if (dateNow.after(balancingEndDate)){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* BalancingSequencePerformer stopped (EndDate not valid) ********"); + step = 99; + } + //pairing the referenceID from the VPP to the conversationID given by the AgentSystem + idPairsBalancing.put(referenceID, conversationID); + //searching for the complete AID of the referenced agent + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setName(tuName); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + System.out.println("Found the following load agents: "); + //loadAgent = new AID[result.length]; + for(int j = 0; j < result.length; j++){ + //loadAgent[j] = result[j].getName(); + agentIdentifiers.add(result[j].getName()); + System.out.println(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(agentIdentifiers.size()==0) { + sd.setName(tuName+"_act"); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + System.out.println("Found the following agents: "); + //loadAgent = new AID[result.length]; + for(int j = 0; j < result.length; j++){ + //loadAgent[j] = result[j].getName(); + agentIdentifiers.add(result[j].getName()); + System.out.println(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + } + if(agentIdentifiers.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + //*********** Sending SUBSCRIBE Request to the corresponding agent *********** + case 1: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new Subscribe to TU: " + tuName +" *******"); + ACLMessage msg = new ACLMessage(ACLMessage.SUBSCRIBE); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + SimpleDateFormat formatter2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN); + formatter2.setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); + Date date; + try { + date = formatter2.parse(balancingStart); + msg.setReplyByDate(date); + } catch (ParseException e) { + e.printStackTrace(); + } + + AID receiver = new AID(); + for(int j = 0; j < agentIdentifiers.size(); j++){ + receiver = agentIdentifiers.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + BalancingSequenceSubscribe newBalancingSequenceSubscribe = new BalancingSequenceSubscribe(); + newBalancingSequenceSubscribe.setTuName(tuName); + newBalancingSequenceSubscribe.setBalancingStart(balancingStart); + newBalancingSequenceSubscribe.setBalancingEnd(balancingEnd); + newBalancingSequenceSubscribe.setUpdateRate(updateRate); + Action act = new Action(); + act.setAction(newBalancingSequenceSubscribe); //Adding the Action the Agent has to perform + act.setActor(receiver); //Adding an dummy Agent, because the actor field is mandatory (source: http://jade.tilab.com/pipermail/jade-develop/2010q4/016200.html) + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + //************* collecting responses from the TUs **************** + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.or( + MessageTemplate.MatchPerformative(ACLMessage.REFUSE), + MessageTemplate.MatchPerformative(ACLMessage.AGREE))))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.AGREE) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* AGREE Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof BalancingSequenceAgree){ + //********** Inform the VPP-System about the results********** + BalancingSequenceAgree _bsa = (BalancingSequenceAgree)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_bsa.getTuName(),_bsa.getAgentName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.BALANCINGAGREE, payload); + step = 3; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else if (msg.getPerformative() == ACLMessage.REFUSE) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* REJECT Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof BalancingSequenceRefuse){ + //********** Inform the VPP-System about the results********** + BalancingSequenceRefuse _bsr = (BalancingSequenceRefuse)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_bsr.getTuName(),_bsr.getAgentName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.BALANCINGREFUSE, payload); + step = 99; + } + }catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } else { //normally can not be the case + step = 99; + } + }else { + block(); + } + break; + //************* collecting values from the TUs **************** + case 3: + mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.or( + MessageTemplate.MatchPerformative(ACLMessage.INFORM), + MessageTemplate.MatchPerformative(ACLMessage.FAILURE))))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof BalancingSequenceInform){ + //********** Inform the VPP-System about the results********** + BalancingSequenceInform _bsi = (BalancingSequenceInform)_pc; + //InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_bsi.getTuName(),_bsi.getAgentName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.BALANCINGINFORM, _bsi); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else if(msg.getPerformative() == ACLMessage.FAILURE) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* FAILURE Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof BalancingSequenceFailure){ + //********** Inform the VPP-System about the results********** + BalancingSequenceFailure _bsf = (BalancingSequenceFailure)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_bsf.getTuName(),msg.getSender().getLocalName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.BALANCINGFAILURE, payload); + step = 99; + } + }catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else { //normally can not be the case + step = 99; + } + }else { //stop the behaviour after the last message has been received and additional 5 secs to get every message from the pending queue + Date currentTime = new Date(); + long t= balancingEndDate.getTime(); + Date afterAdding5Sec=new Date(t + (1 * 5000)); + if(currentTime.after(afterAdding5Sec)) { + step = 99; + } + } + break; + case 99: //final case, here reset() must be called. A reset() in done() would result in a reset() call every cycle, because done() gets called every cycle + reset(); //any Behaviour object that has been executed once, must be reset by calling its reset() method before it can be executed again. + step = 100; + break; + default: + step = 99; + } + } + public boolean done() { + return step == 100; + } + } + + //********************** 4. Accounting Sequence ********************** + private class AccountingSequencePerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String agentName = "noNameSet"; + private byte[] energyConsumptionProfile; + private ACLMessage msg; + + AccountingSequencePerformer(ACLMessage _msg) { + msg = _msg; + } + + public void onStart(){ + try { + ContentElement ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + AccountingSequenceInform _asi = (AccountingSequenceInform)_pc; + tuName = _asi.getTuName(); + agentName = _asi.getAgentName(); + energyConsumptionProfile = _asi.getEnergyConsumptionProfile(); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + + public void action() { + switch (step) { + case 0: //sending the energy consumption profiles to the VPP + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.ENERGYCONSUMPTIONPROFILE, energyConsumptionProfile); + ConsumingRest_VPP putInstance2 = new ConsumingRest_VPP(); + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(agentName,tuName); + putInstance2.putNodeRed(Addresses.URL_NODERED, PutVariable.ACCOUNTINGECPREFERENCE, payload); + step = 1; + break; + case 1: + if(VppVariables.accountingTrigger && tuName.equals(VppVariables.accountingTUName)) { + VppVariables.accountingTrigger = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new INFORM to TU: " + tuName +" *******"); + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + AccountingSequenceInformReceived newAccountingSequenceInformReceived = new AccountingSequenceInformReceived(); + newAccountingSequenceInformReceived.setTuName(tuName); + cel.add(newAccountingSequenceInformReceived); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + step = 99; + } + break; + case 99: //final case, here reset() must be called. A reset() in done() would result in a reset() call every cycle, because done() gets called every cycle + reset(); //any Behaviour object that has been executed once, must be reset by calling its reset() method before it can be executed again. + step = 100; + break; + default: + step = 99; + } + } + + public boolean done() { + return step == 100; + } + } + + //********************** 5.A LoadTimeWindowsSharing Sequence (Request from other Agents) ********************** + private class LoadTimeWindowsRequestPerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private String loadTimeWindowsReference; + private ACLMessage msg; + + LoadTimeWindowsRequestPerformer(ACLMessage _msg){ + msg = _msg; + } + + public void onStart(){ + try { + ContentElement ce = getContentManager().extractContent(msg); + Action _ac = (Action) ce; + if(_ac.getAction() instanceof LoadTimeWindowsShareRequest){ + LoadTimeWindowsShareRequest _ltwsr = (LoadTimeWindowsShareRequest)_ac.getAction(); + loadTimeWindowsReference = _ltwsr.getLoadTimeWindowsReference(); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + + public void action() { + switch (step) { + case 0: //sending the request with reference profiles to the VPP + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + InterfacePayloadLoadTimeWindows payload = new InterfacePayloadLoadTimeWindows(loadTimeWindowsReference); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.LOADTIMEWINDOWSREQUEST, payload); + step = 1; + break; + case 1: + if(VppVariables.loadTimeWindowsTrigger && loadTimeWindowsReference.equals(VppVariables.loadTimeWindowsReference)) { + VppVariables.loadTimeWindowsTrigger = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new INFORM to TU: " + msg.getSender().getLocalName() +" *******"); + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + LoadTimeWindowsShareInform newLoadTimeWindowsShareInform = new LoadTimeWindowsShareInform(); + newLoadTimeWindowsShareInform.setLoadTimeWindowsReference(loadTimeWindowsReference); + newLoadTimeWindowsShareInform.setWindowHighBegin(VppVariables.windowHighBegin); + newLoadTimeWindowsShareInform.setWindowHighEnd(VppVariables.windowHighEnd); + newLoadTimeWindowsShareInform.setWindowLowBegin(VppVariables.windowLowBegin); + newLoadTimeWindowsShareInform.setWindowLowEnd(VppVariables.windowLowEnd); + VppVariables.resetloadTimeWindows(); + cel.add(newLoadTimeWindowsShareInform); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + step = 99; + } + break; + case 99: //final case, here reset() must be called. A reset() in done() would result in a reset() call every cycle, because done() gets called every cycle + reset(); //any Behaviour object that has been executed once, must be reset by calling its reset() method before it can be executed again. + step = 100; + break; + default: + step = 99; + } + } + + public boolean done() { + return step == 100; + } + + } + + //********************** 5.B LoadTimeWindowsSharing Sequence (Broadcast from the VPP) ********************** + private class LoadTimeWindowsBroadcastPerformer extends OneShotBehaviour{ + private static final long serialVersionUID = 1L; + private String loadTimeWindowsReference; + private String windowHighBegin; + private String windowHighEnd; + private String windowLowBegin; + private String windowLowEnd; + + LoadTimeWindowsBroadcastPerformer(String _loadTimeWindowsReference, String _windowHighBegin, String _windowHighEnd, String _windowLowBegin, String _windowLowEnd){ + loadTimeWindowsReference = _loadTimeWindowsReference; + windowHighBegin = _windowHighBegin; + windowHighEnd = _windowHighEnd; + windowLowBegin = _windowLowBegin; + windowLowEnd = _windowLowEnd; + } + + public void action() { + ArrayList tuAgents = new ArrayList(); + System.out.println(this.getAgent().getAID().getLocalName()+"******* Informing TUs about new LoadTimeWindows ********"); + //searching for the complete AID of the referenced agent + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setType("ANN"); + sdSearchTemplate.addServices(sd); + //the same for the "ANN_pla" Services + DFAgentDescription sdSearchTemplate_pla =new DFAgentDescription() ; + sdSearchTemplate_pla.addLanguages(codec.getName()); + sdSearchTemplate_pla.addOntologies(ontology.getName()); + ServiceDescription sd_pla = new ServiceDescription(); + sd_pla.setType("ANN_pla"); + sdSearchTemplate_pla.addServices(sd_pla); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + for(int j = 0; j < result.length; j++){ + tuAgents.add(result[j].getName()); + } + DFAgentDescription[] result_pla = DFService.search(myAgent, sdSearchTemplate_pla); + for(int j = 0; j < result_pla.length; j++){ + tuAgents.add(result_pla[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + sdSearchTemplate_pla.clearAllServices(); + + if(tuAgents.size()>0) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new INFORM to TUs *******"); + try { + + ACLMessage msg = new ACLMessage(ACLMessage.INFORM); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId("loadTimeWindows"); + //add receiver with ANN service description + for(int i = 0; i < tuAgents.size(); i++){ + msg.addReceiver(tuAgents.get(i)); + } + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + LoadTimeWindowsShareInform newLoadTimeWindowsShareInform = new LoadTimeWindowsShareInform(); + newLoadTimeWindowsShareInform.setLoadTimeWindowsReference(loadTimeWindowsReference); + newLoadTimeWindowsShareInform.setWindowHighBegin(windowHighBegin); + newLoadTimeWindowsShareInform.setWindowHighEnd(windowHighEnd); + newLoadTimeWindowsShareInform.setWindowLowBegin(windowLowBegin); + newLoadTimeWindowsShareInform.setWindowLowEnd(windowLowEnd); + cel.add(newLoadTimeWindowsShareInform); + cm.fillContent(msg, cel); + myAgent.send(msg); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + } + + + } + + //********************** 6.A FrequencyRelayEnable Sequence ********************** + private class FREnablePerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String conversationID = "noID"; + private ArrayList agentIdentifiers = new ArrayList(); + + FREnablePerformer(String _tuName) { + tuName = _tuName; + } + + public void onStart(){ + idCounter++; + conversationID = ("FREnable-"+idCounter); + } + + public void action() { + switch (step) { + case 0: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Frequency Relay Enable started ********"); + //searching for the complete AID of the referenced agent + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setName(tuName); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + System.out.println("Found the following load agents: "); + //loadAgent = new AID[result.length]; + for(int j = 0; j < result.length; j++){ + agentIdentifiers.add(result[j].getName()); + System.out.println(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(agentIdentifiers.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + case 1://waiting for confirmation + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out FR enable to TU: " + tuName +" *******"); + ACLMessage msg = new ACLMessage(ACLMessage.REQUEST); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < agentIdentifiers.size(); j++){ + receiver = agentIdentifiers.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + FreqRelayEnableRequest newFreqRelayEnableRequest = new FreqRelayEnableRequest(); + newFreqRelayEnableRequest.setTuName(tuName); + Action act = new Action(); + act.setAction(newFreqRelayEnableRequest); //Adding the Action the Agent has to perform + act.setActor(new AID("*", AID.ISGUID)); //Adding an dummy Agent, because the actor field is mandatory (source: http://jade.tilab.com/pipermail/jade-develop/2010q4/016200.html) + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.or( + MessageTemplate.MatchPerformative(ACLMessage.INFORM), + MessageTemplate.MatchPerformative(ACLMessage.FAILURE))))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + try { + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof FreqRelayEnableInform){ + //********** Inform the VPP-System about the results********** + FreqRelayEnableInform _fre = (FreqRelayEnableInform)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_fre.getTuName(),_fre.getAgentName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.FRENABLEINFORM, payload); + step = 99; + } + }else if (msg.getPerformative() == ACLMessage.FAILURE) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* FAILURE Message Received *******"); + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof FreqRelayEnableFailure){ + //********** Inform the VPP-System about the results********** + FreqRelayEnableFailure _fre = (FreqRelayEnableFailure)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_fre.getTuName(),_fre.getAgentName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.FRENABLEFAILURE, payload); + step = 99; + } + } else { //normally can not be the case + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + step = 99; + } + }else { + block(); + } + break; + case 99: //final case, here reset() must be called. A reset() in done() would result in a reset() call every cycle, because done() gets called every cycle + reset(); //any Behaviour object that has been executed once, must be reset by calling its reset() method before it can be executed again. + step = 100; + break; + default: + step = 99; + } + } + public boolean done() { + return step == 100; + } + } + + //********************** 6.B FrequencyRelayBlock Sequence ********************** + private class FRBlockPerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String conversationID = "noID"; + private ArrayList agentIdentifiers = new ArrayList(); + + FRBlockPerformer(String _tuName) { + tuName = _tuName; + } + + public void onStart(){ + idCounter++; + conversationID = ("FRBlock-"+idCounter); + } + + public void action() { + switch (step) { + case 0: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Frequency Relay Block started ********"); + //searching for the complete AID of the referenced agent + DFAgentDescription sdSearchTemplate = new DFAgentDescription() ; + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setName(tuName); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + System.out.println("Found the following load agents: "); + //loadAgent = new AID[result.length]; + for(int j = 0; j < result.length; j++){ + agentIdentifiers.add(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(agentIdentifiers.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + case 1://waiting for confirmation + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out FR block to TU: " + tuName +" *******"); + ACLMessage msg = new ACLMessage(ACLMessage.REQUEST); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < agentIdentifiers.size(); j++){ + receiver = agentIdentifiers.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + FreqRelayBlockRequest newFreqRelayBlockRequest = new FreqRelayBlockRequest(); + newFreqRelayBlockRequest.setTuName(tuName); + Action act = new Action(); + act.setAction(newFreqRelayBlockRequest); //Adding the Action the Agent has to perform + act.setActor(new AID("*", AID.ISGUID)); //Adding an dummy Agent, because the actor field is mandatory (source: http://jade.tilab.com/pipermail/jade-develop/2010q4/016200.html) + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID),MessageTemplate.and( + MessageTemplate.MatchLanguage(codec.getName()),MessageTemplate.or( + MessageTemplate.MatchPerformative(ACLMessage.INFORM), + MessageTemplate.MatchPerformative(ACLMessage.FAILURE))))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + try { + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof FreqRelayBlockInform){ + //********** Inform the VPP-System about the results********** + FreqRelayBlockInform _frb = (FreqRelayBlockInform)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_frb.getTuName(),_frb.getAgentName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.FRBLOCKINFORM, payload); + step = 99; + } + }else if (msg.getPerformative() == ACLMessage.FAILURE) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* FAILURE Message Received *******"); + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof FreqRelayBlockFailure){ + //********** Inform the VPP-System about the results********** + FreqRelayBlockFailure _frb = (FreqRelayBlockFailure)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_frb.getTuName(),_frb.getAgentName()); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.FRBLOCKFAILURE, payload); + step = 99; + } + } else { //normally can not be the case + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + step = 99; + } + }else { + block(); + } + break; + case 99: //final case, here reset() must be called. A reset() in done() would result in a reset() call every cycle, because done() gets called every cycle + reset(); //any Behaviour object that has been executed once, must be reset by calling its reset() method before it can be executed again. + step = 100; + break; + default: + step = 99; + } + } + public boolean done() { + return step == 100; + } + } + + //********************** 6.C FrequencyRelayStatus Sequence ********************** + private class FRStatusPerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private ACLMessage msg; + private String tuName = "NoNameSet"; + private String agentName = "noNameSet"; + + FRStatusPerformer(ACLMessage _msg, String _tuName, String _agentName) { + msg = _msg; + tuName = _tuName; + agentName = _agentName; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending Frequency Relay Status to VPP *******"); + + } + + public void action() { + switch(step){ + case 0: + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(agentName, tuName); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.FRTRIGGERED, payload); + step = 1; + break; + case 1: + try { + if(VppVariables.freqRelayConfirmTrigger && tuName.equals(VppVariables.freqRelayConfirmTUName)) { + VppVariables.freqRelayConfirmTrigger = false; + VppVariables.resetfreqRelayConfirm(); + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + FreqRelayStatusConfirm newFreqRelayStatusConfirm = new FreqRelayStatusConfirm(); + newFreqRelayStatusConfirm.setTuName(tuName); + newFreqRelayStatusConfirm.setAgentName(agentName); + cel.add(newFreqRelayStatusConfirm); + cm.fillContent(reply, cel); + myAgent.send(reply); + step = 99; + } + } + catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + public boolean done() { + return step == 100; + } + } + + //********************** 7.A Receive CancelOperation Sequence ********************** + private class ReceiveCancelOperationPerformer extends Behaviour{ + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String agentName = "noNameSet"; + private String operationReference = "noReferenceSet"; + private ACLMessage msg; + + ReceiveCancelOperationPerformer(ACLMessage _msg) { + msg = _msg; + } + + public void onStart(){ + try { + ContentElement ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + CancelOperationCancel _coi = (CancelOperationCancel)_pc; + tuName = _coi.getTuName(); + agentName = _coi.getAgentName(); + operationReference = _coi.getOperationReference(); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + + public void action() { + switch (step) { + case 0: + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(operationReference, agentName,tuName); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.CANCELOPERATION, payload); + step = 1; + break; + case 1: + if(VppVariables.cancelOperationTrigger && operationReference.equals(VppVariables.cancelOperationReference)) { + VppVariables.cancelOperationTrigger = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new INFORM to TU: " + tuName +" *******"); + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CancelOperationConfirm newCancelOperationInformReceived = new CancelOperationConfirm(); + newCancelOperationInformReceived.setTuName(tuName); + newCancelOperationInformReceived.setOperationReference(operationReference); + cel.add(newCancelOperationInformReceived); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + step = 99; + } else if(VppVariables.cancelOperationTriggerFail && operationReference.equals(VppVariables.cancelOperationReference)) { + VppVariables.cancelOperationTriggerFail = false; + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new INFORM to TU: " + tuName +" *******"); + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.FAILURE); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CancelOperationFailure newCancelOperationInformReceived = new CancelOperationFailure(); + newCancelOperationInformReceived.setTuName(tuName); + newCancelOperationInformReceived.setOperationReference(operationReference); + cel.add(newCancelOperationInformReceived); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + step = 99; + } + break; + case 99: //final case, here reset() must be called. A reset() in done() would result in a reset() call every cycle, because done() gets called every cycle + reset(); //any Behaviour object that has been executed once, must be reset by calling its reset() method before it can be executed again. + step = 100; + break; + default: + step = 99; + } + } + + public boolean done() { + return step == 100; + } + } + + //********************** 7.B Send CancelOperation Sequence ********************** + private class SendCancelOperationPerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String agentName = "noNameSet"; + private String operationReference = "noIDSet"; + private String conversationID; + private ArrayList tuAgents = new ArrayList(); + + SendCancelOperationPerformer(String _tuName, String _operationReference){ + tuName = _tuName; + operationReference = _operationReference; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* OperationCancelBehaviour started ********"); + agentName = getAID().getLocalName(); + conversationID = "cancelOperation"; + } + + public void action(){ + switch(step){ + case 0: + DFAgentDescription sdSearchTemplate = new DFAgentDescription(); + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setName(tuName); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + for(int j = 0; j < result.length; j++){ + tuAgents.add(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(tuAgents.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + case 1: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out CANCEL (cancel operation) to TU *******"); + + ACLMessage msg = new ACLMessage(ACLMessage.CANCEL); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < tuAgents.size(); j++){ + receiver = tuAgents.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + CancelOperationCancel newCancelOperationInform = new CancelOperationCancel(); + newCancelOperationInform.setAgentName(agentName); + newCancelOperationInform.setTuName(tuName); + newCancelOperationInform.setOperationReference(operationReference); + cel.add(newCancelOperationInform); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID), + MessageTemplate.MatchLanguage(codec.getName()))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof CancelOperationConfirm){ + //********** Inform the VPP-System about the results********** + CancelOperationConfirm _asir = (CancelOperationConfirm)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_asir.getOperationReference(), getAID().getLocalName(),_asir.getTuName() ); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.CANCELOPERATIONCONFIRM, payload); + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else if(msg.getPerformative() == ACLMessage.FAILURE) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* FAILURE Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof CancelOperationFailure){ + //********** Inform the VPP-System about the results********** + CancelOperationFailure _asir = (CancelOperationFailure)_pc; + InterfacePayloadAgentReference payload = new InterfacePayloadAgentReference(_asir.getOperationReference(), getAID().getLocalName(),_asir.getTuName() ); + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.CANCELOPERATIONFAILED, payload); + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else { + step = 99; + } + }else { + block(); + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + } + + public boolean done(){ + return step == 100; + } + + } + + //********************** 8.A RequestInfos Sequence ********************** + private class RequestInfoPerformer extends Behaviour { + private static final long serialVersionUID = 1L; + private int step = 0; + private String tuName = "noNameSet"; + private String conversationID; + private byte[] infoSet; + private ArrayList tuAgents = new ArrayList(); + private Date expireDate; + + RequestInfoPerformer(String _tuName){ + tuName = _tuName; + } + + public void onStart(){ + System.out.println(this.getAgent().getAID().getLocalName()+"******* RequestInfosBehaviour started ********"); + Date dateStart = new Date(); + long t; + t = dateStart.getTime(); + expireDate=new Date(t + (5 * 60000)); //5min added + conversationID = "requestInfoOperation"; + } + + public void action(){ + switch(step){ + case 0: + DFAgentDescription sdSearchTemplate = new DFAgentDescription(); + sdSearchTemplate.addLanguages(codec.getName()); + sdSearchTemplate.addOntologies(ontology.getName()); + ServiceDescription sd = new ServiceDescription(); + sd.setName(tuName); + sdSearchTemplate.addServices(sd); + //searching the DF for the Agents that can provide the service + try { + DFAgentDescription[] result = DFService.search(myAgent, sdSearchTemplate); + for(int j = 0; j < result.length; j++){ + tuAgents.add(result[j].getName()); + } + } + catch (FIPAException fe){ + fe.printStackTrace(); + } + sdSearchTemplate.clearAllServices(); + if(tuAgents.size()>0) { + step = 1; + }else { + System.out.println("No Agent can be found under that name"); + step = 99; + } + break; + case 1: + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out REQUEST (Request Infos) to TU *******"); + ACLMessage msg = new ACLMessage(ACLMessage.REQUEST); + msg.setOntology(ontology.getName()); + msg.setLanguage(codec.getName()); + msg.setConversationId(conversationID); + AID receiver = new AID(); + for(int j = 0; j < tuAgents.size(); j++){ + receiver = tuAgents.get(j); + } + msg.addReceiver(receiver); + try { + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + RequestInfoRequest newRequestInfoRequest = new RequestInfoRequest(); + newRequestInfoRequest.setTuName(tuName); + newRequestInfoRequest.setTuName(getAID().getLocalName()); + Action act = new Action(); + act.setAction(newRequestInfoRequest); //Adding the Action the Agent has to perform + act.setActor(new AID("*", AID.ISGUID)); //Adding an dummy Agent, because the actor field is mandatory (source: http://jade.tilab.com/pipermail/jade-develop/2010q4/016200.html) + cel.add(act); + cm.fillContent(msg, cel); + myAgent.send(msg); + msg.reset(); + step = 2; + } catch (CodecException | OntologyException e){ + e.printStackTrace(); + step = 99; + } + break; + case 2: + MessageTemplate mt = MessageTemplate.and( + MessageTemplate.MatchOntology(ontology.getName()),MessageTemplate.and( + MessageTemplate.MatchConversationId(conversationID), + MessageTemplate.MatchLanguage(codec.getName()))); + msg = receive(mt); //returns the first message of the message queue with the corresponding template + if (msg != null){ + ContentElement ce = null; + if (msg.getPerformative() == ACLMessage.INFORM) { + System.out.println(this.getAgent().getAID().getLocalName()+"******* INFORM Message Received *******"); + try { + ce = getContentManager().extractContent(msg); + Predicate _pc = (Predicate) ce; + if(_pc instanceof RequestInfoInform){ + //********** Inform the VPP-System about the results********** + RequestInfoInform _rii = (RequestInfoInform)_pc; + ConsumingRest_VPP putInstance = new ConsumingRest_VPP(); + infoSet = _rii.getInfoSet(); + putInstance.putNodeRed(Addresses.URL_NODERED, PutVariable.REQUESTINFOINFORM, infoSet); + step = 99; + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + }else if(msg.getPerformative() == ACLMessage.FAILURE) { + step = 99; + }else{ + step = 99; + } + }else { + Date dateNow = new Date(); + if(dateNow.after(expireDate)) { + step = 99; + } + } + break; + case 99: + reset(); + step = 100; + break; + default: + step = 99; + } + + } + public boolean done() { + return step == 100; + } + } + + //********************** 8.B RequestInfosResponse Sequence ********************** + private class RequestInfoResponsePerformer extends OneShotBehaviour{ + private static final long serialVersionUID = 1L; + private String tuName = "noNameSet"; + private byte[] infoSet; + private ACLMessage msg; + + RequestInfoResponsePerformer(ACLMessage _msg) { + msg = _msg; + } + + public void onStart(){ + try { + ContentElement ce = getContentManager().extractContent(msg); + Action _ac = (Action) ce; + if(_ac.getAction() instanceof RequestInfoRequest){ + RequestInfoRequest _rir = (RequestInfoRequest)_ac.getAction(); + tuName = _rir.getTuName(); + } + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + + public void action() { + ConsumingRest_VPP getInstance = new ConsumingRest_VPP(); + infoSet = getInstance.getNodeRed(Addresses.URL_NODERED, PutVariable.REQUESTINFO); + System.out.println(this.getAgent().getAID().getLocalName()+"******* Sending out new RequestInfo *******"); + try { + ACLMessage reply = msg.createReply(); + reply.setPerformative(ACLMessage.INFORM); + ContentManager cm = myAgent.getContentManager(); + ContentElementList cel = new ContentElementList(); + RequestInfoInform newRequestInfoInform = new RequestInfoInform(); + newRequestInfoInform.setTuName(tuName); + newRequestInfoInform.setAgentName(getAID().getLocalName()); + newRequestInfoInform.setInfoSet(infoSet); + cel.add(newRequestInfoInform); + cm.fillContent(reply, cel); + myAgent.send(reply); + } catch (CodecException | OntologyException e) { + e.printStackTrace(); + } + } + + } + +} \ No newline at end of file diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/ontology/CancelOperationCancel.java b/JADE_VPP/src/main/java/mas/JADE_VPP/ontology/CancelOperationCancel.java new file mode 100644 index 0000000..23f1e8c --- /dev/null +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/ontology/CancelOperationCancel.java @@ -0,0 +1,31 @@ +package mas.JADE_VPP.ontology; + +import jade.content.Predicate; + +public class CancelOperationCancel implements Predicate { + private static final long serialVersionUID = 1L; + private String agentName; + private String tuName; + private String operationReference; + + public String getAgentName() { + return agentName; + } + public void setAgentName(String agentName) { + this.agentName = agentName; + } + public String getTuName() { + return tuName; + } + public void setTuName(String tuName) { + this.tuName = tuName; + } + public String getOperationReference() { + return operationReference; + } + public void setOperationReference(String operationReference) { + this.operationReference = operationReference; + } + + +} diff --git a/JADE_VPP/src/main/java/mas/JADE_VPP/ontology/VPP_DR_Ontology.java b/JADE_VPP/src/main/java/mas/JADE_VPP/ontology/VPP_DR_Ontology.java index 0c555d0..31b301a 100644 --- a/JADE_VPP/src/main/java/mas/JADE_VPP/ontology/VPP_DR_Ontology.java +++ b/JADE_VPP/src/main/java/mas/JADE_VPP/ontology/VPP_DR_Ontology.java @@ -71,10 +71,10 @@ public class VPP_DR_Ontology extends Ontology{ public static final String FREQRELAY_STATUSINFORM = "FreqRelayStatusInform"; public static final String FREQRELAY_STATUSCONFIRM = "FreqRelayStatusConfirm"; - public static final String CANCELOPERATION_CANCEL = "CancelOperation"; + public static final String CANCELOPERATION_CANCEL = "CancelOperationCancel"; public static final String CANCELOPERATION_CONFIRM = "CancelOperationConfirm"; public static final String CANCELOPERATION_FAILURE = "CancelOperationFailure"; - public static final String CANCELOPERATION_REFRENCE = "operationReference"; + public static final String CANCELOPERATION_REFERENCE = "operationReference"; public static final String REQUESTINFO_INFORM = "RequestInfoInform"; public static final String REQUESTINFO_DATASET = "infoSet"; @@ -141,7 +141,7 @@ private VPP_DR_Ontology() { add(new PredicateSchema (FREQRELAY_BLOCKFAILURE),FreqRelayBlockFailure.class); add(new PredicateSchema (FREQRELAY_STATUSINFORM),FreqRelayStatusInform.class); add(new PredicateSchema (FREQRELAY_STATUSCONFIRM),FreqRelayStatusConfirm.class); - add(new PredicateSchema (CANCELOPERATION_CANCEL),CancelOperation.class); + add(new PredicateSchema (CANCELOPERATION_CANCEL),CancelOperationCancel.class); add(new PredicateSchema (CANCELOPERATION_CONFIRM),CancelOperationConfirm.class); add(new PredicateSchema (CANCELOPERATION_FAILURE),CancelOperationFailure.class); add(new PredicateSchema (REQUESTINFO_INFORM),RequestInfoInform.class); @@ -182,13 +182,13 @@ private VPP_DR_Ontology() { // *************** PREDICATES PredicateSchema ps = (PredicateSchema) (getSchema(CFPSCHEDULINGSEQUENCE_REFUSE)); - ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); - ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); + ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); + ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(CFPSCHEDULINGSEQUENCE_PROPOSE)); ps.add(CFPSCHEDULINGSEQUENCE_SCHEDULINGPLAN, (PrimitiveSchema) getSchema(BasicOntology.BYTE_SEQUENCE), ObjectSchema.MANDATORY); - ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); - ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); + ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); + ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(CFPSCHEDULINGSEQUENCE_ACCEPTPROPOSAL)); ps.add(CFPSCHEDULINGSEQUENCE_SCHEDULINGSTART, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); @@ -197,20 +197,20 @@ private VPP_DR_Ontology() { ps = (PredicateSchema) (getSchema(CFPSCHEDULINGSEQUENCE_REJECTPROPOSAL)); ps = (PredicateSchema) (getSchema(CFPSCHEDULINGSEQUENCE_SCHEDULINGDONE)); - ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); - ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); + ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); + ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(CFPSCHEDULINGSEQUENCE_SCHEDULINGFAILURE)); - ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); - ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); + ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); + ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(TUCONTROLSEQUENCE_FAILURE)); ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(BALANCINGSEQUENCE_AGREE)); - ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); + ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(BALANCINGSEQUENCE_REFUSE)); ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); @@ -228,15 +228,15 @@ private VPP_DR_Ontology() { ps = (PredicateSchema) (getSchema(CANCELOPERATION_CANCEL)); ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); - ps.add(CANCELOPERATION_REFRENCE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); + ps.add(CANCELOPERATION_REFERENCE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(CANCELOPERATION_CONFIRM)); ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); - ps.add(CANCELOPERATION_REFRENCE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); + ps.add(CANCELOPERATION_REFERENCE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(CANCELOPERATION_FAILURE)); ps.add(TUNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); - ps.add(CANCELOPERATION_REFRENCE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); + ps.add(CANCELOPERATION_REFERENCE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); ps = (PredicateSchema) (getSchema(ACCOUNTINGSEQUENCE_INFORM)); ps.add(AGENTNAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);