Add files via upload
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"elements":
|
||||
[
|
||||
|
||||
|
||||
{ "type": "SelectVariable", "name": "IdVariable", "caption": "ID Variable" }
|
||||
|
||||
],
|
||||
"actions":
|
||||
[
|
||||
|
||||
],
|
||||
"status":
|
||||
[
|
||||
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"id": "{2E62C98E-A730-4A74-E8FB-5A1D95F12446}",
|
||||
"name": "Do16ToWord",
|
||||
"type": 3,
|
||||
"vendor": "J.H. Artworks",
|
||||
"aliases":
|
||||
[
|
||||
],
|
||||
"url": "https://jh-artworks.com",
|
||||
"parentRequirements": [],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "VTDW"
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?
|
||||
// Klassendefinition
|
||||
class Do16ToWord extends IPSModule {
|
||||
// Überschreibt die interne IPS_Create($id) Funktion
|
||||
public function Create() {
|
||||
// Diese Zeile nicht löschen.
|
||||
parent::Create();
|
||||
|
||||
$this->RegisterPropertyInteger("IdVariable",0);
|
||||
|
||||
$this->RegisterVariableBoolean("Q01", "Ausgang 1","",10);
|
||||
$this->EnableAction("Q01");
|
||||
$this->RegisterVariableBoolean("Q02", "Ausgang 2","",20);
|
||||
$this->EnableAction("Q02");
|
||||
$this->RegisterVariableBoolean("Q03", "Ausgang 3","",30);
|
||||
$this->EnableAction("Q03");
|
||||
$this->RegisterVariableBoolean("Q04", "Ausgang 4","",40);
|
||||
$this->EnableAction("Q04");
|
||||
$this->RegisterVariableBoolean("Q05", "Ausgang 5","",50);
|
||||
$this->EnableAction("Q05");
|
||||
$this->RegisterVariableBoolean("Q06", "Ausgang 6","",60);
|
||||
$this->EnableAction("Q06");
|
||||
$this->RegisterVariableBoolean("Q07", "Ausgang 7","",70);
|
||||
$this->EnableAction("Q07");
|
||||
$this->RegisterVariableBoolean("Q08", "Ausgang 8","",80);
|
||||
$this->EnableAction("Q08");
|
||||
$this->RegisterVariableBoolean("Q09", "Ausgang 9","",90);
|
||||
$this->EnableAction("Q09");
|
||||
$this->RegisterVariableBoolean("Q10", "Ausgang 10","",100);
|
||||
$this->EnableAction("Q10");
|
||||
$this->RegisterVariableBoolean("Q11", "Ausgang 11","",110);
|
||||
$this->EnableAction("Q11");
|
||||
$this->RegisterVariableBoolean("Q12", "Ausgang 12","",120);
|
||||
$this->EnableAction("Q12");
|
||||
$this->RegisterVariableBoolean("Q13", "Ausgang 13","",130);
|
||||
$this->EnableAction("Q13");
|
||||
$this->RegisterVariableBoolean("Q14", "Ausgang 14","",140);
|
||||
$this->EnableAction("Q14");
|
||||
$this->RegisterVariableBoolean("Q15", "Ausgang 15","",150);
|
||||
$this->EnableAction("Q15");
|
||||
$this->RegisterVariableBoolean("Q16", "Ausgang 16","",160);
|
||||
$this->EnableAction("Q16");
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
|
||||
public function ApplyChanges() {
|
||||
// Diese Zeile nicht löschen
|
||||
parent::ApplyChanges();
|
||||
|
||||
|
||||
}
|
||||
public function RequestAction($Ident, $Value) {
|
||||
$varid = $this->GetIDForIdent($Ident);
|
||||
SetValue($varid, $Value);
|
||||
|
||||
|
||||
$this->checkValues();
|
||||
}
|
||||
|
||||
|
||||
public function checkValues(){
|
||||
$Idvalue = $this->ReadPropertyInteger("IdVariable");
|
||||
|
||||
|
||||
$IdQ01 = $this->GetIDForIdent("Q01");
|
||||
$IdQ02 = $this->GetIDForIdent("Q02");
|
||||
$IdQ03 = $this->GetIDForIdent("Q03");
|
||||
$IdQ04 = $this->GetIDForIdent("Q04");
|
||||
$IdQ05 = $this->GetIDForIdent("Q05");
|
||||
$IdQ06 = $this->GetIDForIdent("Q06");
|
||||
$IdQ07 = $this->GetIDForIdent("Q07");
|
||||
$IdQ08 = $this->GetIDForIdent("Q08");
|
||||
$IdQ09 = $this->GetIDForIdent("Q09");
|
||||
$IdQ10 = $this->GetIDForIdent("Q10");
|
||||
$IdQ11 = $this->GetIDForIdent("Q11");
|
||||
$IdQ12 = $this->GetIDForIdent("Q12");
|
||||
$IdQ13 = $this->GetIDForIdent("Q13");
|
||||
$IdQ14 = $this->GetIDForIdent("Q14");
|
||||
$IdQ15 = $this->GetIDForIdent("Q15");
|
||||
$IdQ16 = $this->GetIDForIdent("Q16");
|
||||
|
||||
|
||||
$outputs[0] = $this->GetValueBooleanNull($IdQ01);
|
||||
$outputs[1] = $this->GetValueBooleanNull($IdQ02);
|
||||
$outputs[2] = $this->GetValueBooleanNull($IdQ03);
|
||||
$outputs[3] = $this->GetValueBooleanNull($IdQ04);
|
||||
$outputs[4] = $this->GetValueBooleanNull($IdQ05);
|
||||
$outputs[5] = $this->GetValueBooleanNull($IdQ06);
|
||||
$outputs[6] = $this->GetValueBooleanNull($IdQ07);
|
||||
$outputs[7] = $this->GetValueBooleanNull($IdQ08);
|
||||
$outputs[8] = $this->GetValueBooleanNull($IdQ09);
|
||||
$outputs[9] = $this->GetValueBooleanNull($IdQ10);
|
||||
$outputs[10] = $this->GetValueBooleanNull($IdQ11);
|
||||
$outputs[11] = $this->GetValueBooleanNull($IdQ12);
|
||||
$outputs[12] = $this->GetValueBooleanNull($IdQ13);
|
||||
$outputs[13] = $this->GetValueBooleanNull($IdQ14);
|
||||
$outputs[14] = $this->GetValueBooleanNull($IdQ15);
|
||||
$outputs[15] = $this->GetValueBooleanNull($IdQ16);
|
||||
|
||||
$out = $this->binaryArrayToInt($outputs);
|
||||
RequestAction($Idvalue,$out);
|
||||
}
|
||||
|
||||
public function binaryArrayToInt(ARRAY $bitsArray) {
|
||||
// Das Bit-Array umkehren, da es andersherum übergeben wird
|
||||
$reversedBitsArray = array_reverse($bitsArray);
|
||||
|
||||
// Das umgekehrte Bit-Array in einen Binärstring konvertieren
|
||||
$binaryString = implode("", $reversedBitsArray);
|
||||
|
||||
// Den Binärstring in eine Ganzzahl umwandeln
|
||||
$intValue = bindec($binaryString);
|
||||
|
||||
return $intValue;
|
||||
}
|
||||
|
||||
public function GetValueBooleanNull(INT $id)
|
||||
{
|
||||
if (GetValueBoolean($id) == 1){
|
||||
return 1;
|
||||
}else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"elements":
|
||||
[
|
||||
|
||||
|
||||
{ "type": "SelectVariable", "name": "IdVariable", "caption": "ID Variable" }
|
||||
|
||||
],
|
||||
"actions":
|
||||
[
|
||||
|
||||
],
|
||||
"status":
|
||||
[
|
||||
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"id": "{2AF7A31E-0373-D361-6AC4-83B10E742924}",
|
||||
"name": "Do8ToWord",
|
||||
"type": 3,
|
||||
"vendor": "J.H. Artworks",
|
||||
"aliases":
|
||||
[
|
||||
],
|
||||
"url": "https://jh-artworks.com",
|
||||
"parentRequirements": [],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "VTDW"
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?
|
||||
// Klassendefinition
|
||||
class Do8ToWord extends IPSModule {
|
||||
// Überschreibt die interne IPS_Create($id) Funktion
|
||||
public function Create() {
|
||||
// Diese Zeile nicht löschen.
|
||||
parent::Create();
|
||||
|
||||
|
||||
$this->RegisterPropertyInteger("IdVariable",0);
|
||||
|
||||
$this->RegisterVariableBoolean("Q01", "Ausgang 1","",10);
|
||||
$this->EnableAction("Q01");
|
||||
$this->RegisterVariableBoolean("Q02", "Ausgang 2","",20);
|
||||
$this->EnableAction("Q02");
|
||||
$this->RegisterVariableBoolean("Q03", "Ausgang 3","",30);
|
||||
$this->EnableAction("Q03");
|
||||
$this->RegisterVariableBoolean("Q04", "Ausgang 4","",40);
|
||||
$this->EnableAction("Q04");
|
||||
$this->RegisterVariableBoolean("Q05", "Ausgang 5","",50);
|
||||
$this->EnableAction("Q05");
|
||||
$this->RegisterVariableBoolean("Q06", "Ausgang 6","",60);
|
||||
$this->EnableAction("Q06");
|
||||
$this->RegisterVariableBoolean("Q07", "Ausgang 7","",70);
|
||||
$this->EnableAction("Q07");
|
||||
$this->RegisterVariableBoolean("Q08", "Ausgang 8","",80);
|
||||
$this->EnableAction("Q08");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
|
||||
public function ApplyChanges() {
|
||||
// Diese Zeile nicht löschen
|
||||
parent::ApplyChanges();
|
||||
|
||||
|
||||
}
|
||||
public function RequestAction($Ident, $Value) {
|
||||
$varid = $this->GetIDForIdent($Ident);
|
||||
SetValue($varid, $Value);
|
||||
|
||||
|
||||
$this->checkValues();
|
||||
}
|
||||
|
||||
|
||||
public function checkValues(){
|
||||
$Idvalue = $this->ReadPropertyInteger("IdVariable");
|
||||
|
||||
|
||||
$IdQ01 = $this->GetIDForIdent("Q01");
|
||||
$IdQ02 = $this->GetIDForIdent("Q02");
|
||||
$IdQ03 = $this->GetIDForIdent("Q03");
|
||||
$IdQ04 = $this->GetIDForIdent("Q04");
|
||||
$IdQ05 = $this->GetIDForIdent("Q05");
|
||||
$IdQ06 = $this->GetIDForIdent("Q06");
|
||||
$IdQ07 = $this->GetIDForIdent("Q07");
|
||||
$IdQ08 = $this->GetIDForIdent("Q08");
|
||||
|
||||
|
||||
|
||||
$outputs[0] = $this->GetValueBooleanNull($IdQ01);
|
||||
$outputs[1] = $this->GetValueBooleanNull($IdQ02);
|
||||
$outputs[2] = $this->GetValueBooleanNull($IdQ03);
|
||||
$outputs[3] = $this->GetValueBooleanNull($IdQ04);
|
||||
$outputs[4] = $this->GetValueBooleanNull($IdQ05);
|
||||
$outputs[5] = $this->GetValueBooleanNull($IdQ06);
|
||||
$outputs[6] = $this->GetValueBooleanNull($IdQ07);
|
||||
$outputs[7] = $this->GetValueBooleanNull($IdQ08);
|
||||
|
||||
|
||||
$out = $this->binaryArrayToInt($outputs);
|
||||
RequestAction($Idvalue,$out);
|
||||
}
|
||||
|
||||
public function binaryArrayToInt(ARRAY $bitsArray) {
|
||||
// Das Bit-Array umkehren, da es andersherum übergeben wird
|
||||
$reversedBitsArray = array_reverse($bitsArray);
|
||||
|
||||
// Das umgekehrte Bit-Array in einen Binärstring konvertieren
|
||||
$binaryString = implode("", $reversedBitsArray);
|
||||
|
||||
// Den Binärstring in eine Ganzzahl umwandeln
|
||||
$intValue = bindec($binaryString);
|
||||
|
||||
return $intValue;
|
||||
}
|
||||
|
||||
public function GetValueBooleanNull(INT $id)
|
||||
{
|
||||
if (GetValueBoolean($id) == 1){
|
||||
return 1;
|
||||
}else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"elements":
|
||||
[
|
||||
|
||||
|
||||
{ "type": "SelectVariable", "name": "IdVariable", "caption": "ID Variable" }
|
||||
|
||||
],
|
||||
"actions":
|
||||
[
|
||||
|
||||
],
|
||||
"status":
|
||||
[
|
||||
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"id": "{C5BCEBA7-A3E5-E246-7D45-979148112439}",
|
||||
"name": "WordTo16Di",
|
||||
"type": 3,
|
||||
"vendor": "J.H. Artworks",
|
||||
"aliases":
|
||||
[
|
||||
],
|
||||
"url": "https://jh-artworks.com",
|
||||
"parentRequirements": [],
|
||||
"childRequirements": [],
|
||||
"implemented": [],
|
||||
"prefix": "VTWD"
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?
|
||||
// Klassendefinition
|
||||
class WordTo16Di extends IPSModule {
|
||||
// Überschreibt die interne IPS_Create($id) Funktion
|
||||
public function Create() {
|
||||
// Diese Zeile nicht löschen.
|
||||
parent::Create();
|
||||
|
||||
|
||||
$this->RegisterPropertyInteger("IdVariable",0);
|
||||
|
||||
$this->RegisterVariableBoolean("E01", "Eingang 1","",10);
|
||||
$this->RegisterVariableBoolean("E02", "Eingang 2","",20);
|
||||
$this->RegisterVariableBoolean("E03", "Eingang 3","",30);
|
||||
$this->RegisterVariableBoolean("E04", "Eingang 4","",40);
|
||||
$this->RegisterVariableBoolean("E05", "Eingang 5","",50);
|
||||
$this->RegisterVariableBoolean("E06", "Eingang 6","",60);
|
||||
$this->RegisterVariableBoolean("E07", "Eingang 7","",70);
|
||||
$this->RegisterVariableBoolean("E08", "Eingang 8","",80);
|
||||
$this->RegisterVariableBoolean("E09", "Eingang 9","",90);
|
||||
$this->RegisterVariableBoolean("E10", "Eingang 10","",100);
|
||||
$this->RegisterVariableBoolean("E11", "Eingang 11","",110);
|
||||
$this->RegisterVariableBoolean("E12", "Eingang 12","",120);
|
||||
$this->RegisterVariableBoolean("E13", "Eingang 13","",130);
|
||||
$this->RegisterVariableBoolean("E14", "Eingang 14","",140);
|
||||
$this->RegisterVariableBoolean("E15", "Eingang 15","",150);
|
||||
$this->RegisterVariableBoolean("E16", "Eingang 16","",160);
|
||||
|
||||
$this->RegisterTimer("Update", 0, 'VTWD_checkValues('.$this->InstanceID.');');
|
||||
}
|
||||
|
||||
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
|
||||
public function ApplyChanges() {
|
||||
// Diese Zeile nicht löschen
|
||||
parent::ApplyChanges();
|
||||
|
||||
$this->SetTimerInterval("Update", 1 * 1000);
|
||||
|
||||
}
|
||||
public function RequestAction($Ident, $Value) {
|
||||
$varid = $this->GetIDForIdent($Ident);
|
||||
SetValue($varid, $Value);
|
||||
|
||||
|
||||
$this->checkValues();
|
||||
}
|
||||
|
||||
|
||||
public function checkValues(){
|
||||
$Idvalue = $this->ReadPropertyInteger("IdVariable");
|
||||
|
||||
|
||||
$IdE01 = $this->GetIDForIdent("E01");
|
||||
$IdE02 = $this->GetIDForIdent("E02");
|
||||
$IdE03 = $this->GetIDForIdent("E03");
|
||||
$IdE04 = $this->GetIDForIdent("E04");
|
||||
$IdE05 = $this->GetIDForIdent("E05");
|
||||
$IdE06 = $this->GetIDForIdent("E06");
|
||||
$IdE07 = $this->GetIDForIdent("E07");
|
||||
$IdE08 = $this->GetIDForIdent("E08");
|
||||
$IdE09 = $this->GetIDForIdent("E09");
|
||||
$IdE10 = $this->GetIDForIdent("E10");
|
||||
$IdE11 = $this->GetIDForIdent("E11");
|
||||
$IdE12 = $this->GetIDForIdent("E12");
|
||||
$IdE13 = $this->GetIDForIdent("E13");
|
||||
$IdE14 = $this->GetIDForIdent("E14");
|
||||
$IdE15 = $this->GetIDForIdent("E15");
|
||||
$IdE16 = $this->GetIDForIdent("E16");
|
||||
|
||||
|
||||
$inputs = $this->intTo16BitBinary(GetValue($Idvalue));
|
||||
SetValueBoolean($IdE01,$inputs[0]);
|
||||
SetValueBoolean($IdE02,$inputs[1]);
|
||||
SetValueBoolean($IdE03,$inputs[2]);
|
||||
SetValueBoolean($IdE04,$inputs[3]);
|
||||
SetValueBoolean($IdE05,$inputs[4]);
|
||||
SetValueBoolean($IdE06,$inputs[5]);
|
||||
SetValueBoolean($IdE07,$inputs[6]);
|
||||
SetValueBoolean($IdE08,$inputs[7]);
|
||||
SetValueBoolean($IdE09,$inputs[8]);
|
||||
SetValueBoolean($IdE10,$inputs[9]);
|
||||
SetValueBoolean($IdE11,$inputs[10]);
|
||||
SetValueBoolean($IdE12,$inputs[11]);
|
||||
SetValueBoolean($IdE13,$inputs[12]);
|
||||
SetValueBoolean($IdE14,$inputs[13]);
|
||||
SetValueBoolean($IdE15,$inputs[14]);
|
||||
SetValueBoolean($IdE16,$inputs[15]);
|
||||
|
||||
}
|
||||
|
||||
public function intTo16BitBinary(INT $number) {
|
||||
// Überprüfen, ob die Zahl im gültigen 16-Bit-Bereich liegt
|
||||
if ($number < 0 || $number > 65535) {
|
||||
return "Die Zahl liegt nicht im gültigen 16-Bit-Bereich.";
|
||||
}
|
||||
|
||||
// Umwandlung in 16-Bit-Binärdarstellung
|
||||
$binary = decbin($number);
|
||||
|
||||
// Auffüllen mit Nullen auf 16 Bits
|
||||
$paddedBinary = str_pad($binary, 16, '0', STR_PAD_LEFT);
|
||||
|
||||
// Jedes Bit einzeln als Array ausgeben, aber umgekehrt
|
||||
$bitsArray = array_reverse(str_split($paddedBinary));
|
||||
|
||||
return $bitsArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
"version": "6.0",
|
||||
"date": 1491343200
|
||||
},
|
||||
"version": "1.4",
|
||||
"build": 2,
|
||||
"version": "1.5",
|
||||
"build": 1,
|
||||
"date": 0
|
||||
}
|
||||
Reference in New Issue
Block a user