diff --git a/Modelica_LinearSystems2/Examples/ZerosAndPoles/conversionToStateSpace.mo b/Modelica_LinearSystems2/Examples/ZerosAndPoles/conversionToStateSpace.mo index 977cb780..a27efd5f 100644 --- a/Modelica_LinearSystems2/Examples/ZerosAndPoles/conversionToStateSpace.mo +++ b/Modelica_LinearSystems2/Examples/ZerosAndPoles/conversionToStateSpace.mo @@ -1,26 +1,38 @@ -within Modelica_LinearSystems2.Examples.ZerosAndPoles; -function conversionToStateSpace - "Transform a transfer function from zeros and poles representation into a StateSpace description" - extends Modelica.Icons.Function; - - import Modelica_LinearSystems2.StateSpace; - import Modelica_LinearSystems2.ZerosAndPoles; - - input ZerosAndPoles zpi=ZerosAndPoles(k=1, n1={1}, n2=fill(0,0,2),d1=fill(0,0),d2=[1,1]); - - output Boolean ok; - -protected - StateSpace ss1=ZerosAndPoles.Conversion.toStateSpace(zpi); //explicit conversion - StateSpace ss2=StateSpace(zpi); //short conversion using overloading - ZerosAndPoles zpo1=StateSpace.Conversion.toZerosAndPoles(ss1); //explicit conversion - -algorithm - Modelica.Utilities.Streams.print("zpi = " + String(zpi)); - Modelica.Utilities.Streams.print("ss1 = " + String(ss1,6,"ss1")); - Modelica.Utilities.Streams.print("ss2 = " + String(ss2,6,"ss2")); - Modelica.Utilities.Streams.print("zpo1 = " + String(zpo1)); - - ok := true; - -end conversionToStateSpace; +within Modelica_LinearSystems2.Examples.ZerosAndPoles; +function conversionToStateSpace + "Transform a transfer function from zeros and poles representation into a StateSpace description" + extends Modelica.Icons.Function; + + import Modelica_LinearSystems2.StateSpace; + import Modelica_LinearSystems2.ZerosAndPoles; + + input ZerosAndPoles zpi=ZerosAndPoles(k=1, n1={1}, n2=fill(0,0,2),d1=fill(0,0),d2=[1,1]) + "ZerosAndPoles transfer function of a system"; + + output Boolean ok; + +protected + StateSpace ss1=ZerosAndPoles.Conversion.toStateSpace(zpi); //explicit conversion + StateSpace ss2=StateSpace(zpi); //short conversion using overloading + ZerosAndPoles zpo1=StateSpace.Conversion.toZerosAndPoles(ss1); //explicit conversion + +algorithm + Modelica.Utilities.Streams.print("zpi = " + String(zpi)); + Modelica.Utilities.Streams.print("ss1 = " + String(ss1,6,"ss1")); + Modelica.Utilities.Streams.print("ss2 = " + String(ss2,6,"ss2")); + Modelica.Utilities.Streams.print("zpo1 = " + String(zpo1)); + + ok := true; + + annotation ( + Documentation(info=" +

+Transform a transfer function from zeros and poles representation zpi +into a state space description by means of a) an explicit conversion +toStateSpace +and b) a short conversion using overloading. +Show also an explicit conversion from the state space description back to the zeros and +poles representation zpo1. +

+")); +end conversionToStateSpace;